edocsil
edocsil
DIAdiscord.js - Imagine an app
Created by edocsil on 9/8/2024 in #djs-questions
interaction.channel.guildId undefined after ephemeral reply
No description
9 replies
DIAdiscord.js - Imagine an app
Created by edocsil on 7/31/2023 in #djs-questions
Disabling threads sweeper
Trying to disable the threads sweeper but having trouble telling whether it was done correctly. Client constructor:
const client = new Client({ intents, sweepers: { threads: { interval: 0 }, }, })
const client = new Client({ intents, sweepers: { threads: { interval: 0 }, }, })
Logging client.sweepers gives:
Sweepers {
options: { threads: { interval: 0, lifetime: 14400 } },
intervals: {
autoModerationRules: null,
applicationCommands: null,
bans: null,
emojis: null,
invites: null,
guildMembers: null,
messages: null,
presences: null,
reactions: null,
stageInstances: null,
stickers: null,
threadMembers: null,
threads: null,
users: null,
voiceStates: null
}
}
Sweepers {
options: { threads: { interval: 0, lifetime: 14400 } },
intervals: {
autoModerationRules: null,
applicationCommands: null,
bans: null,
emojis: null,
invites: null,
guildMembers: null,
messages: null,
presences: null,
reactions: null,
stageInstances: null,
stickers: null,
threadMembers: null,
threads: null,
users: null,
voiceStates: null
}
}
Was this the correct way to do it? intervals.threads is null like the intervals for sweepers of other types, but does that mean "never sweep"? I still see a lifetime in the options but unclear if interval being null makes that moot. Also tried:
const client = new Client({ intents, sweepers: { threads: null, }, }) // TypeError
const client = new Client({ intents, sweepers: { threads: {}, }, }) // fell back to default settings
const client = new Client({ intents, sweepers: { threads: null, }, }) // TypeError
const client = new Client({ intents, sweepers: { threads: {}, }, }) // fell back to default settings
4 replies
DIAdiscord.js - Imagine an app
Created by edocsil on 6/15/2023 in #djs-questions
[FIXED] TypeError (reading 'user') when creating threads
Started having this error pop up on two bots different bots starting around <t:1686789295>
TypeError: Cannot read properties of null (reading 'user')
at GuildMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildMemberManager.js:39:47)
at ThreadMember._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadMember.js:51:47)
at ThreadMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ThreadMemberManager.js:33:26)
at ThreadChannel._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadChannel.js:197:55)
at ChannelManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ChannelManager.js:42:27)
at ThreadCreateAction.handle (/home/pi/Desktop/yellow/node_modules/discord.js/src/client/actions/ThreadCreate.js:10:36)
at GuildTextThreadManager.create (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildTextThreadManager.js:87:45)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RaidCommandInteractionHopper.#process (/home/pi/Desktop/yellow/bot.js:3643:4)
TypeError: Cannot read properties of null (reading 'user')
at GuildMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildMemberManager.js:39:47)
at ThreadMember._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadMember.js:51:47)
at ThreadMemberManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ThreadMemberManager.js:33:26)
at ThreadChannel._patch (/home/pi/Desktop/yellow/node_modules/discord.js/src/structures/ThreadChannel.js:197:55)
at ChannelManager._add (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/ChannelManager.js:42:27)
at ThreadCreateAction.handle (/home/pi/Desktop/yellow/node_modules/discord.js/src/client/actions/ThreadCreate.js:10:36)
at GuildTextThreadManager.create (/home/pi/Desktop/yellow/node_modules/discord.js/src/managers/GuildTextThreadManager.js:87:45)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RaidCommandInteractionHopper.#process (/home/pi/Desktop/yellow/bot.js:3643:4)
Code:
await parentChannel.threads.create({ // line 3643
name,
type: ChannelType.PrivateThread,
invitable: false,
})
.catch(
// ...
await parentChannel.threads.create({ // line 3643
name,
type: ChannelType.PrivateThread,
invitable: false,
})
.catch(
// ...
On both bots this happens when creating private threads. No code has been updated for ~2 days and this function runs very frequently (edit: not specific to private threads)
39 replies
DIAdiscord.js - Imagine an app
Created by edocsil on 3/16/2023 in #djs-questions
Get name of other bot's command from ID
Using the guildAuditLogEntryCreate event to detect when someone changes permissions for an application command. If it's a specific command that's edited I would like to get the human-readable command name so I can post an alert. Tried:
guild.commands.commands.fetch().then(console.log) // but only saw my own commands
guild.fetchIntegrations().then(console.log) // but did not see commands
guild.commands.commands.fetch().then(console.log) // but only saw my own commands
guild.fetchIntegrations().then(console.log) // but did not see commands
Is it possible to get the name of a command given the command ID and application ID?
7 replies
DIAdiscord.js - Imagine an app
Created by edocsil on 2/22/2023 in #djs-questions
What can cause FetchedThreads.hasMore to be true?
Does GuildChannelManager.fetchActiveThreads have a limit or will it always fetch all threads? FetchedThreads.hasMore exists and I'm wondering what types of situations would call for multiple fetches, if any
15 replies