#development
1 messages · Page 1521 of 1
WHAT IS THIS MADNESS, I Even Gave The Bot Owner Roles
With All The Perms
oop wrong command
wait
There
hey @glacial pagoda ur give role thing for trying ban cmd dont work correctly
if you share your bot than it will crash
the id for the role is channel specific
Error: Cannot find module 'C:\Users\Sam\Desktop\RemindMe\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}```
This file exists and I get this when I do node index.js
any ideas as to what could be making this happen?
did u move the folder off your desktop?
loader.js:880:15
why are you passing discord through args instead of importing/requiring @glacial pagoda
check that line and that char
wheres that?
no
or rename it?
why is it in a foler called remind me?
https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=bannable should be checked either way tbh.
is that the bot name?
cc
u can keep the role thing by adding a const and making it get guild cache and looking for the role name
I Dont Know Importing/requiring
just be sure to catch it in case it cant find it in someone elses server
he was posting the role command, but it seems he was talking about his ban command.
ohhhhhhhhhhh
ok
@glacial pagoda
AHHHHHHHH
u could try som like that
Why
...
yes
why are you passing Discord on the arguments 
0-0
codeblock
thats a function, needs the {
which
this
Thats the ban in my command handler
yeah
thats mine
oh
0-0
AAAAAAAAAAAAAAAAAA
you have ban listed twice
yeah ik
you should
- make the handler dynamic
- don't pass discord - require it in the file
why not, the embed needs discord
i have to
no you don't
we suggested it four times now alex, dont think suggesting it again will help.
ima try
you can just require Discord at the top of the file
that's what literally everyone does
yea actually more importantly this
TAHTS WHAT IM DOING
But yall say dont
dynamic pls
@opal plank my reaction
Confusing me
im getting yanderedev vibes
lol
right fucking there
@misty sigil
@glacial pagoda PLEASE READ THIS https://discordjs.guide/command-handling/
double tag, spicy
IM USING A HANDLER
heres my list of ways to handle commands, ranked from worst to best
- dynamic command handler
1.5) a framework, such as commando - hard coded command handler
- else if chain in a message event
- multiple ifs in a message event
- multiple message events
YOU AINT
basically
this clearly isnt a handler
UDHWAIUFH WAWWHD
this is a massive if chain
qADdjipfaow
thats not a handler
do you have the intetn
thats just multiple files
yandere dev is proud of you
command == 'command' is to specify filw
burn and a half
thats not a handler
i told you to read it, you only read the first part with the example
IT ISNT
0-0
A DAYNAMIC
thats the first part
COMMAND
HANDLER
this is the second part
thats a command loader
ok fair enough
which i told you to read
bro wtf
you stopped reading half way through dude
cba copypasting
its that easy
fam, can you bother reading what im sending?
im just trying to fix my error ;-;
an actual command handler checks if there's a command with a certain name in the client
and executes it if so
or does 300iq like me
dynamically
i have to pass discord
you dont
const command = args.shift().toLowerCase()
const cmd = client.commands.get(command)
if (!cmd) return;
cmd.execute(message, args)
THEN DEFINE IT AT THE TOP
you just have to require again
you dont need to re-use discord in your code, i assure you
they dont even need it, they're likely using it for an embed
which is already bad
embed builder is trash
second you just declaring useless stuff taht you wont even need
~~while you're at it don't use node in the first place
~~
node gud
i'll use deno instead
dunno bout deno though
sometimes i think this channel is too aggressive about this stuff.
node is awesome LMAO
deno might become awesome
node is good for many things, not all
never said it was the best, but sure is the handiest
everything thus far has been made in node, if you got a problem, you got a solution already somewhere
every language has its pros and cons
node targets easy programming and scalability, super good UI building tools and more
compare that to something like java and .net where performance is the target but the languages suck ass for building UIs
what are php's pros
also, i just recently learned that node 15 finally crashing the process on unhandled rejections
easy web vuln 

finally
try, and catch.
yup, electron builder now crashes the whole npm i operation lmfao
remove the intent then?
wraper your whole index in a try/catch
ezpz
actually, better yet
wrap everything
yeah, that work
node 15 is awesome, especially because of native AbortController support
finally a native way to cancel promises
i havent been playing with node 15 yet, so im not sure
i've stuck with node 14 lts
i have it running locally, but prod is 14.8 iirc
ok is there like a place i can go where someone will look over an entire file and help me figure out why th it isnt working
this code i made is legit a nightmare
you see the problem is, theres no error
ok
MongooseError: Operation `messagereminders.find()` buffering timed out after 10000ms```
this is the closest I've gotten to an error in days
but I don't have anything saying messagereminders.find()
ok so it doesn't work but no error?
essentially
thats all that happens and I couldn't tell you where its coming from
i know it's somewhere in this code
//Remind User Function
async function remindUser(bot) {
try {
let reminderEmbed = new discord.MessageEmbed()
.setTitle(data.messageLink)
.setDescription("You asked me to remind you at this time of the message linked above. Click the link to view the message. If the link does not work, the message may have been deleted or you do not have access to it anymore.")
.setColor("#FF0000");
await data.user.send(reminderEmbed)
data.remove();
} catch (err) {
console.log(err);
}
}```
```js
//Node-Scheduler Function
nodeSchedule: async function scheduler(bot) {
try {
(await messageReminderModel.find({})).forEach(data => {
let currentUnix = Date.now()
if(data.time <= currentUnix) core.remindUser()
schedule.scheduleJob(data.time, remindUser);
console.log("Scheduled a reminder.");
});
} catch (err) {
console.log(err);
}
}
}
otherwise i've been trying for days and haven't gotten anywhere
i cant remember how mongoose/mongo index's stuff
is your database/table properly indexed?
im not sure
i think so
it goes in fine
I just can't sift through it, and dm a user
i actually use the _id key in mongo
indexing is specifically searching
messageReminderModel.find({})
``` is this not messagereminders.find()?
click on "indexs"
nvm then :p
okay
..............................................
oh wait
oh
oh
oh
oh
just
pretend I didnt
okay I will attempt that and come back
otherwise does everything else look good?
yea
ok so i am trying to get the bot to update the game of which it is playing
function pingForPlayers() {
// Ping API for server data.
axios.get(`https://api.mcsrvstat.us/1/${process.env.MC_SERVER_IP}`).then(res => {
// If we got a valid response
if(res.data && res.data.players) {
let playerCount = res.data.players.online || 0 // Default to zero
client.user.setPresence({
game: {
// Example: "Watching 5 players on server.com"
name: `${playerCount} player${playerCount > 1 ? 's' : ''} on ${process.env.MC_SERVER_IP}`,
type: 3 // Use activity type 3 which is "Watching"
}
})
console.log('Updated player count to', playerCount)
}
else
console.log('Could not load player count data for', process.env.MC_SERVER)
}).catch(err => console.log('Error pinging api.mcsrvstat.us for data:', err))
}
``` Now the bot is loging the correct player cound just not updating the game. Please @ or reply to me if you can help (so i see the ping) i dont have much experience with discord.js (i normally work with py)
@misty sigil ok i think im actually unclear on how to do what you're talking about
i just tried and i dont think I did it right
store message.author.id
get user by await client.users.fetch(id) / client.users.cache.get(id)
then send by doing <User>.send()
and how do I get the id of the user who reacted to a message again?
is it just reaction.user.id?
yea
TypeError: Cannot read property 'id' of undefined
at Client.<anonymous> (C:\Users\Sam\RemindMe\RemindMe\core.js:23:42)
at processTicksAndRejections (internal/process/task_queues.js:93:5)```
bot.on('messageReactionAdd', async (reaction, user) => {
if(reaction.emoji.name === "⏰") {
let errorEmbed = new discord.MessageEmbed()
.setTitle("An error has occured. It has been reported to the development team for further review.")
.setColor("#FF0000");
const messageLink = reaction.message.messageLink
await user;
const userObject = reaction.user.id```
@misty sigil
i probably did something stupid
fetch the user
reaction doesn't have a user property
you already have a user variable
in the function arguments
nope, im pretty sure its a collection of users or something i think
oh
well
have you read the error
so where's the problem
also don't copypaste code
still wont work
no error this time
those functions are only running after a reminder is set
like node-schedule isn't working at all
@misty sigil if you'd still be willing to help me I've got the whole file (https://pastebin.com/s0eZjq86) pretty much I can't figure out how to be able to use my functions in my module.exports in the same file, and why it's only scheduling reminders when someone creates a new one
yarn add -D @types/node typescript can I do this with NPM
as yarn seems to die on me
Heyo
Can someone help me with a lil something?
Hey I'm trying to use a mongodb currency system but I'm trying to make it that if you own a certain amount of money a type of emoji will pop up that will indicate levels of prosperity. Gold, silver, etc.. the only problem i have is using ranging values. It would look something like this
if(eco.coins <= 100 to 500)
Obviously this is non working code but I would like something like that instead of having to type every number in between
This might be a bit of an advanced topic I don't necessarily expect an answer to, but I am attempting to learn general application scaling. I now find it necessary to rethink how I store Objects sent by Discord. My current implementation is storing some data in memory such as guilds and voice states as those are volatile and are re-sent on READY anyways. The rest is stored in a single Redis instance which I interface transactions beyond GET, SET and DEL commands such as filtering in a cache worker located on the same machine as the Redis instance.
My current implementation isn't exactly as efficient as I'd like it to be since making some complex transactions involving accessing both memory and Redis across client clusters can add quite a bit of overhead. Currently, it takes about a minute for a client in 3k guilds to respond to an OP requesting the guilds a user is in solely based on which guild sub index they get cached in. I know there is a better way to receive user guilds which I will implement, but it just serves as an example.
Another issue is that whenever the client establishes a websocket connection to discord, the amount of data sent after the READY event such as GUILD_CREATEs causes the Redis instance to be starved for resources. I imagine it would be beneficial to batch SET queries to reduce the volume of inbound request processing but IDK.
My main question would be what exactly should I be doing to properly scale based on my needs? Currently, it is necessary that I am able to filter over Users/GuildMembers by ID, name as possibly tag/nickname (ID is included because it comes from acceptance of arbitrary input. I could possibly attempt to see if the input is a key which is indexed before issuing a filter OP, but that may add some overhead). It is also necessary to be able to filter over channels under a specific guild by name or ID for the same reasons highlighted above.
Is there a specific db I should be using? etc...
Is there a specific db I should be using? etc...
PostgreSQL is a pretty good Database
how come this doesn’t work
it says it’s an unknown slash cmd
or api I forgot the error
guys my bot just stopped streaming audio to discord when ran in its usual host
when ran on an alternative host i do have or on my own computer, it works fine
any clue what's happening? ip ban?
nothing
absolutely nothing
the code works as expected, and ran on other machines it streams audio
you’re sending web requests for it right
but not in its usual host
using discord.js, at the backend they are web requests so yeah
it’s possible you’re being ratelimited or possibly had your ip banned
try .catch
and see if it catches the error
Yeaa rate limited or ip ban
i have try catchs
Pray its rate limit
You have an interval set?
i think its an ip ban
what do you mean by a simple request
the bot logs in well and works fine
the only problem is streaming audio
yeah, i suppose
thanks discord
i'll have to change its ip
and contact discord
for some help or an explanation
at least an explanation
I mean its from youtube yes?
yeah i take audio from youtube
oh, youtube?
then its not discord... mmmm
yeah, i didnt think about that
gonna try a curl request to youtube
you need to implement ip proxying
aka ip shuffling
youtube became super strict about scraping data
thanks, you are pretty useful
well yeah
using the unofficial public api
that's how youtube-dl works
Does anyone know why my yarn installation is fucked
yeah, ytdl
try restarting the shell
It works in powershell
maybe check if yarn is on the path env variable
But bash or cmd? ❌
How
Rn yea
just echo $PATH
getting a 204 http status code when using curl -I https://www.youtube.com/
not a 200
mmmm
hm yes
@summer dust Use a proxy or cookies in your ytdl code or enable a VPN
Using cookies can reduce you getting banned and a VPN can also help
I use a /48 IP block for my Lavalink code but for ytdl you gotta choose one of those 3 in order to prevent it
What does this mean?
Running my bot on a hostfor the first time.. never seen this?
What is the discord.py startup cmd
how can you use cookies with ytdl for nodejs?
do you know?
Yes, I can give you an example but I need to know how you’re playing the song with ytdl first
What is the discord.py starup cmd, what do I put for it
sure
Although idk if cookies always work if the IP is already banned so you might need to try with a VPN for it
@mellow kelp yo
something like this is what i do @odd stratus
I have an issue with yarn
yeah, for sure ill change the ip of the server
but if i can prevent it from happening again
how tf do I do this lmfao
its ok
u talking to me?
yes
mmm i thought you got access to a ssh shell
bruh what is this
If you don't mind could you send me the whole code in a SourceBin in my DMs? I could add it in then but you'll need to get the cookies from YouTube
sup
This is the regular ytdl-core right
thanks @odd stratus
yep
👌
what is the discord.py startup cmd, anyone know pls
yarn add -D @types/node typescript never seems to work because of the typescript thing, i can see ti tries to fetch it but fails and says my internet is not working even tho everything else is
it spits out yarn-error.log
-py 3 didn't work
that should work just fine tho
it's ot
is it just an internet error?
not
hold up ill get the log
python3 <filename>.py then
Idk why it does this smh
The node one works
Should I try just node
Or do both typescript and node need to be in the same line
you should be able to do both at the same time
but i guess you could try one at a time
I think it's an issue with the typescript addition
Because it gets node just fine
Well
It just worked randomly
Ok then
Ben awad teaching me react and ts 
yes
once he was trying vue.js with typescript for the first time and wanted to know the type of an 'onclick' event
"Well now I know what this type is" - he said as he typed any
react 18 is definitely going to be king of UI frameworks once it comes out
whats it gonna bring?
facebook is focusing on concurrent UI and SSR
@terse sphinx its already taken over 4 hours 😦
and the 429 error isn't going away
from what i'm seeing
your error says you got API banned for exceeding ratelimits too frequently
API bans last 24 hours they're supposed to last an hour
however it may vary
if it doesn't expire after 24 hours contact discord support
hmm i think i understand why I got API banned
but I don't understand why the ban has already lasted 4 hours and counting
i'm not 100% sure
That doesn't sound very good
If you got API banned you just have done something that's worth noticing
no it wasn't a for loop, my bot didn't have any rate limit handling, so I think a user probably just spammed commands
I found using sql and stuff like that really hard, and lots of stuff I dont understand, is there anything wrong with using JSON?
json aint meant for storing data
also, when I do something like this.
print(req.headers['Retry-After'])```
I get a number which is going down, but whenever the number hits 0 it resets back to 3600
neither is my brain, but it works
its just for economy
if you find it hard to work with SQL use an ORM or a noSQL db
however long it takes
lol
my bot took like 4 days
rip the retry after time just reset
it went from like 400 to 0 and now its back up to 3500
doesn't seem like its going to get fixed any time soon 😦
contact discord support
be specific about your issue or they're just going to bin your ticket to a bot
thats what i did
you should really handle the ratelimit doe
Doesn't the library handle rate limits?
Which lib?
dunno if he mentioned the lib, just said "my bot didn't have any rate limit handling"
it indeed does
How do webhooks work? Like I set up a route for it, but how do I get what the webhook is sending?
webhooks are reverse APIs
Does https://ko-fi.com/ gives an api??
Wdym?
instead of you making a request to the API, the API makes a request to you
An api is like you ask for something and it gives you
A webhook is the thing giving you the data?
Im so confused
A webhook is like something sending data to you?
yeah
But how do you read the data?
Wdym? How would I?
a webhook is nothing more than just a simple HTTP request
I don't really understand this stuff to well lol
you need to have a webserver open and listening to a port
Http request is like a url
well yes and no
a url is only a small part of a request
a request contains the url, headers and extra data in some cases
the bot reviewer applications are currently closed.
you get the data in the body of the request, that's the extra data
pretty sure it was in #announcements last time.
I don't understand how the additional information sent works
I will, lemme reasearch it dw
it's sent in the body of the request
How can I integrate https://ko-fi.com/manage/webhooks with discord webhooks so it sends a message in discord server
many webhooks are not compatible with each other.
you need to host your own webserver to act as a middleware between kofi and discord
.@drifting wedge this might help https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview#http_flow
HTTP isthe foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance text, layout description, images, videos, scripts, and more
the thing in the code blocks is how a http request looks like
you mostly won't encounter a raw format like that with modern day development
libraries handle a lot of that for you
Aiohttp is just requests but async right?
no idea, i don't work with python
Ok ty
Guys is this too much ram resource usage ?
yeah I am caching everything
:/
Feels stupid
im assuming you're using djs
Ty tho
yes
djs is a ram chonker
now its using 600mb
@old cliff
bruh
Mine is in like 700 servers and using like 130 mb
@earnest phoenix for a webhook I would setup a get thing?
i had around 250 (500 at peak activity) mb usage at 2500 guilds with c# and discord.net
@drifting wedge yup
I might have to use RAW event and caching nothing xD
@solemn latch is there anything else i should do to change my bot before resubmitting? (other than fixing that command)
My website handles data really weirdly, I don't like using complicated stuff, so I just use the js fetch
And get response from flask and see what response it matches with
well what was the message cache sweep thingy ?
not that i saw.
alright thanks 🙂
i cached every member in dapi, dbl and dbots (so around 200k members at the time) and didnt exceed 500mb 🤔
you might have to move libraries or the language entirely
look into d.js-light gives you way more control about the cache
its pretty much normal d.js just some of the caching stuff changed
How can I fix this error it shows cmds folder does not exist but it is there
You can see here
is the path correct?
Yes
then it should work
Im very confused, so the url I put for the dbl webhook api
For votes, let's say I set up the url and stuff
How do I get the data?
the DBL server sends a Call to your Webhook Server with the data
you can use this as your receiver. https://github.com/top-gg/python-sdk specifically the webhook section
Ty for spoon feeding me in the docs @slender thistle
Is it possible to make a backup bot that saves the permissions to with all role permissions? Then when you backup everything is normal.
sure but it could be a nightmare from a Data Security side of things
Uh
I've never seen a bot do like that
I feel like it would be useful
But leaking permissions if it happened isn't really bad is it?
https://github.com/Androz2091/discord-backup I think this saves all perms
@cinder patio can that be used as a public bot or only as a personal?
Read the license lmao
discordjs is MIT too, so how you could not use that then?
atleast what I remember
What is wrong
+eval message.guild.channels.cache.get(772051120595009549).message.fetch(798999326717640724).then(message => message.react('😄'));
convert the ids to string
also a message doesn't exist on a channel
^ .messages instead of .message
plus try to do .then(msg =>...) instead of .then(message =>...) since the message object already exists
Heyo, my bots in 80 servers so i think i should apply for verification. What exactly do I need to do, I find their docs confusing about it
you need to go to your bot page in the dev portal, click the bot section and follow the instructions
thx this makes so adiiference
ids are not stored as numbers due to how big they are xD
even at discord they use strings

I'm glad they were helpful
They weren't, the spoon feeding was
I don't read docs or Google
I have you!

Either spoon feed or shivaco feed

if(!message.member.roles.cache.some('750302895202762863')) return message.channel.send(embed)
typeerror: fn is not a function
why doesns't it work?
Hmmm
oh hey cry
guys i development a comand of translate and i have a error you can help me?
can someone tell me why does the bot goes offline even if there is no error in console and the bot still says its online in console?
this happens like after 6+7 hours of hosting on aws
u already asked it on discord.js server
this not aws suppport server xD
xd
Where does the token go?
I'm installing a public bot-open-source, says change the token then it's all good. But In node.js where is the token?
which one would the token be in
did there anyone know how to convert .ttf to .fnt?
Alp
yes
that's what happens if I do npm i discord.js
ok?
ok
if it still wont work
doing it rn
then idk
ok now start your bot
node <yourmainfile>
how do you use npm without knowing what it is
you just installed modules
npm stands for node package manager
you can also use yarn ofc if you want to
welp
@slim void why do you copy github sources
hey guys
sup
I don't?
cool
I made my own bot, however, I saw this new node.js backup bot that like..
how would i change the owner id? With a saved variable of message.author.id
copys perms and everything
and I wanted it 😄
for personal use
damn
it even copys embeds
rip api 😂
if anyone knows the asnwer, please ping me.
Awsome
do u think it's wrong to host someones bot that's on github and distribute it to others
I saw on github, it said: "I cannot afford to make this bot public", I figured what if I host it?
i think it is wrong if you don't credit the person that made it.
if he asked you to host it, then it's actually a good thing. If the did not ask you, you are doing something bad imo.
then it's good
k
do you know the answer btw?
Maybe I won't make it public
feels bad to do that
Plus idk how the bot rlly works
and if people start complaining or asking for updates.. yeah lol
miner mends
I think
that
you need to start over
with learning discord.js
and node stuff
because really to do stuff you want, first you need to understand them
@sharp prairie I agree
My first bot which is in 92 servers is made in discord.py
I tried doing bots in lua
Just wasn't my thing.
I've been learning js tho
oo noice
yeah python and javascript have big differences
and its tough to learn from one to another
it's tough to learn anything from Python
Except Scratch that's not a language
lmao true
I don't like python.
it's very messy in my opinion
Whereas JS looks more clean/organized.
The good thing about python is it's easy..
also whats ur bots name miner?
Hello everybody! So I'm trying to make a user info command. I created a -me command which works perfectly, but the other one which mentions a other user, gives a strange result. Here's the code and the result:
ever heard of GO and Swift ?
you can just do const member = message.mentions.users.first() || message.author
@tidal bluff how's the ID valid when username is invalid ?
So i have this collector ```js
collector1.on(collect, m => {
})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
@near stratus Tell me about it. Idk
@tidal bluff
@sharp prairie I saw that but the mentioned user isn't the command author (e.g it's not me)
did you actually mention someone
also it was supposed to be a Typeerror not undefined
No errors
somebody? 
Something like
Can't read property username of undefined
So i have this collector ```js
collector1.on(collect, m => {
})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
Absolutely no errors
question
@tidal bluff
try this
message.mentions.members.first()
cuz guild Probably don't define user that could be the issue
Hold on
and Probably message belongs to guild
@tidal bluff lol the problem is that it needs to be message.mentions.members.first()
do u even see me? can anybody help?
not message.mentions.users.first();
John Cena is screaming
@sharp prairie Like that
yes
yeah
and now it should work
ok but can somebody help me
hey! How do i change the object named "owner" to a variable i assigned for message.author.id
Same
wtf
huh ?
wut
So i have this collector ```js
collector1.on(collect, m => {
})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
what's so confusing?
Is it edit the json file?
i want to change the "owner' key's value.
to edit the owner value inside the json file, yes.
like permeantly like writing files ?
how edit..?
go to w3schools
Parse the json
like could we be a bit more specific.
So i have this collector ```js
collector1.on(collect, m => {
})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
Hmm
sending the same message 10 times is not going to help solve your issue.
@eternal osprey
fs.readFile('demofile1.json', (e, r) => {
//here parse it
}
hmm okay yeah
then after parsing change the value and write it
i actually already knew how to do the parsing etc.
Then wut
but the changing that is what leaves me hanging in the dark/
can at least someone respond because nobody is reacting on me
like what should i use? Replace? Any function to swap?
the "owner"is an object. The value is already set.
@eternal osprey after the above code just add this
fs.writeFile('demofile.json', 'new JSON object here', err => {
if (err) throw err;
console.log('Saved!');
});
i am trying to replace that value.
Yeah u can set it again bruh
but there are like different objects with different owner values in there.
like
let owner = { name : "js is bad use ts" };
owner = { name : "this is the new data"};
if i use this would it replace all the owner values?
@tidal bluff also use member.user.username
just use a JSON database
Nevermind, I managed to fix it
Thanks anyway, akio too.
i am literally using json
np glad to help
JSON and JSON Database are not same
It's a tool to handle JSON files easily
just search on npm
if u have a big and dynamic data then use proper database
{"2172646":{"id":800,"name":"Necrozma","level":9,"catchChance":1,"spawnId":1300980,"owner":"363191104465666048","catchTime":"01/13/2021 12:04 PM","nickname":""} this is how one object would look like.
json is good for static data
@eternal osprey f it use mongoDB
i can't
i would have to rewrite my whole, literally whole code.
w h y ?
@eternal osprey use a for loop
why would i want to loop it?
to find which object has the owner value you wanna change
aha i see.
anyone familiar with guildemojirolemanager?
guildEmoji.roles.set([`${args[1]}`])
so this was successful, and it added the emoji to the guildemojirole cache.
add the role to a member, and it doesn't apply the restriction removal upon gaining the role--cannot use the emoji despite having the role, and still is inaccessible to use
guildEmoji.roles.add(`${args[1]}`)
also does the same thing
me myself, i was thinking about using ```js
var obj1 = {
"key1" : "value1",
"key2" : "Value2"
};
var obj2 = {
"key3" : "value3",
"key4" : "Value4"
};
function swap(sourceObj, sourceKey, targetObj, targetKey) {
var temp = sourceObj[sourceKey];
sourceObj[sourceKey] = targetObj[targetKey];
targetObj[targetKey] = temp;
}
swap(obj1, "key1", obj1, "key2");
swap(obj1, "key1", obj2, "key4");
});```
I thought your json file was like
[
{
"key1" : "value 1"
"owner" : "16265226272762"
},{
"key1" : "value 2"
"owner" : "123467097653123"
}
]
wut ?
now this works if you have the role while adding it to the cache
but if you add the role to a member afterwards, it will not remove the restriction. i'm honestly a bit stumped
nope
it looks like this
wondering if i have to readd the role to the emojis everytime a guildmember is updated, one way for it to work. but now i'm looking at a lot of requests on an event
@eternal osprey
introducing proper code blocks
{
"2172646" : {
"id":800,
"name":"Necrozma",
"level":9,
"catchChance":1,
"spawnId":1300980,
"owner":"363191104465666048",
"catchTime":"01/13/2021 12:04 PM",
"nickname":""
}
}
so it's even easier
@eternal osprey here is your complete code after all this time
let o = <Object>;
o["7252525"].owner = "New Owner ID"; //Setting the owner ID
fs.write("myfile.json", JSON.stringify(o), e => {
//Handle error
});
@eternal osprey you there ?
but how would i use code blocks?
in my code
@near stratus
So i have this collector ```js
collector1.on(collect, m => {
})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
never worked with those
use 3 ` then define language
m is your param, so apply property content to it to get the content of what they said while your collector is active, then do something with it
if (m.content === "c"){
//do something
}
^example using if statement
i think he got a Brainfart and thought it where a thing in js
meanwhile i'm thinking i actually found a library issue in discord.js 
okay thank u
doesnt work
it just says nothing
no error
or something
No error, just saying specify a user to unban
, what’s wrong?
const member = message.guild.member.cache.get(args[1])right?
you can't mention a member who is banned
Yes so I can replace it with const member = message.guild.member.cache.get(args[1])
Right?
also its possible that the member is no longer in cache
yes
Hmm
fetch banned user from guild
So what should I do?
@earnest phoenix
And also change your username
It sounds weird
Why lol?
it actually means you're a pig in PewDiePie language
that whole coding is wrong as well,
"you cannot kick this user if you dont have ban members perm",
.setTitle("The Ban hammer has spoken")
.setDescription(user has been kicked by author) 
let bannedMemberInfo = await message.guild.fetchBans(); //fetch member here
const bannedMember = bannedMemberInfo.find(b => b.user.username.toLowerCase() === args[0].toLocaleLowerCase()) || bannedMemberInfo.get(args[0]) || bannedMemberInfo.find(bm => bm.user.tag.toLowerCase() === args[0].toLocaleLowerCase());
message.guild.members.unban(bannedMember.user.id)```
This is from my unban code
oh damn, but i want this name with me forever 
multiple users can have the same tag or the same username
yeah
you should probably AND that
wait same tag too ?
yes
a user cannot share the same tag and the same username
they're exclusive
they can have either the same username or the same tag
yeah that's what I got when I had Nitro
Lmao I was lazy and copied my kick commands embed reply

check if the Author has BAN permission before he can Unban
Yes I’ll also do that
So i have this collector ```js
collector1.on(collect, m => {
})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
well you need to a make a filter that checks for the presence of m or c then send a message that contains m or c
i have a filter
that exactly filters the m and c
but in that collector it needs to see if its m or c
that for m i want a different code than c
yeah but how bcz the way somebody saids doesnt work






