allow banning unknown users by ID lol
This commit is contained in:
parent
4b13005bcc
commit
e622914f19
1 changed files with 5 additions and 4 deletions
|
@ -7,7 +7,7 @@ import MessageCommandContext from "../../struct/MessageCommandContext";
|
||||||
import TempBan from "../../struct/TempBan";
|
import TempBan from "../../struct/TempBan";
|
||||||
import { fetchUsername, logModAction } from "../modules/mod_logs";
|
import { fetchUsername, logModAction } from "../modules/mod_logs";
|
||||||
import { storeTempBan } from "../modules/tempbans";
|
import { storeTempBan } from "../modules/tempbans";
|
||||||
import { isModerator, NO_MANAGER_MSG, parseUser, storeInfraction } from "../util";
|
import { isModerator, NO_MANAGER_MSG, parseUserOrId, storeInfraction } from "../util";
|
||||||
import Day from 'dayjs';
|
import Day from 'dayjs';
|
||||||
import RelativeTime from 'dayjs/plugin/relativeTime';
|
import RelativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ export default {
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
return message.reply(`You need to provide a target user!`);
|
return message.reply(`You need to provide a target user!`);
|
||||||
|
|
||||||
let targetUser = await parseUser(args.shift()!);
|
const targetUser = await parseUserOrId(args.shift()!);
|
||||||
if (!targetUser) return message.reply('Sorry, I can\'t find that user.');
|
if (!targetUser) return message.reply('Sorry, I can\'t find that user.');
|
||||||
|
const targetName = await fetchUsername(targetUser._id);
|
||||||
|
|
||||||
if (targetUser._id == message.author_id) {
|
if (targetUser._id == message.author_id) {
|
||||||
return message.reply('nah');
|
return message.reply('nah');
|
||||||
|
@ -84,7 +85,7 @@ export default {
|
||||||
.catch(e => message.reply(`Failed to ban user: \`${e}\``));
|
.catch(e => message.reply(`Failed to ban user: \`${e}\``));
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
message.reply(`### @${targetUser.username} has been banned.\n`
|
message.reply(`### @${targetName} has been banned.\n`
|
||||||
+ `Infraction ID: \`${infId}\` (**#${userWarnCount}** for this user)`),
|
+ `Infraction ID: \`${infId}\` (**#${userWarnCount}** for this user)`),
|
||||||
logModAction('ban', message.serverContext, message.member!, targetUser._id, reason, infraction, `Ban duration: **Permanent**`),
|
logModAction('ban', message.serverContext, message.member!, targetUser._id, reason, infraction, `Ban duration: **Permanent**`),
|
||||||
]);
|
]);
|
||||||
|
@ -116,7 +117,7 @@ export default {
|
||||||
} as TempBan);
|
} as TempBan);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
message.reply(`### ${targetUser.username} has been temporarily banned.\n`
|
message.reply(`### ${targetName} has been temporarily banned.\n`
|
||||||
+ `Infraction ID: \`${infId}\` (**#${userWarnCount}** for this user)`),
|
+ `Infraction ID: \`${infId}\` (**#${userWarnCount}** for this user)`),
|
||||||
logModAction('ban', message.serverContext, message.member!, targetUser._id, reason, infraction, `Ban duration: **${Day(banUntil).fromNow(true)}**`),
|
logModAction('ban', message.serverContext, message.member!, targetUser._id, reason, infraction, `Ban duration: **${Day(banUntil).fromNow(true)}**`),
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in a new issue