3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-22 09:15:03 +00:00

Only send welcome messages once per user, until plugin reload

This commit is contained in:
Dragory 2020-08-21 03:48:16 +03:00
parent b6e99f6c02
commit faee98c4e6
3 changed files with 9 additions and 0 deletions

View file

@ -16,6 +16,13 @@ export const SendWelcomeMessageEvt = welcomeEvent({
if (!config.message) return;
if (!config.send_dm && !config.send_to_channel) return;
// Only send welcome messages once per user (even if they rejoin) until the plugin is reloaded
if (pluginData.state.sentWelcomeMessages.has(member.id)) {
return;
}
pluginData.state.sentWelcomeMessages.add(member.id);
const formatted = await renderTemplate(config.message, {
member: stripObjectToScalars(member, ["user"]),
});