Comments (17)
I think you should also provide your client options maybe(?)
from discord.js-light.
I don't think they are needed so solve those 2 issues.
In the first one, just check the typeof and in 2nd one just ignore if it's null or not set?
Anyway if you want it, here it is:
// Remove non-text channels and remove text channels whose last message is older than 1 hour
function channelFilter(channel: AnyChannel) {
return (
!channel.isText() ||
!channel.lastMessageId ||
SnowflakeUtil.deconstruct(channel.lastMessageId).timestamp < Date.now() - 3600000
);
}
this.instance = new DiscordJS.Client({
allowedMentions: {
parse: ["users", "roles"],
repliedUser: true,
},
makeCache: DiscordJS.Options.cacheWithLimits({
ApplicationCommandManager: 0, // guild.commands
BaseGuildEmojiManager: 0, // guild.emojis
ChannelManager: {
maxSize: 0, // Prevent automatic caching
sweepFilter: () => channelFilter,
sweepInterval: 3600, // Older than an hour
}, // client.channels
GuildChannelManager: {
maxSize: 0, // Prevent automatic caching
sweepFilter: () => channelFilter,
sweepInterval: 3600, // Older than an hour
}, // guild.channels
GuildBanManager: 0, // guild.bans
GuildInviteManager: 0, // guild.invites
GuildManager: Infinity, // client.guilds //! Required for basic guild cache
GuildMemberManager: {
maxSize: 100,
keepOverLimit: (val) => val.id === getConfig().discordClientId,
sweepFilter: () => (val) => val.id !== getConfig().discordClientId,
sweepInterval: 3600, // Older than an hour
}, // guild.members
GuildStickerManager: 0, // guild.stickers
MessageManager: {
// Don't store messages automatically
maxSize: 10,
// Remove manually stored every 60 seconds
sweepInterval: 3600, // Older than an hour
}, // channel.messages
PermissionOverwriteManager: Infinity, // channel.permissionOverwrites (it only eats memory if channel is cached) //! Required for checking channel permissions
PresenceManager: 0, // guild.presences
ReactionManager: 0, // message.reactions
ReactionUserManager: 0, // reaction.users
RoleManager: {
maxSize: Infinity,
sweepFilter: () => (role) => !role.guild.me.roles.cache.has(role.id),
sweepInterval: 3600,
}, // guild.roles //! Required for checking permissions
StageInstanceManager: 0, // guild.stageInstances
ThreadManager: 0, // channel.threads
ThreadMemberManager: 0, // threadchannel.members
UserManager: {
maxSize: 100,
keepOverLimit: (val) => val.id === getConfig().discordClientId,
sweepFilter: () => (val) => val.id !== getConfig().discordClientId,
sweepInterval: 14400, // Older than 4 hours
}, // client.users
VoiceStateManager: 0, // guild.voiceStates
}),
intents: [
DiscordJS.Intents.FLAGS.DIRECT_MESSAGES,
DiscordJS.Intents.FLAGS.GUILDS,
DiscordJS.Intents.FLAGS.GUILD_MESSAGES,
DiscordJS.Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
],
});
Channels are fetched when people execute a command or when required, bot caches only channels from a "whitelist" with the help of forceSet
after fetching it.
from discord.js-light.
what is your discord.js-light version and your discord.js version?
if you have an eval command, you can do eval require("discord.js").version
from discord.js-light.
- discord.js-light: 4.6.0
- discord.js: 13.6.0
grep of `discord.js` from package-lock.json
$ grep 'discord.js' package-lock.json
"discord.js-light": "^4.6.0",
"node_modules/discord.js": {
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.6.0.tgz",
"node_modules/discord.js-light": {
"resolved": "https://registry.npmjs.org/discord.js-light/-/discord.js-light-4.6.0.tgz",
"discord.js": "^13.6.0"
"discord.js": {
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.6.0.tgz",
"discord.js-light": {
"resolved": "https://registry.npmjs.org/discord.js-light/-/discord.js-light-4.6.0.tgz",
"discord.js": "^13.6.0"
from discord.js-light.
hmmm something isnt right, those errors are showing up in the wrong lines for that version
at ChannelUpdateAction.ChannelUpdate [as handle] (./node_modules/discord.js-light/actions.js:64:4)
in 4.6.0 this error would be at line 65 not 64
at ThreadListSyncAction.ThreadListSync [as handle] (./node_modules/discord.js-light/actions.js:667:33)
in 4.6.0 this error would be at line 670 not 667
try uninstalling both discord.js and discord.js-light, and installing only discord.js-light, no need to install discord.js
also, yes i do have a discord support server, its discord.gg/BpeedKh
from discord.js-light.
I'm sorry, it's not the 1st time npm
messed up the packages. I just decided I'm gonna switch to yarn
.
I will get back once I get them again.
from discord.js-light.
Didn't have to wait long:
TypeError: Object.defineProperty called on non-object
at Function.defineProperty (<anonymous>)
at makePartial (./node_modules/discord.js-light/functions.js:26:9)
at ChannelUpdateAction.ChannelUpdate [as handle] (./node_modules/discord.js-light/actions.js:65:4)
at Object.CHANNEL_UPDATE (./node_modules/discord.js-light/handlers.js:99:57)
at WebSocketManager.Client.ws.handlePacket (./node_modules/discord.js-light/client.js:47:29)
at WebSocketShard.onPacket (./node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (./node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (./node_modules/ws/lib/event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (./node_modules/ws/lib/websocket.js:1137:20)
from discord.js-light.
try adding this to your code and let me know what does it log the next time the error shows up
client.on("ready", () => {
const backup = client.actions.ChannelUpdate.handle;
client.actions.ChannelUpdate.handle = function(data) {
try {
backup.call(client.actions.ChannelUpdate, data)
} catch(e) {
console.log(e, data);
}
}
})
from discord.js-light.
Okay, hooked it up. Now waiting for the report.
Fun fact - this only happens on shard no. 24 :D
from discord.js-light.
Hmm this is what I've got:
TypeError: Cannot destructure property 'old' of 'client.actions.ChannelUpdate.handle(...)' as it is undefined.
at Object.CHANNEL_UPDATE (./node_modules/discord.js-light/handlers.js:99:11)
at WebSocketManager.Client.ws.handlePacket (./node_modules/discord.js-light/client.js:47:29)
at WebSocketShard.onPacket (./node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (./node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (./node_modules/ws/lib/event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (./node_modules/ws/lib/websocket.js:1137:20)
at Receiver.emit (node:events:390:28)
at Receiver.dataMessage (./node_modules/ws/lib/receiver.js:513:14)
at Receiver.getData (./node_modules/ws/lib/receiver.js:446:17)
from discord.js-light.
forgot to add a return
client.on("ready", () => {
const backup = client.actions.ChannelUpdate.handle;
client.actions.ChannelUpdate.handle = function(data) {
try {
return backup.call(client.actions.ChannelUpdate, data)
} catch(e) {
console.log(e, data);
return {};
}
}
})
from discord.js-light.
Updated. Will get back once it reports an error.
from discord.js-light.
Okay, I've got it.
Data + Error stack
{
"data": {
"available_tags": [],
"guild_hashes": {
"channels": {
"hash": "4qINifI3TeQ"
},
"metadata": {
"hash": "U8P+CNuVFlo"
},
"roles": {
"hash": "WEAD99Co/a8"
},
"version": 1
},
"guild_id": "432763481289261077",
"id": "951218398019342427",
"last_message_id": "951938573207212136",
"name": "👽question-of-the-day",
"nsfw": false,
"parent_id": "821529627662745681",
"permission_overwrites": [
{
"allow": "0",
"deny": "2112",
"id": "656179690985488385",
"type": 0
},
{
"allow": "274877957120",
"deny": "2048",
"id": "432763481289261077",
"type": 0
},
{
"allow": "268438544",
"deny": "0",
"id": "467978215927840768",
"type": 0
},
{
"allow": "0",
"deny": "268435472",
"id": "443849268969734144",
"type": 0
}
],
"position": 15,
"topic": "Come here everyday, we post questions for you to answer that helps the community learn more about you and is a great way to participate in the server in the **Question of the Day!**",
"type": 15,
"shardId": 24
},
"stack": "
TypeError: Object.defineProperty called on non-object
at Function.defineProperty (<anonymous>)
at makePartial (./node_modules/discord.js-light/functions.js:26:9)
at ChannelUpdateAction.ChannelUpdate (./node_modules/discord.js-light/actions.js:65:4)
at ChannelUpdateAction.client.actions.ChannelUpdate.handle (./src/services/discord/events/ready.ts:67:22)
at Object.CHANNEL_UPDATE (./node_modules/discord.js-light/handlers.js:99:57)
at WebSocketManager.Client.ws.handlePacket (./node_modules/discord.js-light/client.js:47:29)
at WebSocketShard.onPacket (./node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (./node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (./node_modules/ws/lib/event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
"
}
Edit: I corrected one line number because I added a console.log in the handlers.js file.
from discord.js-light.
it seems like your bot has access to one of the few lucky guilds that have been selected to test drive the new GUILD_FORUM
feature discord is working on.
I have added a patch to ignore unsupported/unreleased channel types, you can test it by running npm install timotejroiko/discord.js-light#v4
let me know if it resolves the issue, so i can publish it to npm
from discord.js-light.
Hey, I didn't get any issues for the last 48 hours so it may be resolved. I'll get back in 2 days with final statement.
from discord.js-light.
awesome, i pushed the update to npm, let me know if anything changes
from discord.js-light.
Hey, just wanted to confirm. I don't get that error anymore. Thanks for the fix.
from discord.js-light.
Related Issues (20)
- Buttons Support HOT 10
- v13 HOT 3
- DMChannel does not have "recipient" in v3.5.11 HOT 3
- Privileged Intents Support HOT 2
- Threads Support HOT 1
- v13 is now the stable branch for discord.js HOT 2
- TypeError: Cannot read property 'slice' of null HOT 1
- LimitedCollection Typescript Error HOT 3
- Property 'forceSet' does not exist on type 'Collection<string, Channel>' HOT 18
- `guildCreate` doesn't get triggered on init HOT 4
- Can't set maxSize on cache. HOT 9
- Getting an error HOT 3
- Shards: "auto" not working HOT 4
- How to send webhook in the thread? HOT 2
- Cannot read properties of undefined (reading '_add') HOT 3
- MessageManager#forge doesn't set channel or guild data HOT 1
- discord-api-types conflicts HOT 2
- Discord.js V14 HOT 3
- How can I install discord.js-light master using npm? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord.js-light.