1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 20:30:58 -05:00

Compare commits

..

2 Commits

Author SHA1 Message Date
AnxietyisReal
fff9e67769 Add "see you later" to evening trigger 2024-01-05 12:59:56 +11:00
AnxietyisReal
e64089e29c Fetch user directly from cache and send DM from there. 2024-01-05 12:50:33 +11:00
2 changed files with 3 additions and 1 deletions

View File

@ -121,7 +121,7 @@ export default class Developer {
const member = interaction.options.getMember('member'); const member = interaction.options.getMember('member');
const message = interaction.options.getString('message'); const message = interaction.options.getString('message');
const int = await interaction.reply({content: '*Sending...*', fetchReply: true}); const int = await interaction.reply({content: '*Sending...*', fetchReply: true});
member.send(`${message}\n╰ ${interaction.member.displayName}`).then(()=>int.edit(`Successfully sent a DM to **${member.user.username}** with the following message:\n\`\`\`${message}\`\`\``)).catch((e:Error)=>int.edit(`\`${e.message}\``)) client.users.cache.get(member.id).send(`${message}\n╰ ${interaction.member.displayName}`).then(()=>int.edit(`Successfully sent a DM to **${member.user.username}** with the following message:\n\`\`\`${message}\`\`\``)).catch((e:Error)=>int.edit(`\`${e.message}\``))
} }
} as any)[interaction.options.getSubcommand()](); } as any)[interaction.options.getSubcommand()]();
} }

View File

@ -27,6 +27,8 @@ export default class Response {
} }
protected static async respond(message:Discord.Message, responseKeyword:string) { protected static async respond(message:Discord.Message, responseKeyword:string) {
if (message.type === Discord.MessageType.Reply) return; if (message.type === Discord.MessageType.Reply) return;
// Special case for "see you later"
if (responseKeyword === 'evening' && /^see you later\b/i.test(message.content)) return message.reply(`${this.outgoingArrays(message)[responseKeyword][Math.floor(Math.random()*this.outgoingArrays(message)[responseKeyword].length)]}`).catch(()=>null);
if (new RegExp(`^(${this.incomingArrays[responseKeyword].prefix.join('|')})?\\s?${responseKeyword} (${this.incomingArrays[responseKeyword].suffix.join('|')})\\b`, 'i').test(message.content)) return message.reply(`${this.outgoingArrays(message)[responseKeyword][Math.floor(Math.random()*this.outgoingArrays(message)[responseKeyword].length)]}`).catch(()=>null) if (new RegExp(`^(${this.incomingArrays[responseKeyword].prefix.join('|')})?\\s?${responseKeyword} (${this.incomingArrays[responseKeyword].suffix.join('|')})\\b`, 'i').test(message.content)) return message.reply(`${this.outgoingArrays(message)[responseKeyword][Math.floor(Math.random()*this.outgoingArrays(message)[responseKeyword].length)]}`).catch(()=>null)
} }
protected static outgoingArrays(message:Discord.Message) { protected static outgoingArrays(message:Discord.Message) {