3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Finish preliminary rework, ready to test

This commit is contained in:
Dark 2021-06-02 04:07:50 +02:00
parent 57893e7f76
commit d0a1beb809
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
177 changed files with 854 additions and 707 deletions

View file

@ -6,12 +6,13 @@ import { sendErrorMessage, sendSuccessMessage, hasPermission } from "../../../pl
import { formatReasonWithAttachments } from "./formatReasonWithAttachments";
import { MutesPlugin } from "../../../plugins/Mutes/MutesPlugin";
import humanizeDuration from "humanize-duration";
import { User, Message, GuildMember, TextChannel } from "discord.js";
export async function actualUnmuteCmd(
pluginData: GuildPluginData<ModActionsPluginType>,
user: User | UnknownUser,
msg: Message,
args: { time?: number; reason?: string; mod?: Member },
args: { time?: number; reason?: string; mod?: GuildMember },
) {
// The moderator who did the action is the message author or, if used, the specified -mod
let mod = msg.author;
@ -19,7 +20,7 @@ export async function actualUnmuteCmd(
if (args.mod) {
if (!(await hasPermission(pluginData, "can_act_as_other", { message: msg, channelId: msg.channel.id }))) {
sendErrorMessage(pluginData, msg.channel, "You don't have permission to use -mod");
sendErrorMessage(pluginData, msg.channel as TextChannel, "You don't have permission to use -mod");
return;
}
@ -27,7 +28,7 @@ export async function actualUnmuteCmd(
pp = msg.author;
}
const reason = args.reason ? formatReasonWithAttachments(args.reason, msg.attachments) : undefined;
const reason = args.reason ? formatReasonWithAttachments(args.reason, msg.attachments.array()) : undefined;
const mutesPlugin = pluginData.getPlugin(MutesPlugin);
const result = await mutesPlugin.unmuteUser(user.id, args.time, {
@ -37,7 +38,7 @@ export async function actualUnmuteCmd(
});
if (!result) {
sendErrorMessage(pluginData, msg.channel, "User is not muted!");
sendErrorMessage(pluginData, msg.channel as TextChannel, "User is not muted!");
return;
}
@ -46,7 +47,7 @@ export async function actualUnmuteCmd(
const timeUntilUnmute = args.time && humanizeDuration(args.time);
sendSuccessMessage(
pluginData,
msg.channel,
msg.channel as TextChannel,
asSingleLine(`
Unmuting **${user.username}#${user.discriminator}**
in ${timeUntilUnmute} (Case #${result.case.case_number})
@ -55,7 +56,7 @@ export async function actualUnmuteCmd(
} else {
sendSuccessMessage(
pluginData,
msg.channel,
msg.channel as TextChannel,
asSingleLine(`
Unmuted **${user.username}#${user.discriminator}**
(Case #${result.case.case_number})