This repository was archived by the owner on Jun 12, 2020. It is now read-only.
Open
Conversation
Some change and improvements
Listen `ready` event once, Fix ES-Community#3
…ubscribe Feature channel subscribe
Xstoudi
suggested changes
Aug 5, 2018
Member
Xstoudi
left a comment
There was a problem hiding this comment.
Quelques corrections et réponse à apporter, merci pour l'implémentation Westixy
| .array().forEach(m => { | ||
| const age = (new Date()).getUTCFullYear() - m.joinedAt.getUTCFullYear() | ||
| if (m.id === guild.ownerID) { | ||
| guild.channels.find('name', 'annonces').send(`La communauté fête ses ${age} ans !`) |
Member
There was a problem hiding this comment.
@fraxken n'aura donc jamais la chance de se faire souhaiter son anniversaire ahah !
src/plugin/anniversary.js
Outdated
| guild.channels.find('name', 'annonces').send(`La communauté fête ses ${age} ans !`) | ||
| } | ||
| if (age === 1) m.send(':birthday: Déjà 1 an que tu es sur la communauté ! :vulcan:') | ||
| m.send(`:birthday: La viellesse arrive, ça fait ${age} ans que tu es arrivé sur l'ESCommunity :vulcan:`) |
Member
There was a problem hiding this comment.
Là il faudrait unelsesinon ça va partir sur une double-annonce à chaque première bougie.
src/plugin/anniversary.js
Outdated
| * @param {Guild} guild Server where to apply the plugin | ||
| */ | ||
| static init (guild) { | ||
| cron.schedule('0 0 10 * * *', () => { |
Member
There was a problem hiding this comment.
- Ton cron doit pas être valide : https://crontab.guru/#0_0_10___*
- Quel intérêt d'ajouter une dépendance plutôt que de faire un setInterval ?
Member
Author
There was a problem hiding this comment.
- il est valide c'est juste une implémentation de cron qui autorise les secondes en premier (https://www.npmjs.com/package/node-cron)
- par pur soucis de lisibilité (et la dépendance est tellement light que j'ai trouvé intéressant)
Member
There was a problem hiding this comment.
- Yes bien vu.
- Après réflexion c'est pas bête, ça permet aussi d'avoir le truc exécuté toujours à la même heure.
Xstoudi
approved these changes
Aug 6, 2018
src/plugin/anniversary.js
Outdated
| * @param {Guild} guild Server where to apply the plugin | ||
| */ | ||
| static init (guild) { | ||
| cron.schedule('0 0 10 * * *', () => { |
Member
There was a problem hiding this comment.
- Yes bien vu.
- Après réflexion c'est pas bête, ça permet aussi d'avoir le truc exécuté toujours à la même heure.
fraxken
approved these changes
Aug 11, 2018
Member
Member
Author
|
Il me semble oui si les messages vous conviennent (je les avais mis comme ca sans trop réfléchir :) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implémentation à discuter du plugin anniversaire liée a l'issue #9
node-cron