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

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

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

revision 124 by rakin, Mon Jul 29 17:28:41 2024 UTC revision 227 by rakin, Mon Jul 29 17:29:07 2024 UTC
# Line 1  Line 1 
1  import { BanOptions, CommandInteraction, Guild, GuildMember, Interaction, Message, User } from 'discord.js';  import { BanOptions, CommandInteraction, Guild, 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 23  export async function unmute(client: Dis Line 23  export async function unmute(client: Dis
23          const { getTimeouts, clearTimeoutv2 } = await import('../../utils/setTimeout');          const { getTimeouts, clearTimeoutv2 } = await import('../../utils/setTimeout');
24    
25          const { default: Hardmute } = await import("../../models/Hardmute");          const { default: Hardmute } = await import("../../models/Hardmute");
26            const { default: MuteRecord } = await import("../../models/MuteRecord");
27    
28          const hardmute = await Hardmute.findOne({          const hardmute = await Hardmute.findOne({
29              where: {              where: {
# Line 78  export async function unmute(client: Dis Line 79  export async function unmute(client: Dis
79              mod_tag: d.tag,              mod_tag: d.tag,
80          });          });
81    
82          await user.send({          const muteRecord = await MuteRecord.findOne({
83              embeds: [              where: {
84                  new MessageEmbed()                  user_id: user.user.id,
85                  .setAuthor({                  guild_id: user.guild.id
86                      iconURL: <string> user.guild!.iconURL(),              }
                     name: `\tYou have been unmuted in ${user.guild!.name}`  
                 })  
             ]  
87          });          });
88    
89            if (muteRecord) {
90                await muteRecord.destroy();
91            }
92    
93            try {
94                await user.send({
95                    embeds: [
96                        new MessageEmbed()
97                        .setAuthor({
98                            iconURL: <string> user.guild!.iconURL(),
99                            name: `\tYou have been unmuted in ${user.guild!.name}`
100                        })
101                    ]
102                });
103            }
104            catch (e) {
105                console.log(e);
106            }
107    
108          await client.logger.logUnmute(user, d);          await client.logger.logUnmute(user, d);
109      }      }
110      catch (e) {      catch (e) {
# Line 97  export async function unmute(client: Dis Line 114  export async function unmute(client: Dis
114    
115  export default class UnmuteCommand extends BaseCommand {  export default class UnmuteCommand extends BaseCommand {
116      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
117        permissions = [Permissions.FLAGS.MODERATE_MEMBERS];
118    
119      constructor() {      constructor() {
120          super('unmute', 'moderation', []);          super('unmute', 'moderation', []);
# Line 179  export default class UnmuteCommand exten Line 197  export default class UnmuteCommand exten
197              ]              ]
198          });          });
199      }      }
 }  
200    }

Legend:
Removed from v.124  
changed lines
  Added in v.227

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26