mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Fix various bugs, update djs
This commit is contained in:
parent
4d1924b1ec
commit
dda19de6e6
31 changed files with 96 additions and 72 deletions
|
@ -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>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue