mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 00:31:00 -05:00
Compare commits
2 Commits
4280af2807
...
1719509d07
Author | SHA1 | Date | |
---|---|---|---|
|
1719509d07 | ||
|
977b87d8b0 |
@ -10,11 +10,13 @@ export default async(client:TClient, interaction: Discord.ChatInputCommandIntera
|
|||||||
const reason = interaction.options.getString('reason') ?? 'Reason unspecified';
|
const reason = interaction.options.getString('reason') ?? 'Reason unspecified';
|
||||||
const GuildMember = interaction.options.getMember('member') ?? undefined;
|
const GuildMember = interaction.options.getMember('member') ?? undefined;
|
||||||
const User = interaction.options.getUser('member', true);
|
const User = interaction.options.getUser('member', true);
|
||||||
|
if (reason.length > 1020) return interaction.reply({content: 'Reason cannot be longer than 1020 characters due to Discord\'s limit.', ephemeral: true});
|
||||||
|
|
||||||
const punishLog = `${GuildMember?.user?.username ?? User?.username ?? 'No user data'} ${time ? ['warn', 'kick'].includes(type) ? 'and no duration set' : `and ${time} (duration)` : ''} was used in \`/${interaction.commandName}\` for \`${reason}\``;
|
const punishLog = `${GuildMember?.user?.username ?? User?.username ?? 'No user data'} ${time ? ['warn', 'kick'].includes(type) ? 'and no duration set' : `and ${time} (duration)` : ''} was used in \`/${interaction.commandName}\` for \`${reason}\``;
|
||||||
Logger.console('log', 'PunishmentLog', punishLog);
|
Logger.console('log', 'PunishmentLog', punishLog);
|
||||||
(client.channels.cache.get(client.config.dcServer.channels.punishment_log) as Discord.TextChannel).send({embeds:[new client.embed().setColor(client.config.embedColor).setTitle('Punishment Log').setDescription(punishLog).setTimestamp()]});
|
(client.channels.cache.get(client.config.dcServer.channels.punishment_log) as Discord.TextChannel).send({embeds:[new client.embed().setColor(client.config.embedColor).setTitle('Punishment Log').setDescription(punishLog).setTimestamp()]});
|
||||||
|
|
||||||
|
if (!GuildMember.moderatable) return interaction.reply(`I cannot ${type} this user.`);
|
||||||
if (interaction.user.id === User.id) return interaction.reply(`You cannot ${type} yourself.`);
|
if (interaction.user.id === User.id) return interaction.reply(`You cannot ${type} yourself.`);
|
||||||
if (!GuildMember && !['unban', 'ban'].includes(type)) return interaction.reply(`You cannot ${type} someone who is not in the server.`);
|
if (!GuildMember && !['unban', 'ban'].includes(type)) return interaction.reply(`You cannot ${type} someone who is not in the server.`);
|
||||||
if (User.bot) return interaction.reply(`You cannot ${type} a bot!`);
|
if (User.bot) return interaction.reply(`You cannot ${type} a bot!`);
|
||||||
|
Loading…
Reference in New Issue
Block a user