Type fixes for djs

This commit is contained in:
Dark 2021-06-30 04:56:56 +02:00
parent 653d6c1dc2
commit 0822fc15e5
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
130 changed files with 8877 additions and 411 deletions

View file

@ -1,3 +1,4 @@
import { Snowflake } from "discord.js";
import { getChannelId, getRoleId } from "knub/dist/utils";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
@ -31,7 +32,7 @@ export const InfoCmd = utilityCmd({
signature: {
value: ct.string({ required: false }),
compact: ct.switchOption({ shortcut: "c" }),
compact: ct.switchOption({ def: false, shortcut: "c" }),
},
async run({ message, args, pluginData }) {
@ -45,11 +46,11 @@ export const InfoCmd = utilityCmd({
// 1. Channel
if (userCfg.can_channelinfo) {
const channelId = getChannelId(value);
const channel = channelId && pluginData.guild.channels.cache.get(channelId);
const channel = channelId && pluginData.guild.channels.cache.get(channelId as Snowflake);
if (channel) {
const embed = await getChannelInfoEmbed(pluginData, channelId!, message.author.id);
if (embed) {
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -61,7 +62,7 @@ export const InfoCmd = utilityCmd({
if (guild) {
const embed = await getServerInfoEmbed(pluginData, value, message.author.id);
if (embed) {
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -73,7 +74,7 @@ export const InfoCmd = utilityCmd({
if (user && userCfg.can_userinfo) {
const embed = await getUserInfoEmbed(pluginData, user.id, Boolean(args.compact), message.author.id);
if (embed) {
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -91,7 +92,7 @@ export const InfoCmd = utilityCmd({
message.author.id,
);
if (embed) {
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -106,7 +107,7 @@ export const InfoCmd = utilityCmd({
if (invite) {
const embed = await getInviteInfoEmbed(pluginData, inviteCode);
if (embed) {
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -119,7 +120,7 @@ export const InfoCmd = utilityCmd({
if (serverPreview) {
const embed = await getServerInfoEmbed(pluginData, value, message.author.id);
if (embed) {
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -128,10 +129,10 @@ export const InfoCmd = utilityCmd({
// 7. Role
if (userCfg.can_roleinfo) {
const roleId = getRoleId(value);
const role = roleId && pluginData.guild.roles.cache.get(roleId);
const role = roleId && pluginData.guild.roles.cache.get(roleId as Snowflake);
if (role) {
const embed = await getRoleInfoEmbed(pluginData, role, message.author.id);
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -142,7 +143,7 @@ export const InfoCmd = utilityCmd({
if (emojiIdMatch?.[2]) {
const embed = await getEmojiInfoEmbed(pluginData, emojiIdMatch[2]);
if (embed) {
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}
}
@ -151,7 +152,7 @@ export const InfoCmd = utilityCmd({
// 9. Arbitrary ID
if (isValidSnowflake(value) && userCfg.can_snowflake) {
const embed = await getSnowflakeInfoEmbed(pluginData, value, true, message.author.id);
message.channel.send({ embed });
message.channel.send({ embeds: [embed] });
return;
}