Fix various bugs, update djs
This commit is contained in:
parent
4d1924b1ec
commit
dda19de6e6
31 changed files with 96 additions and 72 deletions
20
backend/package-lock.json
generated
20
backend/package-lock.json
generated
|
@ -14,7 +14,7 @@
|
|||
"cors": "^2.8.5",
|
||||
"cross-env": "^5.2.0",
|
||||
"deep-diff": "^1.0.2",
|
||||
"discord.js": "^13.0.0-dev.ab0b3b9.1625400166",
|
||||
"discord.js": "^13.0.0-dev.a7c6678.1625427504",
|
||||
"dotenv": "^4.0.0",
|
||||
"emoji-regex": "^8.0.0",
|
||||
"erlpack": "github:discord/erlpack",
|
||||
|
@ -81,9 +81,8 @@
|
|||
"version": "30.0.0-beta.38",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.5.1",
|
||||
"discord-api-types": "^0.18.1",
|
||||
"discord.js": "^13.0.0-dev.ab0b3b9.1625400166",
|
||||
"discord.js": "^13.0.0-dev.a7c6678.1625427504",
|
||||
"knub-command-manager": "^9.1.0",
|
||||
"ts-essentials": "^6.0.7"
|
||||
},
|
||||
|
@ -2160,9 +2159,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/discord.js": {
|
||||
"version": "13.0.0-dev.ab0b3b9.1625400166",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.ab0b3b9.1625400166.tgz",
|
||||
"integrity": "sha512-nTdUyPEvy1OxCoSXVJrJDFMxEIEUr/NIpuf8x0gz0XTdrghDrGR756hX4KuqGT12fm9PpqciyT+52f7fkzIxCQ==",
|
||||
"version": "13.0.0-dev.a7c6678.1625427504",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.a7c6678.1625427504.tgz",
|
||||
"integrity": "sha512-S4ntnGVUCRyyOtz8YvoWNpSZyZEFwXTkTjXbU0shveD/QVT+0cBCcMX6vp0zPt3lCkMUgdW+crrOfEYKMGwKoQ==",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.2.0",
|
||||
"@discordjs/collection": "^0.1.6",
|
||||
|
@ -8035,9 +8034,9 @@
|
|||
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg=="
|
||||
},
|
||||
"discord.js": {
|
||||
"version": "13.0.0-dev.ab0b3b9.1625400166",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.ab0b3b9.1625400166.tgz",
|
||||
"integrity": "sha512-nTdUyPEvy1OxCoSXVJrJDFMxEIEUr/NIpuf8x0gz0XTdrghDrGR756hX4KuqGT12fm9PpqciyT+52f7fkzIxCQ==",
|
||||
"version": "13.0.0-dev.a7c6678.1625427504",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.a7c6678.1625427504.tgz",
|
||||
"integrity": "sha512-S4ntnGVUCRyyOtz8YvoWNpSZyZEFwXTkTjXbU0shveD/QVT+0cBCcMX6vp0zPt3lCkMUgdW+crrOfEYKMGwKoQ==",
|
||||
"requires": {
|
||||
"@discordjs/builders": "^0.2.0",
|
||||
"@discordjs/collection": "^0.1.6",
|
||||
|
@ -8872,7 +8871,6 @@
|
|||
"knub": {
|
||||
"version": "file:../../Knub",
|
||||
"requires": {
|
||||
"@discordjs/voice": "^0.5.1",
|
||||
"@types/chai": "^4.2.18",
|
||||
"@types/mocha": "^7.0.2",
|
||||
"@types/node": "^14.14.45",
|
||||
|
@ -8880,7 +8878,7 @@
|
|||
"@typescript-eslint/parser": "^4.23.0",
|
||||
"chai": "^4.3.4",
|
||||
"discord-api-types": "^0.18.1",
|
||||
"discord.js": "^13.0.0-dev.ab0b3b9.1625400166",
|
||||
"discord.js": "^13.0.0-dev.a7c6678.1625427504",
|
||||
"eslint": "^7.2.0",
|
||||
"husky": "^4.3.8",
|
||||
"knub-command-manager": "^9.1.0",
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"cors": "^2.8.5",
|
||||
"cross-env": "^5.2.0",
|
||||
"deep-diff": "^1.0.2",
|
||||
"discord.js": "^13.0.0-dev.ab0b3b9.1625400166",
|
||||
"discord.js": "^13.0.0-dev.a7c6678.1625427504",
|
||||
"dotenv": "^4.0.0",
|
||||
"emoji-regex": "^8.0.0",
|
||||
"erlpack": "github:discord/erlpack",
|
||||
|
|
|
@ -30,7 +30,7 @@ export const SetSlowmodeAction = automodAction({
|
|||
if (channel.type === ChannelTypeStrings.CATEGORY) {
|
||||
// Find all text channels within the category
|
||||
for (const ch of pluginData.guild.channels.cache.values()) {
|
||||
if (ch.parentID === channel.id && ch.type === ChannelTypeStrings.TEXT) {
|
||||
if (ch.parentId === channel.id && ch.type === ChannelTypeStrings.TEXT) {
|
||||
channelsToSlowmode.push(ch as TextChannel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ export async function runAutomod(pluginData: GuildPluginData<AutomodPluginType>,
|
|||
const member = context.member || (userId && pluginData.guild.members.cache.get(userId as Snowflake)) || null;
|
||||
const channelId = context.message?.channel_id;
|
||||
const channel = channelId ? (pluginData.guild.channels.cache.get(channelId as Snowflake) as TextChannel) : null;
|
||||
const categoryId = channel?.parentID;
|
||||
const categoryId = channel?.parentId;
|
||||
|
||||
const config = await pluginData.config.getMatchingConfig({
|
||||
channelId,
|
||||
|
|
|
@ -48,7 +48,7 @@ export const ServersCmd = botControlCmd({
|
|||
const longestId = filteredGuilds.reduce((longest, guild) => Math.max(longest, guild.id.length), 0);
|
||||
const lines = filteredGuilds.map(g => {
|
||||
const paddedId = g.id.padEnd(longestId, " ");
|
||||
const owner = getUser(pluginData.client, g.ownerID);
|
||||
const owner = getUser(pluginData.client, g.ownerId);
|
||||
return `\`${paddedId}\` **${g.name}** (${g.memberCount} members) (owner **${owner.username}#${owner.discriminator}** \`${owner.id}\`)`;
|
||||
});
|
||||
createChunkedMessage(msg.channel as TextChannel, lines.join("\n"));
|
||||
|
|
|
@ -16,7 +16,7 @@ export async function getCompanionChannelOptsForVoiceChannelId(
|
|||
.filter(
|
||||
opts =>
|
||||
opts.voice_channel_ids.includes(voiceChannel.id) ||
|
||||
(voiceChannel.parentID && opts.voice_channel_ids.includes(voiceChannel.parentID)),
|
||||
(voiceChannel.parentId && opts.voice_channel_ids.includes(voiceChannel.parentId)),
|
||||
)
|
||||
.map(opts => Object.assign({}, defaultCompanionChannelOpts, opts));
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ export async function moveToVoiceChannelAction(
|
|||
if (!targetChannel) throw new ActionError("Unknown target channel");
|
||||
if (!(targetChannel instanceof VoiceChannel)) throw new ActionError("Target channel is not a voice channel");
|
||||
|
||||
if (!target.voice.channelID) return;
|
||||
if (!target.voice.channelId) return;
|
||||
await target.edit({
|
||||
channel: targetChannel.id,
|
||||
});
|
||||
|
|
|
@ -30,6 +30,6 @@ function updateGuildInfo(pluginData: GuildPluginData<GuildInfoSaverPluginType>)
|
|||
pluginData.guild.id,
|
||||
pluginData.guild.name,
|
||||
pluginData.guild.iconURL(),
|
||||
pluginData.guild.ownerID,
|
||||
pluginData.guild.ownerId,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ export async function moveMember(
|
|||
errorChannel: TextChannel,
|
||||
) {
|
||||
const modMember: GuildMember = await pluginData.guild.members.fetch(toMoveID as Snowflake);
|
||||
if (modMember.voice.channelID != null) {
|
||||
if (modMember.voice.channelId != null) {
|
||||
try {
|
||||
await modMember.edit({
|
||||
channel: target.voice.channelID,
|
||||
channel: target.voice.channelId,
|
||||
});
|
||||
} catch {
|
||||
sendErrorMessage(pluginData, errorChannel, "Failed to move you. Are you in a voice channel?");
|
||||
|
|
|
@ -11,8 +11,8 @@ export async function sendWhere(
|
|||
channel: TextChannel,
|
||||
prepend: string,
|
||||
) {
|
||||
const voice = member.voice.channelID
|
||||
? (pluginData.guild.channels.resolve(member.voice.channelID) as VoiceChannel)
|
||||
const voice = member.voice.channelId
|
||||
? (pluginData.guild.channels.resolve(member.voice.channelId) as VoiceChannel)
|
||||
: null;
|
||||
|
||||
if (voice == null) {
|
||||
|
|
|
@ -8,7 +8,7 @@ export const LogsStageInstanceCreateEvt = logsEvt({
|
|||
async listener(meta) {
|
||||
const stageChannel =
|
||||
meta.args.stageInstance.channel ??
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.stageInstance.channelID));
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.stageInstance.channelId));
|
||||
meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_CREATE, {
|
||||
stageInstance: stripObjectToScalars(meta.args.stageInstance),
|
||||
stageChannel: stripObjectToScalars(stageChannel),
|
||||
|
@ -22,7 +22,7 @@ export const LogsStageInstanceDeleteEvt = logsEvt({
|
|||
async listener(meta) {
|
||||
const stageChannel =
|
||||
meta.args.stageInstance.channel ??
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.stageInstance.channelID));
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.stageInstance.channelId));
|
||||
meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_DELETE, {
|
||||
stageInstance: stripObjectToScalars(meta.args.stageInstance),
|
||||
stageChannel: stripObjectToScalars(stageChannel),
|
||||
|
@ -36,7 +36,7 @@ export const LogsStageInstanceUpdateEvt = logsEvt({
|
|||
async listener(meta) {
|
||||
const stageChannel =
|
||||
meta.args.newStageInstance.channel ??
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.newStageInstance.channelID));
|
||||
(await meta.pluginData.guild.channels.fetch(meta.args.newStageInstance.channelId));
|
||||
|
||||
const diff = getScalarDifference(meta.args.oldStageInstance, meta.args.newStageInstance);
|
||||
const differenceString = differenceToString(diff);
|
||||
|
|
|
@ -27,10 +27,17 @@ export const MutesCmd = mutesCmd({
|
|||
let totalMutes = 0;
|
||||
let hasFilters = false;
|
||||
|
||||
let stopCollectionFn;
|
||||
let stopCollectionTimeout;
|
||||
let stopCollectionFn = () => {
|
||||
return;
|
||||
};
|
||||
let stopCollectionTimeout: NodeJS.Timeout;
|
||||
const stopCollectionDebounce = 5 * MINUTES;
|
||||
|
||||
const bumpCollectionTimeout = () => {
|
||||
clearTimeout(stopCollectionTimeout);
|
||||
stopCollectionTimeout = setTimeout(stopCollectionFn, stopCollectionDebounce);
|
||||
};
|
||||
|
||||
let lines: string[] = [];
|
||||
|
||||
// Active, logged mutes
|
||||
|
@ -169,11 +176,6 @@ export const MutesCmd = mutesCmd({
|
|||
bumpCollectionTimeout();
|
||||
};
|
||||
|
||||
const bumpCollectionTimeout = () => {
|
||||
clearTimeout(stopCollectionTimeout);
|
||||
stopCollectionTimeout = setTimeout(stopCollectionFn, stopCollectionDebounce);
|
||||
};
|
||||
|
||||
if (totalMutes === 0) {
|
||||
if (args.manual) {
|
||||
listMessage.edit("No manual mutes found!");
|
||||
|
@ -199,14 +201,14 @@ export const MutesCmd = mutesCmd({
|
|||
new MessageButton()
|
||||
.setStyle("SECONDARY")
|
||||
.setEmoji("⬅")
|
||||
.setCustomID(`previousButton:${idMod}`),
|
||||
.setCustomId(`previousButton:${idMod}`),
|
||||
);
|
||||
|
||||
buttons.push(
|
||||
new MessageButton()
|
||||
.setStyle("SECONDARY")
|
||||
.setEmoji("➡")
|
||||
.setCustomID(`nextButton:${idMod}`),
|
||||
.setCustomId(`nextButton:${idMod}`),
|
||||
);
|
||||
|
||||
const row = new MessageActionRow().addComponents(buttons);
|
||||
|
@ -223,10 +225,10 @@ export const MutesCmd = mutesCmd({
|
|||
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true });
|
||||
} else {
|
||||
collector.resetTimer();
|
||||
if (interaction.customID === `previousButton:${idMod}` && currentPage > 1) {
|
||||
if (interaction.customId === `previousButton:${idMod}` && currentPage > 1) {
|
||||
await interaction.deferUpdate();
|
||||
await drawListPage(currentPage - 1);
|
||||
} else if (interaction.customID === `nextButton:${idMod}` && currentPage < totalPages) {
|
||||
} else if (interaction.customId === `nextButton:${idMod}` && currentPage < totalPages) {
|
||||
await interaction.deferUpdate();
|
||||
await drawListPage(currentPage + 1);
|
||||
} else {
|
||||
|
|
|
@ -38,7 +38,7 @@ export const PostButtonRolesCmd = reactionRolesCmd({
|
|||
const btn = new MessageButton()
|
||||
.setLabel(button.label ?? "")
|
||||
.setStyle(button.style ?? "PRIMARY")
|
||||
.setCustomID(customId)
|
||||
.setCustomId(customId)
|
||||
.setDisabled(button.disabled ?? false);
|
||||
|
||||
if (button.emoji) {
|
||||
|
|
|
@ -14,18 +14,17 @@ import { handleModifyRole, handleOpenMenu } from "../util/buttonActionHandlers";
|
|||
const BUTTON_INVALIDATION_TIME = 15 * MINUTES;
|
||||
|
||||
export const ButtonInteractionEvt = reactionRolesEvt({
|
||||
event: "interaction",
|
||||
event: "interactionCreate",
|
||||
|
||||
async listener(meta) {
|
||||
const int = meta.args.interaction.isMessageComponent()
|
||||
? (meta.args.interaction as MessageComponentInteraction)
|
||||
: null;
|
||||
if (!int) return;
|
||||
const allOnMessage = await meta.pluginData.state.buttonRoles.getAllForMessageId(int.message.id);
|
||||
if (allOnMessage.length === 0) return;
|
||||
|
||||
const cfg = meta.pluginData.config.get();
|
||||
const split = int.customID.split(BUTTON_CONTEXT_SEPARATOR);
|
||||
const context = (await resolveStatefulCustomId(meta.pluginData, int.customID)) ?? {
|
||||
const split = int.customId.split(BUTTON_CONTEXT_SEPARATOR);
|
||||
const context = (await resolveStatefulCustomId(meta.pluginData, int.customId)) ?? {
|
||||
groupName: split[0],
|
||||
action: split[1],
|
||||
roleOrMenu: split[2],
|
||||
|
@ -80,7 +79,7 @@ export const ButtonInteractionEvt = reactionRolesEvt({
|
|||
}
|
||||
|
||||
logger.warn(
|
||||
`Action ${context.action} on button ${int.customID} (Guild: ${int.guildID}, Channel: ${int.channelID}) is unknown!`,
|
||||
`Action ${context.action} on button ${int.customId} (Guild: ${int.guildId}, Channel: ${int.channelId}) is unknown!`,
|
||||
);
|
||||
await sendEphemeralReply(int, `A internal error was encountered, please contact the Administrators!`);
|
||||
},
|
||||
|
|
|
@ -33,7 +33,7 @@ export async function handleOpenMenu(
|
|||
const btn = new MessageButton()
|
||||
.setLabel(menuButton.label ?? "")
|
||||
.setStyle("PRIMARY")
|
||||
.setCustomID(customId)
|
||||
.setCustomId(customId)
|
||||
.setDisabled(menuButton.disabled ?? false);
|
||||
|
||||
if (menuButton.emoji) {
|
||||
|
|
|
@ -38,5 +38,7 @@ export async function resolveStatefulCustomId(pluginData: GuildPluginData<Reacti
|
|||
roleOrMenu: cfgButton.role_or_menu,
|
||||
stateless: false,
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ export function splitButtonsIntoRows(actualButtons: MessageButton[], configButto
|
|||
}
|
||||
}
|
||||
|
||||
if (curRow.components.length >= 1) rows.push(curRow);
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ export const StarboardReactionAddEvt = starboardEvt({
|
|||
const config = await pluginData.config.getMatchingConfig({
|
||||
member,
|
||||
channelId: msg.channel.id,
|
||||
categoryId: (msg.channel as TextChannel).parentID,
|
||||
categoryId: (msg.channel as TextChannel).parentId,
|
||||
});
|
||||
|
||||
const boardLock = await pluginData.locks.acquire(allStarboardsLock());
|
||||
|
|
|
@ -150,6 +150,7 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
|
|||
},
|
||||
|
||||
timeAdd(...args) {
|
||||
if (args.length === 0) return;
|
||||
let reference;
|
||||
let delay;
|
||||
|
||||
|
@ -171,6 +172,7 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
|
|||
},
|
||||
|
||||
timeSub(...args) {
|
||||
if (args.length === 0) return;
|
||||
let reference;
|
||||
let delay;
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ export async function onMessageCreate(pluginData: GuildPluginData<TagsPluginType
|
|||
const config = await pluginData.config.getMatchingConfig({
|
||||
member,
|
||||
channelId: msg.channel_id,
|
||||
categoryId: channel.parentID,
|
||||
categoryId: channel.parentId,
|
||||
});
|
||||
|
||||
const tagResult = await matchAndRenderTagFromString(pluginData, msg.data.content, member, {
|
||||
channelId: msg.channel_id,
|
||||
categoryId: channel.parentID,
|
||||
categoryId: channel.parentId,
|
||||
});
|
||||
|
||||
if (!tagResult) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import { SourceCmd } from "./commands/SourceCmd";
|
|||
import { UserInfoCmd } from "./commands/UserInfoCmd";
|
||||
import { VcdisconnectCmd } from "./commands/VcdisconnectCmd";
|
||||
import { VcmoveAllCmd, VcmoveCmd } from "./commands/VcmoveCmd";
|
||||
import { AutoJoinThreadEvt } from "./events/AutoJoinThreadEvt";
|
||||
import { activeReloads } from "./guildReloads";
|
||||
import { refreshMembersIfNeeded } from "./refreshMembers";
|
||||
import { ConfigSchema, UtilityPluginType } from "./types";
|
||||
|
@ -67,6 +68,7 @@ const defaultOptions: PluginOptions<UtilityPluginType> = {
|
|||
jumbo_size: 128,
|
||||
can_avatar: false,
|
||||
info_on_single_result: true,
|
||||
autojoin_threads: true,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
|
@ -148,6 +150,11 @@ export const UtilityPlugin = zeppelinGuildPlugin<UtilityPluginType>()({
|
|||
EmojiInfoCmd,
|
||||
],
|
||||
|
||||
// prettier-ignore
|
||||
events: [
|
||||
AutoJoinThreadEvt,
|
||||
],
|
||||
|
||||
beforeLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ export const CleanCmd = utilityCmd({
|
|||
userId: msg.author.id,
|
||||
member: msg.member,
|
||||
channelId: targetChannel.id,
|
||||
categoryId: targetChannel.parentID,
|
||||
categoryId: targetChannel.parentId,
|
||||
});
|
||||
if (configForTargetChannel.can_clean !== true) {
|
||||
sendErrorMessage(pluginData, msg.channel, `Missing permissions to use clean on that channel`);
|
||||
|
|
|
@ -21,11 +21,11 @@ export const VcdisconnectCmd = utilityCmd({
|
|||
return;
|
||||
}
|
||||
|
||||
if (!args.member.voice || !args.member.voice.channelID) {
|
||||
if (!args.member.voice || !args.member.voice.channelId) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Member is not in a voice channel");
|
||||
return;
|
||||
}
|
||||
const channel = pluginData.guild.channels.cache.get(args.member.voice.channelID) as VoiceChannel;
|
||||
const channel = pluginData.guild.channels.cache.get(args.member.voice.channelId) as VoiceChannel;
|
||||
|
||||
try {
|
||||
await args.member.voice.kick();
|
||||
|
|
|
@ -52,17 +52,17 @@ export const VcmoveCmd = utilityCmd({
|
|||
channel = closestMatch;
|
||||
}
|
||||
|
||||
if (!args.member.voice || !args.member.voice.channelID) {
|
||||
if (!args.member.voice || !args.member.voice.channelId) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Member is not in a voice channel");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.member.voice.channelID === channel.id) {
|
||||
if (args.member.voice.channelId === channel.id) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Member is already on that channel!");
|
||||
return;
|
||||
}
|
||||
|
||||
const oldVoiceChannel = pluginData.guild.channels.cache.get(args.member.voice.channelID);
|
||||
const oldVoiceChannel = pluginData.guild.channels.cache.get(args.member.voice.channelId);
|
||||
|
||||
try {
|
||||
await args.member.edit({
|
||||
|
|
12
backend/src/plugins/Utility/events/AutoJoinThreadEvt.ts
Normal file
12
backend/src/plugins/Utility/events/AutoJoinThreadEvt.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { utilityEvt } from "../types";
|
||||
|
||||
export const AutoJoinThreadEvt = utilityEvt({
|
||||
event: "threadCreate",
|
||||
|
||||
async listener(meta) {
|
||||
const config = meta.pluginData.config.get();
|
||||
if (config.autojoin_threads && meta.args.thread.joinable && !meta.args.thread.joined) {
|
||||
await meta.args.thread.join();
|
||||
}
|
||||
},
|
||||
});
|
|
@ -105,11 +105,11 @@ export async function getChannelInfoEmbed(
|
|||
|
||||
if (channel.type === ChannelTypeStrings.CATEGORY) {
|
||||
const textChannels = pluginData.guild.channels.cache.filter(
|
||||
ch => ch.parentID === channel.id && ch.type !== ChannelTypeStrings.VOICE,
|
||||
ch => ch.parentId === channel.id && ch.type !== ChannelTypeStrings.VOICE,
|
||||
);
|
||||
const voiceChannels = pluginData.guild.channels.cache.filter(
|
||||
ch =>
|
||||
ch.parentID === channel.id && (ch.type === ChannelTypeStrings.VOICE || ch.type === ChannelTypeStrings.STAGE),
|
||||
ch.parentId === channel.id && (ch.type === ChannelTypeStrings.VOICE || ch.type === ChannelTypeStrings.STAGE),
|
||||
);
|
||||
|
||||
embed.fields.push({
|
||||
|
|
|
@ -64,10 +64,10 @@ export async function getServerInfoEmbed(
|
|||
basicInformation.push(`Created: **${serverAge} ago** (\`${prettyCreatedAt}\`)`);
|
||||
|
||||
if (thisServer) {
|
||||
const owner = await resolveUser(pluginData.client, thisServer.ownerID);
|
||||
const owner = await resolveUser(pluginData.client, thisServer.ownerId);
|
||||
const ownerName = `${owner.username}#${owner.discriminator}`;
|
||||
|
||||
basicInformation.push(`Owner: **${ownerName}** (\`${thisServer.ownerID}\`)`);
|
||||
basicInformation.push(`Owner: **${ownerName}** (\`${thisServer.ownerId}\`)`);
|
||||
// basicInformation.push(`Voice region: **${thisServer.region}**`); Outdated, as automatic voice regions are fully live
|
||||
}
|
||||
|
||||
|
@ -81,10 +81,10 @@ export async function getServerInfoEmbed(
|
|||
});
|
||||
|
||||
// IMAGE LINKS
|
||||
const iconUrl = `[Link](${(restGuild || guildPreview)!.iconURL})`;
|
||||
const bannerUrl = restGuild?.bannerURL ? `[Link](${restGuild.bannerURL})` : "None";
|
||||
const iconUrl = `[Link](${(restGuild || guildPreview)!.iconURL()})`;
|
||||
const bannerUrl = restGuild?.bannerURL() ? `[Link](${restGuild.bannerURL()})` : "None";
|
||||
const splashUrl =
|
||||
(restGuild || guildPreview)!.splashURL != null
|
||||
(restGuild || guildPreview)!.splashURL() != null
|
||||
? `[Link](${(restGuild || guildPreview)!.splashURL()?.replace("size=128", "size=2048")})`
|
||||
: "None";
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ export async function getUserInfoEmbed(
|
|||
`),
|
||||
});
|
||||
|
||||
const voiceChannel = member.voice.channelID ? pluginData.guild.channels.cache.get(member.voice.channelID) : null;
|
||||
const voiceChannel = member.voice.channelId ? pluginData.guild.channels.cache.get(member.voice.channelId) : null;
|
||||
if (voiceChannel || member.voice.mute || member.voice.deaf) {
|
||||
embed.fields.push({
|
||||
name: preEmbedPadding + "Voice information",
|
||||
|
|
|
@ -175,7 +175,7 @@ export async function displaySearch(
|
|||
new MessageButton()
|
||||
.setStyle("SECONDARY")
|
||||
.setEmoji("⬅")
|
||||
.setCustomID(`previousButton:${idMod}`)
|
||||
.setCustomId(`previousButton:${idMod}`)
|
||||
.setDisabled(currentPage === 1),
|
||||
);
|
||||
|
||||
|
@ -183,7 +183,7 @@ export async function displaySearch(
|
|||
new MessageButton()
|
||||
.setStyle("SECONDARY")
|
||||
.setEmoji("➡")
|
||||
.setCustomID(`nextButton:${idMod}`)
|
||||
.setCustomId(`nextButton:${idMod}`)
|
||||
.setDisabled(currentPage === searchResult.lastPage),
|
||||
);
|
||||
|
||||
|
@ -191,7 +191,7 @@ export async function displaySearch(
|
|||
new MessageButton()
|
||||
.setStyle("SECONDARY")
|
||||
.setEmoji("🔄")
|
||||
.setCustomID(`reloadButton:${idMod}`),
|
||||
.setCustomId(`reloadButton:${idMod}`),
|
||||
);
|
||||
|
||||
const row = new MessageActionRow().addComponents(buttons);
|
||||
|
@ -204,15 +204,15 @@ export async function displaySearch(
|
|||
if (msg.author.id !== interaction.user.id) {
|
||||
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true });
|
||||
} else {
|
||||
if (interaction.customID === `previousButton:${idMod}` && currentPage > 1) {
|
||||
if (interaction.customId === `previousButton:${idMod}` && currentPage > 1) {
|
||||
collector.stop();
|
||||
await interaction.deferUpdate();
|
||||
await loadSearchPage(currentPage - 1);
|
||||
} else if (interaction.customID === `nextButton:${idMod}` && currentPage < searchResult.lastPage) {
|
||||
} else if (interaction.customId === `nextButton:${idMod}` && currentPage < searchResult.lastPage) {
|
||||
collector.stop();
|
||||
await interaction.deferUpdate();
|
||||
await loadSearchPage(currentPage + 1);
|
||||
} else if (interaction.customID === `reloadButton:${idMod}`) {
|
||||
} else if (interaction.customId === `reloadButton:${idMod}`) {
|
||||
collector.stop();
|
||||
await interaction.deferUpdate();
|
||||
await loadSearchPage(currentPage);
|
||||
|
@ -325,7 +325,7 @@ async function performMemberSearch(
|
|||
}
|
||||
|
||||
if (args.voice) {
|
||||
matchingMembers = matchingMembers.filter(m => m.voice.channelID != null);
|
||||
matchingMembers = matchingMembers.filter(m => m.voice.channelId != null);
|
||||
}
|
||||
|
||||
if (args.bot) {
|
||||
|
|
|
@ -34,6 +34,7 @@ export const ConfigSchema = t.type({
|
|||
jumbo_size: t.Integer,
|
||||
can_avatar: t.boolean,
|
||||
info_on_single_result: t.boolean,
|
||||
autojoin_threads: t.boolean,
|
||||
});
|
||||
export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@ export async function waitForButtonConfirm(
|
|||
new MessageButton()
|
||||
.setStyle("SUCCESS")
|
||||
.setLabel(options?.confirmText || "Confirm")
|
||||
.setCustomID(`confirmButton:${idMod}`),
|
||||
.setCustomId(`confirmButton:${idMod}`),
|
||||
|
||||
new MessageButton()
|
||||
.setStyle("DANGER")
|
||||
.setLabel(options?.cancelText || "Cancel")
|
||||
.setCustomID(`cancelButton:${idMod}`),
|
||||
.setCustomId(`cancelButton:${idMod}`),
|
||||
]);
|
||||
const message = await channel.send({ ...toPost, components: [row] });
|
||||
|
||||
|
@ -29,10 +29,10 @@ export async function waitForButtonConfirm(
|
|||
if (options?.restrictToId && options.restrictToId !== interaction.user.id) {
|
||||
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true });
|
||||
} else {
|
||||
if (interaction.customID === `confirmButton:${idMod}`) {
|
||||
if (interaction.customId === `confirmButton:${idMod}`) {
|
||||
message.delete();
|
||||
resolve(true);
|
||||
} else if (interaction.customID === `cancelButton:${idMod}`) {
|
||||
} else if (interaction.customId === `cancelButton:${idMod}`) {
|
||||
message.delete();
|
||||
resolve(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue