#development

1 messages ยท Page 1025 of 1

pure lion
#

Yeah?

#

Oh

#

U m

cobalt spruce
#

but with member

slender thistle
#

websocket receives a request from Discord with certain data -> data gets processed internally by the library -> library calls a function that's set as an event

pure lion
#

Windows XP shutdown noise<

cobalt spruce
#

lol

pure lion
#

Okay show ban and mute

digital ibex
#

make ur own websocket and library for your api and then you'll know how it works mmLol

solemn latch
#

Looks like your event is inside something grizz

pure lion
#

I'm gonna do that with my esolang at some point

cobalt spruce
#

@pure lion i changed them

pure lion
#

After I learn cpp

cobalt spruce
#

lol

pure lion
#

I'm confused

#

Do you need my help or not

cobalt spruce
#

.

#

.

digital ibex
#

nice dot

elfin flower
#

dt

cobalt spruce
#

dont try this at home

#

all my script on one file

#

lol

sudden geyser
#

not being modular notlikekaguya

digital ibex
#

basically my api

pure lion
#

That's very

high sonnet
#

oh god

solemn latch
#

your event seems to be inside something else, so its trying to run it

pure lion
#

One day I'll be

#

Dead

elfin flower
#

I put my code above all the ones in the event

#

the code is not in a while True loop

#

it still spams

weary ridge
#

all my script on one file
@cobalt spruce is that bad?

#

Mine is all on one file

cobalt spruce
#

@weary ridge THAT IS EPIC GAMER CODER MOMENT

solemn latch
#

modular code is much more manageable

cobalt spruce
#

000..000

weary ridge
#

Lul

elfin flower
#

i have another file called keep_alive that keeps my bot alive 24/7

weary ridge
#

Wow

#

Lol

cobalt spruce
#

message.guild.members.get is not a function
should i add cache?

elfin flower
#

message.guild.ban

#

is a function

solemn latch
#

@cobalt spruce pretty sure thats in the docs

#

๐Ÿค”

cobalt spruce
#

@solemn latch i see i done it thanks tohttps://discordjs.guide/additional-info/changes-in-v12.html#roles

elfin flower
#

learn about guilds

solemn latch
#

he is using djs

elfin flower
#

guild

#

oh

solemn latch
#

not python

elfin flower
#

my bot spams when i never told it to in the code

cobalt spruce
lusty quest
#

if you have a loop with no ending condition it starts to spam

#

or you loop a timeout (idk how the py equivalent is) with a really short delay it spamms

cobalt spruce
#

am not pro at english

#

bruh

solemn latch
#

options need to be an object

#

{}

cobalt spruce
#

ok

elfin flower
#

ok

#

um

#

im gonna

#

make a return

#

that will break

#

the while true

placid iron
#

@cobalt spruce how many lines?

elfin flower
#

is that

#

do

#

how do i do that

#

id id

#

i do

cobalt spruce
#

@placid iron 485

solemn latch
#

didnt you say you got rid of the while true @elfin flower

placid iron
#

not that bad i had a discord bot that was over 1500 lines at a time

#

XD

elfin flower
#

i did

#

but

#

the return will return a break

#

what am i saying

placid iron
#

i managed to get it down to around 800 now

cobalt spruce
#

@placid iron DONT USE ANY HANDLERS

#

lol

#

ur enter BUTTON WORKING

#

enjoy

placid iron
#

wdym handlers. do you mean those @bot.event things

#

and yeah i do like my whitespace

#

XD

cobalt spruce
#

0.0

unborn fulcrum
#

Anyone know how I can make my djs v12 bot take a user ID instead of a mention?

solemn latch
#

?

#

or the input taking an id

unborn fulcrum
#

I want the input to take an id yes

#

like >warn <ID> <reason>

pale vessel
#

use args

unborn fulcrum
#

well of course

pale vessel
#

find a member with that id

elfin flower
#

aaaa

solemn latch
#

you might wanna check if its the right format to be an id

#

which i think regex would do

unborn fulcrum
#

alright, I just figured it out, thanks :)

earnest phoenix
#

I figured it out. Basically what I did is since all of my commands extend the same base class, I can use Class.forName("CLASSNAME") and then use class.newInstance() with a default constructor that just writes an object containing the help information and then use the BaseCommand's getHelp method (that every command has overwritten) to retrieve it

#

^My question from earlier in case anyone else had a similar problem

elfin flower
#

@client.event
async def on_message(message):
if message.author.id != 612900626799788042:
if "AHHHHHHHHHHH" in message.content:
await message.channel.send("ok")

#

it spams ok fsr

#

help

slender thistle
#

What's that ID

elfin flower
#

my id

delicate shore
#

can anyone help me

slender thistle
#

Are you sure it's that event that's spamming

delicate shore
#

UnhandledPromiseRejectionWarning: TypeError: client.users.has is not a function

#

i get thus

elfin flower
#

es

#

yes

delicate shore
#

when using unban comman

slender thistle
#

tried restarting code?

elfin flower
#

yes

delicate shore
#
if(command === "unban"){
    if(!msg.member.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, You do not have perms to unban someone`)
    }
    
    if(!msg.guild.me.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, I do not have perms to unban someone`)
    }
    
    let userID = args[1]
    let reason = args[2]
    
      msg.guild.fetchBans().then(bans=> {
      if(bans.size == 0) return 
      let bUser = bans.find(b => b.user.id == userID)
      if(!bUser) return
        if (!client.users.has(args[1])) return msg.reply("Couldn't find user")
      msg.guild.members.unban(bUser.user)
        
        let bruhgggg = msg.author
        const unban = new Discord.MessageEmbed()
        .setDescription("Member Unbanned")
        .addField(`Member id : ${userID}` ,`By: ${bruhgggg}`)
        .addField(`Reason` ,`${reason}`)
        .setFooter(`s!help For Commands`)
        msg.channel.send(unban);
})
    console.log(args)
    
  };
    ```
solemn latch
#

your on 12 correct @delicate shore ?

delicate shore
#

my code

#

yes

solemn latch
#

cache?

#

๐Ÿค”

delicate shore
#

client.cahce.user?

#

cache*

solemn latch
#

client doesnt have the property cache

#

users does

delicate shore
#

oh

#

then?

#

users.cache?

#

client.users.cache?

#

@solemn latch ?

strange trout
#

Check the docs

#

It takes seconds

delicate shore
#

i cannot rn

#

i am pc

#

not on*

summer torrent
#

yes

solemn latch
#

you know, phones also have browsers

delicate shore
#

but

solemn latch
#

i look at docs all the time on my phone

delicate shore
#

it's diffuclt on mobile

strange trout
#

What

delicate shore
#

moreover my phone is 5 percent

solemn latch
#

the doc website on mobile is really good

#

actually

delicate shore
#

ahh fine link me to docs smh

summer torrent
#

client.users.cache?
@delicate shore yes

strange trout
#

Look them up

delicate shore
#

ok

summer torrent
delicate shore
#

hey

#

my unban command not workingll

#

still

strange trout
#

rip

delicate shore
#

[ 's!unban', '432533456807919639', 'test' ]

#

args are fine

#

because it's logging this

#

so

slender thistle
#

@summer torrent #bot-details-page #details .container -> border-top: none

strange trout
#

Show code where you're unbanning

delicate shore
#

o

#

i sent it

strange trout
#

i see

delicate shore
#

one min

#

i ama send agai

#
if(command === "unban"){
    if(!msg.member.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, You do not have perms to unban someone`)
    }
    
    if(!msg.guild.me.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, I do not have perms to unban someone`)
    }
    
    let userID = args[1]
    let reason = args[2]
    
      msg.guild.fetchBans().then(bans=> {
      if(bans.size == 0) return 
      let bUser = bans.find(b => b.user.id == userID)
      if(!bUser) return
        if (!client.users.cache.has(args[1])) return msg.reply("Couldn't find user")
      msg.guild.members.unban(bUser.user)
        
        let bruhgggg = msg.author
        const unban = new Discord.MessageEmbed()
        .setDescription("Member Unbanned")
        .addField(`Member id : ${userID}` ,`By: ${bruhgggg}`)
        .addField(`Reason` ,`${reason}`)
        .setFooter(`s!help For Commands`)
        msg.channel.send(unban);
})
    console.log();
    
  };
    ```
#

@strange trout i checked thrice it keeps on syaing member not found

summer torrent
#

@slender thistle thanks

delicate shore
#

but it's there

cobalt spruce
solemn latch
#

cache does not have to have a user

#

cache is just the cache

delicate shore
#

oh

#

wo

cobalt spruce
#

@solemn latch is it good man?

delicate shore
#

nice @cobalt spruce

cobalt spruce
#

thanks bro

delicate shore
#

cache does not have to have a user
@solemn latch ???

#

wait then what should come there

#

like

#

if i do (!user)

#

then it just looks for arg

#

but i wanna see if the user is in the server

solemn latch
#

your unbanning someone

#

he cant be in the server

delicate shore
#

oh

#

i am mad

solemn latch
#

lol

delicate shore
#

but he has to be a valid use

#

how to check that

solemn latch
#

tbh, ive never worked on a moderation bot, im not sure

delicate shore
#

oh

#

ok

#

lol

solemn latch
#

pretty sure fetchban returns a user?
maybe

#

๐Ÿคทโ€โ™‚๏ธ

delicate shore
#

hmm

#

i think @strange trout can help

earnest phoenix
#

why u using then?

delicate shore
#

.

earnest phoenix
#

hey guys i just wondered if anyone here is good with evals ive worked with a bit of evals before but i seem to be getting unexpected identifier on this part of it

client.shard.broadcastEval(`
        const guild = this.guilds.cache.get('${result[0].guildid}');
                if (guild) {
          const adEmbed = createEmbed(guild, ${result[0]}, ${msg});
                    const adChannel = this.channels.cache.get('71154296197132810');
                    adChannel.messages.fetch().then((adMessages) => {
                        adMessages.forEach((adMessage) => {
                            if (adMessage.author.bot) adMessage.delete();
                        });
                    });```
delicate shore
#

@earnest phoenix i am?

earnest phoenix
#

yes u

strange trout
#

I've never done moderation. But by the looks of it I'd use the fetchBan() method instead since it returns a user

#

So you don't have to filter

delicate shore
#

oh

#

how to use it can u ?

#

pls...

strange trout
#

Look at the docs

earnest phoenix
#

lol

delicate shore
#

ah

#

๐Ÿ˜ญ

strange trout
#

Not going to spoon feed

delicate shore
#

oof

#
if(command === "unban"){
    if(!msg.member.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, You do not have perms to unban someone`)
    }
    
    if(!msg.guild.me.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, I do not have perms to unban someone`)
    }
    
    let userID = args[0]
      msg.guild.fetchBans().then(bans=> {
      if(bans.size == 0) return 
      let bUser = bans.find(b => b.user.id == userID)
      if(!bUser) return
      msg.guild.members.unban(bUser.user)
})
    
  };```
earnest phoenix
#

learn it

delicate shore
#

this code works

earnest phoenix
#

use then

#

ยฏ\_(ใƒ„)_/ยฏ

delicate shore
#

but

#

it never tells if member is valid

earnest phoenix
#

anyone good with evals here?

#

if (!bans.has(id)) return

#

:p

#

sorry lol

delicate shore
#

is this

earnest phoenix
#

anyone good with evals here?
@earnest phoenix I don't think so

delicate shore
#

the correct

earnest phoenix
#

try

delicate shore
#

oooh

strange trout
#
// Permission logic [x]

const [id, ...reason] = args
 
// check the ID with regex to see if it's valid

//fetch the ban 

await <Guild>.fetchBan(id)

// rest of logic here
delicate shore
#

why is there ..........

#

that's for me just to fill args ?

#

right ?

strange trout
#

No, just a little destructuring

delicate shore
#

ok

#

thnx

cobalt spruce
delicate shore
#

omg guys

#

i found an extension

cobalt spruce
#

@solemn latch

#

take a look up there

delicate shore
#

i thought it was a joke

#

but this really qorks

honest perch
#

dont copy code

#

ew

delicate shore
#

it tells the code acc to your search python and discord.js

earnest phoenix
#

lol

delicate shore
#

i won't

#

i already have my ready

#

i wanted to see fetch

#

so i searched

cobalt spruce
#

@delicate shore bro thats old

solemn latch
#

its actually really nice for small basic things you sometimes forget

delicate shore
#

yes

#

it's free extension

solemn latch
#

anything more than that its useless

strange trout
#

That's why docs exist lol

golden condor
#

Or you could like read the docs

#

And figure it out

strange trout
#

You can refer to them if you forget something

delicate shore
#

but there is not clearly mentioned

#

everything

golden condor
#

Dude

#

Everything is on the docs

cobalt spruce
strange trout
#

docs don't spoon feed either

solemn latch
#

docs mention everything, you just need to understand it

delicate shore
#

not fetch command

#

they don't tell

#

anything

golden condor
#

It doesn't give you the exact code

delicate shore
#

like not understanding also

solemn latch
#

careful with changing like that.
too fast and its considered api abuse @cobalt spruce

strange trout
#

fetchBan

#

right there

delicate shore
#

oh

golden condor
#

And yes <Manager>.fetch is on there

cobalt spruce
#

@solemn latch what is the best time for that

golden condor
#

Oh he meant that

delicate shore
#

i searched and got this

strange trout
#

returns a promise with ban info

cobalt spruce
#

soo i dont get api blocked

delicate shore
#

ok

cobalt spruce
#

lol

strange trout
#

And takes a user resolvable as the param

golden condor
#

Yeah all .fetch is await as it grabs from the api

solemn latch
#

mine changes at a min of 20 minutes inbetween changes, and only changes when my server count changes.

since you want it to change, 2 minutes maybe?

golden condor
#

@cobalt spruce the max you can do is 6 times per minute. I change the status every 20 secs

cobalt spruce
#

@golden condor ok

golden condor
#

It's once every 10 seconds that is the max

earnest phoenix
#

anyone know about evals tho

delicate shore
#

difference between fetch ban and fetch bans?

golden condor
#

@earnest phoenix search up the eval() fucntion

solemn latch
#

broadcast eval just runs code

strange trout
#

Did you read the docs

solemn latch
#

๐Ÿค”

delicate shore
#

Did you read the docs
@strange trout i am

#

rn

earnest phoenix
#

@solemn latch i know how to use them.....

strange trout
earnest phoenix
#

just im having trouble with one part

golden condor
#

You didn't say that you knew

delicate shore
#

yes i am readin that

golden condor
#

Can you be more specific than "one part"?

earnest phoenix
#

i did in till this channel got spammed with pointless questions lol

solemn latch
#

their questions are just as valid as any

golden condor
#

Can you quote the message or smth

solemn latch
#

๐Ÿค”

earnest phoenix
#

basically im having issues with this part

client.shard.broadcastEval(`
                const guild = this.guilds.cache.get('${result[0].guildid}');
                if (guild) {
                    const adEmbed = createEmbed(guild, ${result[0]}, ${msg});
                    const adChannel = this.channels.cache.get('712397868576800779');
                    adChannel.messages.fetch().then((adMessages) => {
                        adMessages.forEach((adMessage) => {
                            if (adMessage.author.bot) adMessage.delete();
                        });
                    });```
#

unexpected identifer

golden condor
#

That... is the entire function

#

And on which line

cobalt spruce
#

@solemn latch 5000 this means 5 sec am right

#

??

delicate shore
#

guys can anyone take some time out of their busy schedule

earnest phoenix
#

@golden condor nope theres a whole other part

solemn latch
#

yeah

golden condor
#

Dude we already told you@delicate shore

delicate shore
#

and help me in making understand fetch bans

#

i am not getting it

#

like i got the code

strange trout
#

You don't even need to fetch the ban

delicate shore
#

but i wanna understand

golden condor
#

Read. The. Docs.

solemn latch
#

fetchbans returns a promise, of a collection

delicate shore
#

i. am. reading.

solemn latch
#

fetchban returns a promise of a BanInfo

golden condor
#

It shows you what it returns

cobalt spruce
#

@solemn latch 20000 means 2 min

#

am confused

delicate shore
#

what is it's usage

solemn latch
#

20,000 means 20 seconds

delicate shore
#

20000 means 2 min
@cobalt spruce 20 sec

cobalt spruce
#

what is 2 min

hoary elm
#

@solemn latch 20000 means 2 min
@cobalt spruce Bots usually use MS iirc 1000 ms I second

cobalt spruce
#

WHAT IS THE NAME OF THAT TIME THING

solemn latch
#

60 x 2 x 1000

golden condor
#

@earnest phoenix which line is it on

delicate shore
#

wait

lusty quest
#

miliseconds

delicate shore
#

no

#

lol

#

120000

#

i think so not sure

hoary elm
#

^^

#

Correct

delicate shore
#

ok

strange trout
#
try {
  <GuildMemberManager>.unban(user)
} catch (err) {
  // handle error
} 
golden condor
#

Is the manager the cache bit?

#

Or the bit before the cache

#

I'm never sure

strange trout
#

If the user isn't banned it'll return an Unknown Ban error which you can handle

solemn latch
#

client.users
users would be the manager
cache would be the cache of the manager

strange trout
#

No it's on the manager itself

golden condor
#

Ah

solemn latch
#

i think ๐Ÿค”

golden condor
#

Ok

strange trout
#

So

message.guild.members.unban()
golden condor
#

Yeah that's it

delicate shore
#

how many days will it take

solemn latch
#

client.users would be the UserManager

delicate shore
#

to go through whole docs

solemn latch
delicate shore
#

of discord.js

strange trout
solemn latch
#

you dont need to go through the entire docs @delicate shore

#

you go to the docs when you dont know something

strange trout
#

@earnest phoenix yo

delicate shore
#

i wanna know everything

#

which i dunno

#

i have not read them

#

i learnt through tuotrials

strange trout
#

Well when you need it to learn it read it

delicate shore
#

of code lyon

#

setigng?

hoary elm
#

Yes

delicate shore
#

if(!message.memeber.hasPermission("YOUR PERMS HERE")){
return msg.reply("You dont have perms")
}

#

this is for perms ^^^

#

and now for say

#

wait

strange trout
delicate shore
#

don't use caps

strange trout
jaunty junco
#

(its discordia btw)

strange trout
#

Are you sure the error is coming from there?

delicate shore
#

@strange trout so it will be like js try{ msg.guild.members.unban(bUser.user) }catch (err){ msg.reply("Unknown ban") }

jaunty junco
#

yes

#

100% sure

strange trout
#

@delicate shore try and see

delicate shore
#

ok

jaunty junco
#

line 90 is the second if statement

delicate shore
#

bye

sudden geyser
#

I'm not experienced with Lua, but are you trying to compare nil with a number?

delicate shore
#

@strange trout it's not jining args

strange trout
#

what

delicate shore
restive pebble
#

.join lol

delicate shore
#

i am doing ^^

jaunty junco
#

I'm not experienced with Lua, but are you trying to compare nil with a number?
@sudden geyser i guess i am?

delicate shore
#

but it's not working @restive pebble

strange trout
#

Lemme see your code where you put reason

restive pebble
#

splice then join

delicate shore
#

ok

wary flame
#

What is the best way to get a guild by ID when sharding?

delicate shore
#
f(command === "unban"){
    if(!msg.member.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, You do not have perms to unban someone`)
    }
    
    if(!msg.guild.me.hasPermission("BAN_MEMBERS")) {
      return msg.channel.send(`**${msg.author.username}**, I do not have perms to unban someone`)
    }
    
    let userID = args[1]
    let reason = args[2].join()
    
    if(!userID) return msg.reply("Mention a user lul")
    
      msg.guild.fetchBans().then(bans=> {
      if(bans.size == 0) return msg.reply("Bruh noone in this server is banned")
      let bUser = bans.find(b => b.user.id == userID)
      if(!bUser) return msg.reply("User not banned lol")
       // if (!client.users.cache.has(args[1])) return msg.reply("Couldn't find user")
     
        try{
        msg.guild.members.unban(bUser.user)
        }catch (err){
          msg.reply("Unknown ban")
        }
        let bruhgggg = msg.author
        const unban = new Discord.MessageEmbed()
        .setDescription("Member Unbanned")
        .addField(`Member id : ${userID}` ,`By: ${bruhgggg}`)
        .addField(`Reason` ,`${reason}`)
        .setFooter(`s!help For Commands`)
        msg.channel.send(unban);
})
    console.log();
    
  };
    ```
jaunty junco
#

What is the best way to get a guild by ID when sharding?
@wary flame give the library you are working on

restive pebble
#

args.slice(2).join(" ")

delicate shore
#

okkokokokokokokokok]kokok

wary flame
#

discord.js @jaunty junco

restive pebble
#

u are taking the string directly

#

and joining

jaunty junco
#

discord.js @jaunty junco
@wary flame ok, but i cant help you sorry.

strange trout
#

I think destructuring looks cleaner

const [id, ...reason] = args
wary flame
#

Thanks for your time anyways

strange trout
#

Or

const [, id, ...reason] = args
opal plank
#

Anyone good with SQL syntax?

strange trout
#

Somewhat, what are you trying to do?

opal plank
#

say i have this object

let foo = {name: 'test', location:'somewhere'}```
Now i have a postgres jsonb table
its contains an array of objects inside like foo above.
To query filter it i can do ``filter->>'name'`` to find the proper row that its contained, however:
```js
//in the table
[{name:'bob', location:'bar'}, {a:1, b:2}, {n:1, m:4}]```
lets say i want to  replace  ``{a:1, b:2}`` obj in that table with the ``foo`` mentioned above(order doesnt matter)
the only non destructive way i see to get that would be using operator ``#-`` with the index of that object.
however im not seeing a way in SQL to get index of that object to define it to be deleted without destroying the array and checking individually
or returning the obj to js and then resending it after its been parsed on the code(instead of using SQL query)
any tips?
#

Im trying to efficiently query the removal of a specific obj in the array of a jsonb table, without querying twice or bringing back the obj to the code

strange trout
#

Hmm, from what I know. I don't think you can use an SQL query to do that. You have to query the database, use JavaScript array methods on said array and then update it

#

That's what I do

opal plank
#

thats the problem, doing 2 database calls with the code would take way too much time

#

the code is time sensitive

#

just the first query is taking 100 ish ms to complete

#

adding logic and then doing another call to update it would bring it way higher

restive pebble
#

if(message.member.hasPermission("SEND_MESSAGES") @earnest phoenix

strange trout
#

Why is it taking so long? I do it a lot for some of my commands and it seems to be pretty quick

opal plank
#

cuz the tables are enormous

#

im doing BLOBs on some of them, that requires transactions, it takes more time

pure lion
#

Tables do be kinda thicc

strange trout
#

Dunno then. I've never worked with super large data sets

cobalt spruce
#

WTH

#

is this

strange trout
#

version

cobalt spruce
#

why its nane

#

v12

#

it old command

strange trout
#

ping is through websocket

sudden geyser
#

If you look at the Client class in the documentation, you'll notice there's no .ping property. But there is .ws.ping instead.

cobalt spruce
#

@strange trout can u just tell me what line am rong in or how i fix it

sudden geyser
#

Also that doesn't represent api latency

strange trout
#

I did

median star
#

poge

strange trout
#

You can just check if they have SEND_MESSAGES

#

Yeah that's my bot

solemn latch
#

thats an eval command

#

it runs code, via a command

#

for testing and stuff

strange trout
#

^

#

It does a lot of things though amariLul

opal plank
#

i wonder how many bots i can get offline by doing eval process.exit()

#

in testing1

hoary elm
#

Usually a requirement to having a bot here with that command is not making it accessible by everyone

strange trout
#

Wouldn't be surprised if there are some

opal plank
#

keyword USUALLY

hoary elm
#

But ^^

sudden geyser
#

laughs in kotlin

solemn latch
#

most peoples eval command isnt listed

#

as a command

opal plank
#

its not hard to figure it out either, prefix+ eval

solemn latch
#

๐Ÿคทโ€โ™‚๏ธ

strange trout
#

I wonder how many people have their token accessible through eval

hoary elm
#

Yikes

opal plank
#

ez token grabb

hoary elm
#

^^ making sure thatโ€™s not possible is the first thing I usually do

regal raven
#

What is eval?

#

๐Ÿค”

hoary elm
#

Helps debug

#

Etc

regal raven
#

Ooooh

#

I use .env ๐Ÿ™‚

hoary elm
#

Thatโ€™s the environment

strange trout
#

You can get your bots token through client.token

regal raven
#

Hm

#

Ooooh

#

Wow

lusty quest
#

i have a function that removes the token from the eval

strange trout
#

I just match and replace with regex

solemn latch
#

my eval command only works in one channel

hoary elm
#

I just match and replace with regex
@strange trout same

solemn latch
#

in a discord server only im in, in a room that requires admin to see

strange trout
hoary elm
#

Yeah looks clean doing it that way

autumn dust
#

u!discrim

#

@limber sphinx

strange trout
#

Nice

jaunty junco
#

that wasnt the order for the images i wanted but sure....

elfin flower
#

i fixed the spamming problem

#

yay

delicate shore
#

my bot cannot use nitro emoji'?

#

bot is in my serverv

crimson vapor
#

there is a special way to send emojis

delicate shore
#

HOW

#

sry for caps

crimson vapor
#

I forget gimme sec lol

delicate shore
#

by mistake

#

ok

strange trout
#

Like that

crimson vapor
#

yea

solemn latch
#

it also needs to be in the guild with the emoji

strange trout
#

If it's unicode then \๐ŸŒ

solemn latch
#

from what i understand

delicate shore
#

what is that

#

35..

solemn latch
#

the id

delicate shore
#

that is emoji number??

solemn latch
#

of the emoji

delicate shore
#

emoji id

#

ok

#

thnx

#

@solemn latch how to get

#

it

#

the id of emoji

solemn latch
delicate shore
#

um

#

wot

#

.emojiid :gg:

#

:gg:

solemn latch
#

๐Ÿค”

delicate shore
#

@solemn latch

try {
          msg.channel.send(`:sheep_dance:
 Fetchhing song, pls wait. **This might take time depending on current ping and cpu usage.**`)
  .then(msg => {
    msg.delete({ timeout: 3000 })
  })```
#

it's still not working

solemn latch
#

you didnt change anything

#

from what i can tell

delicate shore
#

i did

#

oh

#

it is not showing here

#

i actully added

#

the id of emote aswell

#

but it is not wokring

solemn latch
#

then edit your code here, to show what you put

delicate shore
#

see

solemn latch
#

is your bot in the server with that emoji

delicate shore
#

yes

#

it is in my server

crimson vapor
#

hmm

pale vessel
#

are you sure you didn't copy the message id instead

delicate shore
#

yes

crimson vapor
#

very likely as ids are just now at 72 as starting

delicate shore
#

i copied the image adress

solemn latch
#

image adress?

delicate shore
#

and then cropred the

solemn latch
#

just copy the id

crimson vapor
#

try getting the ID again, it looks like that is a message id

pale vessel
#

the id is in the url so it's fine

elfin flower
#

is this how i make/delete a channel
await message.guild.channels.delete()
await message.guild.channel.create()
if not tell me so i dig around more on discord py doc

delicate shore
#

i copued that id

crimson vapor
#

oh

#

nvm

summer acorn
#

is this not possible?

scores !== null ? {
        let totalScore = 0;
        scores.forEach(score => {
            totalScore+=score.score;
        });
        await totalScore;
        await channel.sendMessage(`Total score collected this match: ${totalScore}`);
        } : null
delicate shore
#

so what to do ? @crimson vapor

crimson vapor
#

im not sure as I do not use emojis

delicate shore
#

oh

#

๐Ÿ˜ฆ

#

mee6 does

jaunty junco
#

guys how to check if the one issuing the bot command has perms to ban? (in discordia)

pale vessel
#

does your bot have the send external emojis permission

solemn latch
#

only time ive ever used emoji's is by fetching the emoji

delicate shore
#

does your bot have the send external emojis permission
@pale vessel yes it has admin perms in my server

#

and the emoji is also in same server

pale vessel
#

๐Ÿ˜ฉ

summer acorn
#

@delicate shore code?

#

I've worked with emojis in the past.

delicate shore
#

@summer acorn ^^

pale vessel
#

wait a minute that emoji is animated so it needs to be <a:name:id>

#

lol

delicate shore
#

really?

pale vessel
#

add an a

delicate shore
#

that sucks

pale vessel
#

yeah

pure lion
#

What is coffeescript

delicate shore
#

lemme try afain

summer acorn
#

are you sure that is the correct id?

delicate shore
#

it's a coffe

pale vessel
#

it is

delicate shore
#

with script

summer acorn
#

and emote name

delicate shore
#

yes

pale vessel
#

did it fix it

delicate shore
#

lemme see

pale vessel
#

it should fix it

pure lion
#

Jฤ™vร  sฤrรฏรŸt

delicate shore
summer acorn
#

ok, why is it multiple lines?

pale vessel
#

confidence 100

delicate shore
#

it worked @pale vessel

#

thnx

pale vessel
#

nice man

delicate shore
#

๐Ÿ™‚

pale vessel
#

why not just an if statement

summer acorn
#

uh, true.

#

I just thought that would be a bit better.

golden condor
#

Hello,
I am making a custom mongoose Schema class and I recieve this error:

OverwriteModelError: Cannot overwrite `Guilds` model once compiled.```
This is the class code:
```js
const mongoose = require('mongoose');
class Schema extends mongoose.Schema {
    constructor(name, data) {
        super(data)
        this.model = mongoose.model(name, this)
        this.model.get = async (options, callback) => {
            this.model.findOne(options, (err, res) => {
                return callback(res, err);
            });
        }
        this.model.title = name
        this.model.delete = async (options, callback) => {
            this.model.findOne(options, (err, res) => {
                if (res) {
                    res.delete()
                    return callback(true)
                }
                else return callback(false)
            })
        }
        return this.model
    }
}
module.exports = Schema```
I'm not sure why this doesn't work as it was working earlier
delicate shore
#

hey

#

i am having issues

#

with google commadn

#

any suggestion for fun commands ?

#

other than the 8ball

golden condor
#
    loadSchemas() {
        const models = fs.readdirSync("./Models/")
        for (var model in models) {
            delete require.cache[require.resolve("../Models/" + models[0])]
            model = require(`../Models/${models[0]}`)
            this.db[model.title] = model
            this.log(`${model.title} was loaded`)
        }
    }```This is my code for handling Schemas
delicate shore
elfin flower
#

aaaaaaaaaaaaaaaaaaa

#

is there a way i can mention all channels in the guild?

#

message.guild.channels?

amber fractal
#

map the collection

#

on d.js

delicate shore
elfin flower
#

bruh

#

nvm

delicate shore
#

no

#

i am stealing emojis

#

with carl

elfin flower
#

ok

delicate shore
amber fractal
#

if I didnt have it wrap in a code block, that'd mention all channels

elfin flower
#

the doc says there is a text_channel.delete()
but the error is telling me text_channel has no attribute called delete

solemn latch
#

is your code
text_channel.delete

elfin flower
#

uh

slender thistle
#

What does your code look like

elfin flower
#

yes

solemn latch
#

or
text_channel.delete()

elfin flower
#

i did with the brackets

#

is that not how its supposed to be

solemn latch
#

it was just a first thought.
pretty sure with the () is correct

slender thistle
#

What's text_channel

elfin flower
#

await message.guild.text_channels.delete()

slender thistle
#

well

elfin flower
#

wait is it text_channels or text_channel

slender thistle
#

Neither

marble juniper
#

lol

slender thistle
#

Let me explain a bit of it

marble juniper
#

isn't it just channels

elfin flower
#

or TextChannel

marble juniper
#

I think its just channels

slender thistle
marble juniper
#

oh

#

ok

slender thistle
#

channels includes voice and category channels

marble juniper
#

k

elfin flower
#

it is a list

slender thistle
#

Yes

elfin flower
#

but how do i delete the channels in the list

slender thistle
#

That list consists of TextChannel objects

elfin flower
#

thats what im trying to do

#

oh

slender thistle
#

you either iterate over the list or just a separate element

elfin flower
#

text_channels.TextChannels

crimson vapor
#

are you trying to nuke a server?

elfin flower
#

im testing discord py stuff on my test server

crimson vapor
#

ok

elfin flower
#

text_channels.TextChannels
@elfin flower no

marble juniper
#

(safe a nuke)

surreal notch
#
client.on('ready', () => {
    client.user.setStatus('online')
    client.user.setPresence({
        game: {
            name: 's!help',
            type: "STREAMING",
            url: "https://www.twitch.tv/"
        }
    });
});```
Why my status is not updating in v12
#

ยฏ_(ใƒ„)_/ยฏ

pale vessel
#

there's no such thing as game for setPresence anymore

#

it's called activity now iirc

surreal notch
#

lel

pale vessel
#

anyway, refer docs

#

always do that before asking

surreal notch
#

i do but...

#

i didnt get it

pale vessel
#

sorry to break it down to you but if you can't read docs properly, you won't be able to code properly

elfin flower
#

if you use discordpy

marble juniper
#

if you don't understand docs then we can't help either

slender thistle
marble juniper
#

lol

elfin flower
#

h

slender thistle
#

Essentially your text_channels consists of those objects

#

each element is a TextChannel object that can be deleted if you iterate over them

#

aka a for loop

marble juniper
#

name="i-love-children"

slender thistle
#

test server feat. meme channel memes

pale vessel
#

ttb moment

elfin flower
#

i

surreal notch
#

@pale vessel ```client.on("ready", () => {
client.user.setActivity(Use s!help., {type: "playing"});
});

#

Not updating status

#

ยฏ_(ใƒ„)_/ยฏ

elfin flower
#

what language is taht

pale vessel
#

isn't it PLAYING

elfin flower
#

that*

solemn latch
#

js

surreal notch
#

discord.js v12

elfin flower
#

oh

#

then i cant help

pale vessel
#

i demand you to read docs

surreal notch
#

@pale vessel nope

elfin flower
#

im a discord py man

surreal notch
#

could u share @pale vessel

pale vessel
#

on mobile, too lazy

#

sorry mate

surreal notch
#

lel

slender thistle
#

v12 is stable now, right

pale vessel
#

yeah

solemn latch
#

yes

slender thistle
surreal notch
#

||sir has entered the chat||

elfin flower
#

wait

pale vessel
#

it's PLAYING

#

did you try that

surreal notch
#

oh

#

let me see

pale vessel
#

you said "nope"

#

double check

surreal notch
#

Mine is in small

#

w8

#

i got it

elfin flower
#

on discord py its
await client.change_presence(activity=discord.Game(name='Playing game'))
to change activity

surreal notch
#

i putted playing but it is PLAYING

elfin flower
#

put*

pale vessel
#

if only you read the docs shivaco sent...

surreal notch
elfin flower
#

v

#

await discord.TextChannel.delete()

#

didnt work either

pale vessel
#

aren't you supposed to loop through the channels? TextChannel doesn't sounds like it's from a loop

slender thistle
#

discord.TextChannel doesn't

elfin flower
#

for loop

slender thistle
#

Show your code

elfin flower
#

i deleted it

solemn latch
#

control + z

#

to undo

elfin flower
#

await discord.TextChannel.delete()
@elfin flower was my code

#

and i deleted it'

solemn latch
#

i think he wants the entire command/code

slender thistle
#

Alright

elfin flower
#

ok

#

what now

pale vessel
#

maybe you should learn python

slender thistle
#

The docs say discord.TextChannel.delete because delete is a method of an instance of discord.TextChannel (if you could use it on the class itself, it would say classmethod in the docs)

pale vessel
#

i may not know python, but it seems like a solution for you

earnest phoenix
#

I'm so confused, the user is in the server, the bot is in the server but it still returns undefined. (JavaScript)

console.log(client.users.cache.get("314470444713377800"))

I've even tried this but still the same result:

console.log(message.guild.members.cache.get("USERID"))
#

And the ID's are correct

pale vessel
#

chances are the user is not cached

#

have you tried fetching the user?

earnest phoenix
#

the fetch method returns a promise, right?

pale vessel
#

yeah

#

you only need to do it once and your bot will cache it

earnest phoenix
#

I don't think it'll be ideal for this circumstance, here let me show you

slender thistle
#

The docs say discord.TextChannel.delete because delete is a method of an instance of discord.TextChannel (if you could use it on the class itself, it would say classmethod in the docs)
Guild.text_channels where Guild is an instance of a guild (you get it from message.guild) returns a list that contains those TextChannel instances. Iterating over that list (with a for loop) you will get access to each element and be able to use it

solemn latch
#

@earnest phoenix fetch gets from the cache first, if its not in the cache it gets it from discord iirc.

#

cache doesnt have to have a user in it

#

its only users that have previously been cached

earnest phoenix
#

I'm making a request to my webserver which is hooked up to my SQLite database.
I'm making a leaderboard feature which will display the top 10 users on the server.
It successfully returns the top ten users / and they are also ordered, they come through like this:

[
  { userid: 314470444713377800, wallet: 100, bank: 8900, tokens: 0 },
  { userid: 420366170428801000, wallet: 0, bank: 900, tokens: 0 },
  { userid: 480171429929680900, wallet: 100, bank: 0, tokens: 0 }
]

This is what i'm trying to accomplish...

var embed = new Discord.MessageEmbed()
      .setTitle(`Banked Money Leaderboard | Top ${config.economy.leaderboardLimit}`)
      .setDescription(`${fetchUsers.body.map(x => `${fetchUsers.body.indexOf(x) + 1} โ€ข ${client.users.cache.get(toString(x.userid)).tag}: ${config.economy.currency} \`${x.bank}\``).join("\n")}`)
      .setColor('GREEN')
      return message.channel.send(embed).catch(console.error);
slender thistle
#

Guild.text_channels where Guild is an instance of a guild (you get it from message.guild) returns a list that contains those TextChannel instances. Iterating over that list (with a for loop) you will get access to each element and be able to use it
As a small example:

my_list = [object1, object2, object3] # assume all objects have a method .delete()
for object in my_list: # iterating over the list
    await object.delete() # accessing the current element in the list and using .delete() on it```
earnest phoenix
#

This is what i'm trying to accomplish

#

I'll edit it in to the other message

elfin flower
#

okay

earnest phoenix
#

It maps all the responses, and tries to get their full tag

#

While in the description

lusty quest
#

make a for loop and loop over the database return

earnest phoenix
#

So I don't think that .fetch() will be good

solemn latch
#

well

#

if its not in the cahce

pale vessel
#

it can work

solemn latch
#

cache

#

you have to fetch

lusty quest
#

i do this with a few things where i get mutiple datasets

pale vessel
#

is your function not async

earnest phoenix
#

It's not

#

I don't use async, but I should

pale vessel
#

you can probably make it one

elfin flower
#

wait

#

i have a peanut brain

sonic lodge
#

hi, i'm trying to write a 'say' command for my bot, but users can abuse this and get bots to ping roles / users. how do i replace a mention with just the @ + username to avoid pinging a user

quartz kindle
#

you can use the disableMentions option , depending on which library you use

slender thistle
#

\u200b aka a zero-width space

#

or that

quartz kindle
#

^ the disableMentions option basically does this for you lul

solemn latch
#

tim, fetch tries to get from cache before fetching from the api right?

quartz kindle
#

yes

sonic lodge
#

aight ty

lusty quest
#

and if not cached it cached it (can be disabled with a boolean)

solemn latch
lusty quest
#

client.users.fetch(id,false) will disable caching

elfin flower
#

what objects do i

slender thistle
#

You simply iterate over guild.text_channels

elfin flower
#

oh

#

okay

regal raven
#

How do I get if channel is nsfw in python?

lusty quest
#

check if the Channel object returns a isNSFW true

slender thistle
#

aka channel.is_nsfw()

elfin flower
#

yes

#

i was about to type that

#

like this?

#

nvm its so bad

regal raven
#

Yay

#
if ctx.channel.is_nsfw(): ctx.send("U can't use that command here") else: #code```
#

๐Ÿ™‚

modest maple
#

low key you havent awaited that send and one liners are ๐Ÿคข

elfin flower
#

lemme fix your code

#

if ctx.channel.is_nsfw():
await ctx.send("You can't use that command here!")
else:
#code

lusty quest
#

just invert the is nsfw and return

median star
#

can anyone help me wit some code

@bot.command()
async def problem(ctx):
  """Create instant invite"""
  link = ctx.channel.create_invite(max_age = 300)
  guild = guild
  await ctx.send(719613758049091584,f"Here's an invite to your server! {link}")#sending
slender thistle
#

forgot to await the create_invite thing

#

why the guild = guild

elfin flower
#

because its kinda true

#

the guild is the guild

slender thistle
#

yeah but it's pointless

median star
#

File "main.py", line 35
await link = ctx.channel.create_inv
ite(max_age = 300)
^
SyntaxError: cannot assign to await exp
ression
๎บง

pale vessel
#

isn't it after

#

=

median star
#

oh

slender thistle
#

Yes

#

I mean there's

#

link = await link after that

#

but that's kind of stupid

median star
#

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'guild' referenced before assignment

slender thistle
#

ah yes

#

What did you mean by guild = guild

median star
#

i tried to revfrence it

slender thistle
#

guild doesn't exist

median star
#

:-0

slender thistle
#

Use ctx.guild

median star
#

ctx.guild = guild

slender thistle
#

No

#

The other way

median star
#

guild= ctx.guild

pale vessel
#

why do you even need the guild

median star
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: send() takes from 1 to 2 positional arguments but 3 were given

slender thistle
#

yes

#

only put a string as only argument to .send

#

if you want to send a message to the current channel, use ctx.send and don't set any ID

median star
#

this what i have tso far

#

@bot.command()
async def problem(ctx):
  """Create instant invite"""
  guild = ctx.guild
  link = await ctx.channel.create_invite(max_age = 300)
  await ctx.send(719613758049091584,f"problem in {link}")#sending
    ```
celest schooner
#

if amazon free tier has 750 free hours of EC2 and theres less than 744 hours per month, why do people pay for EC2 still

median star
#

@slender thistle its sending a message to my server like if someone says poge problem i can join there server

earnest phoenix
#

How does one cache all users in a server on a ready event, using JavaScript?

celest schooner
#

@median star you should probably make them confirm that a person will join their server

slender thistle
#

Then use bot.get_channel and use .send on the returned channel from there

opal plank
#

someone know postgresSQL or SQL syntax rather well?

median star
#

@bot.command()
async def problem(ctx):
"""Create instant invite"""
guild = ctx.guild
link = await ctx.channel.create_invite(max_age = 300)
chan = bot.get_channel(719613758049091584)
await ctx.chan.send(f"problem in {link}")#sending

pale vessel
#

that would be cry

slender thistle
#

why ctx.chan

#

You don't have ctx.chan

earnest phoenix
#

@pale vessel I'm still having trouble with the same thing ๐Ÿ˜‚

#

Could you assist?

slender thistle
#

You have chan, not ctx.chan

median star
#

(max_age = 300)
chan = bot.get_channel(719613758049091584)
await chan.send(f"problem in {link}")#sending

slender thistle
#

Yes

median star
#

IT WOKRS

#

@slender thistle tysmkmmmm love

restive willow
#

discord.py: how can I get the number of shards/current shard?

solemn latch
#

@earnest phoenix that is very much not suggestee

#

Suggested

earnest phoenix
#

Why doesn't it cache them when the bot turns on anyway?

solemn latch
#

It uses obserd amounts of ram

earnest phoenix
#

Okay, what do you suggest then?

solemn latch
#

Fetching members you need.
Fetch gets from the cache if its cached

#

If its not. It caches it

earnest phoenix
#

I know what it does, but in my circumstance, what would I do?

solemn latch
#

๐Ÿค”

#

Use fetch

earnest phoenix
#

I swear it's like talking to a brick wall

solemn latch
#

Do you want me to write the code for you

#

Or whats the problem

earnest phoenix
#

You're not comprehending my question

solemn latch
#

Your question is how to get users who may or may not be cached

#

From what i can tell

earnest phoenix
#

My question is not that

#

I asked about it earlier

#

I'll link you

solemn latch
#

Thats not the question you asked here.
You asked how to get all users cached on startup

earnest phoenix
#

I asked: Why doesn't it cache them when the bot turns on anyway?
Not: How to get all users cached on startup

#

Anyway

#

That doesn't matter

#

The issue is linked

median star
#

anyone know why dis not work?

  ctx.send('are you sure you want a staff to join and help')
  await bot.add_reaction('๐Ÿ‘')
  if reaction.emoji == '๐Ÿ‘':
elfin flower
#

await ctx.send()

solemn latch
#

Ngl I still don't see the problem sk1ll.

slender thistle
#

anyone know why dis not work?

  ctx.send('are you sure you want a staff to join and help')
  await bot.add_reaction('๐Ÿ‘')
  if reaction.emoji == '๐Ÿ‘':

@median star what do you even want to do there

median star
#

iscord.ext.commands.errors.MissingRequiredArgument: reaction is a required argument that is missing.

solemn latch
#

If you are trying to do it all in the description, just make a function to do it for you.

median star
#


@bot.command()
async def problem(ctx, reaction):
  await ctx.send('are you sure you want a staff to join and help')
  await bot.add_reaction('๐Ÿ‘')
  if reaction.emoji == '๐Ÿ‘':
    """Create instant invite"""
    guild = ctx.guild
    link = await ctx.channel.create_invite(max_age = 300)
    chan = bot.get_channel(729403688455635014)
    await chan.send(f"problem in {link}")#sending
#

so they confirm they want a staff to join

earnest phoenix
#

I'm trying to fetch an un-cached member inside of a .map

#

Pretty much

opal plank
#

@earnest phoenix use a for(0 in

#

nvm

median star
#

@solemn latch ^^^^^^^

opal plank
#

but still, do a for() in

solemn latch
#

I'm not a python dev

median star
#

;-;

slender thistle
#

use bot.wait_for to wait for a reaction add

opal plank
#

for(c in results) => {//do the adding here}

median star
#

await ctx.send('are you sure you want a staff to join and help')
await bot.wait_for.add_reaction('๐Ÿ‘')
if reaction.emoji == '๐Ÿ‘':
"""Create instant invite"""
guild = ctx.guild

#

?

opal plank
#

im just gonna copy this, getting tired of going up and down

#

I'm making a request to my webserver which is hooked up to my SQLite database.
I'm making a leaderboard feature which will display the top 10 users on the server.
It successfully returns the top ten users / and they are also ordered, they come through like this:

[
  { userid: 314470444713377800, wallet: 100, bank: 8900, tokens: 0 },
  { userid: 420366170428801000, wallet: 0, bank: 900, tokens: 0 },
  { userid: 480171429929680900, wallet: 100, bank: 0, tokens: 0 }
]

This is what i'm trying to accomplish...

var embed = new Discord.MessageEmbed()
      .setTitle(`Banked Money Leaderboard | Top ${config.economy.leaderboardLimit}`)
      .setDescription(`${fetchUsers.body.map(x => `${fetchUsers.body.indexOf(x) + 1} โ€ข ${client.users.cache.get(toString(x.userid)).tag}: ${config.economy.currency} \`${x.bank}\``).join("\n")}`)
      .setColor('GREEN')
      return message.channel.send(embed).catch(console.error);
earnest phoenix
#

I was thinking that this would just return the users tag.

console.log(message.guild.members.fetch("420366170428801025").then(user => { user.tag }))

So I could pretty much add that into the .map(x => { __here__ }) and get it that way

opal plank
#

that result, let it be a let:
then loop a for(in) to with concat

median star
#

so . anyone know?

#

await ctx.send('are you sure you want a staff to join and help')
await bot.wait_for.add_reaction('๐Ÿ‘')
if reaction.emoji == '๐Ÿ‘':
"""Create instant invite"""
guild = ctx.guild
?

opal plank
#

that just returns one

slender thistle
#

uhhhhhhh

#

eugh

#

I want to throw up

median star
#

oh no

slender thistle
#

Have you tried reading the docs for once

opal plank
#

loop it thru with a concat variable

earnest phoenix
#

not in a .map()

summer acorn
#

does this not work in djs-light?

if (!message.guild.member(client.user.id).hasPermission('MANAGE_CHANNELS')) {
opal plank
#

no need to map it

#

read it as an array

opal plank
#

let description = '';
for (r in results) description.concat(r.name // r.tag // r.money)

earnest phoenix
#

No because this will do it for each members ID that is in the array object in the code block above

opal plank
#

arent you listing top 10?

#

im assuming you'd wanted all 10 results looped into the description

earnest phoenix
#
[
  { userid: 314470444713377800, wallet: 100, bank: 8900, tokens: 0 },
  { userid: 420366170428801000, wallet: 0, bank: 900, tokens: 0 },
  { userid: 480171429929680900, wallet: 100, bank: 0, tokens: 0 }
]

To fetch these current users, I was thinking of something like this:

array.map(x => { message.guild.members.fetch(x.userid).then(u => u.tag) })
#

Yeah but there's currently only three in there while testing

opal plank
#

why would you need that?

#

thats in the server, just add <@id >

earnest phoenix
#

Because I want the user objects

opal plank
#

dont do fetch

earnest phoenix
#

And tbh, good point, I forgot about that lmao

opal plank
#

you have the users in cache

earnest phoenix
#

I don't

#

That's the problem

opal plank
#

client.users.cache.get('')

earnest phoenix
#

They haven't cached

opal plank
#

then how'd get them with your bot?

solemn latch
#

he cant know if its in cache, since he is getting stuff from a database

earnest phoenix
#

That's the whole thing i'm on about ๐Ÿ˜‚

#

It returns undefined when trying to get the user in the so-called cache

opal plank
#

do a manual eval. online users only are cached if i recall

earnest phoenix
#

We are all online ๐Ÿ˜‚

#

The user ID's that are specified above, correspond to online users

opal plank
#

the fact that only on this guild i get 60k cache and not the 110k this guild has leads me to believe d.js only caches on message event or fecthes who's online

#

you could do api calls, but that'd be a bit bad

#

client.api.fetch('id')

earnest phoenix
#

hmmmmmmmm

opal plank
#

that'd return their user given by the api without auth

#

aka your public info

earnest phoenix
#

and, if I was to do this <@userid>, if the userid is not found, it would come back as undefined

#

or something

opal plank
#

you are simply adding their id onto the string

#

say this

#

@earnest phoenix

#

but

#

if you dont have that user cached on your client

#

it'll show like this

#

@limber island

earnest phoenix
#

It will show like that if the user isn't in the server and I try to do this <@userid>.
Either way

opal plank
#

thats why i asked, you doing a top 10 in the server, no?:

earnest phoenix
#

Yea

opal plank
#

so everyone should have those users cached, because they are in shared guild(the only one you are trying to get)

#

if its cross servers you might wanna fetch tag

#

cuz no shared guilds

earnest phoenix
#

It's for only one server

#

It's a custom private bot

opal plank
#

but if its in the same one it should be fine

#

then its fine, everyone will have the users cached

#

you're doing this basically

#

'<@' + id + '>'

#

@stoic spear

earnest phoenix
#

I know but if a user leaves the server, it won't change to an actual mention

#

It will stay as those numbers

#

Which are bad

opal plank
#

indeed

earnest phoenix
#

I'll have to filter them out

#

Or remove them from the database entirely

median star
#

  await bot.message.add_reaction('๐Ÿ‘')
  if reaction.emoji == '๐Ÿ‘':

;-; sadcat

earnest phoenix
#

lol eloni

#

rip

opal plank
#

you could try to do a call for each error on get

earnest phoenix
#

hey, im messing around with discord.py, any idea on how i can delete all channels?