Better typeguard (#162)
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 14s
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 14s
This commit is contained in:
parent
755d4295ce
commit
570e94dd48
4 changed files with 10 additions and 17 deletions
|
@ -1,6 +1,6 @@
|
|||
import { SlashCommandBuilder } from "@discordjs/builders";
|
||||
import { Player, useMainPlayer, useQueue } from "discord-player";
|
||||
import { ChannelType, ChatInputCommandInteraction, Client, EmbedBuilder } from "discord.js";
|
||||
import { ChatInputCommandInteraction, Client, EmbedBuilder } from "discord.js";
|
||||
import { getLocale, getLocalizations } from "../../utils/locales";
|
||||
import { getFilename } from "../../utils/misc";
|
||||
|
||||
|
@ -131,12 +131,12 @@ export default {
|
|||
|
||||
syncedLyrics?.onChange(async (lyrics) => {
|
||||
const content = `[${data[0].trackName}]: ${lyrics}`;
|
||||
if (interaction.channel?.type === ChannelType.GroupDM) {
|
||||
await interaction.followUp({
|
||||
if (interaction.channel?.isSendable()) {
|
||||
await interaction.channel?.send({
|
||||
content,
|
||||
});
|
||||
} else {
|
||||
await interaction.channel?.send({
|
||||
await interaction.followUp({
|
||||
content,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
import {
|
||||
ChannelType,
|
||||
Client,
|
||||
EmbedBuilder,
|
||||
GuildMember,
|
||||
Message,
|
||||
TextBasedChannel,
|
||||
} from "discord.js";
|
||||
import { Client, EmbedBuilder, GuildMember, Message, TextBasedChannel } from "discord.js";
|
||||
import { getLocale } from "../../utils/locales";
|
||||
import { isImage, userWithNickname } from "../../utils/misc";
|
||||
import { showDate } from "../../utils/time";
|
||||
|
@ -172,7 +165,7 @@ export default async (message: Message, client: Client) => {
|
|||
!message.content.replace(new RegExp(regex, "g"), "").trim() &&
|
||||
messages.length === urls.length &&
|
||||
!message.mentions.repliedUser &&
|
||||
message.channel.type !== ChannelType.GroupDM
|
||||
message.channel.isSendable()
|
||||
) {
|
||||
message.delete();
|
||||
return message.channel.send({ embeds: [embed] });
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { EmbedBuilder } from "@discordjs/builders";
|
||||
import { GuildQueue, Track } from "discord-player";
|
||||
import { ChannelType, Client } from "discord.js";
|
||||
import { Client } from "discord.js";
|
||||
import { Metadata } from "../../utils/metadata";
|
||||
import { emojiPng } from "../../utils/misc";
|
||||
|
||||
|
@ -20,7 +20,7 @@ export default (queue: GuildQueue<Metadata>, track: Track, client: Client) => {
|
|||
iconURL: emojiPng("🎶"),
|
||||
});
|
||||
|
||||
if (queue.metadata.channel?.type !== ChannelType.GroupDM) {
|
||||
if (queue.metadata.channel?.isSendable()) {
|
||||
queue.metadata?.channel?.send({ embeds: [embed] });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ChannelType, Client, Colors, EmbedBuilder, User } from "discord.js";
|
||||
import { Client, Colors, EmbedBuilder, User } from "discord.js";
|
||||
import { getLocale } from "./locales";
|
||||
import { cleanCodeBlock } from "./misc";
|
||||
import { showDate, strToSeconds, timeDeltaToString } from "./time";
|
||||
|
@ -169,7 +169,7 @@ export const sendReminder = (client: Client, info: infoReminder, option: OptionR
|
|||
} else {
|
||||
// Channel
|
||||
client.channels.fetch(info.channelId ?? "").then((channel) => {
|
||||
if (channel?.isTextBased() && channel.type !== ChannelType.GroupDM) {
|
||||
if (channel?.isSendable()) {
|
||||
let content = `<@${info.userId}>`;
|
||||
embed.setFooter({
|
||||
text: `${loc.get("c_reminder17")} ${timeDeltaToString(info.createdAt)}`,
|
||||
|
|
Loading…
Reference in a new issue