CanadienDragon
CanadienDragon
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 6/4/2024 in #djs-questions
Slash Command Register
commands in my server only register for me, when anyone else trys to use them they dont exist Node Version: 20.11.1 Discord.js Version: 14.15.2 This is how i register my commands below: Code: https://gist.github.com/SkullGaming31/4ba460f861218c24211e1269ccae5ad1
17 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 3/8/2024 in #djs-questions
Commands
my commands for some reason will not delete from my server
console output
Commands Count: 0
Commands Fetched: 0
console output
Commands Count: 0
Commands Fetched: 0
22 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 2/26/2024 in #djs-questions
Discord Presence
Discord.js Version 14.14.1 NodeJS Version: 18.15.0 Been working on my logs for discord trying to get a presence log so when someone changes there custom status/online indicator it logs it in my logs channel, when when i inspect the guild/user object the presence isnt there its just
presences: PresenceManager {},
presences: PresenceManager {},
i have a presence set, i even tryed changing my custom status and clearing it, nothing seems to change it, i do have the intent for presence but still nothing guildMemberUpdate Code: https://gist.github.com/SkullGaming31/cde25fbc5b8bc7d5b0e05a8c368770bd Console.log for old and newMember: https://gist.github.com/SkullGaming31/16ee4796294ee1ee79a3e9064f5933ad
16 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 9/23/2023 in #djs-questions
guildMemberUpdate
Issue: anytime someone's roles is updated or they change there nickname it double/triple posts to my logs channel and i cant figure out why Node: 18.16.0 Discord.js: 14.13.0 Code: https://gist.github.com/SkullGaming31/0cad0c256b3cbf6c826785d81ca1d18f
6 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 9/2/2023 in #djs-questions
Using Commands
my main discord account can access my bots commands but when i try to use commands from a second account nothing shows up for my bot, what would cause this to happen? Discord.js: 14.13.0 Node: 18.15.0 this is one of my commands when its registered
Command {
name: 'suggest',
description: 'Suggest an improvment for the discord bot',
UserPerms: [ 'SendMessages' ],
BotPerms: [ 'SendMessages' ],
defaultMemberPermissions: [ 'SendMessages' ],
type: 1,
options: [ [Object], [Object], [Object] ],
run: [AsyncFunction: run]
},
Command {
name: 'suggest',
description: 'Suggest an improvment for the discord bot',
UserPerms: [ 'SendMessages' ],
BotPerms: [ 'SendMessages' ],
defaultMemberPermissions: [ 'SendMessages' ],
type: 1,
options: [ [Object], [Object], [Object] ],
run: [AsyncFunction: run]
},
20 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 8/24/2023 in #djs-questions
Updated my bot to the latest version of djs
TSError: ⨯ Unable to compile TypeScript: src/Commands/Developer/emit.ts:56:27 - error TS2339: Property 'getString' does not exist on type 'Omit<CommandInteractionOptionResolver<"cached">, "getMessage" | "getFocused">'. 56 const choices = options.getString('event'); ~~~~~ at createTSError (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:859:12) at reportTSError (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:863:19) at getOutput (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1077:36) at Object.compile (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1433:41) at Module.m._compile (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1617:30) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Object.require.extensions.<computed> [as .ts] (C:\Development\DragonBot\node_modules\ts-node\src\index.ts:1621:12) at Module.load (node:internal/modules/cjs/loader:1117:32) at Function.Module._load (node:internal/modules/cjs/loader:958:12) at Module.require (node:internal/modules/cjs/loader:1141:19) { diagnosticCodes: [ 2339 ] } this is the line its pointing too i have tryed typeguarding with inCachedGuild(), inGuild() and neither of them work, could anyone help me out?
const choices = options.getString('event');
const choices = options.getString('event');
34 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 4/18/2023 in #djs-questions
.setImage EmbedBuilder
im learning to interact with api's and im having trouble with setImage for the embedbuilder theres alway a url in the data for a image but no matter what i do it will not set the image ive tried with just using the Random.data.icon_url in the setImage and still nothing there are no errors in the console it just doesnt set the image Node: 18.5.0 Discord: 14.9.0
run: async ({ interaction }) => {
const { user } = interaction;
const BaseURL = 'https://api.chucknorris.io/jokes';
const chuckAPI = axios.create({
baseURL: BaseURL,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'User-Agent': '(Personal) learning to interact with api\'s'
}
});

/**
* /random
* /random/category?{category}
* /search?query={query}
*/

const Random = await chuckAPI.get<IChuck>('/random');
const Category = await chuckAPI.get<ICategory>('/categories');
// const Search = await chuckAPI.get('/search?query=${query}');

console.log(Random.data);

const chuckEmbed = new EmbedBuilder()
.setTitle('ChuckNorris API')
.setAuthor({ name: user.username, iconURL: user.displayAvatarURL({ size: 512 }) })
.setDescription(`\`${Random.data.value}\``)
.setImage(`${Random.data.icon_url}`)
.setColor('Green')
.setTimestamp();

await interaction.reply({ embeds: [chuckEmbed], ephemeral: true });
}
run: async ({ interaction }) => {
const { user } = interaction;
const BaseURL = 'https://api.chucknorris.io/jokes';
const chuckAPI = axios.create({
baseURL: BaseURL,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'User-Agent': '(Personal) learning to interact with api\'s'
}
});

/**
* /random
* /random/category?{category}
* /search?query={query}
*/

const Random = await chuckAPI.get<IChuck>('/random');
const Category = await chuckAPI.get<ICategory>('/categories');
// const Search = await chuckAPI.get('/search?query=${query}');

console.log(Random.data);

const chuckEmbed = new EmbedBuilder()
.setTitle('ChuckNorris API')
.setAuthor({ name: user.username, iconURL: user.displayAvatarURL({ size: 512 }) })
.setDescription(`\`${Random.data.value}\``)
.setImage(`${Random.data.icon_url}`)
.setColor('Green')
.setTimestamp();

await interaction.reply({ embeds: [chuckEmbed], ephemeral: true });
}
3 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 9/30/2022 in #djs-questions
When i start my bot
Discord.js: 14.5.1 node: 16.17.1
Error: Client network socket disconnected before secure TLS connection was established
at connResetException (node:internal/errors:704:14)
at TLSSocket.onConnectEnd (node:_tls_wrap:1590:19)
at TLSSocket.emit (node:events:525:35)
at TLSSocket.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET',
path: undefined,
host: 'discord.com',
port: 443,
localAddress: undefined
}
Error: Client network socket disconnected before secure TLS connection was established
at connResetException (node:internal/errors:704:14)
at TLSSocket.onConnectEnd (node:_tls_wrap:1590:19)
at TLSSocket.emit (node:events:525:35)
at TLSSocket.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET',
path: undefined,
host: 'discord.com',
port: 443,
localAddress: undefined
}
8 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 9/26/2022 in #djs-questions
ChannelCreate with my bot TS
DiscordJS: 14.5.0 Node: 16.16.0 (property) Guild.channels: GuildChannelManager | undefined No overload matches this call. Overload 2 of 2, '(options: GuildChannelCreateOptions): Promise<TextChannel> | undefined', gave the following error. Type 'String' is not assignable to type 'CategoryChannelResolvable | null | undefined'. Overload 2 of 2, '(options: GuildChannelCreateOptions): Promise<TextChannel> | undefined', gave the following error. Type 'String' is not assignable to type 'string | GuildMember | Role | User | Message<boolean> | ThreadMember'. Overload 2 of 2, '(options: GuildChannelCreateOptions): Promise<TextChannel> | undefined', gave the following error. Type 'String' is not assignable to type 'string | GuildMember | Role | User | Message<boolean> | ThreadMember'.ts(2769) index.d.ts(4901, 3): The expected type comes from property 'parent' which is declared here on type 'GuildChannelCreateOptions' index.d.ts(2118, 10): The expected type comes from property 'id' which is declared here on type 'OverwriteResolvable' index.d.ts(2118, 10): The expected type comes from property 'id' which is declared here on type 'OverwriteResolvable' the IDs for Category, botrole and the everyone role are saved in a mongoDB
await guild?.channels
.create({
name: `${customId + '-' + ID}`,
type: ChannelType.GuildText,
parent: Data.Category,
permissionOverwrites: [
{
id: member?.id,
allow: ['SendMessages', 'ViewChannel', 'ReadMessageHistory', 'AttachFiles', 'EmbedLinks'],
},
{
id: Data.Everyone,
deny: ['ViewChannel'],
},
{
id: Data.BotRole,
allow: ['ViewChannel', 'SendMessages']
},
]
})
await guild?.channels
.create({
name: `${customId + '-' + ID}`,
type: ChannelType.GuildText,
parent: Data.Category,
permissionOverwrites: [
{
id: member?.id,
allow: ['SendMessages', 'ViewChannel', 'ReadMessageHistory', 'AttachFiles', 'EmbedLinks'],
},
{
id: Data.Everyone,
deny: ['ViewChannel'],
},
{
id: Data.BotRole,
allow: ['ViewChannel', 'SendMessages']
},
]
})
12 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 9/25/2022 in #djs-questions
input.iconURL error TS
Node: 16.16.0 Discord.js: 14.4.0 The URL of the icon Type 'string | null | undefined' is not assignable to type 'string | undefined'. Type 'null' is not assignable to type 'string | undefined'
const embed = new EmbedBuilder()
.setColor(Colors.DarkPurple)
.setAuthor({ name: `${guild?.name} | Ticket System`, iconURL: guild?.iconURL({ size: 512 }) ?? undefined })
.setDescription(Description);
const embed = new EmbedBuilder()
.setColor(Colors.DarkPurple)
.setAuthor({ name: `${guild?.name} | Ticket System`, iconURL: guild?.iconURL({ size: 512 }) ?? undefined })
.setDescription(Description);
3 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 9/5/2022 in #djs-questions
Discord.js no autocomplete
in my ready.js file i created im not getting any autocomplete for client. i have the jsdocs for it, [email protected], Node: 16.16.0
const { Client, ActivityType } = require('discord.js');
const { MONGO_DATABASE, MONGO_PASSWORD, MONGO_USERNAME, MONGO_DATABASE_URI } = require('../../Structures/config');
const mongoose = require('mongoose');

module.exports = {
name: 'ready',
once: true,
/**
*
* @param {Client} client
* @returns
*/
async execute(client) {
const { user } = client;
console.log(`${client.user.tag} is online!`);
user.setActivity({ name: ' /get-help', type: ActivityType.Watching });

if (!MONGO_DATABASE_URI) return;
await mongoose.connect(MONGO_DATABASE_URI, {
user: MONGO_USERNAME,
pass: MONGO_PASSWORD,
dbName: MONGO_DATABASE,
connectTimeoutMS: 10000,
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log('Database Connected');
}).catch((err) => {
console.log(err);
});
}
};
const { Client, ActivityType } = require('discord.js');
const { MONGO_DATABASE, MONGO_PASSWORD, MONGO_USERNAME, MONGO_DATABASE_URI } = require('../../Structures/config');
const mongoose = require('mongoose');

module.exports = {
name: 'ready',
once: true,
/**
*
* @param {Client} client
* @returns
*/
async execute(client) {
const { user } = client;
console.log(`${client.user.tag} is online!`);
user.setActivity({ name: ' /get-help', type: ActivityType.Watching });

if (!MONGO_DATABASE_URI) return;
await mongoose.connect(MONGO_DATABASE_URI, {
user: MONGO_USERNAME,
pass: MONGO_PASSWORD,
dbName: MONGO_DATABASE,
connectTimeoutMS: 10000,
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log('Database Connected');
}).catch((err) => {
console.log(err);
});
}
};
i only get editor suggestions, is this VSCode or is it something with discord.js V14?
2 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 7/26/2022 in #djs-questions
Undici error
ever since i updated my Discord.js to v14 ive been getting this error Discord.js V14.0.3 Node: 16.16.0
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^

ConnectTimeoutError: Connect Timeout Error
at Timeout.onConnectTimeout [as _onTimeout] (F:\Corey\chatBot Development\Development\OverlayExperts\node_modules\undici\lib\core\connect.js:108:24)
at listOnTimeout (node:internal/timers:561:11)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^

ConnectTimeoutError: Connect Timeout Error
at Timeout.onConnectTimeout [as _onTimeout] (F:\Corey\chatBot Development\Development\OverlayExperts\node_modules\undici\lib\core\connect.js:108:24)
at listOnTimeout (node:internal/timers:561:11)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
but i have no installed undici at all so im not sure why im getting an error for it
7 replies
DIAdiscord.js - Imagine an app
Created by CanadienDragon on 7/22/2022 in #djs-questions
when my bot joins another guild and fires the guildCreate event
34 replies