mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Type fixes for djs
This commit is contained in:
parent
653d6c1dc2
commit
0822fc15e5
130 changed files with 8877 additions and 411 deletions
|
@ -71,7 +71,7 @@ export const CasesModCmd = modActionsCmd({
|
|||
],
|
||||
};
|
||||
|
||||
return { embed };
|
||||
return { embeds: [embed] };
|
||||
},
|
||||
{
|
||||
limitToUserId: msg.author.id,
|
||||
|
|
|
@ -12,13 +12,13 @@ import { modActionsCmd } from "../types";
|
|||
const opts = {
|
||||
expand: ct.bool({ option: true, isSwitch: true, shortcut: "e" }),
|
||||
hidden: ct.bool({ option: true, isSwitch: true, shortcut: "h" }),
|
||||
reverseFilters: ct.switchOption({ shortcut: "r" }),
|
||||
notes: ct.switchOption({ shortcut: "n" }),
|
||||
warns: ct.switchOption({ shortcut: "w" }),
|
||||
mutes: ct.switchOption({ shortcut: "m" }),
|
||||
unmutes: ct.switchOption({ shortcut: "um" }),
|
||||
bans: ct.switchOption({ shortcut: "b" }),
|
||||
unbans: ct.switchOption({ shortcut: "ub" }),
|
||||
reverseFilters: ct.switchOption({ def: false, shortcut: "r" }),
|
||||
notes: ct.switchOption({ def: false, shortcut: "n" }),
|
||||
warns: ct.switchOption({ def: false, shortcut: "w" }),
|
||||
mutes: ct.switchOption({ def: false, shortcut: "m" }),
|
||||
unmutes: ct.switchOption({ def: false, shortcut: "um" }),
|
||||
bans: ct.switchOption({ def: false, shortcut: "b" }),
|
||||
unbans: ct.switchOption({ def: false, shortcut: "ub" }),
|
||||
};
|
||||
|
||||
export const CasesUserCmd = modActionsCmd({
|
||||
|
@ -127,7 +127,7 @@ export const CasesUserCmd = modActionsCmd({
|
|||
],
|
||||
};
|
||||
|
||||
msg.channel.send({ embed });
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ export const DeleteCaseCmd = modActionsCmd({
|
|||
signature: {
|
||||
caseNumber: ct.number({ rest: true }),
|
||||
|
||||
force: ct.switchOption({ shortcut: "f" }),
|
||||
force: ct.switchOption({ def: false, shortcut: "f" }),
|
||||
},
|
||||
|
||||
async run({ pluginData, message, args }) {
|
||||
|
@ -49,8 +49,8 @@ export const DeleteCaseCmd = modActionsCmd({
|
|||
const cases = pluginData.getPlugin(CasesPlugin);
|
||||
const embedContent = await cases.getCaseEmbed(theCase);
|
||||
message.channel.send({
|
||||
...embedContent,
|
||||
content: "Delete the following case? Answer 'Yes' to continue, 'No' to cancel.",
|
||||
embed: embedContent.embed,
|
||||
});
|
||||
|
||||
const reply = await helpers.waitForReply(
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -66,7 +67,7 @@ export const ForcebanCmd = modActionsCmd({
|
|||
|
||||
try {
|
||||
// FIXME: Use banUserId()?
|
||||
await pluginData.guild.bans.create(user.id, {
|
||||
await pluginData.guild.bans.create(user.id as Snowflake, {
|
||||
days: 1,
|
||||
reason: reason != null ? encodeURIComponent(reason) : undefined,
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -49,7 +50,7 @@ export const UnbanCmd = modActionsCmd({
|
|||
|
||||
try {
|
||||
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);
|
||||
await pluginData.guild.bans.remove(user.id, reason != null ? encodeURIComponent(reason) : undefined);
|
||||
await pluginData.guild.bans.remove(user.id as Snowflake, reason != null ? encodeURIComponent(reason) : undefined);
|
||||
} catch {
|
||||
sendErrorMessage(pluginData, msg.channel, "Failed to unban member; are you sure they're banned?");
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Permissions, TextChannel } from "discord.js";
|
||||
import { Permissions, Snowflake, TextChannel } from "discord.js";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { resolveMember } from "../../../utils";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||
|
@ -22,7 +22,7 @@ export const PostAlertOnMemberJoinEvt = modActionsEvt({
|
|||
const logs = pluginData.getPlugin(LogsPlugin);
|
||||
|
||||
if (actions.length) {
|
||||
const alertChannel = pluginData.guild.channels.cache.get(alertChannelId);
|
||||
const alertChannel = pluginData.guild.channels.cache.get(alertChannelId as Snowflake);
|
||||
if (!alertChannel) {
|
||||
logs.log(LogType.BOT_ALERT, {
|
||||
body: `Unknown \`alert_channel\` configured for \`mod_actions\`: \`${alertChannelId}\``,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { DiscordAPIError, User } from "discord.js";
|
||||
import { DiscordAPIError, Snowflake, User } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
|
@ -77,7 +77,7 @@ export async function banUserId(
|
|||
ignoreEvent(pluginData, IgnoredEventType.Ban, userId);
|
||||
try {
|
||||
const deleteMessageDays = Math.min(30, Math.max(0, banOptions.deleteMessageDays ?? 1));
|
||||
await pluginData.guild.bans.create(userId, {
|
||||
await pluginData.guild.bans.create(userId as Snowflake, {
|
||||
days: deleteMessageDays,
|
||||
reason: reason != null ? encodeURIComponent(reason) : undefined,
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { Snowflake, TextChannel } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { UserNotificationMethod } from "../../../utils";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
|
@ -15,7 +15,7 @@ export function getDefaultContactMethods(
|
|||
}
|
||||
|
||||
if (config[`message_on_${type}`] && config.message_channel) {
|
||||
const channel = pluginData.guild.channels.cache.get(config.message_channel);
|
||||
const channel = pluginData.guild.channels.cache.get(config.message_channel as Snowflake);
|
||||
if (channel instanceof TextChannel) {
|
||||
methods.push({
|
||||
type: "channel",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Permissions } from "discord.js";
|
||||
import { Permissions, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { isDiscordHTTPError, isDiscordRESTError, SECONDS, sleep } from "../../../utils";
|
||||
|
@ -21,7 +21,7 @@ export async function isBanned(
|
|||
|
||||
try {
|
||||
const potentialBan = await Promise.race([
|
||||
pluginData.guild.bans.fetch({ user: userId }).catch(() => null),
|
||||
pluginData.guild.bans.fetch({ user: userId as Snowflake }).catch(() => null),
|
||||
sleep(timeout),
|
||||
]);
|
||||
return potentialBan != null;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
|
@ -30,7 +31,10 @@ export async function outdatedTempbansLoop(pluginData: GuildPluginData<ModAction
|
|||
);
|
||||
try {
|
||||
ignoreEvent(pluginData, IgnoredEventType.Unban, tempban.user_id);
|
||||
await pluginData.guild.bans.remove(tempban.user_id, reason != null ? encodeURIComponent(reason) : undefined);
|
||||
await pluginData.guild.bans.remove(
|
||||
tempban.user_id as Snowflake,
|
||||
reason != null ? encodeURIComponent(reason) : undefined,
|
||||
);
|
||||
} catch (e) {
|
||||
pluginData.state.serverLogs.log(LogType.BOT_ALERT, {
|
||||
body: `Encountered an error trying to automatically unban ${tempban.user_id} after tempban timeout`,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { GuildMember } from "discord.js";
|
||||
import { GuildMember, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { CaseTypes } from "../../../data/CaseTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
|
@ -75,7 +75,7 @@ export async function warnMember(
|
|||
noteDetails: notifyResult.text ? [ucfirst(notifyResult.text)] : [],
|
||||
});
|
||||
|
||||
const mod = await pluginData.guild.members.fetch(modId);
|
||||
const mod = await pluginData.guild.members.fetch(modId as Snowflake);
|
||||
pluginData.state.serverLogs.log(LogType.MEMBER_WARN, {
|
||||
mod: stripObjectToScalars(mod),
|
||||
member: stripObjectToScalars(member, ["user", "roles"]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue