/[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 159 by rakin, Mon Jul 29 17:28:49 2024 UTC revision 203 by rakin, Mon Jul 29 17:29:00 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, User } from 'discord.js';  import { BanOptions, CommandInteraction, GuildMember, Interaction, Message, Permissions, User } from 'discord.js';
2  import BaseCommand from '../../utils/structures/BaseCommand';  import BaseCommand from '../../utils/structures/BaseCommand';
3  import DiscordClient from '../../client/Client';  import DiscordClient from '../../client/Client';
4  import CommandOptions from '../../types/CommandOptions';  import CommandOptions from '../../types/CommandOptions';
# 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 119  export async function mute(client: Disco Line 119  export async function mute(client: Disco
119    
120  export default class MuteCommand extends BaseCommand {  export default class MuteCommand extends BaseCommand {
121      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
122        permissions = [Permissions.FLAGS.MODERATE_MEMBERS];
123    
124      constructor() {      constructor() {
125          super('mute', 'moderation', []);          super('mute', 'moderation', []);
# Line 240  export default class MuteCommand extends Line 241  export default class MuteCommand extends
241              dateTime = Date.now() + timeInterval;              dateTime = Date.now() + timeInterval;
242          }          }
243    
244            if (!(await hasPermission(client, user, msg, null, "You don't have permission to mute this user."))) {
245                return;
246            }
247            
248          if (shouldNotModerate(client, user)) {          if (shouldNotModerate(client, user)) {
249              await msg.reply({              await msg.reply({
250                  embeds: [                  embeds: [

Legend:
Removed from v.159  
changed lines
  Added in v.203

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26