-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
63 lines (50 loc) · 1.83 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import Discord from 'discord.js';
import dotenv from 'dotenv';
dotenv.config();
const client = new Discord.Client();
client.on('ready', () => {
console.log('Bot is running');
client.user.setActivity('-help', { type: 'ENGAGEMENT' }).catch(console.error);
});
client.on('message', (message) => {
if (client.user.id === message.author.id) return;
const userTag = `<@${message.member.id}>`
const args = message.content.split(' ');
const extraArgs = args.splice(1);
if (args[0] === '~generate') {
if (extraArgs.length === 0) {
message.channel.send(`${userTag} **ERROR: NO TEXT PROVIDED**`);
return;
}
const qrCodeEmbed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle('Generated QR Code')
.addFields(
{
name: 'Requested By',
value: userTag
},
{
name: 'Encoded Text',
value: extraArgs.join(' ')
},
{
name: 'URL',
value: `https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=${extraArgs.join('+')}`
}
)
.setImage(`https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=${extraArgs.join('+')}`)
.setTimestamp();
message.channel.send(qrCodeEmbed);
}
});
client.login(process.env.BOT_TOKEN);
// let statuses = [
// 'ɪɴɢʏᴇɴ',
// 'ʟᴜᴀ ᴇxᴇᴄᴜᴛᴏʀ',
// 'ᴍᴏᴅ ᴍᴇɴᴜ'
// ]
// let status = statuses[Math.floor(Math.random() * statuses.length)]
// setInterval(() => {
// client.user.setActivity(status, { type: 'Listening to ~generate' });
// }, 5000)