Skip to content

Instantly share code, notes, and snippets.

@DonovanDMC
Last active May 8, 2019 19:39
Show Gist options
  • Save DonovanDMC/0ab1e90c973738cdcca7a15363c873d6 to your computer and use it in GitHub Desktop.
Save DonovanDMC/0ab1e90c973738cdcca7a15363c873d6 to your computer and use it in GitHub Desktop.
Some snippets to help with ignoring bots.

Was your bot denied for responding to other bots? Try out some of these code snippets to help with that

Feel free to provide snippets that we can add to this list in the comments, or in #bfd on Discord.

Libraries Covered:

  • discljord (Clojure)
  • discordcr (Crystal)
  • Discord.Net (C#)
  • DSharpPlus (C#)
  • dscord (D)
  • DiscordGo (Go)
  • DisGord (Go)
  • catnip (Java)
  • Discord4J (Java)
  • Javacord (Java)
  • JDA (Java)
  • Discord.JS (Javascript)
  • Eris (Javascript)
  • Discordia (Lua)
  • discordnim (Nim)
  • RestCord (PHP)
  • Yasmin (PHP)
  • [discord.py Async (Python)](#user-content-discordpy-async-python]
  • discordrb (Ruby)
  • discord-rs (Rust)
  • AckCord (Scala)
  • Sword (Swift)

Discord.JS/Eris (Javascript)

  •  // Provided by Donovan_DMC#3621
    	client.on("message",async(message) => {
        	if(message.author.bot) return;
     });

RestCord (PHP)

  •   // Provided by Donovan_DMC#3621
      // This Library doesn't provide any events, as it doesn't connect and listen to the gateway, so there is no need for ignoring anything in this sense.

Yasmin (PHP)

  •   // Provided by Donovan_DMC#3621
      // untested
      $client->on('message', function ($message) {
         	if($message->author->bot) return;
     	});

discord.py Async (Python)

  •   # Provided by Habchy#1665
      	@bot.event
      	async def on_message(message):
          	if message.author.bot:
              	return

JDA (Java)

  •   // Provided by BricksAndPieces#8260
      @Override
      public void onMessageReceived(MessageReceivedEvent event) {
          if(event.getAuthor().isBot()) return;
          // extra stuffs
      }
@DonovanDMC
Copy link
Author

added code for JDA, provided by BricksAndPieces#8260

@DonovanDMC
Copy link
Author

Renamed Discord.PY to Discord.PY Async, as mentioned by Habchy#1665

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment