Randomized leave messages

This commit is contained in:
Dragon Fire
2019-06-14 15:36:22 -04:00
parent 0d21d61587
commit 11898cadd6
3 changed files with 26 additions and 2 deletions
+3 -1
View File
@@ -10,6 +10,7 @@ const client = new Client({
disabledEvents: ['TYPING_START'] disabledEvents: ['TYPING_START']
}); });
const activities = require('./assets/json/activity'); const activities = require('./assets/json/activity');
const leaveMsgs = require('./assets/json/leave-messages');
client.registry client.registry
.registerDefaultTypes() .registerDefaultTypes()
@@ -52,7 +53,8 @@ client.on('guildMemberRemove', async member => {
if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return null; if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return null;
if (channel.topic && channel.topic.includes('<xiao:disable-leave>')) return null; if (channel.topic && channel.topic.includes('<xiao:disable-leave>')) return null;
try { try {
await channel.send(`**${member.user.tag}** bailed on us...`); const leaveMsg = leaveMsgs[Math.floor(Math.random() * leaveMsgs.length)];
await channel.send(leaveMsg.replace(/{{user}}/gi, `**${member.user.tag}**`));
return null; return null;
} catch (err) { } catch (err) {
return null; return null;
+22
View File
@@ -0,0 +1,22 @@
[
"{{user}} bailed on us...",
"\"Look, what's that!\" said {{user}}, before dashing away.",
"{{user}} ran away.",
"{{user}} decided they didn't want to deal with you anymore and ran off.",
"{{user}} jumped ship.",
"{{user}} ate too much candy and was taken to a hospital in another server.",
"{{user}} left to join a rival gang.",
"{{user}} decided to take a break from your server. Possibly forever.",
"{{user}} said \"See ya, suckers!\"",
"According to all known laws of aviation, there is no way {{user}} should be able to fly. But they did, right out of your server.",
"Goodbye, {{user}}!",
"You forgot to feed {{user}}, so they ran away.",
"{{user}} left to become a hermit in the mountains. I hear he has a goat now.",
"{{user}} flew away. Wait, they have wings?!",
"We'll miss you, {{user}}! I think.",
"{{user}} left the nest. They grow up so fast...",
"{{user}} is no longer a part of your family.",
"And just like that, {{user}} said goodbye to your server and started a new adventure.",
"In other news, local resident {{user}} leaves the server. Cites stupid bot \"Xiao\" as the reason. Wait, stupid?",
"{{user}} left. How unfortunate."
]
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "105.3.1", "version": "105.3.2",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"scripts": { "scripts": {