/[sudobot]/trunk/src/commands/moderation/MuteCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/moderation/MuteCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 153 by rakin, Mon Jul 29 17:28:48 2024 UTC revision 194 by rakin, Mon Jul 29 17:28:58 2024 UTC
# Line 10  import getMember from '../../utils/getMe Line 10  import getMember from '../../utils/getMe
10  import ms from 'ms';  import ms from 'ms';
11  import { unmute } from './UnmuteCommand';  import { unmute } from './UnmuteCommand';
12  import PunishmentType from '../../types/PunishmentType';  import PunishmentType from '../../types/PunishmentType';
13  import { shouldNotModerate } from '../../utils/util';  import { hasPermission, shouldNotModerate } from '../../utils/util';
14    
15  export async function mute(client: DiscordClient, dateTime: number | undefined, user: GuildMember, msg: Message | CommandInteraction, timeInterval: number | undefined, reason: string | undefined, hard: boolean = false) {  export async function mute(client: DiscordClient, dateTime: number | undefined, user: GuildMember, msg: Message | CommandInteraction, timeInterval: number | undefined, reason: string | undefined, hard: boolean = false) {
16      try {      try {
# Line 76  export async function mute(client: Disco Line 76  export async function mute(client: Disco
76          });          });
77                    
78          await client.logger.logMute(user, reason === undefined || reason.trim() === '' ? "*No reason provided*" : reason, timeInterval, msg.member!.user as User, hard);          await client.logger.logMute(user, reason === undefined || reason.trim() === '' ? "*No reason provided*" : reason, timeInterval, msg.member!.user as User, hard);
79          await user.send({  
80              embeds: [          try {
81                  new MessageEmbed()              await user.send({
82                  .setAuthor({                  embeds: [
83                      iconURL: <string> msg.guild!.iconURL(),                      new MessageEmbed()
84                      name: `\tYou have been muted in ${msg.guild!.name}`                      .setAuthor({
85                  })                          iconURL: <string> msg.guild!.iconURL(),
86                  .addField("Reason", reason === undefined || reason.trim() === '' ? "*No reason provided*" : reason)                          name: `\tYou have been muted in ${msg.guild!.name}`
87              ]                      })
88          });                      .addField("Reason", reason === undefined || reason.trim() === '' ? "*No reason provided*" : reason)
89                    ]
90                });
91            }
92            catch (e) {
93                console.log(e);
94            }
95      }      }
96      catch (e) {      catch (e) {
97          console.log(e);          console.log(e);
# Line 234  export default class MuteCommand extends Line 240  export default class MuteCommand extends
240              dateTime = Date.now() + timeInterval;              dateTime = Date.now() + timeInterval;
241          }          }
242    
243            if (!(await hasPermission(client, user, msg, null, "You don't have permission to mute this user."))) {
244                return;
245            }
246            
247          if (shouldNotModerate(client, user)) {          if (shouldNotModerate(client, user)) {
248              await msg.reply({              await msg.reply({
249                  embeds: [                  embeds: [

Legend:
Removed from v.153  
changed lines
  Added in v.194

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26