A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy

🦺 (commands/say) check type of channel for type safety

Jo ee5bd155 261a5580

+6 -2
+2 -1
deno.json
··· 7 7 "discord.js": "npm:discord.js@^14.17.3", 8 8 "discord-api-types/gateway": "npm:discord-api-types@0.37.118/gateway", 9 9 "discord-api-types/rest": "npm:discord-api-types@0.37.118/rest", 10 - "@discord.js/builders": "npm:@discordjs/builders@1.10.0" 10 + "@discord.js/builders": "npm:@discordjs/builders@1.10.0", 11 + "discord-api-types/payloads": "npm:discord-api-types@0.37.118/payloads" 11 12 } 12 13 }
+4 -1
src/commands/utility/say.ts
··· 1 1 import { SlashCommandBuilder } from "@discord.js/builders"; 2 2 import { ChatInputCommandInteraction } from "discord.js"; 3 3 import { Command } from "../../utils/classes/Command.ts"; 4 + import { ChannelType } from "discord-api-types/payloads"; 4 5 5 6 export default new Command({ 6 7 data: new SlashCommandBuilder() ··· 17 18 flags: ["Ephemeral"] 18 19 }); 19 20 20 - interaction.channel?.send({ content: interaction.options.getString("message") }); 21 + if(interaction.channel && interaction.channel.type === ChannelType.GuildText){ 22 + interaction.channel?.send({ content: interaction.options.getString("message") ?? "" }); 23 + } 21 24 } 22 25 })