1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 00:31:00 -05:00

Forward attachments too.

This commit is contained in:
toast-ts 2024-03-09 17:40:40 +11:00
parent a2fe3afdb7
commit 0ad5c2cc37

View File

@ -10,7 +10,12 @@ import MessageTool from '../helpers/MessageTool.js';
export default class MessageCreate {
static async run(client:TClient, message:Discord.Message) {
if (message.author.bot) return;
if (!message.inGuild()) return (client.channels.resolve(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({content: `${this.randomEmotes[Math.floor(Math.random()*this.randomEmotes.length)]} ${MessageTool.formatMention(client.config.whitelist[0], 'user')}\n**${message.author.username}** (\`${message.author.id}\`) sent me a DM, their message is:\`\`\`${message.content}\`\`\``, allowedMentions: {parse: ['users']}});
if (!message.inGuild()) {
let fwdImages:string[] = [];
message.attachments.forEach(x=>fwdImages.push(x.url));
(client.channels.resolve(client.config.dcServer.channels.bot_log) as Discord.TextChannel).send({content: `${this.randomEmotes[Math.floor(Math.random()*this.randomEmotes.length)]} ${MessageTool.formatMention(client.config.whitelist[0], 'user')}\n**${message.author.username}** (\`${message.author.id}\`) sent me a DM, their message is:\`\`\`${message.content.length < 1 ? '(No content)' : message.content}\`\`\``, files: fwdImages, allowedMentions: {parse: ['users']}});
return;
}
let automodded: boolean;
if (client.config.botSwitches.automod && !message.member?.roles.cache.has(client.config.dcServer.roles.dcmod) && !message.member?.roles.cache.has(client.config.dcServer.roles.admin) && message.guildId === client.config.dcServer.id) {