#development

1 messages · Page 1740 of 1

opal plank
#

but either way, the only difference in latency will be the request itself, you can calculate your bot's ping by simply doing a request to discord itself

#

i doubt discord's response time to process a request in that endpoint would change much at all in that

vivid fulcrum
#

the same answer as to can you change the time you were born

lavish bramble
opal plank
#

convert it?

drifting wedge
#

how do i make the text start at the left?

#

i mean idk how to explain it too well

#

but baically i want the icon on the left

#

the text at top right

lavish bramble
drifting wedge
#

and the value in bottom right

craggy pine
#

text-align: left?

drifting wedge
#

doesnt work

opal plank
#

get the timezone of asia/calcutta, get your original timestamp in unix, then just convert it

craggy pine
#

ah

vivid fulcrum
#

flexbox, the answer to everything is flexbox

opal plank
#

or simply add the hours based on the difference in timezones

#

which might be simplier

boreal iron
#

Witch!

lavish bramble
#
.addField("Created At", guild.createdAt)
opal plank
#

or use something like moment or some other time manipulation package to do the convertsion for you

#

make a variable, convert it, put the variable there in the adField, thats it

vivid fulcrum
#

all timestamps you get from discord are unix, inheritely that means they're in UTC

#

aka

#

+0000

lavish bramble
opal plank
#

if you have no idea what i said you need to learn the basics of JS

#

and how functions work

vivid fulcrum
#

so you can manipulate the date to get it in a specific timezone by just adding/removing hours and minutes

lavish bramble
#

Ok

opal plank
#

arent timezones specifically hour based?

#

dunno if theres minutes corrections

vivid fulcrum
#

there's also minute corrections but rare

opal plank
#

hmmm thats interesting, was unaware of that

vivid fulcrum
#

iirc there's quarters and halves

boreal iron
#

yeah they exist

opal plank
#

might wanna use a package to deal with that then so you dont have to worry about the specifics @lavish bramble

#

i fucking hate when you mention someone and the mention goes in the middle of the text

vivid fulcrum
#

i almost failed geography that is the only thing that i remember from that class

opal plank
#

fucking discord, fix yer shit

vivid fulcrum
earnest phoenix
vivid fulcrum
#

that's a very good point

opal plank
#

the right answer to everything is learning first

#

or the right answer, thats also the right answer

boreal iron
# opal plank

100% looks like an error caused by the user - yes YOU!

vivid fulcrum
#

the answer is below
the answer is above

opal plank
earnest phoenix
#

this

#

ihy erwin

opal plank
#

ihy what

boreal iron
#

it's your fault, accept it and everything is fine

heavy talon
#

yarrak

vivid fulcrum
#

that message disappeared with the speed of light

#

a smart person would conclude that the answer is actually "above" and exit the function :smart:

#

im going to buy nitro just so i can use that emoji

boreal iron
#

lol

#

I dunno any more useless way to shred your money

vivid fulcrum
#

nevermind my money is on pp and discord on android forces me to go through google pay

opal plank
boreal iron
#

don't force me to ask what fortnite is

near stratus
boreal iron
#

no I'm not that old... calm

boreal iron
drifting wedge
#

yo gamers

#

what do you think?

boreal iron
#

that took a while just for that "one" element lol

drifting wedge
#

wdym?

near stratus
#

at least the first two

boreal iron
#

well just increase the size on hover only, looks a little more special

drifting wedge
#

i can make it also a big brighter on hover?

near stratus
#

yea

near stratus
drifting wedge
#

.server_stats_items:hover .server_stats_items { is this correct?

#

shi

#

1 sec

#

it works

boreal iron
#

how do we know the elements and their names, lmao

drifting wedge
#

whatever

#

its fine 1 sec

boreal iron
#

:hover is the attribute u need

#

nvm... you did already

drifting wedge
#

making it bigger

boreal iron
#

wtf

drifting wedge
#

it affects the entire box

boreal iron
#

.server_stats_items .server_stats_items

drifting wedge
#

like changing the icon sise

#

size

#

it was a typo

#

2nd was suppsoed to be icon

boreal iron
#

why is server_stats_items element being there 2x?

drifting wedge
#

TYPO

boreal iron
#

OK I will forgive you! Don't let it happen again!

proven lantern
#

The first time i call await msg.guild.members.fetch({user: allPlayerIds}); i get a Collection, but the second time this same code returns an array.

#

i am invoking the same bot command twice

#

i am using discord.js-light

#

is this a bug or expected behavior?

pale vessel
#

might be a bug

drifting wedge
#

why does it go under?
i have the z-index of the dropdown set to like 9999999999999999

boreal iron
#

You have to set a z-index for the menu as well

#

which is lower

pale vessel
drifting wedge
#

lower = on top?

boreal iron
#

nope

drifting wedge
#

im congused

#

confused

boreal iron
#

versa

drifting wedge
#

what

#

my brian

#

brain

boreal iron
#

higher = on top

drifting wedge
#

yeah

#

so why isnt the drop down on top?

boreal iron
#

Does your menu actually have a lower z-index assigned?

proven lantern
pale vessel
proven lantern
#

thanks

boreal iron
drifting wedge
#

kinda

#

i decided to move it

#

but this happens

boreal iron
#

z-index is assigned to the wrong element

#

the childs should not be affected

drifting wedge
#

got it

#

done

#

ty tho

lavish bramble
#
			.addField('Member Count', `Total Members :- ${message.guild.memberCount}\nUsers :- ${members.filter(m => !m.user.bot).size}\nBots :- ${members.filter(m => m.user.bot).size}`)

Its showing 1 bot and 1 user

#

But my guild have 3 bots

slim heart
#

u just have to turn the other thing down

ancient gulch
#
async findOne(get, table, isQuery, message: Message){
      let a = await this.db.query('SELECT '+ get + ' FROM '+ table + ' WHERE guildId = '+ message.guild.id +' ', async (err, rows) => {
            return rows
      })
        console.log(a)
    }

It's returning the query and not the rows, how can i make it return rows outside the function

earnest phoenix
#

Assign it to a variable as its called with a callback

#
async fn(...) {
  let a;

  await this.db.query(..., (_, rows) => {
    a = rows;
  });

  return a;
}```
ancient gulch
#

okay ty

ancient gulch
worn sonnet
#

Heya!

earnest phoenix
worn sonnet
#

What's good approach, iterating through a list or making request to the mongodb database everytime a person sends the message

#

In on_message() function

#

I use python which is apparently not good with speed

earnest phoenix
#

Depends on how many documents there are, if not too many, lists are good, if there are too many documents however, making a request to the database is the better approach since it can retrieve the document faster than iterating through a list

ancient gulch
worn sonnet
#

And all

#

Most of the times the request I send to db returns none as it doesn't match the criteria or filter I pass, can this be considered as optimization of bandwidth

earnest phoenix
earnest phoenix
worn sonnet
#

Oh oke

#

Since I just started using a server based db I was kinda worried about requests I make and all thanks for answering

lament rock
#

The smarter thing to do is to batch queries together if possible. The volume of packets at scale can overwhelm a database

#

batching inserts for example

worn sonnet
#

I'm simply reading the db

worn sonnet
#

Or fetching the info

lament rock
#

Oh. Then not much you can do there

worn sonnet
#

At first I thought I'll just get all the info at once in initialization

#

And loop through it

#

Which will decrease the requests to db drastically

lament rock
#

how large is the data set and how often do you expect to make requests

worn sonnet
#

Dataset can be varied as over time

worn sonnet
lament rock
#

If it's stuff like prefix data or the language of the user, it's safe to just request that data each time

#

it's also more convenient to not worry about desyncs at scale to request the latest data

#

considering shards can be on different clusters

worn sonnet
#

Oh oke thanks mate

lavish bramble
#
message.guild.fetchBans()
  .then(banned => {
    let list = banned.map(user => user.tag).join('\n');

    // Make sure if the list is too long to fit in one message, you cut it off appropriately.
    if (list.length >= 1950) list = `${list.slice(0, 1948)}...`;

    const embed = new MessageEmbed()
		.setTitle("Ban List")
		.setColor("RANDOM")
		.setDescription(`Total Bans :- ${banned.size}\nUsers :- ${list}` || "None")
		.setTimestamp()
		message.channel.send(embed)
  })
  .catch(console.error);
		

Its not showing the users tags

lament rock
#

fetchBans returns a Collection<string, { reason?: string; user: User; }>;

#

need to map(entry => entry.user.tag)

quaint wasp
#

does anyone have a recommendation on the place to host a discord bot at exept Glitch Heroku and github?

placid iron
#

Okay but GitHub hosting?

quaint wasp
#

whats that?

placid iron
#

Idk bro, I was asking you that

quaint wasp
#

😐

long crow
#

raspi do wonder too

lyric mountain
#

Imagine hosting bot on github

pale vessel
#

hey I host mine on GitHub cowboyrage

lucid prawn
#

How can you add commands with a command in 14.4.0?

sudden geyser
#

You want to create subcommands?

#

For Discord.js 14.4.0?

lucid prawn
#

Yes

sudden geyser
#

Unless you're using a framework with that capability, you'll need to store, parse, and process the subcommand yourself.

#

Though I'm confused.

#

Discord.js has no 14.4.0 version

lucid prawn
#

That my node version

sudden geyser
#

Alright, but that's not your Discord.js version.

lucid prawn
#

My discord version is 12.5.1

soft glade
#

i have a question for people that use python

sudden geyser
#

ask away

soft glade
#

is it possible to a discord-rpc on a discord bot (python)

sudden geyser
#

@lucid prawn in that case,

Unless you're using a framework with that capability, you'll need to store, parse, and process the subcommand yourself.

If you'd like to implement it yourself, you'll need to parse the message as <prefix><command> <subcommand> [...arg].

You'll need to see if a subcommand argument was supplied. If there was one supplied, look through your subcommands collection (aka where you store subcommands, such as directly to a command) and see if a match was found. If so, run a function specialized for the subcommand. Else, run the command that was associated with the invalid subcommand (including the subcommand argument since it's just an argument now). But that's up to you to decide how to implement it.

soft glade
#

oh ok

#

i was only asking bc i have a discord rpc that adds button to my profile and i was wondering if i can do that to a bot

sudden geyser
#

I was answering Mika's question. I don't have experience with RPC myself.

soft glade
#

ohhhh

clear marlin
#

RPC, on a bot?

soft glade
clear marlin
#

I don't think that works.

deep mantle
soft glade
deep mantle
clear marlin
#

Bots are just allowed LISTENING, WATCHING, STREAMING .

deep mantle
#

whoops its pypi

clear marlin
#

those rpcs are for user accounts.

clear marlin
lucid prawn
#

Lol

earnest phoenix
#

Mika in here...

#

Hi Mika

#

Anyways.... So I hear it's possible to do any coding with a phone. I got my bot online but it goes offline if not used for a long time. Which is concerning so.... The commands for moderation should work as well for the bot without a computer?

clear marlin
#

well, your bot needs to be hosted 🤷‍♂️

#

there's no other way it'd be online 24/7

earnest phoenix
#

I use the uptimerobot website to keep it online

earnest phoenix
clear marlin
#

I guess it should.

rocky hearth
#

is this ok to do this in react?

#

speacially at line 136.... update other state in some state

azure otter
#

Hi

clear marlin
rocky hearth
#

nope, but its behaving weirdly.

#

randomly both of the state is changing
sometimes A and somtimes B

clear marlin
#

and you want one state to change to the other state

rocky hearth
#

I just want to update the state of isAllSelected to be true, when all the elements of selectedUsers have truthy value

#

when id is undefined, I'm just toggling the isAllSelected

clear marlin
rocky hearth
#

but im not using class components

earnest phoenix
#

@rocky hearth hello

#

Sir

rocky hearth
#

what?

earnest phoenix
#

Hello, Im new to bot developing and stuff, I made a bot using Repl.it, But It's impossible to make it online forever, I don't know how to do it. Help please.

rocky hearth
earnest phoenix
#

to start the bot
use this code
const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
});

client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!');
}
});

client.login('your-token');

cinder patio
#

not the array

#

do [...array] or arrwy.slice() to clone it

rocky hearth
#

ik, that's why isAllSelected is a boolean

cinder patio
#

Oh nvm I miaread the function name

rocky hearth
cinder patio
#

Looks fine to me, how are you calling it

rocky hearth
#

what I dont understand is, Is it good to update two states at a time?

cinder patio
#

Yeah as long as the first state won't change again if you update the second one

rocky hearth
#

and is it possible to update a state, and not rerender the component

cinder patio
#

mmm why are you using an array to store the selected users, this may not be the problem, but you should use a Record for thay

cinder patio
#

which stays persistent over state changes

#

but doesn't change the state when updated

rocky hearth
#

hv u used immer

cinder patio
#

You need to return a new object in the update functions

#

Updating the current one will almost always cause bugs

rocky hearth
#

in immer, we can directly mutate the state. And now its works fine

cinder patio
#

return { ...draft} trust me, React relies on immutability

#

If you were to use a useEffect hook on it it wouldn't work

#

I've been there

rocky hearth
cinder patio
#

That's not a function though...

#

The first one

#

Are you using immerjs? I don't know then

#

Maybe it's doing it under the hood cause in React you have to return a new object

rocky hearth
cinder patio
#

I didn't see that oop

rocky hearth
#

lol, np

cinder patio
#

Yeh that's exactly what immer's doing

trail finch
#

ummm I have a request to the reviewers... Um I edit my bot sometimes so while I do it won't work as you know xd and I don't have a particular time when I code, I code it whenever I remember that I should add this or that or edit this or that um nvm....... If you may dm me before testing my bot named yoink I would be grateful

cinder patio
#

So have 2 bot accounts

#

one for development and one for the public

trail finch
#

umm honestly I mistake a lot when I do that... I tried it once and the bot had to be deleted :\ ewe

clear marlin
#

a beta bot and a main/public bot

#

test your features in the beta bot

#

and push them if you like it

rocky hearth
#

for css, I've a div set to overflow: hidden, but I want one of its child to let be overflowed. How can I achieve that?

#

the child is actually a dropdown menu

#

so it dont look like this

umbral zealot
#

Position absolute in a parent of position relative

#

That should fix it.

rocky hearth
# cinder patio Nope, if you want that consider using a Ref
function Test() {
  let counter = 0
  const [name, setName] = useState("John")
  const updateCounter = () => {
    counter++
    setName((str) => str + counter)
  }
  return (
    <div className=''>
      <span>{name}</span>
      <span>{counter}</span>
      <button onClick={updateCounter}>click me</button>
    </div>
  )
}

You've said, when the state changes, the component get rerenders
then the counter should get updated as well
Can you tell me, y this doesn't work?

#

In this case, as the counter increases it gets appended to the name.

cinder patio
#

counter is bound to the state, once the state changes, counter gets reset to 0

#

Use Refs for that kinda stuff

rocky hearth
#

Ooh... I got it. Silly me

jade stirrup
#

asking for a friend can anyone help

earnest phoenix
#

Hello

#

We applied for verification

#

For bot

#

And it says suspicious growth

#

But it is own growth no fake servers

#

And one of staff said

#

You want to make it 280 servers

#

If any one add it in fake servers

#

Will it verify

glossy burrow
#

Anyone know a bot that can give a role to people who have something in there custom status? Like if someone puts my discord server url in they status they get a role automatically but once its taken out the role is gone

rocky hearth
glossy burrow
clear marlin
earnest phoenix
#

Ok

#

Sir

cinder stratus
#

@earnest phoenix join discord developers server and ask here

earnest phoenix
cinder stratus
earnest phoenix
#

dose any one know how to make my bot when it is mentioned reply with its prefix

cinder stratus
#

@earnest phoenix use regular expression

earnest phoenix
#

?

cinder stratus
#

Regex

quartz kindle
#

if you're using discord.js just use message.mentions

earnest phoenix
#

ohhh

vagrant grove
#

sad

sudden knoll
#

Tim, do you use galaxygate?

earnest phoenix
#

do i put in my index.js#

quartz kindle
sudden knoll
#

I assume you prefer it over DO and AWS etc then?

quartz kindle
#

i never tried them

#

but they are more expensive, so...

earnest phoenix
#

its spamming

#

how do i fix

sudden knoll
quartz kindle
sudden knoll
earnest phoenix
tawdry oracle
#

how can i have 1 cases in one switch but with 2 strings?

quartz kindle
#

LOL

#

what the fuck is that code

earnest phoenix
#

its bad but it kinda works

sudden knoll
#

It’s recursively calling

quartz kindle
#

it doesnt work lol, thats why its spamming

earnest phoenix
#

dammm

sudden knoll
#

Why are you using on message tho

earnest phoenix
#

ok im not the best

quartz kindle
#

message.mentions.bot doesnt exist

#

and youre sending a message in both if cases, so it will always send

tawdry oracle
#
 switch (aww) {
                case "no" || "maybe":

}
```why does this dont work
#

how can i do it like that?

quartz kindle
#

case "no": case "maybe":

cinder stratus
#
switch(aww) {
case 'no':
case 'maybe':
//some code
}
tawdry oracle
#

tnaks

cinder stratus
#

np

lusty quest
earnest phoenix
#

oohh

eternal osprey
#

hey

#

how do i save the data i receive from the request.get and assign it to a variable? (the response.body)

#
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'URLGOESHERE',
  'headers': {
    'Authorization': 'AUTHGOESHERE'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});```
vivid fulcrum
#

dude

#

seriously

#

use node-fetch

#

you got told 3 times request is deprecated

#

4 times now

eternal osprey
#

OKAY let me get node-fetch

#

wait then

worn sonnet
#

hi

vivid fulcrum
#

node-fetch has proper async support

worn sonnet
#

i'm trying to connect heroku to mongoDB atlas

eternal osprey
#

the thing is, i don't know how to authorize using node-fetch

worn sonnet
#

but i couldn't find the ip to whitelist

vivid fulcrum
eternal osprey
#

okay

#

but this would still give me an issue on how i can assign the variable

worn sonnet
#

i searched and they say whitelist 0.0.0/0

#

which is kinda wrong since anyone can connect to it

lusty quest
#

ask the support of your host.

vivid fulcrum
#

at that point it's just async/await or then pattern

#

you could've used that with request too, like tim and i told you

#

but drop request, it's deprecated and full of vulnerabilities

eternal osprey
vivid fulcrum
#

ok

#

you have a tendency to lie in this chat so i dont believe a single thing you say lol

rancid copper
#

Hello

cinder stratus
#

Hello

rancid copper
#

@livid jackal is that u outside my window

rapid wharf
#

In discord.py
em.add_field(name=f'Boosters [{len(guild.premium_subscribers)}]', value=str(guild.premium_subscribers))
this is giving response as <Member id=500305380014948362 name='Asuka' discriminator='7580' bot=False nick=None guild=<Guild id=787709538160869406 name='Asuka Bae' shard_id=None chunked=True member_count=1387>>]
I tried for half an horn using loops n all, but cat fighure out how to solve this

earnest phoenix
#

Well, you're stringifying a list, what do you expect?

pale vessel
#

For the list to somehow join properly, like how magic stuff happen in Python

earnest phoenix
#

how to use Vps ?

vivid fulcrum
#

that's like asking how to use a car

earnest phoenix
vivid fulcrum
#

you need to provide more detail on what you specifically want to do and what os your vps is running

near stratus
thick nexus
#

uh how do you check for like 2 permissions like has permissions _____ or has permissions ______

blazing sentinel
#

which library do you use?

thick nexus
#

python?

#

is that library

blazing sentinel
#

np

#

then

#

if message.author.guild_permissions.administrator or message.author.guild_permissions.manage_guild:
do_sth()

#

or you can change the permissions

thick nexus
#

o

#

ok

long horizon
#

how some bots like koya make a welcome pic with the user name and profile pic and upload it as a welcome message?

sudden geyser
#

The bot will "draw" the image (like with a canvas builder) then send it as a file.

#

"draw" is in quotations since there are many ways to create an image.

mystic harness
#

how to make this? with discord.js?

sudden geyser
#

If you want to make clickable links, you want to use Markdown syntax.

#

[text to display](url goes here)

#

For example, [Google](https://google.com/)

#

It'll only work in embeds, but if you're using Webhooks, it'll work in plain text too.

mystic harness
#

kk ty

frigid mountain
#

Config.json

{
	"prefix": "+",
	"token": "My_token",
}

My index.js

const fs = require('fs');

const Discord = require('discord.js');
const client = new Discord.Client();

const config = require('./config.json');
client.config = config;

const { GiveawaysManager } = require('discord-giveaways');
client.giveawaysManager = new GiveawaysManager(client, {
    storage: "./giveaways.json",
    updateCountdownEvery: 5000,
    default: {
        botsCanWin: false,
        embedColor: "#FF0000",
        reaction: "🎉"
    }
});

client.giveawaysManager.on("giveawayReactionAdded", (giveaway, member, reaction) => {
    console.log(`${member.user.tag} entered giveaway #${giveaway.messageID} (${reaction.emoji.name})`);
});

client.giveawaysManager.on("giveawayReactionRemoved", (giveaway, member, reaction) => {
    console.log(`${member.user.tag} unreact to giveaway #${giveaway.messageID} (${reaction.emoji.name})`);
});

client.giveawaysManager.on("giveawayEnded", (giveaway, winners) => {
    console.log(`Giveaway #${giveaway.messageID} ended! Winners: ${winners.map((member) => member.user.username).join(', ')}`);
});

fs.readdir("./events/", (_err, files) => {
    files.forEach((file) => {
        if (!file.endsWith(".js")) return;
        const event = require(`./events/${file}`);
        let eventName = file.split(".")[0];
        client.on(eventName, event.bind(null, client));
        delete require.cache[require.resolve(`./events/${file}`)];
    });
});

client.commands = new Discord.Collection();

fs.readdir("./commands/", (_err, files) => {
    files.forEach((file) => {
        if (!file.endsWith(".js")) return;
        let props = require(`./commands/${file}`);
        let commandName = file.split(".")[0];
        client.commands.set(commandName, props);
    });
});

client.login(config.token);
mystic harness
#

can someone help me make change prefix command?

#

for prefix i use ${this.client.prefix} to show prefix

tired panther
mystic harness
#

db?

#

aha

#

i have it

#

i think

#

wait

cosmic forum
#

Anyone know a good npm package that can encode and decode strings of text?

mystic harness
#

i have database.json

cosmic forum
rocky hearth
#

jwt i guess?

slender thistle
cinder patio
frigid mountain
#

Help

raw jacinth
#

With what?

mystic harness
#

i have some problem, every gw i did with bot it save in database,json and my memori getting full
how to fix that?

umbral zealot
#

Don't use JSON as a database.

mystic harness
#

what to do then?

#

i am not a some big developer

#

so

umbral zealot
#

An actual database

mystic harness
#

i use free hosting

#

i dont pay yet

umbral zealot
#

Doesn't matter. You can use sqlite or mongo or postgres or whatever. Just don't use JSON, it is NOT a database.

tired panther
#

mongodb atlas is a good choice

#

free 500mb data space

umbral zealot
#

If they can use JSON they can use sqlite though and that's the easiest one.

mystic harness
#

but i have everything setup yet just i dont know why every giveaway i made save in database

#

can i make something like when gw finish to gw from databe delete

#

something like that

umbral zealot
#

You setup something that's bad. And now it broke. So now you get to fix your mistake.

mystic harness
#

or can i make like every 5 days database auto clean?

#

or something like that?

umbral zealot
#

You are using a method that will break in many ways.

#

We will not help you load another shell in the shotgun you have aimed at your foot at the moment. You need to actually stop using JSON right now, it will only keep bringing you pain.

frigid mountain
#

No help

mystic harness
#

then what to do, i only know for that

umbral zealot
#

If you think that's too hard because you're too lazy to actually learn things right, then go use one of the followign:

  • nedb
  • quick.db
  • enmap
  • @joshdb/core
mystic harness
#

you mean this?

umbral zealot
#

Why would you call that json.sqlite. why...

mystic harness
#

idk dont ask

umbral zealot
#

call it "giveaways.sqlite" or something

#

so it's actually descriptive

marble juniper
#

json.sqlite.txt.data.pdf.csv

vivid fulcrum
#

.txt

marble juniper
#

lol

mystic harness
#

now just to ask everywhere where is database.json i need to change that in giveaway.sqlite?

vivid fulcrum
#

i just leave my local db files nameless, just the extension is there

umbral zealot
#

you can't just rename the file

#

jesus christ

mystic harness
#

in code

cinder stratus
marble juniper
#

code.js.ts.c.cs.py.java

umbral zealot
#

No you need to rewrite the code too

slender thistle
#

json.sqlite.txt.ini.env.pdf.csv.docx.xslx

umbral zealot
#

so that it actually uses a database module

mystic harness
#

i mean to change this

umbral zealot
#

yeah you can't just do that

#

again

#

you need to actually write code to properly access the database

cinder stratus
#

I don't think that package has inbuilt sqlite support

umbral zealot
#

I don't... what? A package???

marble juniper
#

use an orm like sequelize lol

cinder stratus
#

discord-giveaways

#

If I'm not mistaken

marble juniper
#

use postgres

#

or ded

#

or booli

umbral zealot
cinder stratus
#

I use MongoDB

marble juniper
#

im just kidding

marble juniper
#

jk

#

I use mongodb myself

cinder stratus
#

Quickdb > enmap > mongodb

#

My journey with dbs

frigid mountain
#

I keep getting error

umbral zealot
#

enmap is bae hug

cinder stratus
#

Mind checking your confug.json

umbral zealot
marble juniper
cinder stratus
#

😂

umbral zealot
#

Obviously my opinion is highly biased.

frigid mountain
umbral zealot
#

but hey millions of downloads agree with me

sudden geyser
#

enmap bad

cinder stratus
#

,

umbral zealot
#

JSON is very strict, you can't add that last comma there

cinder stratus
#

Remove the comma after my token

frigid mountain
sudden geyser
#

and the missing colon

cinder stratus
#

Yeah

sudden geyser
#

and the syntax in general

kindred sinew
#
    raise HTTPException(r, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.```
I'm getting this error when attempting to run the bot ![DogmaShrug](https://cdn.discordapp.com/emojis/789182922883858472.webp?size=128 "DogmaShrug")
sudden geyser
#

You sent too many requests to Discord and got temporarily blocked.

#

Though I don't know how you did it.

kindred sinew
#

The bot is in only 13 servers... how on earth could it be reaching a limit ObiConfusion

cinder stratus
#

Yeah happens to me time to time

slender thistle
#

How do you get to 429 with logins

cinder stratus
#

Like assign a new ip

slender thistle
#

IP address won't change anything

cinder stratus
#

Or wait

sudden geyser
#

I don't know how you'd be able to hit the 10,000 rate limit. Maybe it's something internal.

IP addresses that make too many invalid HTTP requests are automatically and temporarily restricted from accessing the Discord API. Currently, this limit is 10,000 per 10 minutes. An invalid request is one that results in 401, 403, or 429 statuses.

slender thistle
#

The ban is per-token

cinder stratus
sudden geyser
#

It's probably per-token.

#

Relying on IPs is not reliable.

slender thistle
#

I highly doubt Discord relies on IP addresses

cinder stratus
#

The last time I got 429 on my Bot from discord was 3 days ago

#

I just assigned a new ip to the project from gcp

#

And restart

#

Bot online

tired panther
#

Was there any breaking changes on mongoose v.5.10 to v.5.12?

sudden geyser
#

If they're following semantic versioning, no.

slender thistle
#

Imagine following semver

sudden geyser
#

semver sucks but we need it

tired panther
slender thistle
sudden geyser
#

It's a way of versioning releases based on how it affects source code.

kindred sinew
sudden geyser
#

Maybe.

slender thistle
#

Tbf I don't mind following it. I just have an issue really understanding when I should increment minor or micro

sudden geyser
#

See this

slender thistle
#

Oh, interesting

tired panther
kindred sinew
sudden geyser
#

Probably

slender thistle
#

Curious why they decided to go with IPs instead of tokens

cinder stratus
#

I got rate limits because I don't have any cooldown in my Bot and people literally spam the commands like crazy

kindred sinew
tired panther
cinder stratus
#

Lol

slender thistle
#

d.py handles ratelimits internally

kindred sinew
slender thistle
#

How even

cinder stratus
#

Djs ratelimit handling might be good but when my Bot stars spamming to the gateway it is more than 1k in few seconds like super fast even harder to debug

sudden geyser
# slender thistle Tbf I don't mind following it. I just have an issue really understanding when I ...

Major = anything that may break a person relying on the code (e.g. changing a public function name and not adding a replacement).
Minor = A new feature (e.g. new public function) that won't break others' code.
Patch = A bug fix that doesn't break others' code.

What I don't like about semver is that a lot of changes can be major, and I also don't like how it makes it easy to climb up the major number (e.g. 24.3.2). Maybe if it were like edition.major.minor.patch where edition is a "big" release for the library.

vivid fulcrum
#

djs doesn't have good ratelimit handling at all

#

instead of queuing your request, half the time it errors out

frigid mountain
#

What does it mean?

sudden geyser
#

You provided invalid intents.

cinder stratus
#

You need to specify intents which exist

frigid mountain
sudden geyser
slender thistle
#

imo minor could be used for both breaking changes and new features, while major is for really significant changes (like, say, complete rewrite of one system, if not the package entirely)

sudden geyser
#

yeah but semver doesn't like that

slender thistle
#

🎵 Let's break the rules~ 🎵

cinder stratus
#

But you agree or not djs is switching NodeJS versions like crazy

cinder stratus
vocal trellis
#

anybody knows goed node js hosting ( i want to host dashboard and bot )

slender thistle
#

Though at least in my case I don't do very weird shit to climb up to v10

#

... yet?

cinder stratus
#

Eris works good in NodeJS 10

#

But now djs needs v14 in newer updates

vivid fulcrum
#

there's like no reason to not use the newest node version anyway

kindred sinew
#
# set prefix on guild join
@client.event
async def on_guild_join(guild):
    with open('prefixes.json', 'r') as f:
        prefixes = json.load(f)
    
    prefixes[str(guild.id)] = "."

    with open('prefixes.json', 'w') as f:
      json.dump(prefixes, f, indent=4)

#remove prefix on guild remove
@client.event
async def on_guild_remove(guild):
    with open('prefixes.json', 'r') as f:
      prefixes = json.load(f)
    
    prefixes.pop(str(guild.id))

    with open('prefixes.json', 'w') as f:
      json.dump(prefixes, f, indent=4)

#change prefix via command in guild
@client.command()
@commands.has_permissions(administrator=True)
async def changeprefix(ctx, prefix):
    with open('prefixes.json', 'r') as f:
      prefixes = json.load(f)
    
    prefixes[str(ctx.guild.id)] = prefix

    with open('prefixes.json', 'w') as f:
      json.dump(prefixes, f, indent=4)
    
    await ctx.send(f'Prefix changed to : {prefix}')

Anyway I should change this? or a better way to do it?

My bot is joining guilds at times and it's not always updating prefixes.json, which breaks the bot for them essentially, no prefix, no commands.

vivid fulcrum
#

stop using json as your db

slender thistle
#

Oh dear

cinder stratus
#

Yeah

#

Use something like sqlite

#

Easy peasy

kindred sinew
#

So the json is simply breaking it?

cinder stratus
#

Json is not a db

sudden geyser
#

It's probably not, but there are better alternatives.

#

e.g. SQLite with SQL.

cinder stratus
#

Apache Cassandra 😂

vocal trellis
#

Hello, my dashboard api doesnt want to work: https://tickety.top/ is the dashboard and https://tickety.top/api the api but it gives an ubuntu gateway error! on the direct ip the api works

vivid fulcrum
#

it might be the underlying cause, you're probably overwriting the existing data because files don't support concurrent or parallel operations at kalypso

kindred sinew
sudden geyser
#

My bot is joining guilds at times and it's not always updating prefixes.json, which breaks the bot for them essentially, no prefix, no commands.
If there's no entry in your "database", you should implicitly default to a prefix (e.g. .).

tired panther
tired panther
#

do not repost lol

sudden geyser
#

I recommend you only add an entry if the user sets one rather than setting one for the users.

marble juniper
#

ah yes

#

copy paste

tired panther
vocal trellis
#

😂

tired panther
vocal trellis
#

no credentials are stored

kindred sinew
vocal trellis
sudden geyser
vocal trellis
#

indeed

tired panther
vocal trellis
#

sure i will make one when my fk api works

vocal trellis
#

finding out whats wrong

#

Also can you help me creating a privacy

#

What do i need to supply

#

In it

tired panther
#

how can we help?

vocal trellis
#

now errors

tired panther
#

we do not have magic balls

vocal trellis
#

no consoel errors

#

it is a question like

#

you can fix it by enabling this in your ubuntu settings

sudden geyser
# vocal trellis can you help me

I don't have enough experience building a web server, but the meaning of the error is as so:

The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server. (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502)

I noticed if I visit /api and get 502 then quickly switch to any other URL, I get the same error page. A few seconds after, it returns an average 404 on any other page (go back to /api and get 502).

kindred sinew
# sudden geyser Yes.

Alright, so what would that look like exactly?

def get_prefix(client, message):
    with open('prefixes.json', 'r') as f:
        prefixes = json.load(f)
    return prefixes[str(message.guild.id)]

client = commands.Bot(command_prefix=get_prefix)

This is what I currently have.

sudden geyser
#

Instead of prefixes[...], use prefixes.get(...) and default to . if not found (.get(...) returns None).

#

But of course, as others have said, you should use a proper database for this purpose.

#

I'm only answering this question to tell you about defaulting rather than populating.

kindred sinew
#
def get_prefix(client, message):
    with open('prefixes.json', 'r') as f:
        prefixes = json.load(f)
    return prefixes.get(str(message.guild.id), ".")

client = commands.Bot(command_prefix=get_prefix)

That look right?

sudden geyser
#

looks correct. try it out and see

ancient gulch
#

Okay so, i want to make a count system with an array, i mean i want something like

[1] - 1
[3] - 2
[5] - 3
[10] - 4
[20] - 5

so, 1, 3,5 for the first three digit, then it add 10 to the rest, but didn't how to do that

let count = 0;
for(var i of array) {
  count += 10
  console.log(`[${count}] - ${i}`)
}
[10] - 1
[20] - 2
[30] - 3
[40] - 4
[50] - 5
kindred sinew
#

How long does the rate limit usually last? For a 429 Too Many Requests?

sudden geyser
sudden geyser
sudden geyser
#

They got temporarily blocked

#

I think it lasts for an hour or a day

kindred sinew
earnest phoenix
#

why does fetch invites require 2fa

umbral zealot
#

Probs because it's considered a moderation action with data that should be private as much as possible

sudden geyser
ancient gulch
#

tysm

rapid wharf
# earnest phoenix Well, you're stringifying a list, what do you expect?

In discord.py i made this command to show all the boosters of the server

async def boosters(ctx):
    guild = ctx.guild
    em = discord.Embed(title='Lovely people who have Boosted this server...', color=0xFF3933)
    em.add_field(name=f'Boosters [{len(guild.premium_subscribers)}]', value=guild.premium_subscribers)
    await ctx.send(embed=em)``` but it responds as ```<Member id=500305380014948362 name='Asuka' discriminator='7580' bot=False nick=None guild=<Guild id=787709538160869406 name='Asuka Bae' shard_id=None chunked=True member_count=1387>>]``` and i want it as ``` Asuka#7580``` 
i tried many things, but cant figure it out, what to do
vivid fulcrum
#

use list comprehensions and pass the member to str()

slender thistle
#

That's a fucking list

#

use str.join

rapid wharf
rapid wharf
# slender thistle use str.join

it does not work still the same 😩

Boosters [2]
[<Member id=493267802883358731 name='Kashyap Patel' discriminator='3304' bot=False nick=None guild=<Guild id=787709538160869406 name='Asuka Bae' shard_id=None chunked=True member_count=1385>>, <Member id=500305380014948362 name='Asuka' discriminator='7580' bot=False nick=None guild=<Guild id=787709538160869406 name='Asuka Bae' shard_id=None chunked=True member_count=1385>>]```
slender thistle
#

Show what you did

rapid wharf
#
async def boosters(ctx):
    guild = ctx.guild
    em = discord.Embed(title='Lovely people who have Boosted this server...', color=0xFF3933)
    em.add_field(name=f'Boosters [{len(guild.premium_subscribers)}]', value=str().join(guild.premium_subscribers))
    await ctx.send(embed=em)```
#

code

slender thistle
#

Do you understand what str.join does

rapid wharf
#

i mean i m not a pro in code

#

so if u can

slender thistle
#

It's basic list stuff

vivid fulcrum
#

so if u can spoonfeed me pwetty pwease 🥺 👉 👈

slender thistle
#

str.join is a method of a string, and what it does is join passed element's with the string on which the method is used

rapid wharf
slender thistle
#

Example: ' '.join([str(e) for e in [1, 2, 3]])

#

Do you understand what this does

cinder stratus
#

I see it just adds element to a string

#

Passed elements can be of any type right?

slender thistle
#

My dumb ass keeps forgetting it must be a string

cinder stratus
#

Oh!

#

I don't even know python

slender thistle
#

There we go

cinder stratus
#

I'll remember it might be helpful if I learn it someday

slender thistle
#

the provided iterable must be of type Iterable[str], meaning it's full of strings

cinder stratus
#

Strictly typed languages

slender thistle
#

Not really

#

Python lists elements can be of any type

cinder stratus
#

Hmm

slender thistle
#
>>> class MyClass:
...     ...
...
>>> [1, 'really', MyClass, MyClass()]
[1, 'really', <class '__main__.MyClass'>, <__main__.MyClass object at 0x000001C2B80C0F70>]
cinder stratus
#

But I'll probably learn kotlin rather than choosing python

slender thistle
#

That's fine

cinder patio
#

learn it all bb

cinder stratus
#

Because I have to rewrite my Bot someday in kotlin

cinder patio
#

you have to?

cinder stratus
#

Yep

spare badger
#

Hey guys. I'm using discord.js and I'm seeing that the guild owner is null. How is that possible? Every guild has an owner right? In the documentation is also says its nullable but I don't get why.

#

Am I missing some kind of permission or something?

cinder stratus
#

If it's null just fetch it

cinder patio
#

<Guild>.owner is not guaranteed to be cached

cinder stratus
#

Guild#ownerID

#

Is there

spare badger
cinder patio
#

Guild#ownerID is the id of the owner

cinder stratus
#
await <Guild>.members.fetch(id)
cinder patio
#

or users ^

tired panther
#

Why do you have to know, who the owner of the server is Pika_Think

rapid wharf
#

@slender thistle well i did this value=' '.join[str(e) for e in [guild.premium_subscribers]]) its showing invalid syntax, then i tried value=''.join[str(guild.premium_subscribers)]) and its showing TypeError: 'builtin_function_or_method' object is not subscriptable

woeful pike
#

join is a function

#

you call it like ''.join(...) not ''.join[...]

rapid wharf
#

ohh

rocky hearth
#

does djs supports slash commands yet?

tired panther
#

npm install discordjs/discord.js

rocky hearth
#

does, npm install discord.js wont work?

tired panther
tired panther
rocky hearth
#

so it'll be in stable at v13, right?

sudden geyser
#

When it's released, probably

#

If you want to use it early, I you can experiment on the master/main branch.

static matrix
#

I bought a new VPS but im having this issue.

rocky hearth
#

I once read the on the site, that they'll also support clickable buttons on embeds, anytime soon

solemn latch
# static matrix

when you moved your files over to the vps, did you copy the node_modules folder?
you shouldn't do that as it can cause issues.

static matrix
#

@solemn latch No i didnt.

#

I did npm i after moving

vivid fulcrum
#

what's your node version

static matrix
#

v.8.10

vivid fulcrum
#

why are you using such an ancient version

#

use the latest

#

the error is probably coming from djs which uses optional catch binding

static matrix
#

Yes I just realized

#

OMG

#

V8

vale garden
#

hi

#
Bot Quarantined
Your bot has been flagged by our anti-spam system for abusive behavior. While your bot is quarantined, it is unable to join any more guilds, or send any direct messages to users it has not messaged before. If you believe this to be in error, click here and select "Appeal an Action Trust and Safety took on my bot" as the Report Type to submit an appeal.
#

i got this above my bot

#

it was a bot ordered by someone and it sends dms to users whenever they join a server

#

it also has a point system which lets them add a certain number of users to their servers using oauth guilds.join

#

does anyone know what this means

umbral zealot
#

I mean it's pretty clear isn't it?

vivid fulcrum
#

it was a bot ordered by someone and it sends dms to users whenever they join a server
read what it says again

ember quarry
#

anyone know how to handle background task that takes too long time?

umbral zealot
#

it's sending too many DMs clearly

vivid fulcrum
ember quarry
#

i tried this but as the task takes about 2-3 min in total to complete and after complition of the task bot goes offline without any error even the code is still running

slender thistle
#

Sync database wrapper moment

vale garden
#

that wouldnt be considered spam would it

#

mee6 does the same thing

umbral zealot
#

it would be if there's 10,000 users.

vale garden
#

and many other bots

vale garden
umbral zealot
#

I can't speak for other bots. But you're not mee6 or dyno

#

What does your welcome message look like?

vale garden
#

its a custom message for each server

#

one sec ill have to check my db

#

Hey, you could win Nitro for FREE
Join these servers to WIN
and GROW your server FAST!

<inv link 1>
<inv link 2>

#

this is the msg

umbral zealot
#

HAHAHAHAHAHAHAH

#

yeah that'll get your ass banned in a second

#

congrats.

vale garden
#

wot

#

why

umbral zealot
#

Because it's literally advertising

vale garden
#

hmm

#

but ive seen those kinda msgs on mee6 too

#

why is it allowed for them tho

#

its yagdb or whatever

#

not mee6

#

lol

umbral zealot
#

I don't know

#

if you want more details, or if you want to argue the decision, you know what to do.

vale garden
#

well i thought this wasnt the reason thats why i asked here lol

#

anyways thnx

wheat mesa
#

Pretty sure it’s against ToS to send advertisement DMs like that

vale garden
#

loads of bots do it th

#

o

#

damn

#

mine has the same command which mee6 has

#

that is to set a custom welcome msg

#

does anyone here have the link to the discord devs server

umbral zealot
#

They won't be able to help you

#

It tells you in the message how to contact them.

vale garden
#

kk

wheat mesa
#

mee6 can send welcome message DMs, but I don’t think it’s intended for the purpose of advertisement

vale garden
#

well mine is the same thing

wheat mesa
#

I wouldn’t risk anything

#

I haven’t seen any bots DM advertise links by default, unless it’s a custom message set by the server admins

uneven lily
#

Hi, a few days ago my bot started using shards, the problem now I have a lot of problems with counting for users or servers, is there a way to merge all members / servers of a shard into one count?

To see the servers count I use

$ {client.guilds.cache.size}

Below I leave 2 photos of the server count from 2 different shards

Lang: Javascript
https://cdn.discordapp.com/attachments/622379620674830346/840976774036324392/unknown.png
https://cdn.discordapp.com/attachments/622379620674830346/840976826213203979/unknown.png

rocky hearth
#

in react I want to store <a></a> or <button></button> based on a condition in variable, so that later I could render it. How do I achieve that?

#

similiar to as='div' prop in some packages

umbral zealot
#

It's much easier to just have a condition showing either/or with { if } blocks

rocky hearth
#

but it'll get bulkier, If I later choose to add div or span too

umbral zealot
#

That's how you write React components, better get used to it 😄

#

You can also do dynamic classes instead, on divs or spans, in certain cases

#

there's no universal rule here and you shouldn't try to find one

#

semantic > dynamic

rocky hearth
#

I just want have a as prop on the component, which will accept any string element, which I want to render with

umbral zealot
#

So make a component that does that and returns the appropriate thing then

rocky hearth
#

like this

umbral zealot
#

yes

#

that's a prop

#

that returns conditionally, probably

#

This is not a thing that's common

rocky hearth
#

react has a function called React.createElement(), will it help?
it accepts a string, to render with

deft tangle
#

Please Explain Me How To Write Embeds

umbral zealot
#

For example if you want a <link> or <button> depending on a condition it's much better to use an inline condition

rocky hearth
umbral zealot
#

if it's between like 2-3 different elements, write conditions instead of dynamic things

deft tangle
rocky hearth
deft tangle
#

This[✓✓✓]?

rocky hearth
#

backtick is present on ur keyboard left to the key 1

umbral zealot
#

```
thing here
```

boreal iron
#

` `

deft tangle
#

Ok Ok

#

XY

wheat mesa
#

That’s 1

deft tangle
#

XY

boreal iron
#

3 for code blocks

rocky hearth
#

that's single backtick used

boreal iron
#

at the beginning and the end

wheat mesa
#
Code stuff
deft tangle
#

XY

deft tangle
boreal iron
#

magic

deft tangle
boreal iron
#

what?

wheat mesa
#

?

boreal iron
#

```Code stuff```

wheat mesa
#

^^

boreal iron
#

You can also enable syntax highlighting

deft tangle
#

[```Code_Stuff]

boreal iron
#

```language
Code
```

deft tangle
#

Code_Stuff

boreal iron
#

for example JS
```js
let x = 0;
```

#
let x = 0;
deft tangle
#
There's a ghost inside me
It all belongs to the other side
We live, we love, we lie```
#

Still🥺

boreal iron
#

Still what?

deft tangle
#

I used ```

wheat mesa
#

What’s the problem

boreal iron
#

Yes and you got a code block. What's the issue with it?

deft tangle
#

Code Block?

#

See The Difference Between Both The Messages Bro

wheat mesa
#

That means you used 1 or 2 backticks

boreal iron
deft tangle
#

Whut

wheat mesa
#

I’m on mobile I can’t tell the difference between the two haha

deft tangle
#

Really_Disgusting

#

🥺

boreal iron
#

TEXT INLINE CODE BLOCK TEXT

#

TEXT

NOT INLINE CODE BLOCK

TEXT

#

it's not hard to understand

deft tangle
#

Yes It's Not Difficult To Do Too

wheat mesa
#

Yeah, not sure why your discord is displaying it differently

boreal iron
feral aspen
#

How to loop through all the roles in a server?

lost heath
#

the nicb is the best one

wheat mesa
rocky hearth
#

u do hv block

deft tangle
wheat mesa
#

I see it as I’m supposed to

boreal iron
#

You can ESCAPE the brackets ```

#

\`

deft tangle
#

My Developer Mod Is On

rocky hearth
#

that should be not an issue.

deft tangle
#

DV Mode Has Any Connection With These Blocks?

boreal iron
wheat mesa
#

Try looking it up, usually discord js questions are pretty common to find answers to

feral aspen
#

Thanks!

deft tangle
#

Btw Thanks For Teaching Me

rocky hearth
deft tangle
#

I'll Try To Fix The Problem

feral aspen
#

Returns the IDs, I want the names..

rocky hearth
#

no it does, return all the roles of type Collection

#

u must be iterating over keys

feral aspen
#

I'm caching all the roles, but trying to return a collection not IDs but names.

#

Just like Dyno.

boreal iron
nova prawn
#

API v9 includes supports for threads, an upcoming feature. Older API versions will not receive any Gateway Events for threads, so it is important to update soon!

#

What does this mean? How can i update my bot to the new API?

boreal iron
#

an upcoming feature

#

Since you're probably don't the feature, yes you can.

umbral zealot
#

Is this for the Discord API?

feral aspen
boreal iron
#

CACHE

wheat mesa
#

Cache

boreal iron
#

lmao

feral aspen
#

Returns IDs..

#

I want the names.

rocky hearth
#

message.guild.roles.cache.forEach(role => console.log(role.name, role.id))
now it'll work

wheat mesa
#

^^

rocky hearth
#

what djs version u using?

feral aspen
#

undefined

feral aspen
#

Wait.

#

forEach is not in v12.

rocky hearth
#

it should be

feral aspen
boreal iron
#

foreach is no djs exclusive method

#

It's js

wheat mesa
#

Yeah

feral aspen
#

What can I use instead, map?

#

message.guild.roles.cache.map(role => console.log(role.name, role.id))

boreal iron
#

guild.roles.cache will return a collection.

#

You can also convert it into an array.

#

guild.roles.cache.array()

feral aspen
#

Uh.

boreal iron
#

get the length guild.roles.cache.size and loop to it

rocky hearth
#

so it doesn't have forEach u can use each instead

feral aspen
#

Returns the IDs

boreal iron
#

Well if they aren't cached then fetch them.

rocky hearth
feral aspen
#

I did this.

#

message.guild.roles.cache.each(role => role.name)

wheat mesa
#

And did it work

boreal iron
#

Yeah, that's correct

feral aspen
#
Collection(9) [Map] {
  '737011108954505267' => [Role],
  '751138549432189030' => [Role],
  '751676936283226124' => [Role],
  '776710533130223626' => [Role],
  '776710562821570560' => [Role],
  '782644949698871298' => [Role],
  '806548255013994546' => [Role],
  '807824111840657472' => [Role],
  '815657508600545311' => [Role]
}
rocky hearth
#

if you want to convert it to an array, use map instead

#

each gives u a Collection back

boreal iron
#

That's why I mentioned to create an array message.guild.roles.cache.array() and loop through it.

umbral zealot
#

You usually don't need to convert a collection to an array

boreal iron
#

Maybe 1 line more code

umbral zealot
#

you can easily loop through collections

#

collecation.forEach works fine

boreal iron
#

Depends on how you need it

umbral zealot
#

also collection.map

boreal iron
#

But yeah

#

Oh it's you... lol didn't know your nickname

rocky hearth
#

Oh, forEach is a Maps method. That's y they didnt documented it

#

so it does exist, but it returns nothing

boreal iron
#

as well as an array method

vagrant prairie
#

i have a simple question

#

one which i get confused at

#

alot

#
totalcost > balance``` or ```js
totalcost < balance```
vagrant prairie
#

thx

boreal iron
#

How is the Discord chat 2 minutes BEFORE my local system time... KEKW

vagrant prairie
#

i get confused mmyes

deep mantle
#

You might want to do greater than or equal to Incase they have exactly the cost

wheat mesa
#

That’s a relatively simple thing, if your total cost is greater than your balance, then you cannot purchase whatever it is you’re buying

old cliff
#

is there any npm package to parse a function into a string?

wheat mesa
#

<=

vagrant prairie
#

i was close

#

;-;

#

ima go relearn js

#

scyas

boreal iron
#

A JS function... no lib needed

#
function test(a, b) {
  return a + b;
}

console.log(test.toString());
wheat mesa
#

Isn’t toString() automatically called when placed in console.log

rocky hearth
#

OR

console.log(`Funtion: ${test}`)
wheat mesa
#

Ah, so only with interpolation

rocky hearth
wheat mesa
#

Got it

rocky hearth
#

same true for any object. (functions are objects too)

#

also, u can override the toString() method, to customize it a little bit

cinder patio
#

I'm pretty sure console.log calls toString automatically

lyric mountain
vagrant prairie
#

mAtHs

lyric mountain
#

Imagine a lowering sequence, > means the direction

#

6 > 4 > 3 > 1

#

Or just remember that meme "something >>>>> all"

vagrant prairie
#

thx

#

for 2 things

#

helping me understand

#

helping me learn maths

#

(no sarcasm)

lyric mountain
#

This technically is more logic than math

vagrant prairie
#

but

lyric mountain
#

Iirc it only appears in domain definitions in math

vagrant prairie
#

stiill maths

cinder patio
#

Wait... so you don't know what > and < are in math?

vivid fulcrum
#

my mom taught me that the one that's smaller is where the pointy part is at

#

since i was a child

cinder patio
#

idk I feel like I've always known this

ocean jolt
solemn latch
vivid fulcrum
#

never went to kindergarten gang

ocean jolt
#

Lol

lyric mountain
#

Came with pre-installed softwares I see

vivid fulcrum
#

it was full when i was supposed to go so my mom just said fuck it you're not going

#

and taught me everything in like two months

#

so i came to first grade fully literate

lyric mountain
#

Damn you missed so much fart jokes

lusty quest
#

ive died atleast almost once during my time in Kindergarten

lyric mountain
#

Jumping from a chair?

#

Or the infamous outlet?