Last active
January 26, 2025 04:35
-
-
Save pedroricardo/da90fd467962ca8424cfc56dc3a54df6 to your computer and use it in GitHub Desktop.
Como Criar Bot para Discord em Javascript #2 https://www.youtube.com/watch?v=KYnXhtyqQRQ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Discord = require("discord.js"); //baixar a lib | |
const client = new Discord.Client(); | |
const config = require("./config.json"); | |
client.on("ready", () => { | |
console.log(`Bot foi iniciado, com ${client.users.size} usuários, em ${client.channels.size} canais, em ${client.guilds.size} servidores.`); | |
client.user.setPresence({ game: { name: 'comando', type: 1, url: 'https://www.twitch.tv/pedroricardo'} }); | |
//0 = Jogando | |
// 1 = Transmitindo | |
// 2 = Ouvindo | |
// 3 = Assistindo | |
}); | |
client.on("message", async message => { | |
if(message.author.bot) return; | |
if(message.channel.type === "dm") return; | |
if(!message.content.startsWith(config.prefix)) return; | |
const args = message.content.slice(config.prefix.length).trim().split(/ +/g); | |
const comando = args.shift().toLowerCase(); | |
// coamdno ping | |
if(comando === "ping") { | |
const m = await message.channel.send("Ping?"); | |
m.edit(`Pong! A Latência é ${m.createdTimestamp - message.createdTimestamp}ms. A Latencia da API é ${Math.round(client.ping)}ms`); | |
} | |
}); | |
client.login(config.token); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"prefix": "!", | |
"token": "XXXXXXX" | |
} |
Mesmo problema alguem conseguiu resolver?
Descobri o pq, as diretrizes do discord atualizaram, ele fez um tutorial
mais recente, recomendo ver
Em qui, 3 de fev de 2022 21:18, bMexe ***@***.***> escreveu:
… ***@***.**** commented on this gist.
------------------------------
Mesmo problema alguem conseguiu resolver?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/da90fd467962ca8424cfc56dc3a54df6#gistcomment-4052919>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXL6IKPYQXMTHLLHY37XHJTUZMLOTANCNFSM4I56TZRA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
ol
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Olá deve estar faltando alguma instrução nas classe que são chamadas. Pelo oque consegui entender não esta encontrando alguns módulos.
Vou dar uma pesquisada caso encontrem mandem postem aqui.