🐛 name and msg save

This commit is contained in:
Adrian Amaglio 2020-04-02 19:44:09 +02:00
parent 1ccf4b3c5c
commit 094ace0d2f

View File

@ -150,7 +150,7 @@ const client = new Discord.Client();
client.on('ready', () => {
console.log('Connected to Discord as ' + client.user.tag);
client.user.setAvatar('avatar.png')
client.user.setUsername('Educ-Bot')
client.user.setUsername(process.env.BOT_USERNAME)
});
/* Discord message center */
client.on('message', msg => {
@ -203,21 +203,21 @@ client.on('message', msg => {
}
/* save and ignore own messages */
else if(msg.author.username === process.env.BOT_USERNAME){
if (msg.content.startsWith(':')) /* Save if its educpop summary */
if (!msg.content.startsWith('<')) /* Save if its educpop summary */
channel.last_msg = msg;
}
/* Educ pop stuff */
else if(msg.content.startsWith('-')) {
const content = msg.content.slice(1)
if (content.toLowerCase() in reactions) {
educpopDelPerson(channel, msg.author.username, content.toLowerCase())
educpopDelPerson(channel, msg.member.nickname, content.toLowerCase())
msg.delete()
reply(channel)
}
}
else if (msg.content.toLowerCase() in reactions) {
var reaction = msg.content.toLowerCase()
educpopAddPerson(channel, msg.author.username, msg.content.toLowerCase())
educpopAddPerson(channel, msg.member.nickname, msg.content.toLowerCase())
msg.delete()
reply(channel)
}