mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Upgrade DJS, fix bugs
This commit is contained in:
parent
0822fc15e5
commit
be71357ff9
17 changed files with 123 additions and 66 deletions
|
@ -63,24 +63,26 @@ export const AboutCmd = utilityCmd({
|
|||
);
|
||||
loadedPlugins.sort();
|
||||
|
||||
const aboutContent: MessageOptions & { embed: EmbedWith<"title" | "fields"> } = {
|
||||
embed: {
|
||||
title: `About ${pluginData.client.user!.username}`,
|
||||
fields: [
|
||||
{
|
||||
name: "Status",
|
||||
value: basicInfoRows
|
||||
.map(([label, value]) => {
|
||||
return `${label}: **${value}**`;
|
||||
})
|
||||
.join("\n"),
|
||||
},
|
||||
{
|
||||
name: `Loaded plugins on this server (${loadedPlugins.length})`,
|
||||
value: loadedPlugins.join(", "),
|
||||
},
|
||||
],
|
||||
},
|
||||
const aboutContent: MessageOptions = {
|
||||
embeds: [
|
||||
{
|
||||
title: `About ${pluginData.client.user!.username}`,
|
||||
fields: [
|
||||
{
|
||||
name: "Status",
|
||||
value: basicInfoRows
|
||||
.map(([label, value]) => {
|
||||
return `${label}: **${value}**`;
|
||||
})
|
||||
.join("\n"),
|
||||
},
|
||||
{
|
||||
name: `Loaded plugins on this server (${loadedPlugins.length})`,
|
||||
value: loadedPlugins.join(", "),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const supporters = await pluginData.state.supporters.getAll();
|
||||
|
@ -92,9 +94,10 @@ export const AboutCmd = utilityCmd({
|
|||
);
|
||||
|
||||
if (supporters.length) {
|
||||
aboutContent.embed.fields.push({
|
||||
aboutContent.embeds![0].fields!.push({
|
||||
name: "Zeppelin supporters 🎉",
|
||||
value: supporters.map(s => `**${s.name}** ${s.amount ? `${s.amount}€/mo` : ""}`.trim()).join("\n"),
|
||||
inline: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -105,12 +108,12 @@ export const AboutCmd = utilityCmd({
|
|||
botRoles = botRoles.filter(r => r.color); // Filter to those with a color
|
||||
botRoles.sort(sorter("position", "DESC")); // Sort by position (highest first)
|
||||
if (botRoles.length) {
|
||||
aboutContent.embed.color = botRoles[0].color;
|
||||
aboutContent.embeds![0].color = botRoles[0].color;
|
||||
}
|
||||
|
||||
// Use the bot avatar as the embed image
|
||||
if (pluginData.client.user!.avatarURL()) {
|
||||
aboutContent.embed.thumbnail = { url: pluginData.client.user!.avatarURL()! };
|
||||
aboutContent.embeds![0].thumbnail = { url: pluginData.client.user!.avatarURL()! };
|
||||
}
|
||||
|
||||
msg.channel.send(aboutContent);
|
||||
|
|
|
@ -87,7 +87,7 @@ export const CleanCmd = utilityCmd({
|
|||
return;
|
||||
}
|
||||
|
||||
const targetChannel = args.channel ? pluginData.guild.channels.cache.get(args.channel) : msg.channel;
|
||||
const targetChannel = args.channel ? pluginData.guild.channels.cache.get(args.channel as Snowflake) : msg.channel;
|
||||
if (!targetChannel || !(targetChannel instanceof TextChannel)) {
|
||||
sendErrorMessage(pluginData, msg.channel, `Invalid channel specified`);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { TextChannel } from "discord.js";
|
||||
import { Snowflake, TextChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage } from "../../../pluginUtils";
|
||||
import { messageLink } from "../../../utils";
|
||||
|
@ -38,7 +38,7 @@ export const ContextCmd = utilityCmd({
|
|||
const previousMessage = (
|
||||
await (pluginData.guild.channels.cache.get(channel.id) as TextChannel).messages.fetch({
|
||||
limit: 1,
|
||||
before: messageId,
|
||||
before: messageId as Snowflake,
|
||||
})
|
||||
)[0];
|
||||
if (!previousMessage) {
|
||||
|
|
|
@ -58,7 +58,7 @@ export const InfoCmd = utilityCmd({
|
|||
|
||||
// 2. Server
|
||||
if (userCfg.can_server) {
|
||||
const guild = await pluginData.client.guilds.fetch(value).catch(noop);
|
||||
const guild = await pluginData.client.guilds.fetch(value as Snowflake).catch(noop);
|
||||
if (guild) {
|
||||
const embed = await getServerInfoEmbed(pluginData, value, message.author.id);
|
||||
if (embed) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { VoiceChannel } from "discord.js";
|
||||
import { Snowflake, VoiceChannel } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
|
@ -21,7 +21,7 @@ export const VcmoveCmd = utilityCmd({
|
|||
|
||||
if (isSnowflake(args.channel)) {
|
||||
// Snowflake -> resolve channel directly
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(args.channel);
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(args.channel as Snowflake);
|
||||
if (!potentialChannel || !(potentialChannel instanceof VoiceChannel)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Unknown or non-voice channel");
|
||||
return;
|
||||
|
@ -31,7 +31,7 @@ export const VcmoveCmd = utilityCmd({
|
|||
} else if (channelMentionRegex.test(args.channel)) {
|
||||
// Channel mention -> parse channel id and resolve channel from that
|
||||
const channelId = args.channel.match(channelMentionRegex)![1];
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(channelId);
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (!potentialChannel || !(potentialChannel instanceof VoiceChannel)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Unknown or non-voice channel");
|
||||
return;
|
||||
|
@ -104,7 +104,7 @@ export const VcmoveAllCmd = utilityCmd({
|
|||
|
||||
if (isSnowflake(args.channel)) {
|
||||
// Snowflake -> resolve channel directly
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(args.channel);
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(args.channel as Snowflake);
|
||||
if (!potentialChannel || !(potentialChannel instanceof VoiceChannel)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Unknown or non-voice channel");
|
||||
return;
|
||||
|
@ -114,7 +114,7 @@ export const VcmoveAllCmd = utilityCmd({
|
|||
} else if (channelMentionRegex.test(args.channel)) {
|
||||
// Channel mention -> parse channel id and resolve channel from that
|
||||
const channelId = args.channel.match(channelMentionRegex)![1];
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(channelId);
|
||||
const potentialChannel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (!potentialChannel || !(potentialChannel instanceof VoiceChannel)) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Unknown or non-voice channel");
|
||||
return;
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
MessageButton,
|
||||
MessageComponentInteraction,
|
||||
Permissions,
|
||||
Snowflake,
|
||||
TextChannel,
|
||||
User,
|
||||
} from "discord.js";
|
||||
|
@ -316,7 +317,7 @@ async function performMemberSearch(
|
|||
const roleIds = args.role.split(",");
|
||||
matchingMembers = matchingMembers.filter(member => {
|
||||
for (const role of roleIds) {
|
||||
if (!member.roles.cache.has(role)) return false;
|
||||
if (!member.roles.cache.has(role as Snowflake)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue