mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 13:55:03 +00:00
Added Discord attachment link reaction, fixed emoji configuration and moved util functions
This commit is contained in:
parent
a4c4b17a14
commit
592d037148
173 changed files with 1540 additions and 1170 deletions
|
@ -3,7 +3,8 @@ import { AllowedGuilds } from "../../data/AllowedGuilds";
|
|||
import { ApiPermissionAssignments } from "../../data/ApiPermissionAssignments";
|
||||
import { Configs } from "../../data/Configs";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { makeIoTsConfigParser, sendSuccessMessage } from "../../pluginUtils";
|
||||
import { makeIoTsConfigParser } from "../../pluginUtils";
|
||||
import { CommonPlugin } from "../Common/CommonPlugin";
|
||||
import { zeppelinGlobalPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { getActiveReload, resetActiveReload } from "./activeReload";
|
||||
import { AddDashboardUserCmd } from "./commands/AddDashboardUserCmd";
|
||||
|
@ -77,7 +78,7 @@ export const BotControlPlugin = zeppelinGlobalPlugin<BotControlPluginType>()({
|
|||
if (guild) {
|
||||
const channel = guild.channels.cache.get(channelId as Snowflake);
|
||||
if (channel instanceof TextChannel) {
|
||||
sendSuccessMessage(pluginData, channel, "Global plugins reloaded!");
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(channel, "Global plugins reloaded!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { renderUserUsername } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const AddDashboardUserCmd = botControlCmd({
|
||||
|
@ -19,7 +20,7 @@ export const AddDashboardUserCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const guild = await pluginData.state.allowedGuilds.find(args.guildId);
|
||||
if (!guild) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Server is not using Zeppelin");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Server is not using Zeppelin");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,10 +37,11 @@ export const AddDashboardUserCmd = botControlCmd({
|
|||
}
|
||||
|
||||
const userNameList = args.users.map((user) => `<@!${user.id}> (**${renderUserUsername(user)}**, \`${user.id}\`)`);
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`The following users were given dashboard access for **${guild.name}**:\n\n${userNameList}`,
|
||||
);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendSuccessMessage(
|
||||
msg,
|
||||
`The following users were given dashboard access for **${guild.name}**:\n\n${userNameList}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import moment from "moment-timezone";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { DBDateFormat, isGuildInvite, resolveInvite } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { isEligible } from "../functions/isEligible";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
|
@ -18,19 +18,21 @@ export const AddServerFromInviteCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const invite = await resolveInvite(pluginData.client, args.inviteCode, true);
|
||||
if (!invite || !isGuildInvite(invite)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Could not resolve invite"); // :D
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Could not resolve invite"); // :D
|
||||
return;
|
||||
}
|
||||
|
||||
const existing = await pluginData.state.allowedGuilds.find(invite.guild.id);
|
||||
if (existing) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Server is already allowed!");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Server is already allowed!");
|
||||
return;
|
||||
}
|
||||
|
||||
const { result, explanation } = await isEligible(pluginData, args.user, invite);
|
||||
if (!result) {
|
||||
sendErrorMessage(pluginData, msg.channel, `Could not add server because it's not eligible: ${explanation}`);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(msg, `Could not add server because it's not eligible: ${explanation}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -51,6 +53,8 @@ export const AddServerFromInviteCmd = botControlCmd({
|
|||
);
|
||||
}
|
||||
|
||||
sendSuccessMessage(pluginData, msg.channel, "Server was eligible and is now allowed to use Zeppelin!");
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendSuccessMessage(msg, "Server was eligible and is now allowed to use Zeppelin!");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { ApiPermissions } from "@shared/apiPermissions";
|
||||
import moment from "moment-timezone";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { DBDateFormat, isSnowflake } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const AllowServerCmd = botControlCmd({
|
||||
|
@ -20,17 +21,17 @@ export const AllowServerCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const existing = await pluginData.state.allowedGuilds.find(args.guildId);
|
||||
if (existing) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Server is already allowed!");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Server is already allowed!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSnowflake(args.guildId)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Invalid server ID!");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Invalid server ID!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.userId && !isSnowflake(args.userId)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Invalid user ID!");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Invalid user ID!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -51,6 +52,6 @@ export const AllowServerCmd = botControlCmd({
|
|||
);
|
||||
}
|
||||
|
||||
sendSuccessMessage(pluginData, msg.channel, "Server is now allowed to use Zeppelin!");
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, "Server is now allowed to use Zeppelin!");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ChannelToServerCmd = botControlCmd({
|
||||
|
@ -16,7 +17,7 @@ export const ChannelToServerCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const channel = pluginData.client.channels.cache.get(args.channelId);
|
||||
if (!channel) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Channel not found in cache!");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Channel not found in cache!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { noop } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const DisallowServerCmd = botControlCmd({
|
||||
|
@ -18,7 +19,7 @@ export const DisallowServerCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const existing = await pluginData.state.allowedGuilds.find(args.guildId);
|
||||
if (!existing) {
|
||||
sendErrorMessage(pluginData, msg.channel, "That server is not allowed in the first place!");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "That server is not allowed in the first place!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,6 +28,6 @@ export const DisallowServerCmd = botControlCmd({
|
|||
.get(args.guildId as Snowflake)
|
||||
?.leave()
|
||||
.catch(noop);
|
||||
sendSuccessMessage(pluginData, msg.channel, "Server removed!");
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, "Server removed!");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isGuildInvite, resolveInvite } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { isEligible } from "../functions/isEligible";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
|
@ -16,17 +16,17 @@ export const EligibleCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const invite = await resolveInvite(pluginData.client, args.inviteCode, true);
|
||||
if (!invite || !isGuildInvite(invite)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Could not resolve invite");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Could not resolve invite");
|
||||
return;
|
||||
}
|
||||
|
||||
const { result, explanation } = await isEligible(pluginData, args.user, invite);
|
||||
|
||||
if (result) {
|
||||
sendSuccessMessage(pluginData, msg.channel, `Server is eligible: ${explanation}`);
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, `Server is eligible: ${explanation}`);
|
||||
return;
|
||||
}
|
||||
|
||||
sendErrorMessage(pluginData, msg.channel, `Server is **NOT** eligible: ${explanation}`);
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, `Server is **NOT** eligible: ${explanation}`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const LeaveServerCmd = botControlCmd({
|
||||
|
@ -16,7 +17,7 @@ export const LeaveServerCmd = botControlCmd({
|
|||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
if (!pluginData.client.guilds.cache.has(args.guildId as Snowflake)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "I am not in that guild");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "I am not in that guild");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -26,10 +27,10 @@ export const LeaveServerCmd = botControlCmd({
|
|||
try {
|
||||
await pluginData.client.guilds.cache.get(args.guildId as Snowflake)?.leave();
|
||||
} catch (e) {
|
||||
sendErrorMessage(pluginData, msg.channel, `Failed to leave guild: ${e.message}`);
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, `Failed to leave guild: ${e.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
sendSuccessMessage(pluginData, msg.channel, `Left guild **${guildName}**`);
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, `Left guild **${guildName}**`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { AllowedGuild } from "../../../data/entities/AllowedGuild";
|
||||
import { ApiPermissionAssignment } from "../../../data/entities/ApiPermissionAssignment";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { renderUserUsername, resolveUser } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ListDashboardPermsCmd = botControlCmd({
|
||||
|
@ -16,7 +16,7 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
if (!args.user && !args.guildId) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Must specify at least guildId, user, or both.");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Must specify at least guildId, user, or both.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
if (args.guildId) {
|
||||
guild = await pluginData.state.allowedGuilds.find(args.guildId);
|
||||
if (!guild) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Server is not using Zeppelin");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Server is not using Zeppelin");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
if (args.user) {
|
||||
existingUserAssignment = await pluginData.state.apiPermissionAssignments.getByUserId(args.user.id);
|
||||
if (existingUserAssignment.length === 0) {
|
||||
sendErrorMessage(pluginData, msg.channel, "The user has no assigned permissions.");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "The user has no assigned permissions.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -54,11 +54,9 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
}
|
||||
|
||||
if (finalMessage === "") {
|
||||
sendErrorMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`The user ${userInfo} has no assigned permissions on the specified server.`,
|
||||
);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(msg, `The user ${userInfo} has no assigned permissions on the specified server.`);
|
||||
return;
|
||||
}
|
||||
// Else display all users that have permissions on the specified guild
|
||||
|
@ -67,7 +65,9 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
|
||||
const existingGuildAssignment = await pluginData.state.apiPermissionAssignments.getByGuildId(guild.id);
|
||||
if (existingGuildAssignment.length === 0) {
|
||||
sendErrorMessage(pluginData, msg.channel, `The server ${guildInfo} has no assigned permissions.`);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendErrorMessage(msg, `The server ${guildInfo} has no assigned permissions.`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,6 @@ export const ListDashboardPermsCmd = botControlCmd({
|
|||
}
|
||||
}
|
||||
|
||||
await sendSuccessMessage(pluginData, msg.channel, finalMessage.trim(), {});
|
||||
await pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, finalMessage.trim(), {});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { renderUserUsername, resolveUser } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ListDashboardUsersCmd = botControlCmd({
|
||||
|
@ -14,7 +14,7 @@ export const ListDashboardUsersCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const guild = await pluginData.state.allowedGuilds.find(args.guildId);
|
||||
if (!guild) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Server is not using Zeppelin");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Server is not using Zeppelin");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,12 @@ export const ListDashboardUsersCmd = botControlCmd({
|
|||
`<@!${user.id}> (**${renderUserUsername(user)}**, \`${user.id}\`): ${permission.permissions.join(", ")}`,
|
||||
);
|
||||
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`The following users have dashboard access for **${guild.name}**:\n\n${userNameList.join("\n")}`,
|
||||
{},
|
||||
);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendSuccessMessage(
|
||||
msg,
|
||||
`The following users have dashboard access for **${guild.name}**:\n\n${userNameList.join("\n")}`,
|
||||
{},
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import moment from "moment-timezone";
|
||||
import { GuildArchives } from "../../../data/GuildArchives";
|
||||
import { getBaseUrl, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { getBaseUrl } from "../../../pluginUtils";
|
||||
import { getRateLimitStats } from "../../../rateLimitStats";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const RateLimitPerformanceCmd = botControlCmd({
|
||||
|
@ -13,7 +14,7 @@ export const RateLimitPerformanceCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg }) {
|
||||
const logItems = getRateLimitStats();
|
||||
if (logItems.length === 0) {
|
||||
sendSuccessMessage(pluginData, msg.channel, `No rate limits hit`);
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, `No rate limits hit`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { isStaffPreFilter, sendErrorMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { getActiveReload, setActiveReload } from "../activeReload";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
|
@ -14,7 +15,7 @@ export const ReloadGlobalPluginsCmd = botControlCmd({
|
|||
|
||||
const guildId = "guild" in message.channel ? message.channel.guild.id : null;
|
||||
if (!guildId) {
|
||||
sendErrorMessage(pluginData, message.channel, "This command can only be used in a server");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(message, "This command can only be used in a server");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const ReloadServerCmd = botControlCmd({
|
||||
|
@ -16,18 +17,18 @@ export const ReloadServerCmd = botControlCmd({
|
|||
|
||||
async run({ pluginData, message: msg, args }) {
|
||||
if (!pluginData.client.guilds.cache.has(args.guildId as Snowflake)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "I am not in that guild");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "I am not in that guild");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await pluginData.getKnubInstance().reloadGuild(args.guildId);
|
||||
} catch (e) {
|
||||
sendErrorMessage(pluginData, msg.channel, `Failed to reload guild: ${e.message}`);
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, `Failed to reload guild: ${e.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const guild = await pluginData.client.guilds.fetch(args.guildId as Snowflake);
|
||||
sendSuccessMessage(pluginData, msg.channel, `Reloaded guild **${guild?.name || "???"}**`);
|
||||
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, `Reloaded guild **${guild?.name || "???"}**`);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { isStaffPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isStaffPreFilter } from "../../../pluginUtils";
|
||||
import { renderUserUsername } from "../../../utils";
|
||||
import { CommonPlugin } from "../../Common/CommonPlugin";
|
||||
import { botControlCmd } from "../types";
|
||||
|
||||
export const RemoveDashboardUserCmd = botControlCmd({
|
||||
|
@ -18,7 +19,7 @@ export const RemoveDashboardUserCmd = botControlCmd({
|
|||
async run({ pluginData, message: msg, args }) {
|
||||
const guild = await pluginData.state.allowedGuilds.find(args.guildId);
|
||||
if (!guild) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Server is not using Zeppelin");
|
||||
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Server is not using Zeppelin");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -35,10 +36,11 @@ export const RemoveDashboardUserCmd = botControlCmd({
|
|||
}
|
||||
|
||||
const userNameList = args.users.map((user) => `<@!${user.id}> (**${renderUserUsername(user)}**, \`${user.id}\`)`);
|
||||
sendSuccessMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`The following users were removed from the dashboard for **${guild.name}**:\n\n${userNameList}`,
|
||||
);
|
||||
pluginData
|
||||
.getPlugin(CommonPlugin)
|
||||
.sendSuccessMessage(
|
||||
msg,
|
||||
`The following users were removed from the dashboard for **${guild.name}**:\n\n${userNameList}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue