dubfib
dubfib
DIAdiscord.js - Imagine an app
Created by dubfib on 1/4/2023 in #djs-questions
Bot not starting
I tried using discord.js under deno and the bot won't even start, it deployed commands successfully. code:
import { Client, Events, GatewayIntentBits } from 'npm:discord.js@14';

const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent ]});

client.once(Events.ClientReady, async (bot) => {
console.log(`Ready! Logged in as ${bot.user.tag}`);
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === 'ping') {
await interaction.reply({ content: 'Pong!' });
};
});

client.login("insert token here");
import { Client, Events, GatewayIntentBits } from 'npm:discord.js@14';

const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent ]});

client.once(Events.ClientReady, async (bot) => {
console.log(`Ready! Logged in as ${bot.user.tag}`);
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === 'ping') {
await interaction.reply({ content: 'Pong!' });
};
});

client.login("insert token here");
console:
$ deno run index.ts
✅ Granted env access to "JEST_WORKER_ID".
✅ Granted read access to "/home/dubfib/.cache/deno/npm/node_modules".
✅ Granted read access to "/home/dubfib/.cache/deno/node_modules".
✅ Granted read access to "/home/dubfib/.cache/node_modules".
✅ Granted read access to "/home/dubfib/node_modules".
✅ Granted read access to "/home/node_modules".
✅ Granted read access to "/node_modules".
✅ Granted env access to "WS_NO_BUFFER_UTIL".
✅ Granted env access to "WS_NO_UTF_8_VALIDATE".
✅ Granted env access to "SHARDS".
✅ Granted env access to "SHARD_COUNT".
✅ Granted env access to "SHARDING_MANAGER".
✅ Granted env access to "DISCORD_TOKEN".
✅ Granted net access to "insert url".
✅ Granted net access to "insert url".
✅ Granted net access to "inset url".
✅ Granted net access to "discord.com:0".
✅ Granted net access to "gateway.discord.gg".
$ deno run index.ts
✅ Granted env access to "JEST_WORKER_ID".
✅ Granted read access to "/home/dubfib/.cache/deno/npm/node_modules".
✅ Granted read access to "/home/dubfib/.cache/deno/node_modules".
✅ Granted read access to "/home/dubfib/.cache/node_modules".
✅ Granted read access to "/home/dubfib/node_modules".
✅ Granted read access to "/home/node_modules".
✅ Granted read access to "/node_modules".
✅ Granted env access to "WS_NO_BUFFER_UTIL".
✅ Granted env access to "WS_NO_UTF_8_VALIDATE".
✅ Granted env access to "SHARDS".
✅ Granted env access to "SHARD_COUNT".
✅ Granted env access to "SHARDING_MANAGER".
✅ Granted env access to "DISCORD_TOKEN".
✅ Granted net access to "insert url".
✅ Granted net access to "insert url".
✅ Granted net access to "inset url".
✅ Granted net access to "discord.com:0".
✅ Granted net access to "gateway.discord.gg".
deno version: 1.29.1 typescript: 4.9.4
4 replies
DIAdiscord.js - Imagine an app
Created by dubfib on 12/26/2022 in #djs-questions
DiscordAPIError Unknown Interaction
Error:
[ERROR] Encountered error on chat input command "leaderboard" at path "/insert/path/here/commands/leaderboard.ts" DiscordAPIError: Unknown interaction
at RequestHandler.execute (/insert/path/here/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RequestHandler.push (/insert/path/here/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async CommandInteraction.deferReply (/insert/path/here/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:61:5) {
method: 'post',
path: '/interactions/1056759382110634005/aW50ZXJhY3Rpb246MTA1Njc1OTM4MjExMDYzNDAwNTo0MmliU1VPQnZzNjhYeTF2MTBlSWdXWHlMYnYzcmNxMWZobENOdHpSNlhqUGsxazRDcFlOazdMUks2cXdtbW1qMHFVNEdxUndFc005eHdoRXVjNDJXZklJWkdWa2ZyY0t1c3kwSVdqTWo2b0g0S2pHbFQzNzR3dzFSaGFramRDSQ/callback',
code: 10062,
httpStatus: 404,
requestData: { json: { type: 5, data: [Object] }, files: [] }
}
[ERROR] Encountered error on chat input command "leaderboard" at path "/insert/path/here/commands/leaderboard.ts" DiscordAPIError: Unknown interaction
at RequestHandler.execute (/insert/path/here/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RequestHandler.push (/insert/path/here/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async CommandInteraction.deferReply (/insert/path/here/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:61:5) {
method: 'post',
path: '/interactions/1056759382110634005/aW50ZXJhY3Rpb246MTA1Njc1OTM4MjExMDYzNDAwNTo0MmliU1VPQnZzNjhYeTF2MTBlSWdXWHlMYnYzcmNxMWZobENOdHpSNlhqUGsxazRDcFlOazdMUks2cXdtbW1qMHFVNEdxUndFc005eHdoRXVjNDJXZklJWkdWa2ZyY0t1c3kwSVdqTWo2b0g0S2pHbFQzNzR3dzFSaGFramRDSQ/callback',
code: 10062,
httpStatus: 404,
requestData: { json: { type: 5, data: [Object] }, files: [] }
}
my code is very long so: https://sourceb.in/QoDce66r02
9 replies
DIAdiscord.js - Imagine an app
Created by dubfib on 11/13/2022 in #djs-voice
not joining voice channel
const { Client, GatewayIntentBits } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');

const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
]});

client.once('ready', async () => {
console.log('online');
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === 'ping') {
await interaction.reply('joining voice channel');

joinVoiceChannel({
channelId: interaction.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
};
});
const { Client, GatewayIntentBits } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');

const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
]});

client.once('ready', async () => {
console.log('online');
});

client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;

if (interaction.commandName === 'ping') {
await interaction.reply('joining voice channel');

joinVoiceChannel({
channelId: interaction.channelId,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
};
});
5 replies