Mulo
Mulo
DIAdiscord.js - Imagine an app
Created by Mulo on 2/21/2024 in #djs-questions
CDN picture urls
In regards to CDN picture urls: My users save the discord url of a picture into the bot db. Everytime the bot posts the url it will display the image regardless of the expiration date? The whole update was meant if I use those urls to show pics in my website right? Then the exp is a concern?
3 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 2/25/2023 in #djs-questions
How are db handled with Sharding?
For example, Im using mongodb to store data per guild. When sharding takes place, and is a separate server per shard, is the corresponding guild data supposed to be copied to the new server?
4 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 1/23/2023 in #djs-questions
If im using shards, can I have the bot go offline for a specific guild?
While other guild have it online and working
3 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 12/9/2022 in #djs-questions
HTTPError [FetchError] request to httpsdiscord.comapiv9channels
HTTPError [FetchError]: request to https://discord.com/api/v9/channels/1047428819130269747 failed, reason: write EPIPE
at RequestHandler.execute (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:201:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async ThreadChannel.edit (/home/ubuntu/discord/node_modules/discord.js/src/structures/ThreadChannel.js:320:21)
at async Client.<anonymous> (/home/ubuntu/discord/bot.js:1440:12) {
code: 500,
method: 'patch',
path: '/channels/1047428819130269747',
requestData: {
json: {
name: '✅ ok',
archived: undefined,
auto_archive_duration: undefined,
rate_limit_per_user: undefined,
locked: undefined,
invitable: undefined
},
files: []
}
}
HTTPError [FetchError]: request to https://discord.com/api/v9/channels/1047428819130269747 failed, reason: write EPIPE
at RequestHandler.execute (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:201:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async ThreadChannel.edit (/home/ubuntu/discord/node_modules/discord.js/src/structures/ThreadChannel.js:320:21)
at async Client.<anonymous> (/home/ubuntu/discord/bot.js:1440:12) {
code: 500,
method: 'patch',
path: '/channels/1047428819130269747',
requestData: {
json: {
name: '✅ ok',
archived: undefined,
auto_archive_duration: undefined,
rate_limit_per_user: undefined,
locked: undefined,
invitable: undefined
},
files: []
}
}
why did it failed to fetch? if that is even the problem?
6 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 12/6/2022 in #djs-questions
oAuth2 using Refresh Token
I have a db with all the refresh_tokens for oAuth2. How can i use the refresh_token to get the new access_token?
2 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 11/2/2022 in #djs-questions
Where do you set permissons to use contextMenu?
5 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 10/25/2022 in #djs-questions
MODALS - check all fields?
I have a situation where modals are submitted even tho some fields are empty. Is there a way to promt the user to fill all answers?
5 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 10/14/2022 in #djs-voice
Creating-deleting vc on join-leave error
Im getting this error and it doesnt say where in the code comes from. Any idea where to look at and how to fix it?
/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^

DiscordAPIError: Unknown Channel
at RequestHandler.execute (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async GuildMemberManager.edit (/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildMemberManager.js:279:15) {
method: 'patch',
path: '/guilds/467433493261975563/members/251684946131812353',
code: 10003,
httpStatus: 400,
requestData: {
json: {
channel: undefined,
channel_id: '1030560012726173787',
communication_disabled_until: undefined
},
files: []
}
}

Node.js v17.3.0
[nodemon] app crashed - waiting for file changes before starting...
/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^

DiscordAPIError: Unknown Channel
at RequestHandler.execute (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/ubuntu/discord/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async GuildMemberManager.edit (/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildMemberManager.js:279:15) {
method: 'patch',
path: '/guilds/467433493261975563/members/251684946131812353',
code: 10003,
httpStatus: 400,
requestData: {
json: {
channel: undefined,
channel_id: '1030560012726173787',
communication_disabled_until: undefined
},
files: []
}
}

Node.js v17.3.0
[nodemon] app crashed - waiting for file changes before starting...
4 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 10/4/2022 in #djs-questions
Some roles were not mentioned or added to the thread.
From this morning my bot nor a user can ping a role in a thread:
12 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 9/22/2022 in #djs-questions
Can a higher role 'deny' permissions of a lower role?
As in, a player with role A has permission to see a channel. If that player is given an higher role B that denies seeing that channel, will role B override A permissions?
6 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 8/28/2022 in #djs-questions
is there an oauth2 endpoint that would show the amount of members for each guild?
?
4 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 8/8/2022 in #djs-questions
Create Events
client.on('ready', async () => {
let c = await client.guilds.fetch("467433493261975563")

let eventName = {
name: "test",
scheduled_start_time: new Date('August 10, 2022 03:24:00'),
description: "testing yo",
channel_id: "1005915518739431604",
entity_type: "2",
privacy_level: 2,
image: "URL",
}

c.scheduledEvents.create(eventName)
})
client.on('ready', async () => {
let c = await client.guilds.fetch("467433493261975563")

let eventName = {
name: "test",
scheduled_start_time: new Date('August 10, 2022 03:24:00'),
description: "testing yo",
channel_id: "1005915518739431604",
entity_type: "2",
privacy_level: 2,
image: "URL",
}

c.scheduledEvents.create(eventName)
})
Errors out:
/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93
if (!channel_id) throw new Error('GUILD_VOICE_CHANNEL_RESOLVE');
^

Error [GUILD_VOICE_CHANNEL_RESOLVE]: Could not resolve channel to a guild voice channel.
at GuildScheduledEventManager.create (/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93:30)
at Client.<anonymous> (/home/ubuntu/discord/schedules/mondaymovies.js:28:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'GUILD_VOICE_CHANNEL_RESOLVE'
}
/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93
if (!channel_id) throw new Error('GUILD_VOICE_CHANNEL_RESOLVE');
^

Error [GUILD_VOICE_CHANNEL_RESOLVE]: Could not resolve channel to a guild voice channel.
at GuildScheduledEventManager.create (/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93:30)
at Client.<anonymous> (/home/ubuntu/discord/schedules/mondaymovies.js:28:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'GUILD_VOICE_CHANNEL_RESOLVE'
}
11 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 8/1/2022 in #djs-questions
Error fetching channel
*sry wrong title, should be setNicknames doesnt always update
let getguild = await client.guilds.cache.get("ID")
let userToAddRole = await getguild.members.fetch("ID")
userToAddRole.setNickname(`[WN] ${userToAddRole.user.username}`)
let getguild = await client.guilds.cache.get("ID")
let userToAddRole = await getguild.members.fetch("ID")
userToAddRole.setNickname(`[WN] ${userToAddRole.user.username}`)
this sometimes updates the nicknames, but sometimes doesnt. Any reasons why this would be the case?
6 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 7/25/2022 in #djs-questions
Modal help
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');
im getting error const modal = new ModalBuilder() ^ TypeError: ModalBuilder is not a constructor
15 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 7/24/2022 in #djs-questions
Send Ephem. on member add now working
client.on("guildMemberAdd", async (member) => {
await client.channels.cache.get("CH_ID").send({ "content": `__**Welcome **__! `, ephemeral: true })
}
client.on("guildMemberAdd", async (member) => {
await client.channels.cache.get("CH_ID").send({ "content": `__**Welcome **__! `, ephemeral: true })
}
are ephemeral only for interactions?
4 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 7/20/2022 in #djs-questions
How to restart after bot crashes
I know is not JS related, but maybe is still one of the best places to ask. Sometimes user input error out. Im using ubuntu and nodemon the bot file. Anyone knows how to reboot automatically?
21 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 7/19/2022 in #djs-questions
cache members
let getguild = await client.guilds.fetch("ID")
let getmembers = await c.members.fetch()
let getguild = await client.guilds.fetch("ID")
let getmembers = await c.members.fetch()
once i got all members fetch, how can i loop thorugh each one? is it through .cache.get?
12 replies
DIAdiscord.js - Imagine an app
Created by Mulo on 7/3/2022 in #djs-questions
Oauth2 bot reply
Im stuck if somebody can help: I got the info from the Oauth2, but now im lost as to how to send back a dm to the user
fetch('https://discordapp.com/api/v6/users/@me', {
method: 'GET',
headers: { 'Authorization': `Bearer ${json.access_token}` }
}).then(response => response.json()).then(resp => {MakeappThread(resp.id)})
fetch('https://discordapp.com/api/v6/users/@me', {
method: 'GET',
headers: { 'Authorization': `Bearer ${json.access_token}` }
}).then(response => response.json()).then(resp => {MakeappThread(resp.id)})
the above is fine, im getting the info. this the function that supposed to put the bot instance on
function MakeappThread(UID, servers){

client.on('ready', async () => {

const user = client.users.cache.get(UID);
user.send("HELLO")

});
}
function MakeappThread(UID, servers){

client.on('ready', async () => {

const user = client.users.cache.get(UID);
user.send("HELLO")

});
}
the function is firing, the client doesnt go on
14 replies