Yinoguns
Yinoguns
DIAdiscord.js - Imagine an app
Created by Yinoguns on 4/29/2024 in #djs-questions
Bot Randomly Shutdown without Logs
Hello, My Bot randomly and without any logs or notice...went offline. I have no code that forces it to go offline, around 10:30am UTC+1 it apparantly went offline; a re-deploy of the server fixed it. Are there any Events I should subscribe to, incase this happens again, or any like:
client.on('debug', (...) => {
if (<something>.includes('shutdown')) {
console.log('[ErrorPush] - Bot has shutdown...'); // this is setup to push a notification to my phone
}
});
client.on('debug', (...) => {
if (<something>.includes('shutdown')) {
console.log('[ErrorPush] - Bot has shutdown...'); // this is setup to push a notification to my phone
}
});
8 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 1/16/2023 in #djs-questions
Embed with multiple Images
16 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 1/7/2023 in #djs-questions
ButtonBuilder, but ButtonStyle not exported from DJS?
5 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 1/5/2023 in #djs-questions
Lost Bot Member due to Cache Options?
Bit of a biggie, I had an error: TypeError: Cannot read properties of null (reading 'bitfield') In this code:
channelToMessage.permissionsFor(
client.guilds.cache.get(guildId).members.me
).bitfield
channelToMessage.permissionsFor(
client.guilds.cache.get(guildId).members.me
).bitfield
I think it's because I changed my caching to:
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: 5,
PresenceManager: 5,
}),
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: 5,
PresenceManager: 5,
}),
I suspect this lost me the bot Member in the cache...? and thus members.me So I've updated to:
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: {
maxSize: 5,
keepOverLimit: ({ id }) => id === CLIENT_ID
},
PresenceManager: 5,
}),
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: {
maxSize: 5,
keepOverLimit: ({ id }) => id === CLIENT_ID
},
PresenceManager: 5,
}),
Does this all checkout to anyone, I have applied this change but am curious if this could have happened in the firdt place. If not, whst caused the error? 🤔
7 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 12/20/2022 in #djs-questions
Infinite Rate Limit & Global(...) ?
50 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 12/7/2022 in #djs-questions
Want to setup and confirm the rateLimit(ed) event
So I want to setup the rate limit event, but am having trouble getting it to fire, KinectThePascal suggested to edit channel, which does rate but doesn't fire the event, begins here: https://discord.com/channels/222078108977594368/824411059443204127/1050013001572421652 Code:
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.Channel, // Enable Partials, in hope of getting hidden webhooks
],
allowedMentions: {
parse: ['users', 'roles', 'everyone'],
},
rest: {
// have tried with this commented out too
rejectOnRateLimit: rateLimitData => {
return true; // rateLimitData.path.endsWith('/crosspost');
},
// have tried this, and 'rateLimit' too
// rateLimited: async (...args) => {
// console.log('Bot encountered a Rate Limit (client constructor)', [...args]);
// },
},
});

// have tried 'rateLimit' also
client.rest.on('rateLimited', async (...args) => {
console.log('Bot encountered a Rate Limit', [...args]);
});
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.Channel, // Enable Partials, in hope of getting hidden webhooks
],
allowedMentions: {
parse: ['users', 'roles', 'everyone'],
},
rest: {
// have tried with this commented out too
rejectOnRateLimit: rateLimitData => {
return true; // rateLimitData.path.endsWith('/crosspost');
},
// have tried this, and 'rateLimit' too
// rateLimited: async (...args) => {
// console.log('Bot encountered a Rate Limit (client constructor)', [...args]);
// },
},
});

// have tried 'rateLimit' also
client.rest.on('rateLimited', async (...args) => {
console.log('Bot encountered a Rate Limit', [...args]);
});
I have tried: Client({ rateLimited }) Client({ rateLimit }) Client({ rest: { rateLimited } }) Client({ rest: { rateLimit } }) client.on('rateLimit' client.on('rateLimited' client.rest.on('rateLimit' client.rest.on('rateLimited' Least I'm pretty sure I've tried all these... I am using a quick prefix-command to trigger the rate limits: Channel Edit Errored RateLimitError[/channels/:id]
} else if (message.content.startsWith('renameChannel')) {
const [com, num] = message.content.split(' ');

const guild = client.guilds.cache.get('770233729343160362');
const ch = guild.channels.cache.get('1025347371405692950');
ch.edit({ name: `scouting-lighten-${num}` }).catch(error => console.log('Channel Edit Errored', error));
} else if (message.content.startsWith('renameChannel')) {
const [com, num] = message.content.split(' ');

const guild = client.guilds.cache.get('770233729343160362');
const ch = guild.channels.cache.get('1025347371405692950');
ch.edit({ name: `scouting-lighten-${num}` }).catch(error => console.log('Channel Edit Errored', error));
25 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 11/10/2022 in #djs-questions
Unable to get all Webhooks - Permissions?
Would I be correct, in saying even if a Bot has setup a Webhook to the News Channel of a Server it is Admin of (Bot Server), that if the bot loses scope over the connected Channel, that the Webhook is effectively invisible to the Bot?
51 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 10/28/2022 in #djs-questions
Server Suggestion
Make a Forum Channel for suggestions. There is no space on this server for improving it.
36 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 9/15/2022 in #djs-questions
Question - Support of All Intents
So, if we don't like people using numbers for "all intents"...why does new Client support being passed a single number?
104 replies
DIAdiscord.js - Imagine an app
Created by Yinoguns on 9/10/2022 in #djs-questions
Plan I want to Verifiy - Bulk Messages
So this is more of a "I don't need help doing this, but woukd like to aor the concept". My bot is for a game that has two factions. These factions use Discord. My Faction has a server for all members, and of course all the clans have their servers too. What I want to make, is a Slash Command in the main server, that posts a message to a chosen channel and with chosen roles/text; for clan server my bot is that has opted-in; I am not forcing the pings onto the servers. So to recap: Main server posts an emergency for example. All subscribed servers get a message with chosen pings for the emergency; possibly different pings per type, also defined by the clan servers. To avoid the 50/s limit, I was thinking to batch the messages in 20 sends per second. As the rate limits are per route, it is my expectation that no one message will get rate limited and my only concern is the global limit. Concur? Thanks.
8 replies