Skip to content
This repository was archived by the owner on Jun 12, 2020. It is now read-only.

Conversation

@Westixy
Copy link
Member

@Westixy Westixy commented Jun 12, 2018

Ajout des commandes:

  • !subscribe [list] : s'abonne à un channel / affiche la list des channel auxquels on est abonnés
  • !unsubscribe : se désabonne a un channel
  • !alert <message> : envoi une alerte a toutes les personnes aboonée a ce channel

@Westixy
Copy link
Member Author

Westixy commented Jun 12, 2018

image

Copy link
Member

@Xstoudi Xstoudi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ptit résumé :

  1. Les messages du bot sont en français
  2. Mettre le chemin de la DB dans les variables d'environnement
  3. Ne pas spammer le channel dès que quelqu'un s'abonne/se désabonne. Si tu dois avoir un message d'erreur ou un message de confirmation, préfère les messages privés.
  4. Supprimer le message qui contient la commande (pour toutes les commandes)

config/prod.json Outdated
"JSKongress"
]
],
"subscriber": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cette config devrait être en variable d'environnement.

index.js Outdated
@@ -1,16 +1,24 @@
require('dotenv').config()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas nécessaire pour la prod, tu peux virer ça et ajouter les variables d'environnement dans ta commande.

channel: message.channel.name
})
if (subscribedChannel !== null) {
return message.channel.send(`${message.author.username} already have subscribed to the channel \`#${message.channel.name}\``)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'imagine que ce n'est pas la peine d'avertir la planète entière que le mec s'est abonné.

userId: message.author.id,
channel: message.channel.name
})
return message.channel.send(`${message.author.username} has subscribed to the channel \`#${message.channel.name}\``)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'imagine que ce n'est pas la peine d'avertir la planète entière que le mec s'est abonné.

userId: message.author.id
})
if (subscribedChannels.length === 0) return message.channel.send('You haven\'t subscribed to a channel')
return message.channel.send(`${message.author.username} has subscribed to this channels :\n${subscribedChannels.map(a => `\`#${a.channel}\``).join('\n')}`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'imagine que ce n'est pas la peine d'avertir la planète entière que le mec s'est abonné.

const subscribedChannels = subs.find({
userId: message.author.id
})
if (subscribedChannels.length === 0) return message.channel.send('You haven\'t subscribed to a channel')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'imagine que ce n'est pas la peine d'avertir la planète entière que le mec ne s'est pas abonné.

})
if (subscribedChannel !== null) {
subs.remove(subscribedChannel)
return message.channel.send(`${message.author.username} has unsubscribed to the channel \`#${message.channel.name}\``)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem

subs.remove(subscribedChannel)
return message.channel.send(`${message.author.username} has unsubscribed to the channel \`#${message.channel.name}\``)
}
return message.channel.send(`${message.author.username} hasn't subscribed to the channel \`#${message.channel.name}\``)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem

channel: message.channel.name
})
if (subscribersOnChannel.length === 0) {
return message.channel.send(`There is no subscribers for this channel.`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem

if (subscribersOnChannel.length === 0) {
return message.channel.send(`There is no subscribers for this channel.`)
}
return message.channel.send(`${args.join(' ')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supprimer le message qui contient la commande avant de faire ça.

@Westixy
Copy link
Member Author

Westixy commented Jun 12, 2018

Done

@Xstoudi Xstoudi merged commit 81a3e75 into ES-Community:master Jun 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants