3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 22:21:51 +00:00

Fix various bugs, update djs

This commit is contained in:
Dark 2021-07-04 23:14:12 +02:00
parent 4d1924b1ec
commit dda19de6e6
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
31 changed files with 96 additions and 72 deletions

View file

@ -14,7 +14,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"deep-diff": "^1.0.2", "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", "dotenv": "^4.0.0",
"emoji-regex": "^8.0.0", "emoji-regex": "^8.0.0",
"erlpack": "github:discord/erlpack", "erlpack": "github:discord/erlpack",
@ -81,9 +81,8 @@
"version": "30.0.0-beta.38", "version": "30.0.0-beta.38",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@discordjs/voice": "^0.5.1",
"discord-api-types": "^0.18.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", "knub-command-manager": "^9.1.0",
"ts-essentials": "^6.0.7" "ts-essentials": "^6.0.7"
}, },
@ -2160,9 +2159,9 @@
} }
}, },
"node_modules/discord.js": { "node_modules/discord.js": {
"version": "13.0.0-dev.ab0b3b9.1625400166", "version": "13.0.0-dev.a7c6678.1625427504",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.ab0b3b9.1625400166.tgz", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.a7c6678.1625427504.tgz",
"integrity": "sha512-nTdUyPEvy1OxCoSXVJrJDFMxEIEUr/NIpuf8x0gz0XTdrghDrGR756hX4KuqGT12fm9PpqciyT+52f7fkzIxCQ==", "integrity": "sha512-S4ntnGVUCRyyOtz8YvoWNpSZyZEFwXTkTjXbU0shveD/QVT+0cBCcMX6vp0zPt3lCkMUgdW+crrOfEYKMGwKoQ==",
"dependencies": { "dependencies": {
"@discordjs/builders": "^0.2.0", "@discordjs/builders": "^0.2.0",
"@discordjs/collection": "^0.1.6", "@discordjs/collection": "^0.1.6",
@ -8035,9 +8034,9 @@
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==" "integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg=="
}, },
"discord.js": { "discord.js": {
"version": "13.0.0-dev.ab0b3b9.1625400166", "version": "13.0.0-dev.a7c6678.1625427504",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.ab0b3b9.1625400166.tgz", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.a7c6678.1625427504.tgz",
"integrity": "sha512-nTdUyPEvy1OxCoSXVJrJDFMxEIEUr/NIpuf8x0gz0XTdrghDrGR756hX4KuqGT12fm9PpqciyT+52f7fkzIxCQ==", "integrity": "sha512-S4ntnGVUCRyyOtz8YvoWNpSZyZEFwXTkTjXbU0shveD/QVT+0cBCcMX6vp0zPt3lCkMUgdW+crrOfEYKMGwKoQ==",
"requires": { "requires": {
"@discordjs/builders": "^0.2.0", "@discordjs/builders": "^0.2.0",
"@discordjs/collection": "^0.1.6", "@discordjs/collection": "^0.1.6",
@ -8872,7 +8871,6 @@
"knub": { "knub": {
"version": "file:../../Knub", "version": "file:../../Knub",
"requires": { "requires": {
"@discordjs/voice": "^0.5.1",
"@types/chai": "^4.2.18", "@types/chai": "^4.2.18",
"@types/mocha": "^7.0.2", "@types/mocha": "^7.0.2",
"@types/node": "^14.14.45", "@types/node": "^14.14.45",
@ -8880,7 +8878,7 @@
"@typescript-eslint/parser": "^4.23.0", "@typescript-eslint/parser": "^4.23.0",
"chai": "^4.3.4", "chai": "^4.3.4",
"discord-api-types": "^0.18.1", "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", "eslint": "^7.2.0",
"husky": "^4.3.8", "husky": "^4.3.8",
"knub-command-manager": "^9.1.0", "knub-command-manager": "^9.1.0",

View file

@ -29,7 +29,7 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"deep-diff": "^1.0.2", "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", "dotenv": "^4.0.0",
"emoji-regex": "^8.0.0", "emoji-regex": "^8.0.0",
"erlpack": "github:discord/erlpack", "erlpack": "github:discord/erlpack",

View file

@ -30,7 +30,7 @@ export const SetSlowmodeAction = automodAction({
if (channel.type === ChannelTypeStrings.CATEGORY) { if (channel.type === ChannelTypeStrings.CATEGORY) {
// Find all text channels within the category // Find all text channels within the category
for (const ch of pluginData.guild.channels.cache.values()) { 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); channelsToSlowmode.push(ch as TextChannel);
} }
} }

View file

@ -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 member = context.member || (userId && pluginData.guild.members.cache.get(userId as Snowflake)) || null;
const channelId = context.message?.channel_id; const channelId = context.message?.channel_id;
const channel = channelId ? (pluginData.guild.channels.cache.get(channelId as Snowflake) as TextChannel) : null; 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({ const config = await pluginData.config.getMatchingConfig({
channelId, channelId,

View file

@ -48,7 +48,7 @@ export const ServersCmd = botControlCmd({
const longestId = filteredGuilds.reduce((longest, guild) => Math.max(longest, guild.id.length), 0); const longestId = filteredGuilds.reduce((longest, guild) => Math.max(longest, guild.id.length), 0);
const lines = filteredGuilds.map(g => { const lines = filteredGuilds.map(g => {
const paddedId = g.id.padEnd(longestId, " "); 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}\`)`; return `\`${paddedId}\` **${g.name}** (${g.memberCount} members) (owner **${owner.username}#${owner.discriminator}** \`${owner.id}\`)`;
}); });
createChunkedMessage(msg.channel as TextChannel, lines.join("\n")); createChunkedMessage(msg.channel as TextChannel, lines.join("\n"));

View file

@ -16,7 +16,7 @@ export async function getCompanionChannelOptsForVoiceChannelId(
.filter( .filter(
opts => opts =>
opts.voice_channel_ids.includes(voiceChannel.id) || 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)); .map(opts => Object.assign({}, defaultCompanionChannelOpts, opts));
} }

View file

@ -34,7 +34,7 @@ export async function moveToVoiceChannelAction(
if (!targetChannel) throw new ActionError("Unknown target channel"); if (!targetChannel) throw new ActionError("Unknown target channel");
if (!(targetChannel instanceof VoiceChannel)) throw new ActionError("Target channel is not a voice 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({ await target.edit({
channel: targetChannel.id, channel: targetChannel.id,
}); });

View file

@ -30,6 +30,6 @@ function updateGuildInfo(pluginData: GuildPluginData<GuildInfoSaverPluginType>)
pluginData.guild.id, pluginData.guild.id,
pluginData.guild.name, pluginData.guild.name,
pluginData.guild.iconURL(), pluginData.guild.iconURL(),
pluginData.guild.ownerID, pluginData.guild.ownerId,
); );
} }

View file

@ -10,10 +10,10 @@ export async function moveMember(
errorChannel: TextChannel, errorChannel: TextChannel,
) { ) {
const modMember: GuildMember = await pluginData.guild.members.fetch(toMoveID as Snowflake); const modMember: GuildMember = await pluginData.guild.members.fetch(toMoveID as Snowflake);
if (modMember.voice.channelID != null) { if (modMember.voice.channelId != null) {
try { try {
await modMember.edit({ await modMember.edit({
channel: target.voice.channelID, channel: target.voice.channelId,
}); });
} catch { } catch {
sendErrorMessage(pluginData, errorChannel, "Failed to move you. Are you in a voice channel?"); sendErrorMessage(pluginData, errorChannel, "Failed to move you. Are you in a voice channel?");

View file

@ -11,8 +11,8 @@ export async function sendWhere(
channel: TextChannel, channel: TextChannel,
prepend: string, prepend: string,
) { ) {
const voice = member.voice.channelID const voice = member.voice.channelId
? (pluginData.guild.channels.resolve(member.voice.channelID) as VoiceChannel) ? (pluginData.guild.channels.resolve(member.voice.channelId) as VoiceChannel)
: null; : null;
if (voice == null) { if (voice == null) {

View file

@ -8,7 +8,7 @@ export const LogsStageInstanceCreateEvt = logsEvt({
async listener(meta) { async listener(meta) {
const stageChannel = const stageChannel =
meta.args.stageInstance.channel ?? 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, { meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_CREATE, {
stageInstance: stripObjectToScalars(meta.args.stageInstance), stageInstance: stripObjectToScalars(meta.args.stageInstance),
stageChannel: stripObjectToScalars(stageChannel), stageChannel: stripObjectToScalars(stageChannel),
@ -22,7 +22,7 @@ export const LogsStageInstanceDeleteEvt = logsEvt({
async listener(meta) { async listener(meta) {
const stageChannel = const stageChannel =
meta.args.stageInstance.channel ?? 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, { meta.pluginData.state.guildLogs.log(LogType.STAGE_INSTANCE_DELETE, {
stageInstance: stripObjectToScalars(meta.args.stageInstance), stageInstance: stripObjectToScalars(meta.args.stageInstance),
stageChannel: stripObjectToScalars(stageChannel), stageChannel: stripObjectToScalars(stageChannel),
@ -36,7 +36,7 @@ export const LogsStageInstanceUpdateEvt = logsEvt({
async listener(meta) { async listener(meta) {
const stageChannel = const stageChannel =
meta.args.newStageInstance.channel ?? 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 diff = getScalarDifference(meta.args.oldStageInstance, meta.args.newStageInstance);
const differenceString = differenceToString(diff); const differenceString = differenceToString(diff);

View file

@ -27,10 +27,17 @@ export const MutesCmd = mutesCmd({
let totalMutes = 0; let totalMutes = 0;
let hasFilters = false; let hasFilters = false;
let stopCollectionFn; let stopCollectionFn = () => {
let stopCollectionTimeout; return;
};
let stopCollectionTimeout: NodeJS.Timeout;
const stopCollectionDebounce = 5 * MINUTES; const stopCollectionDebounce = 5 * MINUTES;
const bumpCollectionTimeout = () => {
clearTimeout(stopCollectionTimeout);
stopCollectionTimeout = setTimeout(stopCollectionFn, stopCollectionDebounce);
};
let lines: string[] = []; let lines: string[] = [];
// Active, logged mutes // Active, logged mutes
@ -169,11 +176,6 @@ export const MutesCmd = mutesCmd({
bumpCollectionTimeout(); bumpCollectionTimeout();
}; };
const bumpCollectionTimeout = () => {
clearTimeout(stopCollectionTimeout);
stopCollectionTimeout = setTimeout(stopCollectionFn, stopCollectionDebounce);
};
if (totalMutes === 0) { if (totalMutes === 0) {
if (args.manual) { if (args.manual) {
listMessage.edit("No manual mutes found!"); listMessage.edit("No manual mutes found!");
@ -199,14 +201,14 @@ export const MutesCmd = mutesCmd({
new MessageButton() new MessageButton()
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setEmoji("⬅") .setEmoji("⬅")
.setCustomID(`previousButton:${idMod}`), .setCustomId(`previousButton:${idMod}`),
); );
buttons.push( buttons.push(
new MessageButton() new MessageButton()
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setEmoji("➡") .setEmoji("➡")
.setCustomID(`nextButton:${idMod}`), .setCustomId(`nextButton:${idMod}`),
); );
const row = new MessageActionRow().addComponents(buttons); 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 }); interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true });
} else { } else {
collector.resetTimer(); collector.resetTimer();
if (interaction.customID === `previousButton:${idMod}` && currentPage > 1) { if (interaction.customId === `previousButton:${idMod}` && currentPage > 1) {
await interaction.deferUpdate(); await interaction.deferUpdate();
await drawListPage(currentPage - 1); await drawListPage(currentPage - 1);
} else if (interaction.customID === `nextButton:${idMod}` && currentPage < totalPages) { } else if (interaction.customId === `nextButton:${idMod}` && currentPage < totalPages) {
await interaction.deferUpdate(); await interaction.deferUpdate();
await drawListPage(currentPage + 1); await drawListPage(currentPage + 1);
} else { } else {

View file

@ -38,7 +38,7 @@ export const PostButtonRolesCmd = reactionRolesCmd({
const btn = new MessageButton() const btn = new MessageButton()
.setLabel(button.label ?? "") .setLabel(button.label ?? "")
.setStyle(button.style ?? "PRIMARY") .setStyle(button.style ?? "PRIMARY")
.setCustomID(customId) .setCustomId(customId)
.setDisabled(button.disabled ?? false); .setDisabled(button.disabled ?? false);
if (button.emoji) { if (button.emoji) {

View file

@ -14,18 +14,17 @@ import { handleModifyRole, handleOpenMenu } from "../util/buttonActionHandlers";
const BUTTON_INVALIDATION_TIME = 15 * MINUTES; const BUTTON_INVALIDATION_TIME = 15 * MINUTES;
export const ButtonInteractionEvt = reactionRolesEvt({ export const ButtonInteractionEvt = reactionRolesEvt({
event: "interaction", event: "interactionCreate",
async listener(meta) { async listener(meta) {
const int = meta.args.interaction.isMessageComponent() const int = meta.args.interaction.isMessageComponent()
? (meta.args.interaction as MessageComponentInteraction) ? (meta.args.interaction as MessageComponentInteraction)
: null; : null;
if (!int) return; 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 cfg = meta.pluginData.config.get();
const split = int.customID.split(BUTTON_CONTEXT_SEPARATOR); const split = int.customId.split(BUTTON_CONTEXT_SEPARATOR);
const context = (await resolveStatefulCustomId(meta.pluginData, int.customID)) ?? { const context = (await resolveStatefulCustomId(meta.pluginData, int.customId)) ?? {
groupName: split[0], groupName: split[0],
action: split[1], action: split[1],
roleOrMenu: split[2], roleOrMenu: split[2],
@ -80,7 +79,7 @@ export const ButtonInteractionEvt = reactionRolesEvt({
} }
logger.warn( 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!`); await sendEphemeralReply(int, `A internal error was encountered, please contact the Administrators!`);
}, },

View file

@ -33,7 +33,7 @@ export async function handleOpenMenu(
const btn = new MessageButton() const btn = new MessageButton()
.setLabel(menuButton.label ?? "") .setLabel(menuButton.label ?? "")
.setStyle("PRIMARY") .setStyle("PRIMARY")
.setCustomID(customId) .setCustomId(customId)
.setDisabled(menuButton.disabled ?? false); .setDisabled(menuButton.disabled ?? false);
if (menuButton.emoji) { if (menuButton.emoji) {

View file

@ -38,5 +38,7 @@ export async function resolveStatefulCustomId(pluginData: GuildPluginData<Reacti
roleOrMenu: cfgButton.role_or_menu, roleOrMenu: cfgButton.role_or_menu,
stateless: false, stateless: false,
}; };
} else {
return null;
} }
} }

View file

@ -20,6 +20,7 @@ export function splitButtonsIntoRows(actualButtons: MessageButton[], configButto
} }
} }
if (curRow.components.length >= 1) rows.push(curRow);
return rows; return rows;
} }

View file

@ -34,7 +34,7 @@ export const StarboardReactionAddEvt = starboardEvt({
const config = await pluginData.config.getMatchingConfig({ const config = await pluginData.config.getMatchingConfig({
member, member,
channelId: msg.channel.id, channelId: msg.channel.id,
categoryId: (msg.channel as TextChannel).parentID, categoryId: (msg.channel as TextChannel).parentId,
}); });
const boardLock = await pluginData.locks.acquire(allStarboardsLock()); const boardLock = await pluginData.locks.acquire(allStarboardsLock());

View file

@ -150,6 +150,7 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
}, },
timeAdd(...args) { timeAdd(...args) {
if (args.length === 0) return;
let reference; let reference;
let delay; let delay;
@ -171,6 +172,7 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
}, },
timeSub(...args) { timeSub(...args) {
if (args.length === 0) return;
let reference; let reference;
let delay; let delay;

View file

@ -22,12 +22,12 @@ export async function onMessageCreate(pluginData: GuildPluginData<TagsPluginType
const config = await pluginData.config.getMatchingConfig({ const config = await pluginData.config.getMatchingConfig({
member, member,
channelId: msg.channel_id, channelId: msg.channel_id,
categoryId: channel.parentID, categoryId: channel.parentId,
}); });
const tagResult = await matchAndRenderTagFromString(pluginData, msg.data.content, member, { const tagResult = await matchAndRenderTagFromString(pluginData, msg.data.content, member, {
channelId: msg.channel_id, channelId: msg.channel_id,
categoryId: channel.parentID, categoryId: channel.parentId,
}); });
if (!tagResult) { if (!tagResult) {

View file

@ -35,6 +35,7 @@ import { SourceCmd } from "./commands/SourceCmd";
import { UserInfoCmd } from "./commands/UserInfoCmd"; import { UserInfoCmd } from "./commands/UserInfoCmd";
import { VcdisconnectCmd } from "./commands/VcdisconnectCmd"; import { VcdisconnectCmd } from "./commands/VcdisconnectCmd";
import { VcmoveAllCmd, VcmoveCmd } from "./commands/VcmoveCmd"; import { VcmoveAllCmd, VcmoveCmd } from "./commands/VcmoveCmd";
import { AutoJoinThreadEvt } from "./events/AutoJoinThreadEvt";
import { activeReloads } from "./guildReloads"; import { activeReloads } from "./guildReloads";
import { refreshMembersIfNeeded } from "./refreshMembers"; import { refreshMembersIfNeeded } from "./refreshMembers";
import { ConfigSchema, UtilityPluginType } from "./types"; import { ConfigSchema, UtilityPluginType } from "./types";
@ -67,6 +68,7 @@ const defaultOptions: PluginOptions<UtilityPluginType> = {
jumbo_size: 128, jumbo_size: 128,
can_avatar: false, can_avatar: false,
info_on_single_result: true, info_on_single_result: true,
autojoin_threads: true,
}, },
overrides: [ overrides: [
{ {
@ -148,6 +150,11 @@ export const UtilityPlugin = zeppelinGuildPlugin<UtilityPluginType>()({
EmojiInfoCmd, EmojiInfoCmd,
], ],
// prettier-ignore
events: [
AutoJoinThreadEvt,
],
beforeLoad(pluginData) { beforeLoad(pluginData) {
const { state, guild } = pluginData; const { state, guild } = pluginData;

View file

@ -98,7 +98,7 @@ export const CleanCmd = utilityCmd({
userId: msg.author.id, userId: msg.author.id,
member: msg.member, member: msg.member,
channelId: targetChannel.id, channelId: targetChannel.id,
categoryId: targetChannel.parentID, categoryId: targetChannel.parentId,
}); });
if (configForTargetChannel.can_clean !== true) { if (configForTargetChannel.can_clean !== true) {
sendErrorMessage(pluginData, msg.channel, `Missing permissions to use clean on that channel`); sendErrorMessage(pluginData, msg.channel, `Missing permissions to use clean on that channel`);

View file

@ -21,11 +21,11 @@ export const VcdisconnectCmd = utilityCmd({
return; 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"); sendErrorMessage(pluginData, msg.channel, "Member is not in a voice channel");
return; 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 { try {
await args.member.voice.kick(); await args.member.voice.kick();

View file

@ -52,17 +52,17 @@ export const VcmoveCmd = utilityCmd({
channel = closestMatch; 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"); sendErrorMessage(pluginData, msg.channel, "Member is not in a voice channel");
return; 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!"); sendErrorMessage(pluginData, msg.channel, "Member is already on that channel!");
return; return;
} }
const oldVoiceChannel = pluginData.guild.channels.cache.get(args.member.voice.channelID); const oldVoiceChannel = pluginData.guild.channels.cache.get(args.member.voice.channelId);
try { try {
await args.member.edit({ await args.member.edit({

View 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();
}
},
});

View file

@ -105,11 +105,11 @@ export async function getChannelInfoEmbed(
if (channel.type === ChannelTypeStrings.CATEGORY) { if (channel.type === ChannelTypeStrings.CATEGORY) {
const textChannels = pluginData.guild.channels.cache.filter( 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( const voiceChannels = pluginData.guild.channels.cache.filter(
ch => 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({ embed.fields.push({

View file

@ -64,10 +64,10 @@ export async function getServerInfoEmbed(
basicInformation.push(`Created: **${serverAge} ago** (\`${prettyCreatedAt}\`)`); basicInformation.push(`Created: **${serverAge} ago** (\`${prettyCreatedAt}\`)`);
if (thisServer) { if (thisServer) {
const owner = await resolveUser(pluginData.client, thisServer.ownerID); const owner = await resolveUser(pluginData.client, thisServer.ownerId);
const ownerName = `${owner.username}#${owner.discriminator}`; 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 // basicInformation.push(`Voice region: **${thisServer.region}**`); Outdated, as automatic voice regions are fully live
} }
@ -81,10 +81,10 @@ export async function getServerInfoEmbed(
}); });
// IMAGE LINKS // IMAGE LINKS
const iconUrl = `[Link](${(restGuild || guildPreview)!.iconURL})`; const iconUrl = `[Link](${(restGuild || guildPreview)!.iconURL()})`;
const bannerUrl = restGuild?.bannerURL ? `[Link](${restGuild.bannerURL})` : "None"; const bannerUrl = restGuild?.bannerURL() ? `[Link](${restGuild.bannerURL()})` : "None";
const splashUrl = const splashUrl =
(restGuild || guildPreview)!.splashURL != null (restGuild || guildPreview)!.splashURL() != null
? `[Link](${(restGuild || guildPreview)!.splashURL()?.replace("size=128", "size=2048")})` ? `[Link](${(restGuild || guildPreview)!.splashURL()?.replace("size=128", "size=2048")})`
: "None"; : "None";

View file

@ -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) { if (voiceChannel || member.voice.mute || member.voice.deaf) {
embed.fields.push({ embed.fields.push({
name: preEmbedPadding + "Voice information", name: preEmbedPadding + "Voice information",

View file

@ -175,7 +175,7 @@ export async function displaySearch(
new MessageButton() new MessageButton()
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setEmoji("⬅") .setEmoji("⬅")
.setCustomID(`previousButton:${idMod}`) .setCustomId(`previousButton:${idMod}`)
.setDisabled(currentPage === 1), .setDisabled(currentPage === 1),
); );
@ -183,7 +183,7 @@ export async function displaySearch(
new MessageButton() new MessageButton()
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setEmoji("➡") .setEmoji("➡")
.setCustomID(`nextButton:${idMod}`) .setCustomId(`nextButton:${idMod}`)
.setDisabled(currentPage === searchResult.lastPage), .setDisabled(currentPage === searchResult.lastPage),
); );
@ -191,7 +191,7 @@ export async function displaySearch(
new MessageButton() new MessageButton()
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setEmoji("🔄") .setEmoji("🔄")
.setCustomID(`reloadButton:${idMod}`), .setCustomId(`reloadButton:${idMod}`),
); );
const row = new MessageActionRow().addComponents(buttons); const row = new MessageActionRow().addComponents(buttons);
@ -204,15 +204,15 @@ export async function displaySearch(
if (msg.author.id !== interaction.user.id) { if (msg.author.id !== interaction.user.id) {
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true });
} else { } else {
if (interaction.customID === `previousButton:${idMod}` && currentPage > 1) { if (interaction.customId === `previousButton:${idMod}` && currentPage > 1) {
collector.stop(); collector.stop();
await interaction.deferUpdate(); await interaction.deferUpdate();
await loadSearchPage(currentPage - 1); await loadSearchPage(currentPage - 1);
} else if (interaction.customID === `nextButton:${idMod}` && currentPage < searchResult.lastPage) { } else if (interaction.customId === `nextButton:${idMod}` && currentPage < searchResult.lastPage) {
collector.stop(); collector.stop();
await interaction.deferUpdate(); await interaction.deferUpdate();
await loadSearchPage(currentPage + 1); await loadSearchPage(currentPage + 1);
} else if (interaction.customID === `reloadButton:${idMod}`) { } else if (interaction.customId === `reloadButton:${idMod}`) {
collector.stop(); collector.stop();
await interaction.deferUpdate(); await interaction.deferUpdate();
await loadSearchPage(currentPage); await loadSearchPage(currentPage);
@ -325,7 +325,7 @@ async function performMemberSearch(
} }
if (args.voice) { if (args.voice) {
matchingMembers = matchingMembers.filter(m => m.voice.channelID != null); matchingMembers = matchingMembers.filter(m => m.voice.channelId != null);
} }
if (args.bot) { if (args.bot) {

View file

@ -34,6 +34,7 @@ export const ConfigSchema = t.type({
jumbo_size: t.Integer, jumbo_size: t.Integer,
can_avatar: t.boolean, can_avatar: t.boolean,
info_on_single_result: t.boolean, info_on_single_result: t.boolean,
autojoin_threads: t.boolean,
}); });
export type TConfigSchema = t.TypeOf<typeof ConfigSchema>; export type TConfigSchema = t.TypeOf<typeof ConfigSchema>;

View file

@ -13,12 +13,12 @@ export async function waitForButtonConfirm(
new MessageButton() new MessageButton()
.setStyle("SUCCESS") .setStyle("SUCCESS")
.setLabel(options?.confirmText || "Confirm") .setLabel(options?.confirmText || "Confirm")
.setCustomID(`confirmButton:${idMod}`), .setCustomId(`confirmButton:${idMod}`),
new MessageButton() new MessageButton()
.setStyle("DANGER") .setStyle("DANGER")
.setLabel(options?.cancelText || "Cancel") .setLabel(options?.cancelText || "Cancel")
.setCustomID(`cancelButton:${idMod}`), .setCustomId(`cancelButton:${idMod}`),
]); ]);
const message = await channel.send({ ...toPost, components: [row] }); const message = await channel.send({ ...toPost, components: [row] });
@ -29,10 +29,10 @@ export async function waitForButtonConfirm(
if (options?.restrictToId && options.restrictToId !== interaction.user.id) { if (options?.restrictToId && options.restrictToId !== interaction.user.id) {
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true });
} else { } else {
if (interaction.customID === `confirmButton:${idMod}`) { if (interaction.customId === `confirmButton:${idMod}`) {
message.delete(); message.delete();
resolve(true); resolve(true);
} else if (interaction.customID === `cancelButton:${idMod}`) { } else if (interaction.customId === `cancelButton:${idMod}`) {
message.delete(); message.delete();
resolve(false); resolve(false);
} }