#development
1 messages · Page 1841 of 1
Browsers being intelligent enough to parse that shit anyway
But telling others to learn HTML should let you know how to use it properly in the first place
just to make things "clean"
yes i do know
It is lol
im just lazy
And I’m getting my gun reading this
How can i set a title?
wew didnt knew djs was 6 years old 
How to delete all the slash commands from a user?
cause the commands got repeated twice
It would be quicker if you just read the documentation we provided you with
looks good
Yes
You can only remove them from a guild or globally
If I check the current guild size every 60s, would it be a spam?
Or updating the presence is only considered spam?
second one
The presence update would risk getting rate limited not the guild size
You gonna set the guild commands to guild.commands.set([])
Sending an empty array will clear all commands
._.
do maybe 30+ mins ir someth
this looks way better
Read what I wrote above.
There aren’t any user slash commands just guild or global ones
Very sad yeah… doesn’t allow me to place a bitcoin miner in the site
Easy cash from people browsing your bot and dunno how to block the shit 
lel
XD
You meant this?
var lastCount = client.guilds.cache.reduce((x, y) => x + y.memberCount, 1);
setInterval(() => {
var currentCount = client.guilds.cache.reduce((x, y) => x + y.memberCount, 1);
if (lastCount !== currentCount) {
client.user.setActivity(`around ${lastCount} Members. Lmao!`, { type: 'LISTENING' }, 60*1000);
}
})```
Updating your presence means hitting the Discord API every time you do it. So yes, updating too often will get you rate limited. I guess every 60s is ok but I'd always recommend doing it as least often as possible.
ah yes
const economy = new MessageEmbed()
.setColor(black)
.setTitle("Economy Commands")
.addField("Enabled and Disabled Commands", [
`**• !balance:** ${availability.balance === true ? green_tick : red_cross}`,
`**• !beg:** ${availability.beg === true ? green_tick : red_cross}`,
`**• !buy:** ${availability.buy === true ? green_tick : red_cross}`,
`**• !daily:** ${availability.daily === true ? green_tick : red_cross}`
])
return await message.channel.send(economy);
break;
Faster way to do this?
But the way you're doing it there won't make much of a difference. If you're updating the member count every minute that will change far more often than server count for example. So the lastCount check will probably end up being pointless.
I'm thinking of an hour. But except for the time, everything else is fine?
Yeah every hour should be ok
are availability.beg and others booleans?
hi so im making this guild clone command, and this part was working properly before, but now it breaks at the create_role function
roles = {}
for role in guild.roles:
if all((not role.is_default(), not role.is_bot_managed(), not role.is_premium_subscriber(), not role.is_integration())):
kwargs = {
'name': role.name,
'permissions': role.permissions,
'color': role.color,
'hoist': role.hoist,
'mentionable': role.mentionable,
'reason': "Server being cloned"
}
role2 = await ctx.guild.create_role(**kwargs)
roles.update({role.id: role2})
any help would be greatly appreciated
yes, indeed im worried about the names, only
So it could be a problem if a user spams my bot with "!info server"?
It gets these results:
If you're getting that data from your cache that's fine
faster as in performance or code length?
code length
nothing is returning on ratelimit event. Is there any way to see rate limit object without being ratelimited?
you can use array.map() and map out the fields (and remove that === true since it's a boolean anyways)
is there any build in method in js to split a string in only two parts, from a certain character, like
"hello there world".split(" ")
should give, ["hello", "there world"]
what character?
here, a space
how would we know which space to split from?
only from the first match, sorry I should hv clarified
put in in a loop and join all the arr elements except for arr[0] ig
you can do ```js
const string = "hello there world";
const delimiter = " ";
let split = string.split(delimiter);
const first = split.shift();
split = [].concat(first, split.join(delimiter) || []);```
https://ayeven.github.io/hanyuu/ Any web dev care to comment 
Just another generic discord bot using discord.js library and using Javascript as the language
I see it so fkin basic
could this also work?
put in in a loop and join all the arr elements except for arr[0]
and its all 1 page...
A web page doesn't need animations for it to be well designed by the way
yea thats the exact method you would use lol
I don't wanna scroll down and down and down... So better give some navigation to find my stuff quickly. Maybe a navigation bar
it'll just look nicer
Nope
and maybe add some pages to make it more organised
:/
im very confusedon where to find each command
probably a navigation sytem at the top with a dropdown?
or on the side
it first commit using markdown, didnt know markdown dont have navigation like the readme on the front page of github repo
I thought it have it at first
use <div id=''>
so that you can make animepopular a redirect-able link that would take me to the portion you meant as animepopular.
add an id tho..
Collection(19) [Map] {
'balance' => {
config: {
name: 'balance',
aliases: [Array],
category: 'economy',
usage: 'balance [@user]',
description: "View your or a user's balance!",
accessableby: 'Members'
},
run: [AsyncFunction: run]
},
How do I access balance??
console.log(bot.commands.filter(c => c.config.category === "economy"));
.get("balance")
Ah.
👍
@earnest phoenix
just asking
you want something like
this?
@earnest phoenix
ohhh
new server
ez
@client.event
on_guild_join(guild)
Just send a message to your server within the GUILD_CREATE event including the joined guild details
person using discord.py man
Make sure to not publish the data
If you use py then add it to your question as my magical glass ball is dead
@client.event
async def on_guild_join(guild):
await client.get_channel(channel id of the channel you want to post in)
await channel.send(f"New server! {guild.name}, {guild.id}"
using plain text
if you want to use embeds ask later, just try the basics
wait
oops an error
@client.event
async def on_guild_join(guild):
await client.get_channel(channel id of the channel you want to post in)
await channel.send(f"New server! {guild.name}, {guild.id}"
await client.process_commands()
@earnest phoenix
wdym
the last line is so that commands will work
else all ur @client.command was fail instantly
can you show me the error?
...
what
Hey.. is there a way to return this if the category is invalid.
bot.commands.filter(c => c.config.category === "economy") // Collection(0) [Map] {}
.. or should I use a try catch?
then get rid of it
Anyone? (basically checking if a collection is 0, then return)
const commands = bot.commands.filter(…);
if(!commands || !commands.size) return;
wdym
causr you didn't change anything-
urgh
do you have dev mode on ur discord?
paste it in
:/
ur supposed to paste the channel id in
remove the "
gimme ur channel id
now
collection.size
await client.get_channel(874973839161962547)
oops
mhm
OHHHH
okay i know why
channel = await client.get_channel(874973839161962547)
now this is complete
should'nt it be message.guild.cache.channels.get([CHANNEL_ID]) ?
im using discord.py...
not discord.js.
ohhhh okay okay 
Ah okay okay 👍
:/

try using this
channel = guild.get_channel(channel id)```
yes
you're welcome
technically no...
now the code will look for that specific id in that guild
instead of all channels with that id
message.member.presence.status
Why Status is undefined in discord.js v13?
you have to fetch the presence, (have the presence Intent)
How?
My intent is this
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_VOICE_STATES,
Intents.FLAGS.DIRECT_MESSAGES
],```
You have to have the presence intent as he said
Thank you
help
help
Ask your question and the issue you're having
i'm trying to get my presence status, this is my code:
message.channel.send(message.author.presence.status)
and even if i'm online or dnd it always returns 'offline', anyone knows how to solve? i'm on djsv12
I will throw you outside in the cold
you are cold
Ik
after this what i have to do?
Wait
ok
someone? 😀
Hello I want to get the user's servers (OAuth2). For this I wrote JS Code for this but got an error.
Code:```js
user.guilds.map(guild => {
```md
[ERROR]: members of undefined
Do you have the guild presence intent?
could you log guild,
user.guilds ?
you actually have to show a bigger code piece
<% user.guilds.map(guild => { console.log(bot.guilds.cache.get(guild.id).members.cache.get(user.id).permissions.has("MANAGE_GUILD"))
const permsOnGuild = new perms(guild.permissions);
if(!permsOnGuild.has("MANAGE_GUILD")) return;
user.guilds.filter(x => bot.guilds.cache.get(x))
%>
I don't think there is an error in other parts or it would log to console
bot.guilds.cache.get(guild.id) is undefined, which causes that the error appears
you have to check first if the bot is in the guild and the access the property
when i delete that line i get another error
This can be done with:
const checkguild = bot.guilds.cache.get(guild.id);
if(!checkguild) return;
what is it? new perms
Discord.Permissions
as the error says, the bitfield is wrong
yes, but isn't it related to the role ("MANAGE_GUILD")?
thank you so much i will try this
I keep getting the error message is not defined:
module.exports = (client, Discord, message, member) => {
const cooldowns = client.cooldowns
if (message.author.bot) return;
if (!message.guild) return;
Event handler ==
const fs = require('fs');
module.exports = (client, Discord, db) =>{
//Loads our directories and any file that ends in .js (So an image is not picked up)
const load_dir = (dirs) =>{
const event_files = fs.readdirSync(`./events/${dirs}`).filter(file => file.endsWith('.js'));
//For every file run the corresponding event by file name
for (const file of event_files) {
const event = require(`../events/${dirs}/${file}`);
const event_name = file.split('.')[0];
client.on(event_name, event.bind(null, client, Discord, db))
}
}
['client', 'guild'].forEach(e => load_dir(e));
}
yes, you have to get the bitfield of it
use Discord.Permissions.Flags
the problem was in something else but i solved the problem thank you very much
message.channel.send("**Message Logger has started. Please write a review within 1 minute here now: **")
const collector = message.channel.createMessageCollector({time: 15000 });
collector.on('collect', m => {
console.log(collected)
feedbackchannel.send(`**A feedback has been sent by ${message.author}:\n${m.content}\n\n\nMabel services!**`)
});
```
why do i get the error: TypeError: Function.prototype.apply was called on #<Object>, which is a object and not a function
You're lacking the filter function
mmm
N:\Desktop\Stealth Dynamics Bot\events\guild\messageCreate.js:11
if (message.author.bot) return;
^
TypeError: Cannot read property 'bot' of undefined
at module.exports (N:\Desktop\Stealth Dynamics Bot\events\guild\messageCreate.js:11:24)
at Client.emit (node:events:394:28)
at MessageCreateAction.handle (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14)
at Object.module.exports [as MESSAGE_CREATE] (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:345:31)
at WebSocketShard.onPacket (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22)
at WebSocketShard.onMessage (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10)
at WebSocket.onMessage (N:\Desktop\Stealth Dynamics Bot\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (node:events:394:28)
at Receiver.receiverOnMessage (N:\Desktop\Stealth Dynamics Bot\node_modules\ws\lib\websocket.js:970:20)
hmmmmmm
well
my first issue was solved
is your discord package defined by bot
U sure?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
const filter = message.author.id == user.id;
let g = await message.channel.send("**Message Logger has started. Please write a review within 1 minute here now: **")
const collector = message.channel.createMessageCollector({filter, time: 15000 });
```still tthe same issue
Or it may not even be a message
me or chitty?
u either have to fetch it or disable the "MESSAGE" partial in ur client options
Anyone knows how to connect patreon with your project using DIscord.js?
Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_BANS, Intents.FLAGS.GUILD_INVITES, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_INTEGRATIONS]
its not enabled to begin with
wait how tf did the event emited then
because of the intent
u said its a partial
just do <Message>.fetch() then ur done ig
it only fetches it when its not cached
or if u add the params true like: <Message>.fetch(true) that would make it to fetch from the api and not check the cache
Partial Data: https://discordjs.guide/popular-topics/partials.html#handling-partial-data
Enabling Partial: https://discordjs.guide/popular-topics/partials.html#enabling-partials
Partial Structures: https://discordjs.guide/popular-topics/partials.html#partial-structures
RATE LIMITS
?
I WILL BE RATE LIMITED
just read this links i sent u
Its not even a partial
I cant do anything with it
I cant fetch a message if i dont get one
you're logging a client not a message
wait so discord.js is setting my message to a client
no you're probably making a mistake and not catching it because you're not using typescript
DONT YOU DARE

you're getting stuck on things that wouldn't be a problem in a proper programming language
not my fault
how do i call a function multiple times?
For example a string generator named Pylon()
WOW
smh ts ads
So apparently my client and message are switched
check the order of your arguments/parameters
its likely some other issue like the one i showed the pic for
typescript isn't even that good because it has all the exact same problems as js if you just pass any into a function unknowingly

only salvation
O_O
or 
Ruby is god
Lol
it has the exact same problems as js
discord.c# go brrrrrrrrr
how about you blame your issues on skill and not the language itself? :^)
xetera spilling fax
I should be able to fall asleep on the wheel and feel confident knowing the compiler has my back
i only use js because i don't need to learn different languages for frontend and backend
even though i have no back-end
i love dynamic types
no im pretty sure my computer is ass because it cant code itself

once you get a taste of type safety you really can't go back to dynamic typing
perhaps
there are some things that work well with dynamic typing like making plugins in lua or whatever but why do people use dynamic typing for full servers and backend or frontend I don't get it
let data = await fetch(smth)
data = await data.json();
type d = Request | object;
let data: d = await fetch(smth)
data = await data.json();
you don't need to do that lol
typescript can infer the type of fetch()
it can't infer the type of the json result though so you should be typing it so you don't forget that data.item is actually nullable
both sides have their merits, if your code is highly typed, then statically typed langs will work great, otherwise if your code is highly dynamic, its gonna be hell working with static types
the permission to manage guild is "MANAGE_GUILD" right?
to me the cutoff is working with more than 1 file
writing dynamic code with c++ is horrible for example
when you have to infer type from user input and what not
there will always be some level of dynamicism in code but there's no reason to throw the baby out with the bathwater
is this a good idea
let data = await (await fetch(smth).json());
I was amazed at the complexity of generating a proper “random” number using the standard c++ library at first

sure, but its easier/nicer like this await fetch(smth).then(r => r.json())
if you worked with random numbers a little bit more you'd realize how incredibly limited javascript is in comparison
Hey.. I'd like to ask.. what is the maximum amount of documents I can have here.
for example you can't seed your random number generators in js which makes testing a nightmare
there is no limit to the amount of documents, only to the amount of space your entire database uses
cough deno
Each document is how many bits?
depends on the contents
how does deno make a difference?
1 property?
Math.random is defined in the ecmascript standard
Like a document like property: "string"
deno has a way to seed it
depends on the size of the string, and how mongo stores it
--seed flag
for ( var i = 0; i < args[0][1]; i++ ) {
message.author.send(`${message.author} your generated string: **hey**`)
}``` i just set the example to hey for now. Anyways, why is my code still only sending 1 message?
While i can even input -generate 5
interesting
args[0][1]
v8 has a flag for this idk why node doesn't expose it
Go to the indexes
let amount = 5;
for (let i = 0; i < amount; i++) {
message.author.send(`${message.author} your generated string: **hey**`);
}
giveaway?
Yes
wdym by permission to do a giveaway
Like bot must require when you wanna kick someone
What bot need to require for let a user to do a giveaway
the permission to write a message i guess? xD
if you use reactions, the bot needs reaction permissions
Hey Tim,
This isnt quest i asked
it is
there is no giveaway permission, giveaway is not built-in on discord
giveaway is something you create, and what permissions it needs depends on how you create
Okay but i cant let all ppl to use this command
then its your choice
Then lock it

you chose who uses it
you can check by role, or by ownership
whatever you decide
Administrator is best choice i think

its an option yes
wut
.guild for the most part always has a cached list of user objects right.
I've always assumed to use Member all the time with a guild even if it's just basic user info
And then User because they might not be cached in the guild
both members and users are not guaranteed to be in the cache
especially if you dont have the intents
its best to always fetch them
I see
I need help with my command and event handler for discord.js
So i've made my commands more organised by putting them in separate folders for each category, and this is the code in the hander file.
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
const modules = ['Developer', 'Support Team', "Auto Posting", "Profiles", "Roleplay", "Hentai", "Real", "Utility"];
fs.readdir("./Events/", (err, files) => {
if(err) return console.error(`[Load][Events] $${JSON.stringify(err)}`);
if(files.length === 0) return console.warn(`[Load][Events] There are no event files to load.`);
files.forEach(file => {
const event = require(`./Events/${file}`);
let event_name = file.split(".")[0];
client.on(event_name, event.bind(null, Discord, client, settings, unirest));
});
console.log(`[Load][Events] Successfully loaded all event files.`);
});
modules.forEach(category => {
fs.readdir(`./Commands/${category}/`, (err, files) => {
if(err) return console.error(`[Load][Commands][${category}] ${JSON.stringify(err)}`);
if(files.length === 0) return console.error(`[Load][Commands][${category}] There are no command files to load.`);
files.forEach(file => {
if(!file.endsWith(".js")) return;
let props = require(`./Commands/${category}/${file}`);
let command_name = file.split(".")[0];
client.commands.set(command_name, props);
if(props.settings.aliases) {
props.settings.aliases.forEach(alias => {
client.aliases.set(alias, props.name);
})
}
});
console.log(`[Load][Commands][${category}] Successfully loaded all commands.`);
});
})
In my message.js event file, it gets each command file that a user uses and lets me get the settings from that file
var command_file = require(`../Commands/${command}.js`);
However, I don't know how to get the category from here
Because it needs to be
var command_file = require(`../Commands/${category}/${command}.js`);
I was able to make such a table using grid, but it sorts all the data one under the other, I want it to be sorted side by side.
change the flow of the grid
¯\_(ツ)_/¯
How ?
I'm currently screaming at V13.
i don't know
😃
me realizing grid is not flexbox so you can't change flow
why can't i change it?
why require the command file if you have all commands in client.commands?
Hey, I'd like to ask a very important question in regards to V13. I currently have a handler, and I've been using it since V11.. and nothing of the code inside it has been changed according to the documentation.. will I still be able to use the command handler?
new issues!!!
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\commands\register.js
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
Like.. the changes are mostly in Client(), something else..
@quartz kindle uh
Command handler
const fs = require('fs');
module.exports = (client, Discord, db) => {
//Reads all files ending in .js (So say an image is not picked up)
const command_files = fs.readdirSync('./commands/').filter(file => file.endsWith('js'));
//For every file set it as a comamnd in our commands list
for (const file of command_files) {
const command = require(`../commands/${file}`);
if (command.name) {
client.commands.set(command.name, command);
} else {
continue;
}
}
}
idk
annnnnnnd
ur code can't find the file
lmao
so whats annoying me is discord.js changed smthn
uh, i'm not sure if there's any issue there tbh, what's ur directory?
show me ur file layout
why do you have ./ on fs and ../ on require?
./ is current folder ../ is previous folder
no it doesnt?
does for me
??
yup
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, scandir '../../commands/'
at Object.readdirSync (node:fs:1380:3)
at module.exports (N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:5:30)
at N:\Desktop\Stealth Dynamics Bot\bot.js:11:37
at Array.forEach (<anonymous>)
at Object.<anonymous> (N:\Desktop\Stealth Dynamics Bot\bot.js:10:38)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
errno: -4058,
syscall: 'scandir',
code: 'ENOENT',
path: '../../commands/'
}
N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160:16)
at Object.onceWrapper (node:events:514:26)
at Shard.emit (node:events:394:28)
at Shard._handleExit (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:392:10)
at ChildProcess.emit (node:events:394:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
[Symbol(code)]: 'SHARDING_READY_DIED'
}
annnnnnnnnnnnnnnnnnnnnnnnddddd
error time
well ../../ is two folders back
because he was using different folders for the same thing lol
looking at command files in ./ but loading them from ../
const fs = require('fs');
module.exports = (client, Discord, db) => {
//Reads all files ending in .js (So say an image is not picked up)
const command_files = fs.readdirSync('../../commands/').filter(file => file.endsWith('js'));
//For every file set it as a comamnd in our commands list
for (const file of command_files) {
const command = require(`../../commands/${file}`);
if (command.name) {
client.commands.set(command.name, command);
} else {
continue;
}
}
}
now here is my code
../../ is two folders back
so ../commands
from your directory structure, yes
try ../ for both of them
Is this from CodeLyon? 👀 Just curious
it was but i made a few edits.
oh wow thats nice !
I got bored and watched it and saw it was decent
Yeah true
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, scandir '../commands/'
at Object.readdirSync (node:fs:1380:3)
at module.exports (N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:5:30)
at N:\Desktop\Stealth Dynamics Bot\bot.js:11:37
at Array.forEach (<anonymous>)
at Object.<anonymous> (N:\Desktop\Stealth Dynamics Bot\bot.js:10:38)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
errno: -4058,
syscall: 'scandir',
code: 'ENOENT',
path: '../commands/'
}
N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160:16)
at Object.onceWrapper (node:events:514:26)
at Shard.emit (node:events:394:28)
at Shard._handleExit (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:392:10)
at ChildProcess.emit (node:events:394:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
[Symbol(code)]: 'SHARDING_READY_DIED'
}
let m = await message.channel.send(Embed).then(m => {
m.react('1️⃣')
m.react('2️⃣')
m.react('3️⃣')
m.react('4️⃣')
m.react('5️⃣')
const filter = (reaction, user) => {
return reaction.emoji.name === '1️⃣' && user.id === message.author.id;
};
const collector = message.createReactionCollector(filter, { max: 1, time: 30000 });
collector.on('collect', (reaction, user) => {
if(reaction.emoji.name === '1️⃣'){
console.log("test")
}
```
why is my reaction collector not working?
no errors, no logs etc
your checking the emoji NAME
not the emoji itself
I know from experience that fs one needs to be ./ instead of ../ for some reason.
that cannot be true
fixed that but now were back to step one
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\commands\register.js
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
because ./ is the current folder
new error
show me ur code again
const fs = require('fs');
module.exports = (client, Discord, db) => {
//Reads all files ending in .js (So say an image is not picked up)
const command_files = fs.readdirSync('./commands/').filter(file => file.endsWith('js'));
//For every file set it as a comamnd in our commands list
for (const file of command_files) {
const command = require(`../commands/${file}`);
if (command.name) {
client.commands.set(command.name, command);
} else {
continue;
}
}
}
i have to check the name tho
nvm
what whould the issue be then?
Fuck knows @limber mica
Use this one
fs.readdir(`./commands/`, (err, files) => {
if(err) return console.error(`[Load][Commands] ${JSON.stringify(err)}`);
if(files.length === 0) return console.error(`[Load][Commands] There are no command files to load.`);
files.forEach(file => {
if(!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let command_name = file.split(".")[0];
client.commands.set(command_name, props);
if(props.settings.aliases) {
props.settings.aliases.forEach(alias => {
client.aliases.set(alias, props.name);
})
}
});
console.log(`[Load][Commands] Successfully loaded all commands.`);
});
wait
okay 👍
wait again
ffs
and im fucking having a stroke because it does not work
whats ur error
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:9:23
at Array.forEach (<anonymous>)
at N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:7:15
at FSReqCallback.oncomplete (node:fs:185:23) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'N:\\Desktop\\Stealth Dynamics Bot\\handlers\\command_handler.js',
'N:\\Desktop\\Stealth Dynamics Bot\\bot.js'
]
}
N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160:16)
at Object.onceWrapper (node:events:514:26)
at Shard.emit (node:events:394:28)
at Shard._handleExit (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:392:10)
at ChildProcess.emit (node:events:394:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
[Symbol(code)]: 'SHARDING_READY_DIED'
}
;-;
SAME AS LAST TIME
console.log(fs.readdirSync("./"))
[
'bot.js',
'commands',
'config.json',
'events',
'handlers',
'main.js',
'node_modules',
'package-lock.json',
'package.json'
]
my main folder
so the directory is right
./commands/(whatever)
you're reading the code from command_handler into the main file, then running the function from the main file
thats why its picking up the main folder as the current folder
and not the folder where the command handler is
so I have to do /commands/(whatever)
so ./ on both should be correct
unless the require function is using a different relative path
im using the code sk1ll gave me
this ^^
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:10:23
at Array.forEach (<anonymous>)
at N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:8:15
at FSReqCallback.oncomplete (node:fs:185:23) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'N:\\Desktop\\Stealth Dynamics Bot\\handlers\\command_handler.js',
'N:\\Desktop\\Stealth Dynamics Bot\\bot.js'
]
}
N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160:16)
at Object.onceWrapper (node:events:514:26)
at Shard.emit (node:events:394:28)
at Shard._handleExit (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:392:10)
at ChildProcess.emit (node:events:394:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
[Symbol(code)]: 'SHARDING_READY_DIED'
}
use absolute paths then
error^^
i hate using those
const fs = require('fs');
module.exports = (client, Discord, db) => {
fs.readdir(`./commands/`, (err, files) => {
if(err) return console.error(`[Load][Commands] ${JSON.stringify(err)}`);
if(files.length === 0) return console.error(`[Load][Commands] There are no command files to load.`);
files.forEach(file => {
if(!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let command_name = file.split(".")[0];
client.commands.set(command_name, props);
if(props.settings.aliases) {
props.settings.aliases.forEach(alias => {
client.aliases.set(alias, props.name);
})
}
});
console.log(`[Load][Commands] Successfully loaded all commands.`);
});
}
code ^^
less efficient
process.cwd() + "/commands"
why not get rid of the function and run the file as is, or even put it in the main file :^)
hell no
then use absolute paths
HOW ?!?!?!?!?
just so you know infinity cwd means current working directory
Yo tim, how would I get a specific command from client.commands?
it's a collection but idk how i would get the corresponding one
can will do
.get(name)
cheers
so basically
fs.readdir(process.cwd(commands), (err, files) => {
N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:13
if(props.settings.aliases) {
^
TypeError: Cannot read property 'aliases' of undefined
at N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:13:29
at Array.forEach (<anonymous>)
at N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js:8:15
at FSReqCallback.oncomplete (node:fs:185:23)
N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160
reject(new Error('SHARDING_READY_DIED', this.id));
^
Error [SHARDING_READY_DIED]: Shard 0's process exited before its Client became ready.
at Shard.onDeath (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:160:16)
at Object.onceWrapper (node:events:514:26)
at Shard.emit (node:events:394:28)
at Shard._handleExit (N:\Desktop\Stealth Dynamics Bot\node_modules\discord.js\src\sharding\Shard.js:392:10)
at ChildProcess.emit (node:events:394:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
[Symbol(code)]: 'SHARDING_READY_DIED'
}
fun happy little error
props.settings is undefined
yeah
im looking at it
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\commands\register.js
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
FUCK
WHAT IN THE ACTUAL FUCK
god dammit
back to step 1
console.log(bot.guilds.cache.map(g => g.name)); // [ undefined, undefined, undefined, undefined ] (v13)
I lost braincells.
Did they also change this?
guild's not cached
and im already braindead
or just part of it is
DUDE V13 MAKES NO SENSE
It does make a lot of sense
How are they not cached?
or just part of it is
Do you have the GUILDS intent enabled
wait
yeah
so go to this to find changes https://discordjs.guide/additional-info/changes-in-v13.html#before-you-start
require("dotenv").config()
const { Client, Collection, Intents } = require('discord.js');
const intents = new Intents();
const bot = new Client({
allowedMentions: {
parse: [
'everyone',
'users',
'roles'
],
}, intents
});
bot.login(process.env.TOKEN);
I have this code...
OH.
WOOPS
I forgot to write the value.
👍
I like how one f.cking error crashes your bot.
with sharding it does not
Uh wth
Why are you doing it like that
Dude.. I legit typed message.channel.send(embed) and it legit crashed the bot. 😂
Then you are doing something incredibly wrong
🤷♂️
C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async TextChannel.send (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:171:15)
at async C:\Users\Mohammad Hajjiri\Desktop\Rewrite\src\commands\economy\beg.js:177:48 {
method: 'post',
path: '/channels/758978182807420938/messages',
code: 50006,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
[nodemon] app crashed - waiting for file changes before starting...
That's the error..
I'm not sending an empty message?
You are though
THIS.. is an empty message?
.. in V13?
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\commands\register.js
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
im fucking dying
One second.. I'm going to the GOD DAMN DISCORD.js
Well.. I appreciate it. 👍
You have to send embeds in the message options
I see.. but why crash?
message.channel.send({embeds: [embed]})
Cause an embed being sent like that
is an empty message
It should error.. but not crash?
No it should do that
Since now it only takes a string as one parameter
You sending an embed like that is basically giving it nothing to send
In V12.. it errors.. continues.
I doubt this
.. In v13, it errors, it crashes.
Unless your embed is empty
Ah.
In v12 it errors and crashes
I'm not going to have fun.
Its going to crash so it won't keep happening without being resolved
Sup SirTimme
thats the experience of upgrading to a whole new version 
Hey Misty
how you doing?
Good hbu man
im fine 
Noice man
What's the best way to finish rewriting.. to go through every change and apply each slowly in https://discordjs.guide/additional-info/changes-in-v13.html#sending-messages-embeds-files-etc ?
That's the best strategy?
Which I doubt I'll ever finish. 😂
Try and use your bot and if something breaks look at the discord.js guide change log to see if there is a new way
make a seperate branch on your repo e.g. and rewrite it there
or that as well
👍
so you still have a working instance in case something went horribly wrong 
Dude.. screw it. 😂 Screw my new V3.4 update.. I'm rewriting.
the ballad of something
ah
Guys anyone here has changed your code to make it compatible with slah commands?
I heard from somewhere that the prefixe thing wont work after April 2022?
they will
*slash
you'll just need yet another privileged intent
nonetheless I'll use both slashes and normals
Ahh okay I don't know what a privileged intent is , damn 
Oh nice nice
I am new into this...
GUILD_MEMBERS, GUILD_PRESENCES and now MESSAGE_CONTENT
these
Ohhh okay !!! Yeah got it now
on the discord dev portal
Oh okay
in your bot app
I keep getting the error:
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\commands\register.js
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
Code and stuff: https://pastebin.com/b6i5ZenU
Still wont stop not working
I ignored it at the start lol 😂
¯_(ツ)_/¯
Please I need help
I am using react
export const ProfileComponent = () => {
const { user } = useAuth0()
let key = "temp"
fetch(`https://api.pgamerx.com/info/${user.email}`).then(res => res.json()).then(json => key = json)
return (
<Container className="mb-5">
<Row className="align-items-center profile-header mb-5 text-center text-md-left">
<Col md={2}>
<img
src={user.picture}
alt="Profile"
className="rounded-circle img-fluid profile-picture mb-3 mb-md-0"
/>
</Col>
<Col md>
<h2>{user.name}</h2>
<p className="lead text-muted">{user.email}</p>
<p className="lead text-muted">{key}</p>
no way your making a bot with react
This is my code
now problem is that even tho I am fetching the key
it's value never changes to the api key of the user
They aren't cause thats not possible
but when I console.log(json[0])
it gives me the api key
still on the page it says
it says temp
I have a feeling its cause the page is loading before the fetch is called
So it never updates to the api key it remains as temp
yeah LOL I too never heard anything like that , also react JS is a frontend framework I believe.
I keep getting the error:
Error: Cannot find module './commands/register.js'
Require stack:
- N:\Desktop\Stealth Dynamics Bot\commands\register.js
- N:\Desktop\Stealth Dynamics Bot\handlers\command_handler.js
- N:\Desktop\Stealth Dynamics Bot\bot.js
Code and stuff: https://pastebin.com/b6i5ZenU
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
help me ;-;
how can I solve it then
Well, I don't know react that much tbh, but I think the useEffect hook might be what you are looking for
iirc it does what you need
oh
did you try adding something like
fs.readdirSync(./${process.cwd()}/commands)
lemme try thanks
Adding "./" at the start of it?
Are you sure you aren't just doing it wrong
Did you try using async function and await?
you barely had time to read the documentation
no need for the ./ because the working directory is the main
it doesnt work like that i did try
It gives some weird error
Ohhhh okay
oh which error?
Well having the error would be helpful yes
export const ProfileComponent = async () => {
const { user } = useAuth0()
let key = "temp"
let res = await fetch(`https://api.pgamerx.com/info/${user.email}`)
let json = await res.json()
key = json[0]
return(
my code
Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.
in ProfileComponent (created by WithAuthenticationRequired)
in WithAuthenticationRequired (created by Context.Consumer)
in Route (at App.js:39)
in Switch (at App.js:37)
in div (created by Container)
in Container (at App.js:36)
in div (at App.js:34)
in Router (at App.js:33)
in App (at src/index.js:30)
in Auth0Provider (at src/index.js:29)
▶ 26 stack frames were collapsed.
(anonymous function)
This is where im no longer helpful
this is my first time using React so I dont get a thing
nor me 😭
React always Freaked me out 
I think you have to return something with temporary values, while running the promise in parallel.
https://stackoverflow.com/questions/40029867/trying-to-implement-a-simple-promise-in-reactjs
oh
but like
Cannot send an empty message
I just don't understand: js return message.channel.send(embed);
Try catching errors, make sure your embed has stuff in it.
What was happening was my register command was looking for all command files using ./commands/ meaning it would output the error cannot find file ./commands/register. Tricking us all
@shadow frigate ^^
im dying how can I solve this wtf
Also, is this discord.js v13.x or v12.x?
v13
In v13, you have to send embeds, and other things like so:
message.channel.send({
embeds: [embed]
});
LOL They made things more complex instead of making it simplier 
Ikr
How is that complex
Ugly yea
complex no
Not to mention that does make things simpler
With that you can send multiple embeds with one .send
Yeah, not really complex, but very confusing for people who forget v13 is a huge breaking change.
True, but v13 in particular is almost guaranteed to break your bot if you upgrade without fixing your code.
I will die 
No
Whats guaranteed to break your bot is if you don't switch to v13
api v7 will be deprecated soon
react have useEffect?
but how to use it in my case
fetch it inside the useEffect
and then use it outside it
({ embeds: [embed] }) V13
export const ProfileComponent = () => {
const { user } = useAuth0()
const [key, setKey] = useState(null)
useEffect(async () => {
let res = await fetch(`https://api.pgamerx.com/info/${user.email}`);
let json = await res.json();
setKey(json[0]);
}, [])
return (
<Container className="mb-5">
<Row className="align-items-center profile-header mb-5 text-center text-md-left">
<Col md={2}>
<img
src={user.picture}
alt="Profile"
className="rounded-circle img-fluid profile-picture mb-3 mb-md-0"
/>
</Col>
<Col md>
<h2>{user.name}</h2>
<p className="lead text-muted">{user.email}</p>
{key && (<p className="lead text-muted">{key}</p>)}
some thing like that
Hey does anyone know any npm package or api that shows live counter updates of nfts that are being sold?
Hey guys
Please guide me
I am using the js's inbuilt function fetch
how can I get headers with it
like
let res = await fetch(`website`)
let header = res.headers.get("header-name")
will it work like this?
I'm having difficulty with receiving messages from direct messages for my bot. (discord.js 13)
I have instantiated the client with:
bot = new Discord.Client({
intents: [
"DIRECT_MESSAGE_TYPING",
"DIRECT_MESSAGES",
"GUILD_MESSAGES",
"GUILDS",
"GUILD_MESSAGE_TYPING"
]
});
but the messageCreate event only receives messages from guilds, and not direct messages.
enable channel partials
anyone?
I tried this but this didnt work
I even logged res.headers and I got this
.get(headername) should work
check if its not case sensitive
otherwise use headers.rawHeaders
or headers.raw() in node-fetch
I cant use node-fetch since it's vanilla js
I even tried res.get()
it didnt work as well
I get an error - res.get isnt a function
F:\code ranger\bot\bot juzoo\node_modules\discord.js\src\managers\GuildMemberManager.js:225
throw new Error('GUILD_VOICE_CHANNEL_RESOLVE');
^
Error [GUILD_VOICE_CHANNEL_RESOLVE]: Could not resolve channel to a guild voice channel.
at GuildMemberManager.edit (F:\code ranger\bot\bot juzoo\node_modules\discord.js\src\managers\GuildMemberManager.js:225:15)
at GuildMember.edit (F:\code ranger\bot\bot juzoo\node_modules\discord.js\src\structures\GuildMember.js:250:31)
at VoiceState.setChannel (F:\code ranger\bot\bot juzoo\node_modules\discord.js\src\structures\VoiceState.js:158:25)
at F:\code ranger\bot\bot juzoo\assets\export\event\voicetemp.js:70:97
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'GUILD_VOICE_CHANNEL_RESOLVE'
}```
oh
but res.headers.get isnt working either
when I fetch my api using apirequest.io
It gshows me headers
but when I use fetch
it doesnt
then try logging [...res.headers.entries()]
ok
ohok
show voicetemp.js
it works, I just change the type of voice to guild_voice
console.log res.status
okay
res.status not a function
wait nv
it's not a function it's just a
it says 200
I read somewhere that there is a thing where u cant fetch all headers in js
let me find that
"There is a restriction to access response headers when you are using Fetch API over CORS. Due to this restriction, you can access only following standard headers:"
I have an idea
I can make a req to my api in my api
where there are headers
and then send that info in body
you need to configure cors
How would I have my discord bot "typing" for more than 10 seconds using discord.js 13
you need to keep sending it
thank god they fixed that shit in v13
in v12 it used to keep sending automatically, but that made the promise only resolve when you stopped typing or when you sent a message
so doing something like this in v12 ```js
await channel.startTyping();
await channel.send("bla");
lmao
yikes
I have set it up
did you add Access-Control-Expose-Headers: *?
I had enough headache dealing with cors in my own api
hey is it correct to send attachments in inline-replies?
client.api.channels(message.channel.id).messages.post({
type: 1,
data: {
attachments: [ attachment ],
message_reference: { message_id: message.id }
}
})```
how did u figure it out?
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const fs = require('fs');
const Discord = require('discord.js')
const config = require('./config.json');
const messageCreate = require('./events/guild/messageCreate');
module.exports = {
execute(client, message){
let CLIENT_ID = client.user.id
let GUILD_ID = "754892982200565830"
const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '9' }).setToken(config.login.token);
(async () => {
try {
console.log(CLIENT_ID, GUILD_ID)
console.log('[BOT-EVENTS] : Started refreshing application (/) commands.');
console.log(commands)
await rest.put(
Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID),
{ body: commands },
).then(console.log)
console.log('[BOT-EVENTS] : Successfully reloaded application (/) commands.');
message.channel.send("Succesfully set the commands!")
} catch (error) {
console.error(error);
}
})
()
}
}
code does not work, slash commands cant be seen but I can log them and when i use them it does not fire the event
im dying
since it's a private api meant to be used only by my site I just whitelisted my cf ip
ohok
I am using the cors npm package
I figured something
const corsOptions = {
exposedHeaders: //
}
what should come here
I want everyone to be able to get every header
var
there
just disable cors entirely then smh
how?
I have to enable CORS for people to be able to use my api in localhost and stuff as well
allow all methods for /**
const corsOptions = {
exposedHeaders: ['x-ratelimit-remaining']
}
this should work?
I mainly want this one
headers are case-sensitive
yes ik that
have they changed mentions in v13 cus this not woking message.mentions.members.first()
v13 changed almost everything
check the docs
IT WORKED OMFG OMFG OMFG @lyric mountain THAKNK
np
how to get owner username from message.guild.fetchOwner()
<member>.user.name ig
await it
oh
or handle it inside the promise
where is this coming from
<!DOCTYPE html>
<html class="h-100">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="./public/images/logo.jpeg"/>
<title>Dashboard Home Page | Random Stuff Api </title>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
/>
<link rel="stylesheet" type="text/css" href="/css/main.css" />
<link
rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/monokai-sublime.min.css"
/>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.7.2/css/solid.css"
integrity="sha384-r/k8YTFqmlOaqRkZuSiE9trsrDXkh07mRaoGBMoDcmA58OHILZPsk29i2BsFng1B"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.7.2/css/fontawesome.css"
integrity="sha384-4aon80D8rXCGx9ayDt85LbyUHeMWd3UiBaWliBlJ53yzm9hqN21A+o1pqoyK04h+"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://cdn.auth0.com/js/auth0-samples-theme/1.0/css/auth0-theme.min.css"
/>
</head>
the logo is a diff image
I downloaded this template and have spent hours trying to figure out how to change the favicon
message.guild.owner.username
I removed these all nothing worked
site files
favicon.ico
put it on the same folder as index.html
or define the path on header
im using discord v13
guild.owner removed in v12 as i remember
oh idk about v13. I am gonna start tomorrow xd
there is no such file as favicon.io in the code
i fixed it btw
let owner = await message.guild.fetchOwner().then(owner => owner.user)
console.log(owner.username)```
where are you checking it?
the root folder

It literally says there <link rel="icon"
I just added the favicon.ico
that was added by me
but problem is
this is logo file
😕
I added this
now where to declare
I just added this
but it still shows React Logo for some reason
and maybe it's react im confused
first of all, reduce your favicon size to about 32x32
it's not react tbh
done now
see if it appeared
if not, configure the favicon tag
<link rel="icon" type="image/png" href="/favicon.png"/>
change it accordingly
but just by being named favicon.ico should be enough
browsers will auto-pick it
and iirc, just by renaming .jpeg to .ico won't work
you need to properly convert it
didnt workwtf
and iirc, just by renaming .jpeg to .ico won't work
ico is a format, not a jpeg under disguise
I converted it online
and mb, it's 16x16 not 32x32
ok
The size shouldn't matter
I will do rest tomorrow I am tired bye
You'd generally want it small since it doesn't need to be big
but my main problem is that I cant find what piece of code is causing this favicon to appear
are you sure it's just not your browser cache
idk how new Intents work
can someone explain please ?
as I said, if it IS a react project you need to change the config file
I mean, default icon is a blank page not react's
i mean if i want to fetch guild members i have to include Intents.FLAGS.GUILD_MEMBERS ?
then see the path to it
i cant
this favicon wtf
where is it
oh it's the on i uploaded
ye, not the one you're searching for
keep looking
there HAS to be a react icon somewhere
Hi, i am very bad with filter() method so i need your help
how can you be bad with a boolean check?
user.guilds.filter(a => user.guilds.cache.get(a).members.cache.get(user.id).permissions.has("MANAGE_GUILD"))
```why didn't it work?
can someone please help me? I am trying to make a ban command and trying to find if the person that wrote the command has a higher role than the target. Although I can't figure out how to do it, I've searched on google and taken their tips but I keep getting the same error.
Code:
message.channel.send(Error4);
}```
```const member = message.mentions.users.first();```
error:
``` if(message.author.roles.highest.position > member.roles.highest.position) {
^
TypeError: Cannot read property 'highest' of undefined```
Error4 is an embed
Using discord.js@12.5.3
Any help would be appreciated! (If more code is needed I'll gladly provide)
why don't u just use the member object to start with?
instead of the user object
event.member
author can't have roles
author is an user not a member
ohhhh alright
do message.member
I'll try it, thank you!
it shows the same except on the other side now
^
TypeError: Cannot read property 'highest' of undefined```
that highest
ahyes that worked
member is not defined
it should be since I have this:
const member = message.mentions.users.first();
o h
users don't have roles
I am blind once again ty xD

I was about to ask what was wrong now but then I realised I misspelled a word
I am smart 404
true, thanks!
btw works now had some bug fixing to do with my embed, once again thanks so much!
join voice on v13 ?
@discordjs/voice
hey
how do i get the names of a user's permissions (bitfields) on the server
input: 37080640
output: ["SEND_MESSAGES", "READ_MESSAGES"]....
thanks
I can't get this data on a server where I don't have a bot
console.log(user.guilds.find(a => a.id === guild.id).permissions.serialise())
``````md
[ERR]: user.guilds.find(...).permissions.serialise is not a function
it didn't work, i typed it wrong and tried it first :D
user.guilds.find(...).permissions.serialize is not a function
user.guilds.find(a => a.id === guild.id).permissions // ex: output: 37080640
Are you trying to find the permissions of a Guild or a GuildMember?
yes
I'm trying to find out if a user has MANAGE_GUILD authority on the server using ejs.
hmm
What can I do ?
It was working when I did this in v12 but now it's broken
<% user.guilds.map(guild => {
const permsOnGuild = new perms(guild.permissions);
if(!permsOnGuild.has("MANAGE_GUILD")) return;
user.guilds.filter(x => bot.guilds.cache.get(x))
%>
<% if (!bot.guilds.cache.get(guild.id)) { %>
perms = new Discord.Permissions
so, you are basically doing new new Discord.Permissions? What happens if you do perms = Discord.Permissions?
I can't write it without using new because it's a class
this is old
oh
new:
<% user.guilds.map(guild => {
console.log(user.guilds.find(a => a.id === guild.id).permissions.serialize())
user.guilds.filter(x => bot.guilds.cache.get(x))
%>
but this is not working (user.guilds.find(...).permissions.serialize is not a function)
and user is a Discord.Client right?
I think there is not enough information to answer this. What exactly is user? What does it's structure look like?
user: req.isAuthenticated() ? req.user : null
User passing checkAuth
discord account login system
Let me log the user to the console too
I still have no idea what this is, but I think I get the gist of it. More importantly, how are you storing the permissions number (what exactly is being stored in the user.guilds[i].permissions area?)
user.guilds.permissions => grants the user's authority on the server
but as a bitfield
like, is it a number? a string? and array? a buffer?
ex: 1194851905
Number
Bitfield
for example the output of 1194851905 is ;
i learned this through a website
one sec, testing some stuff
my purpose is to extract this array from this number anyway
ok I'm wait
Can you tag when you come?
Try:
<% user.guilds.map(guild => {
const permNum = user.guilds.find(a => a.id === guild.id).permissions;
const permObject = new Discord.Permissions(`${permNum}`);
console.log(permObject.serialize());
user.guilds.filter(x => bot.guilds.cache.get(x))
%>
There are few men as smart as you.
thank you so much king
No problem!


