-Carlosđź‘‘
-Carlosđź‘‘
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by -Carlosđź‘‘ on 4/11/2024 in #djs-questions
TypeError: Cannot read properties of undefined (reading 'members')
const guild = container.client.guilds.cache.get(event.guild_id);
const member = await guild.members.fetch(event.author.id);
const guild = container.client.guilds.cache.get(event.guild_id);
const member = await guild.members.fetch(event.author.id);
TypeError: Cannot read properties of undefined (reading 'members')
TypeError: Cannot read properties of undefined (reading 'members')
This is inside a Raw event
40 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 3/30/2024 in #sapphire-support
Prevent commands from being ran on DMs and prevent bots from using commands by default
did Sapphire recently add this behavior stated in the title? I recently removed Preconditions that prevented this and looks like it's still blocking commands from being ran on DMs or prevent bots from using commands, which is what I want
5 replies
DIAdiscord.js - Imagine an app
Created by -Carlosđź‘‘ on 2/29/2024 in #djs-questions
Rare Error
[ERROR] Encountered error on event listener "messageUpdate" for event "messageUpdate" at path "/home/container/src/listeners/messageUpdate.js" TypeError: Cannot read properties of null (reading 'permissions')
at isStaff (/home/container/src/utils.js:621:17)
at automod (/home/container/src/handlers/automod.js:4:48)
at MessageUpdate.run (/home/container/src/listeners/messageUpdate.js:8:12)
at /home/container/node_modules/@sapphire/framework/dist/cjs/lib/structures/Listener.cjs:27:63
at Object.fromAsync (/home/container/node_modules/@sapphire/result/dist/cjs/index.cjs:619:46)
at MessageUpdate._run (/home/container/node_modules/@sapphire/framework/dist/cjs/lib/structures/Listener.cjs:27:42)
at Client.emit (node:events:518:28)
at module.exports [as MESSAGE_UPDATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js:14:12)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12)
[ERROR] Encountered error on event listener "messageUpdate" for event "messageUpdate" at path "/home/container/src/listeners/messageUpdate.js" TypeError: Cannot read properties of null (reading 'permissions')
at isStaff (/home/container/src/utils.js:621:17)
at automod (/home/container/src/handlers/automod.js:4:48)
at MessageUpdate.run (/home/container/src/listeners/messageUpdate.js:8:12)
at /home/container/node_modules/@sapphire/framework/dist/cjs/lib/structures/Listener.cjs:27:63
at Object.fromAsync (/home/container/node_modules/@sapphire/result/dist/cjs/index.cjs:619:46)
at MessageUpdate._run (/home/container/node_modules/@sapphire/framework/dist/cjs/lib/structures/Listener.cjs:27:42)
at Client.emit (node:events:518:28)
at module.exports [as MESSAGE_UPDATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_UPDATE.js:14:12)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:355:31)
at WebSocketManager.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:239:12)
i entered into my main bot's console and this error was logged, I tried reproducing the error but I couldn't, everything was working fine, my best guess is that for some reason <Message>.member went undefined, any ideas?
32 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 2/24/2024 in #sapphire-support
this.error()
Is there any way of using this.error() but not trigger messageCommandDenied? This is because on the messageCommandDenied event I made it so it deletes the message if there's no error message, but in some cases I don't want to delete the message and instead do nothing
3 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 2/3/2024 in #sapphire-support
Delete Message Instantly
https://github.com/skyra-project/skyra/blob/main/src/lib/util/functions/messages.ts does the deleteMessageImmediately function in the file above actually delete the message instantly? Faster than doing <Message>.delete()?
10 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 1/26/2024 in #sapphire-support
ChatInputCommand
How to know if a interaction comes from a slash command?
3 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 1/26/2024 in #sapphire-support
Error Handling
[ERROR] Encountered error on message command "test" at path "C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\commands\Developer\test.js" Anyway of removing these error messages if the type of the error is a string? I don't want this error showing up on console when I do stuff like, for example:
if (something) throw 'some error here'
if (something) throw 'some error here'
9 replies
DIAdiscord.js - Imagine an app
Created by -Carlosđź‘‘ on 1/17/2024 in #djs-questions
Better way of checking if a channel is locked or not
. The codes above do work, but I feel they're not performant and there are probably better ways of doing this, any ideas?
4 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 1/17/2024 in #sapphire-support
check if message starts with the prefix
how can I check if a message starts with the bot's prefix? Including the bot's mention
7 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 1/16/2024 in #sapphire-support
Get command used with a message object
Is there any way to know which command was used only by having a message object?
13 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 1/6/2024 in #sapphire-support
Fuzzy Search
So I'm trying to prevent the bot from finding users if in the command only 1 character of their name was provided
await args.pick('member', { context: { performFuzzySearch: false } }).catch(() => {});
await args.pick('member', { context: { performFuzzySearch: false } }).catch(() => {});
I tried with the code above but it still finds the member even if I only provided 1 character of their username
4 replies
DIAdiscord.js - Imagine an app
Created by -Carlosđź‘‘ on 1/6/2024 in #djs-questions
Removing messages from cache after a certain time
messages: {
interval: 3600,
filter: Sweepers.filterByLifetime({
lifetime: 3600
})
}
messages: {
interval: 3600,
filter: Sweepers.filterByLifetime({
lifetime: 3600
})
}
Could the code above that removes messages from cache after an hour affect events like messageCreate, messageDelete, messageUpdate or messageBulkDelete?
10 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 1/3/2024 in #sapphire-support
Memory Leak
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 interactionCreate listeners added to [Client]. Use emitter.setMaxListeners() to increase limit I recently got this error, my bot only has 2 slash commands and 4 context menus, which are not used much, I already asked in the djs server and they said to go ask here instead
13 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 1/2/2024 in #sapphire-support
Certain amount of infractions per page
let warnings = await db.find({
user: user.id,
guild: message.guild.id,
automod: flagCheck ? true : false
});
let warnings = await db.find({
user: user.id,
guild: message.guild.id,
automod: flagCheck ? true : false
});
for (const warn of warnings) {
fields.push({
name: `${warn.type} | ID: ${warn.id}`,
value: `> **Reason:** ${warn.reason}\n> **Date:** <t:${warn.date}:f>\n${
warn.expires === 'Never' ? '' : `> **Expires:** <t:${warn.expires}:f>`
}`,
inline: false
});
}
for (const warn of warnings) {
fields.push({
name: `${warn.type} | ID: ${warn.id}`,
value: `> **Reason:** ${warn.reason}\n> **Date:** <t:${warn.date}:f>\n${
warn.expires === 'Never' ? '' : `> **Expires:** <t:${warn.expires}:f>`
}`,
inline: false
});
}
This is how I get a list of warnings of the provided user, my question is, how can I make it so there's pages with certain amount of infractions shown in each page? I'm using PaginatedMessages from @sapphire/discord.js-utilities
44 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 12/9/2023 in #sapphire-support
Sapphire Snowflake
how is this working if I don't even have @sapphire/snowflake installed? utils.js . package.json .
6 replies
DIAdiscord.js - Imagine an app
Created by -Carlosđź‘‘ on 12/2/2023 in #djs-questions
[ERROR] Encountered error on event listener "moderationLog"
Full Error: https://pastebin.com/GnkxtJqe moderationLog Listener: https://pastebin.com/DLgksCHN I'm calling the moderationLog Listener on the automodBan function:
return container.client.emit("moderationLog", data, false);
return container.client.emit("moderationLog", data, false);
No idea why it saying something about Line 17, the DM embed is sent without problems, the problem must be at the webhookEmbed since the webhook is not being sent, I have another function which does the same as automodBan except instead of banning it just adds a warn to the user's record, in this function both dm and webhook are sent without problems Part of the error i'm talking about: at ModerationLogListener.run (C:\Users\cmart\Desktop\Discord Bots\Sapphire\src\listeners\moderationLog.js:17:8)
7 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 12/1/2023 in #sapphire-support
[ERROR] Encountered error on event listener "moderationLog"
31 replies
DIAdiscord.js - Imagine an app
Created by -Carlosđź‘‘ on 12/1/2023 in #djs-questions
[ERROR] Encountered error on event listener "moderationLog"
5 replies
DIAdiscord.js - Imagine an app
Created by -Carlosđź‘‘ on 11/28/2023 in #djs-questions
makeCache and sweepers Client Options
I have some questions related to this, one of them is the GuildMessages automatically caches all messages? and how does makeCache and sweepers exactly work? I don't really have problems with RAM but I would like to make my bot as performant as possible
19 replies
SIASapphire - Imagine a framework
Created by -Carlosđź‘‘ on 11/28/2023 in #sapphire-support
Arguments
The channel built-in argument will detect any channel? (Including Text Channels, Voice Channels, Threads, etc)?
4 replies