MCPcopy Create free account
hub / github.com/RTByte/rtbyte / run

Method run

src/commands/Moderator/unban.js:20–46  ·  view source on GitHub ↗
(msg, [username, ...reason])

Source from the content-addressed store, hash-verified

18 }
19
20 async run(msg, [username, ...reason]) {
21 if (!Array.isArray(reason) || !reason.length) reason.unshift('Unspecified');
22 const silent = reason[0].endsWith('-s');
23 if (silent) reason[0].replace('-s', '');
24
25 const bans = await msg.guild.fetchBans();
26 if (!bans.has(username.id)) return msg.reject(msg.language.get('COMMAND_UNBAN_NOT_BANNED'));
27
28 reason += ' (fc)';
29
30 const modCase = new ModCase(msg.guild)
31 .setUser(username)
32 .setType('unban')
33 .setReason(reason)
34 .setModerator(msg.author)
35 .setSilent(silent);
36 await modCase.submit();
37
38 const embed = await modCase.embed();
39 await embed.send();
40
41 await msg.guild.members.unban(username, reason);
42
43 if (silent) return msg.delete({ reason: msg.language.get('COMMAND_MODERATION_SILENT') });
44
45 return msg.affirm();
46 }
47
48};

Callers

nothing calls this directly

Calls 11

rejectMethod · 0.80
setSilentMethod · 0.80
setModeratorMethod · 0.80
setReasonMethod · 0.80
setTypeMethod · 0.80
setUserMethod · 0.80
submitMethod · 0.80
embedMethod · 0.80
sendMethod · 0.80
affirmMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected