-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
31 lines (24 loc) · 806 Bytes
/
bot.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
var settings = require('./appsettings.json');
const Discord = require('discord.js')
const { MessageAttachment, Client } = require('discord.js')
const bot = new Client()
var version = '1.0.1'
bot.on('ready', () => {
console.log('Bot ready to serve!')
})
bot.on('message', (message) => {
let url = ''
if (message.content === '!a') {
if (message.attachments.size > 0) {
message.attachments.forEach(attachment => {
url = attachment.url;
});
let channel = bot.channels.cache.get(settings.AttachmentChannelID);
const attachment = new MessageAttachment(url);
channel.send(attachment);
} else {
message.reply("um, Sir where is yours attachment?")
}
}
})
bot.login(settings.Token)