fix: examples

This commit is contained in:
Yuzu 2022-07-14 20:59:52 -05:00
parent fbe426dbdb
commit 6e6aac1443
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ import {
GatewayIntents, GatewayIntents,
InteractionResponseTypes, InteractionResponseTypes,
Session, Session,
} from "https://deno.land/x/biscuit/mod.ts?code"; } from "https://deno.land/x/biscuit/mod.ts";
const token = Deno.env.get("TOKEN") ?? Deno.args[0]; const token = Deno.env.get("TOKEN") ?? Deno.args[0];
@ -32,7 +32,6 @@ session.on("messageCreate", (message) => {
const args = message.content.substring(PREFIX.length).trim().split(/\s+/gm); const args = message.content.substring(PREFIX.length).trim().split(/\s+/gm);
const name = args.shift()?.toLowerCase(); const name = args.shift()?.toLowerCase();
console.log(args, name);
if (name === "ping") { if (name === "ping") {
message.reply({ components: [row] }); message.reply({ components: [row] });

View File

@ -20,14 +20,12 @@ const command: CreateApplicationCommand = {
description: "Replies with pong!", description: "Replies with pong!",
}; };
const guildId = "";
session.on("ready", async (payload) => { session.on("ready", async (payload) => {
console.log("Logged in as:", payload.user.username); console.log("Logged in as:", payload.user.username);
console.log("Creating the application commands..."); console.log("Creating the application commands...");
// create command // create command
try { try {
await session.createApplicationCommand(command, guildId); await session.createApplicationCommand(command);
console.log("Done!"); console.log("Done!");
} catch (err) { } catch (err) {
console.error(err); console.error(err);
@ -36,7 +34,10 @@ session.on("ready", async (payload) => {
// Follow interaction event // Follow interaction event
session.on("interactionCreate", (interaction) => { session.on("interactionCreate", (interaction) => {
if (!interaction.isCommand()) return; if (!interaction.isCommand()) {
return;
}
if (interaction.commandName === "ping") { if (interaction.commandName === "ping") {
interaction.respond({ interaction.respond({
type: InteractionResponseTypes.ChannelMessageWithSource, type: InteractionResponseTypes.ChannelMessageWithSource,