WienerScript/examples/discord-bot/index.ws

34 lines
1,009 B
Text
Raw Normal View History

2020-07-04 12:25:59 +01:00
FIX OIDA Discord = require('discord.js');
2020-07-06 07:14:44 +01:00
FIX OIDA client = new Discord.Client();
2020-07-04 12:25:59 +01:00
client.on('ready', () => {
I MAN JA NUR('bot has started');
client.user.setActivity(`Watching ${client.guilds.cache.size} servers`);
});
2020-07-06 07:14:44 +01:00
client.on('message', OWIZAHRA (message) => {
2020-07-04 12:25:59 +01:00
WOS WÜSTN(message.author.bot)
DRAH DI HAM;
WOS WÜSTN(!message.content.startsWith(process.env.PREFIX))
DRAH DI HAM;
2020-07-06 07:14:44 +01:00
FIX OIDA args = message.content.replace(process.env.PREFIX, '').trim().split(/ +/g);
2020-07-04 12:25:59 +01:00
FIX OIDA command = args.shift().toLowerCase();
WOS IS MIT DIR(command) {
I SCHAU NUR "ping":
FIX OIDA m = JO GLEI message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`);
PASST SCHO;
I SCHAU NUR "say":
SCHAU MA MOL {
JO GLEI message.delete();
JO GLEI message.channel.send(args.join(" "));
} LECK OASCH (err) {
GSCHISSN GRISSN(err)
}
PASST SCHO;
}
});
client.login(process.env.TOKEN);