Add owner debug command for channel information
This commit is contained in:
parent
3e7313d40f
commit
3bc0015dbe
2 changed files with 35 additions and 0 deletions
|
@ -20,6 +20,7 @@ import { ServersCmd } from "./commands/ServersCmd";
|
||||||
import { BotControlPluginType, ConfigSchema } from "./types";
|
import { BotControlPluginType, ConfigSchema } from "./types";
|
||||||
import { PerformanceCmd } from "./commands/PerformanceCmd";
|
import { PerformanceCmd } from "./commands/PerformanceCmd";
|
||||||
import { AddServerFromInviteCmd } from "./commands/AddServerFromInviteCmd";
|
import { AddServerFromInviteCmd } from "./commands/AddServerFromInviteCmd";
|
||||||
|
import { ChannelToServerCmd } from "./commands/ChannelToServerCmd";
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
config: {
|
config: {
|
||||||
|
@ -52,6 +53,7 @@ export const BotControlPlugin = zeppelinGlobalPlugin<BotControlPluginType>()({
|
||||||
EligibleCmd,
|
EligibleCmd,
|
||||||
PerformanceCmd,
|
PerformanceCmd,
|
||||||
AddServerFromInviteCmd,
|
AddServerFromInviteCmd,
|
||||||
|
ChannelToServerCmd,
|
||||||
],
|
],
|
||||||
|
|
||||||
async afterLoad(pluginData) {
|
async afterLoad(pluginData) {
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { Guild, GuildChannel, TextChannel } from "discord.js";
|
||||||
|
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||||
|
import { isOwnerPreFilter, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||||
|
import { GuildInvite, isGuildInvite, resolveInvite, verboseUserMention } from "../../../utils";
|
||||||
|
import { botControlCmd } from "../types";
|
||||||
|
import { isEligible } from "../functions/isEligible";
|
||||||
|
|
||||||
|
export const ChannelToServerCmd = botControlCmd({
|
||||||
|
trigger: ["channel_to_server", "channel2server"],
|
||||||
|
permission: null,
|
||||||
|
config: {
|
||||||
|
preFilters: [isOwnerPreFilter],
|
||||||
|
},
|
||||||
|
|
||||||
|
signature: {
|
||||||
|
channelId: ct.string(),
|
||||||
|
},
|
||||||
|
|
||||||
|
async run({ pluginData, message: msg, args }) {
|
||||||
|
const channel = pluginData.client.channels.cache.get(args.channelId);
|
||||||
|
if (!channel) {
|
||||||
|
sendErrorMessage(pluginData, msg.channel as TextChannel, "Channel not found in cache!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const channelName = channel.isVoice() ? channel.name : `#${(channel as TextChannel).name}`;
|
||||||
|
|
||||||
|
const guild: Guild | null = (channel as GuildChannel).guild ?? null;
|
||||||
|
const guildInfo = guild ? `${guild.name} (\`${guild.id}\`)` : "Not a server";
|
||||||
|
|
||||||
|
msg.channel.send(`**Channel:** ${channelName} (\`${channel.type}\`) (<#${channel.id}>)\n**Server:** ${guildInfo}`);
|
||||||
|
},
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue