Skip to content

Instantly share code, notes, and snippets.

@HypeTmBersek
Created September 19, 2023 00:29
Show Gist options
  • Save HypeTmBersek/ed36be28a4312c1c2b1d6a3334d7f307 to your computer and use it in GitHub Desktop.
Save HypeTmBersek/ed36be28a4312c1c2b1d6a3334d7f307 to your computer and use it in GitHub Desktop.
Use o template discord.js para ter seu próprio Bot !!
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
// Evento que é executado quando o bot está pronto
client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});
// Evento que é executado quando o bot recebe uma mensagem
client.on('messageCreate', (message) => {
// Verifica se a mensagem foi enviada por um bot (para evitar loops infinitos)
if (message.author.bot) return;
// Verifica se a mensagem começa com "!oi"
if (message.content.startsWith('!oi')) {
// Responde com uma mensagem
message.reply('Oi, como posso ajudar?');
}
});
// Conecta o bot ao servidor do Discord usando seu token
const BOT_TOKEN = 'SEU_TOKEN_AQUI';
client.login(BOT_TOKEN);
@HypeTmBersek
Copy link
Author

🎉✅

@HypeTmBersek
Copy link
Author

Try using it before saying anything, okay?

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