Skip to content

Commit a5583fa

Browse files
committed
✨ Simple bot
1 parent 031e01b commit a5583fa

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { config } from 'dotenv';
2+
import {Client, RichEmbed} from 'discord.js';
3+
4+
config();
5+
const { TOKEN_DISCORD } = process.env
6+
const bot = new Client();
7+
8+
bot.on('ready', () => {
9+
console.log(`Logged in as ${bot.user.tag}`);
10+
console.log(`Exit ${ bot.user.tag }: ctrl + c`);
11+
});
12+
13+
bot.on('message', (msg) => {
14+
const { content } = msg
15+
const cmds = {
16+
"!invite": 'https://discord.gg/kYBtYPj',
17+
"!azurePipelines": 'https://azure.microsoft.com/pt-br/services/devops/pipelines/',
18+
"!youtube": 'https://youtube.com/collabcode',
19+
};
20+
21+
cmds[content] && msg.reply(cmds[content]);
22+
});
23+
24+
bot.on('message', (message) => {
25+
if (message.content === 'embed') {
26+
const embed = new RichEmbed()
27+
.setTitle('A slick little embed')
28+
.setColor(0xFF0000)
29+
.setDescription('Hello, this is a slick embed!');
30+
31+
message.channel.send(embed);
32+
}
33+
})
34+
35+
bot.login(TOKEN_DISCORD)

0 commit comments

Comments
 (0)