28 |
} |
} |
29 |
}); |
}); |
30 |
|
|
31 |
await History.create(user.id, msg.guild!, 'warn', warned_by?.id ?? msg.member!.user.id, reason ?? null); |
// await History.create(user.id, msg.guild!, 'warn', warned_by?.id ?? msg.member!.user.id, reason ?? null); |
32 |
|
|
33 |
await user.send({ |
let DMed = true; |
|
embeds: [ |
|
|
new MessageEmbed({ |
|
|
author: { |
|
|
name: `You have been warned in ${msg.guild!.name}`, |
|
|
iconURL: msg.guild!.iconURL()! |
|
|
}, |
|
|
fields: [ |
|
|
{ |
|
|
name: 'Reason', |
|
|
value: reason ?? '*No reason provided*' |
|
|
}, |
|
|
{ |
|
|
name: 'Strike', |
|
|
value: `${strike} time(s)` |
|
|
} |
|
|
] |
|
|
}) |
|
|
] |
|
|
}); |
|
34 |
|
|
35 |
|
try { |
36 |
|
await user.send({ |
37 |
|
embeds: [ |
38 |
|
new MessageEmbed({ |
39 |
|
author: { |
40 |
|
name: `You have been warned in ${msg.guild!.name}`, |
41 |
|
iconURL: msg.guild!.iconURL()! |
42 |
|
}, |
43 |
|
fields: [ |
44 |
|
{ |
45 |
|
name: 'Reason', |
46 |
|
value: reason ?? '*No reason provided*' |
47 |
|
}, |
48 |
|
{ |
49 |
|
name: 'Strike', |
50 |
|
value: `${strike} time(s)` |
51 |
|
} |
52 |
|
] |
53 |
|
}) |
54 |
|
] |
55 |
|
}); |
56 |
|
} |
57 |
|
catch (e) { |
58 |
|
console.log(e); |
59 |
|
DMed = false; |
60 |
|
} |
61 |
|
|
62 |
await client.logger.logWarn(msg, user, (warned_by ?? msg.member!.user) as User, reason, warning.get('id') as number); |
await client.logger.logWarn(msg, user, (warned_by ?? msg.member!.user) as User, reason, warning.get('id') as number); |
63 |
|
|
64 |
return { warning, strike }; |
return { warning, strike, DMed }; |
65 |
} |
} |
66 |
|
|
67 |
export default class WarnCommand extends BaseCommand { |
export default class WarnCommand extends BaseCommand { |
137 |
} |
} |
138 |
|
|
139 |
try { |
try { |
140 |
const { warning, strike } = await warn(client, user.user, reason, msg, msg.member?.user as User); |
const { warning, strike, DMed } = await warn(client, user.user, reason, msg, msg.member?.user as User); |
141 |
|
|
142 |
await msg.reply({ |
await msg.reply({ |
143 |
embeds: [ |
embeds: [ |
159 |
{ |
{ |
160 |
name: "ID", |
name: "ID", |
161 |
value: warning.get('id') + '' |
value: warning.get('id') + '' |
162 |
} |
}, |
163 |
|
...(DMed ? {} : { |
164 |
|
name: "Note", |
165 |
|
value: ":warning: The user has DMs disabled, so they might not know that they've been warned." |
166 |
|
}) |
167 |
]) |
]) |
168 |
] |
] |
169 |
}); |
}); |
172 |
console.log(e); |
console.log(e); |
173 |
} |
} |
174 |
} |
} |
|
} |
|
175 |
|
} |