fix and todos
This commit is contained in:
parent
b500d7d485
commit
af7e3d1557
12
educ.js
12
educ.js
@ -27,7 +27,7 @@ var reactions = {
|
||||
'description': 'Je veux répondre rapidement',
|
||||
},
|
||||
'suffit': {
|
||||
'prefix': ':octogonal_sign:',
|
||||
'prefix': ':octagonal_sign:',
|
||||
'description': 'On tourne en rond',
|
||||
},
|
||||
'écoute': {
|
||||
@ -54,12 +54,11 @@ var channels = {}
|
||||
var last_post = null; /* On se souvient du derier post que ce bot a envoyé pour le virer dès que possible */
|
||||
|
||||
client.on('message', msg => {
|
||||
if(msg.content === '!educpop-reset') {
|
||||
if(msg.content === '!educpop-reset') { //TODO room parametrized
|
||||
for (var index in reactions) {
|
||||
reactions[index].people = []
|
||||
}
|
||||
reply(msg)
|
||||
msg.reply('La liste est vidée :)')
|
||||
}
|
||||
else if (msg.content === '!educpop-enable') {
|
||||
var id = msg.channel.id
|
||||
@ -98,7 +97,7 @@ client.on('message', msg => {
|
||||
/* Educ pop stuff */
|
||||
else if(msg.content.startsWith('-')) {
|
||||
var content = msg.content.slice(1)
|
||||
if (content in reactions) {
|
||||
if (content.toLowerCase() in reactions) {
|
||||
var reaction = reactions[content].people
|
||||
var index = reaction.indexOf(msg.author.username)
|
||||
if (index >= 0) {
|
||||
@ -107,7 +106,7 @@ client.on('message', msg => {
|
||||
reply(msg)
|
||||
}
|
||||
}
|
||||
else if (msg.content in reactions) {
|
||||
else if (msg.content.toLowerCase() in reactions) {
|
||||
var reaction = reactions[msg.content].people
|
||||
if (reaction.indexOf(msg.author.username) < 0) {
|
||||
reaction.push(msg.author.username)
|
||||
@ -123,6 +122,9 @@ function reply (msg) {
|
||||
if (reactions[index].people.length > 0)
|
||||
text += '\n' + reactions[index].prefix + String(reactions[index].people)
|
||||
}
|
||||
if (text === '') {
|
||||
text = 'Personne ne s’est manifesté :/'
|
||||
}
|
||||
|
||||
if(channels[msg.channel.id]) channels[msg.channel.id].delete()
|
||||
msg.reply(text)
|
||||
|
Loading…
Reference in New Issue
Block a user