#development

1 messages · Page 1521 of 1

lament rock
#

A guild owner can have roles assigned to them so long as the client has permissions to manage a member's role and the role isn't higher or equal to their highest

glacial pagoda
#

With All The Perms

#

oop wrong command

#

wait

#

There

earnest phoenix
#

hey @glacial pagoda ur give role thing for trying ban cmd dont work correctly

#

if you share your bot than it will crash

#

the id for the role is channel specific

glacial pagoda
#

I Know @earnest phoenix

#

But look at the error

earnest phoenix
#

...

#

whatever

gritty bolt
#
Error: Cannot find module 'C:\Users\Sam\Desktop\RemindMe\index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}```
This file exists and I get this when I do node index.js
#

any ideas as to what could be making this happen?

earnest phoenix
#

did u move the folder off your desktop?

gritty bolt
#

nope

#

its right there

earnest phoenix
#

loader.js:880:15

#

why are you passing discord through args instead of importing/requiring @glacial pagoda

#

check that line and that char

gritty bolt
#

wheres that?

earnest phoenix
#

wait...

#

u didnt delete index.js right?

gritty bolt
#

no

earnest phoenix
#

or rename it?

gritty bolt
#

right there

earnest phoenix
#

why is it in a foler called remind me?

solemn latch
earnest phoenix
#

is that the bot name?

gritty bolt
#

bot folder

#

yes

glacial pagoda
#

It Might Work?

earnest phoenix
glacial pagoda
#

I Dont Know Importing/requiring

earnest phoenix
#

just be sure to catch it in case it cant find it in someone elses server

glacial pagoda
#

But I Dont want to specify the role

#

all member roles are diff

gritty bolt
#

i literally

#

like

#

do I need to reinstall node?

solemn latch
glacial pagoda
earnest phoenix
#

u could try som like that

glacial pagoda
#

Im Not Doing Mute roles

#

its ban

earnest phoenix
#

no shit

#

im saying switch it

#

just nvm

glacial pagoda
#

Why

earnest phoenix
#

also

#

its

#

messageEmbed

#

uncap the M

glacial pagoda
#

...

earnest phoenix
#

it cant read MessageEmbed

#

only messageEmbed

#

nvm

glacial pagoda
#

but for the rest of my commands, they use Cap M and work

#

im trying your way

earnest phoenix
#

on index.js

#

did u pass Discord

glacial pagoda
#

yes

earnest phoenix
#

like that?

mellow kelp
#

why are you passing Discord on the arguments KEKW

glacial pagoda
earnest phoenix
#

why do u have a {

#

use ;

glacial pagoda
#

codeblock

solemn latch
#

thats a function, needs the {

glacial pagoda
earnest phoenix
glacial pagoda
#

thats my main.js

#

command handler

#

@earnest phoenix

#

i have a huge list

solemn latch
#

why is that screenshot diffrent

#

than the one above

glacial pagoda
#

which

glacial pagoda
solemn latch
glacial pagoda
#

Thats the ban in my command handler

solemn latch
#

yeah

earnest phoenix
#

thats mine

solemn latch
#

oh

glacial pagoda
#

0-0

solemn latch
#

what?

#

you both have the same command list?

glacial pagoda
#

ban

earnest phoenix
misty sigil
solemn latch
glacial pagoda
#

yeah ik

solemn latch
misty sigil
#

and you're passing discord

#

please

glacial pagoda
#

to specify

#

and to get

misty sigil
#

you should

  1. make the handler dynamic
  2. don't pass discord - require it in the file
glacial pagoda
#

why not, the embed needs discord

misty sigil
#

you require it

#

in the file

glacial pagoda
#

i have to

misty sigil
#

no you don't

solemn latch
#

we suggested it four times now alex, dont think suggesting it again will help.

glacial pagoda
#

ima try

mellow kelp
#

you can just require Discord at the top of the file

#

that's what literally everyone does

misty sigil
#

and make a dynamic handler

mellow kelp
glacial pagoda
#

TAHTS WHAT IM DOING

opal plank
#

dude

glacial pagoda
#

But yall say dont

opal plank
#

dynamic pls

misty sigil
#

@opal plank my reaction

glacial pagoda
#

Confusing me

mellow kelp
#

im getting yanderedev vibes

glacial pagoda
#

lol

misty sigil
#

right fucking there

glacial pagoda
opal plank
glacial pagoda
#

ok

opal plank
#

double tag, spicy

glacial pagoda
#

IM USING A HANDLER

misty sigil
#

heres my list of ways to handle commands, ranked from worst to best

  1. dynamic command handler
    1.5) a framework, such as commando
  2. hard coded command handler
  3. else if chain in a message event
  4. multiple ifs in a message event
  5. multiple message events
opal plank
#

YOU AINT

misty sigil
#

@glacial pagoda no you arent

#

you're just using else if chain in a message event

misty sigil
#

basically

opal plank
#

this clearly isnt a handler

misty sigil
#

UDHWAIUFH WAWWHD

opal plank
#

this is a massive if chain

glacial pagoda
misty sigil
#

qADdjipfaow

opal plank
#

thats not a handler

misty sigil
#

do you have the intetn

opal plank
#

thats just multiple files

mellow kelp
#

yandere dev is proud of you

glacial pagoda
#

command == 'command' is to specify filw

solemn latch
opal plank
#

thats not a handler

glacial pagoda
#

and get is to get the command

#

YES IT IS

opal plank
misty sigil
#

THIS

#

THIS IS A COMMAND HANDLER

opal plank
#

IT ISNT

glacial pagoda
#

0-0

opal plank
#

A DAYNAMIC

mellow kelp
#

thats the first part

opal plank
#

COMMAND

#

HANDLER

#

this is the second part

solemn latch
misty sigil
#

ok fair enough

opal plank
#

which i told you to read

earnest phoenix
#

bro wtf

misty sigil
opal plank
misty sigil
#

cba copypasting

opal plank
earnest phoenix
#

just type Require = Discord;

#

at the top

glacial pagoda
earnest phoenix
#

its that easy

opal plank
misty sigil
#

no aaron

#

thats not a command handler

#

thats a fucking else if chain

glacial pagoda
#

im just trying to fix my error ;-;

misty sigil
#

@earnest phoenix can i see your client intents

#

Let me write a command handler

#

ffs

mellow kelp
#

an actual command handler checks if there's a command with a certain name in the client

#

and executes it if so

opal plank
#

or does 300iq like me

mellow kelp
#

dynamically

opal plank
#

try/catch

glacial pagoda
#

i have to pass discord

opal plank
#

you dont

glacial pagoda
misty sigil
#
const command = args.shift().toLowerCase()
const cmd = client.commands.get(command)
if (!cmd) return;
cmd.execute(message, args)
#

THEN DEFINE IT AT THE TOP

mellow kelp
#

you just have to require again

opal plank
#

you dont need to re-use discord in your code, i assure you

mellow kelp
#

well, first of all

#

LEARN JS

opal plank
#

they dont even need it, they're likely using it for an embed

#

which is already bad

#

embed builder is trash

misty sigil
#

i need to rework my code

#

like entirely

#

to remove embed builder n shit

opal plank
#

second you just declaring useless stuff taht you wont even need

misty sigil
#

why am i being asked something

#

wITHOUT CONTEXT

earnest phoenix
misty sigil
#

yea ok

#

sure

opal plank
#

node gud

misty sigil
#

i'll use deno instead

opal plank
#

dunno bout deno though

solemn latch
#

sometimes i think this channel is too aggressive about this stuff.

earnest phoenix
#

node is awesome LMAO

misty sigil
#

node isn't the best

#

as far as things go

mellow kelp
#

deno might become awesome

earnest phoenix
#

node is good for many things, not all

opal plank
#

never said it was the best, but sure is the handiest

misty sigil
#

yea you're right

#

it works and it works relatively well lol

opal plank
#

everything thus far has been made in node, if you got a problem, you got a solution already somewhere

misty sigil
#

whats the actual fucking error

earnest phoenix
#

every language has its pros and cons

node targets easy programming and scalability, super good UI building tools and more
compare that to something like java and .net where performance is the target but the languages suck ass for building UIs

misty sigil
#

what are php's pros

opal plank
#

also, i just recently learned that node 15 finally crashing the process on unhandled rejections

earnest phoenix
#

easy web vuln mmLol

misty sigil
opal plank
#

anyone using node 15, better have good code

misty sigil
#

finally

misty sigil
earnest phoenix
misty sigil
#

remove the intent then?

opal plank
#

ezpz

#

actually, better yet

misty sigil
#

wrap everything

opal plank
#

yeah, that work

earnest phoenix
#

node 15 is awesome, especially because of native AbortController support

#

finally a native way to cancel promises

opal plank
#

i havent been playing with node 15 yet, so im not sure

misty sigil
#

i've stuck with node 14 lts

opal plank
#

i have it running locally, but prod is 14.8 iirc

misty sigil
#

14.15 on my home server

#

??

gritty bolt
#

ok is there like a place i can go where someone will look over an entire file and help me figure out why th it isnt working

#

this code i made is legit a nightmare

misty sigil
#

if you tell us the error

#

yes

gritty bolt
#

you see the problem is, theres no error

misty sigil
#

ok

gritty bolt
#
MongooseError: Operation `messagereminders.find()` buffering timed out after 10000ms```
this is the closest I've gotten to an error in days
#

but I don't have anything saying messagereminders.find()

misty sigil
#

ok so it doesn't work but no error?

gritty bolt
#

essentially

#

thats all that happens and I couldn't tell you where its coming from

#

i know it's somewhere in this code

#
//Remind User Function
async function remindUser(bot) {
    try {
        let reminderEmbed = new discord.MessageEmbed()
                .setTitle(data.messageLink)
                .setDescription("You asked me to remind you at this time of the message linked above. Click the link to view the message. If the link does not work, the message may have been deleted or you do not have access to it anymore.")
                .setColor("#FF0000");
                await data.user.send(reminderEmbed)
                data.remove();
    } catch (err) {
        console.log(err);
    }
    }```
```js
//Node-Scheduler Function
nodeSchedule: async function scheduler(bot) {
try {
    (await messageReminderModel.find({})).forEach(data => {
        let currentUnix = Date.now()
        if(data.time <= currentUnix) core.remindUser()
        schedule.scheduleJob(data.time, remindUser);
    console.log("Scheduled a reminder.");
});
} catch (err) {
    console.log(err);
}
}
}
#

otherwise i've been trying for days and haven't gotten anywhere

solemn latch
#

i cant remember how mongoose/mongo index's stuff

#

is your database/table properly indexed?

gritty bolt
#

im not sure

#

i think so

#

it goes in fine

#

I just can't sift through it, and dm a user

misty sigil
#

i actually use the _id key in mongo

solemn latch
#

indexing is specifically searching

misty sigil
#
messageReminderModel.find({})
``` is this not messagereminders.find()?
gritty bolt
#

that is

#

actually

#

thats it

solemn latch
#

click on "indexs"

misty sigil
#

i see your problem

#

you are storing a user mention

solemn latch
#

nvm then :p

misty sigil
#

and trying to .send on a string

#

store a user ID

#

and get it from cache / fetch it

gritty bolt
#

okay

misty sigil
#

..............................................

gritty bolt
#

oh wait

#

oh

#

oh

#

oh

#

oh

#

just

#

pretend I didnt

#

okay I will attempt that and come back

#

otherwise does everything else look good?

misty sigil
#

yea

mental willow
#

ok so i am trying to get the bot to update the game of which it is playing

function pingForPlayers() {

    // Ping API for server data.
    axios.get(`https://api.mcsrvstat.us/1/${process.env.MC_SERVER_IP}`).then(res => {
        // If we got a valid response
        if(res.data && res.data.players) {
            let playerCount = res.data.players.online || 0 // Default to zero
            client.user.setPresence({
                game: {
                    // Example: "Watching 5 players on server.com"
                    name: `${playerCount} player${playerCount > 1 ? 's' : ''} on ${process.env.MC_SERVER_IP}`,
                    type: 3 // Use activity type 3 which is "Watching"
                }
            })
            console.log('Updated player count to', playerCount)
        }
        else
            console.log('Could not load player count data for', process.env.MC_SERVER)

    }).catch(err => console.log('Error pinging api.mcsrvstat.us for data:', err))
}
``` Now the bot is loging the correct player cound just not updating the game. Please @ or reply to me if you can help (so i see the ping) i dont have much experience with discord.js (i normally work with py)
gritty bolt
#

@misty sigil ok i think im actually unclear on how to do what you're talking about

#

i just tried and i dont think I did it right

misty sigil
gritty bolt
#

but I cant just send it to the id

#

after that

misty sigil
#

get user by await client.users.fetch(id) / client.users.cache.get(id)
then send by doing <User>.send()

gritty bolt
#

and how do I get the id of the user who reacted to a message again?

misty sigil
#

yea

gritty bolt
#
TypeError: Cannot read property 'id' of undefined
    at Client.<anonymous> (C:\Users\Sam\RemindMe\RemindMe\core.js:23:42)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)```
#
    bot.on('messageReactionAdd', async (reaction, user) => {
    if(reaction.emoji.name === "⏰") {
        let errorEmbed = new discord.MessageEmbed()
        .setTitle("An error has occured. It has been reported to the development team for further review.")
        .setColor("#FF0000");
        const messageLink = reaction.message.messageLink
        await user;
        const userObject = reaction.user.id```
#

@misty sigil

#

i probably did something stupid

earnest phoenix
#

fetch the user

mellow kelp
#

reaction doesn't have a user property

earnest phoenix
#

oh

#

does it not?

mellow kelp
#

you already have a user variable

mellow kelp
mellow kelp
earnest phoenix
#

oh

#

yeah

#

just checked the docs

gritty bolt
#

oh

earnest phoenix
#

well

#

have you read the error

#

so where's the problem

#

also don't copypaste code

gritty bolt
#

still wont work

#

no error this time

#

those functions are only running after a reminder is set

#

like node-schedule isn't working at all

#

@misty sigil if you'd still be willing to help me I've got the whole file (https://pastebin.com/s0eZjq86) pretty much I can't figure out how to be able to use my functions in my module.exports in the same file, and why it's only scheduling reminders when someone creates a new one

gilded olive
#

yarn add -D @types/node typescript can I do this with NPM

#

as yarn seems to die on me

earnest phoenix
#

Heyo

#

Can someone help me with a lil something?

#

Hey I'm trying to use a mongodb currency system but I'm trying to make it that if you own a certain amount of money a type of emoji will pop up that will indicate levels of prosperity. Gold, silver, etc.. the only problem i have is using ranging values. It would look something like this

if(eco.coins <= 100 to 500)

Obviously this is non working code but I would like something like that instead of having to type every number in between

boreal iron
#

X >= 100 && X <= 500

#

Just put more than 1 condition in your statement

lament rock
#

This might be a bit of an advanced topic I don't necessarily expect an answer to, but I am attempting to learn general application scaling. I now find it necessary to rethink how I store Objects sent by Discord. My current implementation is storing some data in memory such as guilds and voice states as those are volatile and are re-sent on READY anyways. The rest is stored in a single Redis instance which I interface transactions beyond GET, SET and DEL commands such as filtering in a cache worker located on the same machine as the Redis instance.

My current implementation isn't exactly as efficient as I'd like it to be since making some complex transactions involving accessing both memory and Redis across client clusters can add quite a bit of overhead. Currently, it takes about a minute for a client in 3k guilds to respond to an OP requesting the guilds a user is in solely based on which guild sub index they get cached in. I know there is a better way to receive user guilds which I will implement, but it just serves as an example.

Another issue is that whenever the client establishes a websocket connection to discord, the amount of data sent after the READY event such as GUILD_CREATEs causes the Redis instance to be starved for resources. I imagine it would be beneficial to batch SET queries to reduce the volume of inbound request processing but IDK.

My main question would be what exactly should I be doing to properly scale based on my needs? Currently, it is necessary that I am able to filter over Users/GuildMembers by ID, name as possibly tag/nickname (ID is included because it comes from acceptance of arbitrary input. I could possibly attempt to see if the input is a key which is indexed before issuing a filter OP, but that may add some overhead). It is also necessary to be able to filter over channels under a specific guild by name or ID for the same reasons highlighted above.

Is there a specific db I should be using? etc...

odd stratus
#

Is there a specific db I should be using? etc...
PostgreSQL is a pretty good Database

sterile lantern
#

how come this doesn’t work

#

it says it’s an unknown slash cmd

#

or api I forgot the error

summer dust
#

guys my bot just stopped streaming audio to discord when ran in its usual host

#

when ran on an alternative host i do have or on my own computer, it works fine

#

any clue what's happening? ip ban?

gilded olive
#

Sounds like it

#

What error do you get when you try to stream audio?

summer dust
#

nothing

#

absolutely nothing

#

the code works as expected, and ran on other machines it streams audio

sterile lantern
#

you’re sending web requests for it right

summer dust
#

but not in its usual host

summer dust
sterile lantern
#

it’s possible you’re being ratelimited or possibly had your ip banned

#

try .catch

#

and see if it catches the error

gilded olive
#

Yeaa rate limited or ip ban

summer dust
#

i have try catchs

gilded olive
#

Pray its rate limit

summer dust
#

and catch all promises

#

and nothing appears

#

damn it should display a rate error

sterile lantern
#

You have an interval set?

summer dust
#

i think its an ip ban

gilded olive
#

Try a simple request right now

#

See what happens

summer dust
#

what do you mean by a simple request

#

the bot logs in well and works fine

#

the only problem is streaming audio

gilded olive
#

Welp

#

Ip ban KEKW

summer dust
#

yeah, i suppose

#

thanks discord

#

i'll have to change its ip

#

and contact discord

#

for some help or an explanation

#

at least an explanation

gilded olive
#

I mean its from youtube yes?

summer dust
#

yeah i take audio from youtube

gilded olive
#

From my knowledge

#

Youtube is in full right to ip ban you for that

summer dust
#

oh, youtube?

#

then its not discord... mmmm

#

yeah, i didnt think about that

#

gonna try a curl request to youtube

earnest phoenix
#

you need to implement ip proxying

#

aka ip shuffling

#

youtube became super strict about scraping data

gilded olive
#

Yea its not discord

#

They dont give a shit

mellow kelp
#

wait is it possible to scrape youtube audio

#

gasp

summer dust
#

thanks, you are pretty useful

earnest phoenix
#

using the unofficial public api

#

that's how youtube-dl works

gilded olive
#

Does anyone know why my yarn installation is fucked

summer dust
#

yeah, ytdl

gilded olive
#

It says yarn isnt found when I just set it up SoWeary

#

Reinstalled it bless rng

mellow kelp
#

try restarting the shell

gilded olive
#

It works in powershell

mellow kelp
#

maybe check if yarn is on the path env variable

gilded olive
#

But bash or cmd? ❌

mellow kelp
#

check your path variable spoonfeed

#

you on bash right?

gilded olive
#

Rn yea

mellow kelp
#

just echo $PATH

gilded olive
#

I can see yarn

#

AppData/Local/Yarn/bin

summer dust
#

not a 200

#

mmmm

mellow kelp
#

idk what else to try then hashflushed

summer dust
#

and getting a 200 when using curl on another host

#

fucking youtube

#

got ip banned

gilded olive
#

Im trying

#

yarn --version right

mellow kelp
#

yea

#

or just yarn -v

gilded olive
#

Well thats nice

#

YES

#

Its working

#

Thanku elcholo

#

(Your name is interesting)

mellow kelp
#

hm yes

odd stratus
#

@summer dust Use a proxy or cookies in your ytdl code or enable a VPN

#

Using cookies can reduce you getting banned and a VPN can also help

#

I use a /48 IP block for my Lavalink code but for ytdl you gotta choose one of those 3 in order to prevent it

slim void
#

What does this mean?

#

Running my bot on a hostfor the first time.. never seen this?

summer dust
#

do you know?

odd stratus
#

Yes, I can give you an example but I need to know how you’re playing the song with ytdl first

slim void
#

What is the discord.py starup cmd, what do I put for it

summer dust
#

sure

odd stratus
#

Although idk if cookies always work if the IP is already banned so you might need to try with a VPN for it

gilded olive
#

@mellow kelp yo

summer dust
gilded olive
#

I have an issue with yarn

summer dust
slim void
#

bruh

summer dust
#

but if i can prevent it from happening again

slim void
#

how tf do I do this lmfao

summer dust
#

its ok

slim void
#

I've never used a host?

#

Startup cmd?!?!

summer dust
slim void
#

u talking to me?

summer dust
#

yes

slim void
#

so like this?

#

yeah no 😦

summer dust
#

mmm i thought you got access to a ssh shell

slim void
#

bruh what is this

odd stratus
mellow kelp
summer dust
#

sure

#

i send you the whole function i use

odd stratus
#

This is the regular ytdl-core right

summer dust
#

thanks @odd stratus

summer dust
odd stratus
#

👌

slim void
#

what is the discord.py startup cmd, anyone know pls

odd stratus
#

That's what a document says

slim void
#

what?

#

It's not supporting python now

gilded olive
# mellow kelp sup

yarn add -D @types/node typescript never seems to work because of the typescript thing, i can see ti tries to fetch it but fails and says my internet is not working even tho everything else is

slim void
gilded olive
#

it spits out yarn-error.log

slim void
#

-py 3 didn't work

mellow kelp
#

that should work just fine tho

slim void
#

it's ot

mellow kelp
#

is it just an internet error?

slim void
#

not

gilded olive
#

hold up ill get the log

odd stratus
#

python3 <filename>.py then

slim void
#

like this?

odd stratus
slim void
#

yoo

#

😂 this host is a bit wack

gilded olive
#

Idk why it does this smh

#

The node one works

#

Should I try just node

#

Or do both typescript and node need to be in the same line

mellow kelp
#

you should be able to do both at the same time

#

but i guess you could try one at a time

gilded olive
#

I think it's an issue with the typescript addition

#

Because it gets node just fine

#

Well

#

It just worked randomly

#

Ok then

mellow kelp
#

o

#

aight

gilded olive
#

Ben awad teaching me react and ts pogchamp

mellow kelp
#

yes

#

once he was trying vue.js with typescript for the first time and wanted to know the type of an 'onclick' event

#

"Well now I know what this type is" - he said as he typed any

earnest phoenix
#

react 18 is definitely going to be king of UI frameworks once it comes out

mellow kelp
#

whats it gonna bring?

earnest phoenix
#

facebook is focusing on concurrent UI and SSR

earnest phoenix
#

@terse sphinx its already taken over 4 hours 😦

#

and the 429 error isn't going away

#

from what i'm seeing

#

your error says you got API banned for exceeding ratelimits too frequently

#

API bans last 24 hours they're supposed to last an hour

#

however it may vary

#

if it doesn't expire after 24 hours contact discord support

#

hmm i think i understand why I got API banned

#

but I don't understand why the ban has already lasted 4 hours and counting

gilded olive
#

What did you do to get API banned

#

Accidental for loop?

earnest phoenix
#

i'm not 100% sure

pale vessel
#

That doesn't sound very good

#

If you got API banned you just have done something that's worth noticing

earnest phoenix
#

no it wasn't a for loop, my bot didn't have any rate limit handling, so I think a user probably just spammed commands

twilit geode
#

I found using sql and stuff like that really hard, and lots of stuff I dont understand, is there anything wrong with using JSON?

mellow kelp
#

json aint meant for storing data

earnest phoenix
#

also, when I do something like this.

print(req.headers['Retry-After'])```

I get a number which is going down, but whenever the number hits 0 it resets back to 3600
twilit geode
#

its just for economy

earnest phoenix
#

if you find it hard to work with SQL use an ORM or a noSQL db

twilit geode
#

...

#

ty

#

I will take cry as an instruction

sacred trout
#

how much time does it take a bot to get reviewd?

#

reviewed

earnest phoenix
#

however long it takes

sacred trout
#

lol

earnest phoenix
#

my bot took like 4 days

sacred trout
#

oh ok

#

tanks

#

thanks*

earnest phoenix
#

rip the retry after time just reset

#

it went from like 400 to 0 and now its back up to 3500

#

doesn't seem like its going to get fixed any time soon 😦

#

contact discord support

#

be specific about your issue or they're just going to bin your ticket to a bot

#

thats what i did

#

you should really handle the ratelimit doe

pale vessel
#

Doesn't the library handle rate limits?

gilded olive
#

Which lib?

pale vessel
#

Was thinking of Discord.js, but I just looked again, they seem to be using d.py

earnest phoenix
#

dunno if he mentioned the lib, just said "my bot didn't have any rate limit handling"

gilded olive
#

d.py does handle rate limits afaik

earnest phoenix
#

it indeed does

gilded olive
#

I tried seeing how far I could push it

#

Got rate limited for 44 minutes

drifting wedge
#

How do webhooks work? Like I set up a route for it, but how do I get what the webhook is sending?

earnest phoenix
#

webhooks are reverse APIs

delicate shore
drifting wedge
earnest phoenix
#

instead of you making a request to the API, the API makes a request to you

drifting wedge
#

An api is like you ask for something and it gives you

#

A webhook is the thing giving you the data?

#

Im so confused

#

A webhook is like something sending data to you?

solemn latch
#

yeah

drifting wedge
#

But how do you read the data?

solemn latch
#

in the http receiver.

#

generally

drifting wedge
#

Wdym? How would I?

earnest phoenix
#

a webhook is nothing more than just a simple HTTP request

drifting wedge
#

I don't really understand this stuff to well lol

earnest phoenix
#

you need to have a webserver open and listening to a port

drifting wedge
#

Http request is like a url

earnest phoenix
#

well yes and no

drifting wedge
#

So the webhook sends the data in the url?

#

Wot

earnest phoenix
#

a url is only a small part of a request

#

a request contains the url, headers and extra data in some cases

solemn latch
#

the bot reviewer applications are currently closed.

delicate shore
earnest phoenix
solemn latch
drifting wedge
#

Where would I get the body?

#

That's what I don't understand

earnest phoenix
#

from the request

#

use a webserver library

drifting wedge
#

I don't understand how the additional information sent works

#

I will, lemme reasearch it dw

earnest phoenix
#

it's sent in the body of the request

drifting wedge
#

Rq

#

I don't get that lol, lemme look into it more

#

Ty

delicate shore
solemn latch
#

many webhooks are not compatible with each other.

earnest phoenix
#

you need to host your own webserver to act as a middleware between kofi and discord

#

the thing in the code blocks is how a http request looks like

#

you mostly won't encounter a raw format like that with modern day development

#

libraries handle a lot of that for you

drifting wedge
#

Aiohttp is just requests but async right?

earnest phoenix
#

no idea, i don't work with python

drifting wedge
#

Ok ty

old cliff
#

yeah I am caching everything

#

:/

#

Feels stupid

earnest phoenix
#

im assuming you're using djs

drifting wedge
#

Ty tho

old cliff
#

yes

earnest phoenix
#

djs is a ram chonker

drifting wedge
#

I think I understood

#

It's too much lol

#

Too much ram

old cliff
#

now its using 600mb

drifting wedge
#

@old cliff

old cliff
#

bruh

drifting wedge
#

Mine is in like 700 servers and using like 130 mb

#

@earnest phoenix for a webhook I would setup a get thing?

earnest phoenix
#

i had around 250 (500 at peak activity) mb usage at 2500 guilds with c# and discord.net

#

@drifting wedge yup

drifting wedge
#

Ez!!!!!

#

Ty

old cliff
#

I might have to use RAW event and caching nothing xD

lone edge
#

@solemn latch is there anything else i should do to change my bot before resubmitting? (other than fixing that command)

drifting wedge
#

My website handles data really weirdly, I don't like using complicated stuff, so I just use the js fetch

#

And get response from flask and see what response it matches with

old cliff
#

well what was the message cache sweep thingy ?

lone edge
earnest phoenix
#

i cached every member in dapi, dbl and dbots (so around 200k members at the time) and didnt exceed 500mb 🤔

#

you might have to move libraries or the language entirely

lusty quest
#

its pretty much normal d.js just some of the caching stuff changed

earnest phoenix
lusty quest
#

is the path correct?

earnest phoenix
#

Yes

lusty quest
#

then it should work

drifting wedge
#

Im very confused, so the url I put for the dbl webhook api

#

For votes, let's say I set up the url and stuff

#

How do I get the data?

lusty quest
#

the DBL server sends a Call to your Webhook Server with the data

solemn latch
drifting wedge
#

Ty for spoon feeding me in the docs @slender thistle

slim void
#

Is it possible to make a backup bot that saves the permissions to with all role permissions? Then when you backup everything is normal.

lusty quest
#

sure but it could be a nightmare from a Data Security side of things

slim void
#

Uh

#

I've never seen a bot do like that

#

I feel like it would be useful

#

But leaking permissions if it happened isn't really bad is it?

cinder patio
slim void
#

@cinder patio can that be used as a public bot or only as a personal?

pale vessel
#

Read the license lmao

slim void
#

Mit?

#

Doesn't that mean public.

#

Yeah distribution

restive furnace
#

discordjs is MIT too, so how you could not use that then?

#

atleast what I remember

earnest phoenix
#

What is wrong
+eval message.guild.channels.cache.get(772051120595009549).message.fetch(798999326717640724).then(message => message.react('😄'));

tight plinth
#

convert the ids to string

earnest phoenix
#

also a message doesn't exist on a channel

tight plinth
#

^ .messages instead of .message

#

plus try to do .then(msg =>...) instead of .then(message =>...) since the message object already exists

copper lance
#

Heyo, my bots in 80 servers so i think i should apply for verification. What exactly do I need to do, I find their docs confusing about it

tight plinth
#

you need to go to your bot page in the dev portal, click the bot section and follow the instructions

earnest phoenix
tight plinth
#

ids are not stored as numbers due to how big they are xD

#

even at discord they use strings

slender thistle
#

I'm glad they were helpful

drifting wedge
#

They weren't, the spoon feeding was

#

I don't read docs or Google

#

I have you!

#

Either spoon feed or shivaco feed

slender thistle
tribal siren
#

if(!message.member.roles.cache.some('750302895202762863')) return message.channel.send(embed)

#

typeerror: fn is not a function

#

why doesns't it work?

slate apex
#

Hmmm

earnest phoenix
#

read the error

#

some takes in a function

tribal siren
#

oh hey cry

earnest phoenix
#

hii

#

how to fetch messages from a userid

uncut swallow
#

guys i development a comand of translate and i have a error you can help me?

analog jolt
#

can someone tell me why does the bot goes offline even if there is no error in console and the bot still says its online in console?
this happens like after 6+7 hours of hosting on aws

earnest phoenix
uncut swallow
#

xd

slim void
#

Where does the token go?

#

I'm installing a public bot-open-source, says change the token then it's all good. But In node.js where is the token?

#

which one would the token be in

slim void
#

nvm fixed it

#

Alp

analog tinsel
#

did there anyone know how to convert .ttf to .fnt?

slim void
#

Alp

analog tinsel
#

yes

slim void
#

Do you know what this means

analog tinsel
#

im using discord bot maker :d

#

im noob

slim void
#

WAT

#

ew

#

🤔

analog tinsel
#

you must install modules

#

type npm i --force

blissful bridge
slim void
#

holy grap

#

@blissful bridge

slim void
blissful bridge
#

ok?

slim void
#

why no w ork

#

here is updated error

blissful bridge
#

ok do npm i --save

#

then just try to start your bot

slim void
#

ok

blissful bridge
#

if it still wont work

slim void
#

doing it rn

blissful bridge
#

then idk

slim void
blissful bridge
#

ok now start your bot

slim void
#

I idd

#

with what starup?

blissful bridge
#

node <yourmainfile>

slim void
#

yoo

#

wtf

#

ur like

#

magic

#

😂

#

Eren

blissful bridge
#

not even close to magic

slim void
#

can u educate me what npm even is

#

or what I just did?

slender thistle
#

how do you use npm without knowing what it is

blissful bridge
#

you just installed modules

slim void
#

tbh

#

I just sometimes do without knowing

blissful bridge
#

you need them to run your bot

#

or for its functions

slim void
slender thistle
#

npm stands for node package manager

slim void
#

I never used npm in my life

blissful bridge
#

you can also use yarn ofc if you want to

sharp prairie
#

welp

tribal siren
#

@slim void why do you copy github sources

eternal osprey
#

hey guys

tribal siren
#

sup

eternal osprey
#

i have a json file containing the key owner

tribal siren
#

cool

slim void
#

I made my own bot, however, I saw this new node.js backup bot that like..

eternal osprey
slim void
#

copys perms and everything

#

and I wanted it 😄

#

for personal use

#

damn

#

it even copys embeds

#

rip api 😂

eternal osprey
slim void
#

Awsome

#

do u think it's wrong to host someones bot that's on github and distribute it to others

#

I saw on github, it said: "I cannot afford to make this bot public", I figured what if I host it?

eternal osprey
eternal osprey
slim void
#

I would credit him 100%

#

and take 0 credit for it

eternal osprey
#

then it's good

slim void
#

k

eternal osprey
slim void
#

Maybe I won't make it public

#

feels bad to do that

#

Plus idk how the bot rlly works

#

and if people start complaining or asking for updates.. yeah lol

sharp prairie
#

miner mends

#

I think

#

that

#

you need to start over

#

with learning discord.js

#

and node stuff

#

because really to do stuff you want, first you need to understand them

slim void
#

@sharp prairie I agree

#

My first bot which is in 92 servers is made in discord.py

#

I tried doing bots in lua

#

Just wasn't my thing.

#

I've been learning js tho

sharp prairie
#

yeah python and javascript have big differences

#

and its tough to learn from one to another

near stratus
slim void
#

I don't like python.

#

it's very messy in my opinion

#

Whereas JS looks more clean/organized.

#

The good thing about python is it's easy..

sharp prairie
#

also whats ur bots name miner?

tidal bluff
#

Hello everybody! So I'm trying to make a user info command. I created a -me command which works perfectly, but the other one which mentions a other user, gives a strange result. Here's the code and the result:

near stratus
sharp prairie
#

you can just do const member = message.mentions.users.first() || message.author

near stratus
#

@tidal bluff how's the ID valid when username is invalid ?

timber fractal
#

So i have this collector ```js
collector1.on(collect, m => {

})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
tidal bluff
#

@near stratus Tell me about it. Idk

tidal bluff
#

@sharp prairie I saw that but the mentioned user isn't the command author (e.g it's not me)

near stratus
tidal bluff
#

No errors

near stratus
#

Something like
Can't read property username of undefined

tidal bluff
timber fractal
#

So i have this collector ```js
collector1.on(collect, m => {

})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
tidal bluff
slim void
#

question

near stratus
#

@tidal bluff
try this

message.mentions.members.first()
#

cuz guild Probably don't define user that could be the issue

tidal bluff
#

Hold on

near stratus
#

and Probably message belongs to guild

sharp prairie
#

@tidal bluff lol the problem is that it needs to be message.mentions.members.first()

timber fractal
sharp prairie
#

not message.mentions.users.first();

near stratus
tidal bluff
sharp prairie
#

yes

near stratus
#

yeah

sharp prairie
#

and now it should work

timber fractal
eternal osprey
tidal bluff
sharp prairie
#

wtf

timber fractal
#

So i have this collector ```js
collector1.on(collect, m => {

})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
eternal osprey
sacred aurora
#

Is it edit the json file?

eternal osprey
#

i want to change the "owner' key's value.

eternal osprey
sacred aurora
#

Fs read the file, hen edit

#

Yeag

near stratus
#

like permeantly like writing files ?

sacred aurora
#

Hmm typo

#

Then write it again

eternal osprey
near stratus
sacred aurora
#

Parse the json

eternal osprey
#

like could we be a bit more specific.

sacred aurora
#

Then edit the owner

#

Then write again the file with stringify json

eternal osprey
#

that is not how objects work.

#

i was told to use keys and values.

timber fractal
#

So i have this collector ```js
collector1.on(collect, m => {

})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
sacred aurora
#

Hmm

eternal osprey
near stratus
#

@eternal osprey

fs.readFile('demofile1.json', (e, r) => {
    //here parse it
}
eternal osprey
#

hmm okay yeah

near stratus
#

then after parsing change the value and write it

eternal osprey
sacred aurora
#

Then wut

eternal osprey
#

but the changing that is what leaves me hanging in the dark/

timber fractal
eternal osprey
#

like what should i use? Replace? Any function to swap?

sacred aurora
#

can u just set it?

#

like object = value

eternal osprey
near stratus
#

@eternal osprey after the above code just add this

fs.writeFile('demofile.json', 'new JSON object here', err =>  {
  if (err) throw err;
  console.log('Saved!');
});
eternal osprey
#

i am trying to replace that value.

sacred aurora
#

Yeah u can set it again bruh

eternal osprey
near stratus
eternal osprey
#

if i use this would it replace all the owner values?

sharp prairie
#

@tidal bluff also use member.user.username

near stratus
sharp prairie
#

and rn I am trying

#

to use

tidal bluff
sharp prairie
#

oh

#

noice

tidal bluff
#

Thanks anyway, akio too.

eternal osprey
sharp prairie
near stratus
#

just search on npm

sacred aurora
#

if u have a big and dynamic data then use proper database

eternal osprey
#

{"2172646":{"id":800,"name":"Necrozma","level":9,"catchChance":1,"spawnId":1300980,"owner":"363191104465666048","catchTime":"01/13/2021 12:04 PM","nickname":""} this is how one object would look like.

sacred aurora
#

json is good for static data

near stratus
#

@eternal osprey f it use mongoDB

eternal osprey
#

i would have to rewrite my whole, literally whole code.

near stratus
tribal siren
#

what does guild.mfaLevel stand for?

#

like what's mfa?

near stratus
#

@eternal osprey use a for loop

eternal osprey
near stratus
eternal osprey
analog imp
#

anyone familiar with guildemojirolemanager?
guildEmoji.roles.set([`${args[1]}`])
so this was successful, and it added the emoji to the guildemojirole cache.
add the role to a member, and it doesn't apply the restriction removal upon gaining the role--cannot use the emoji despite having the role, and still is inaccessible to use
guildEmoji.roles.add(`${args[1]}`)
also does the same thing

eternal osprey
#

me myself, i was thinking about using ```js
var obj1 = {
"key1" : "value1",
"key2" : "Value2"
};
var obj2 = {
"key3" : "value3",
"key4" : "Value4"
};
function swap(sourceObj, sourceKey, targetObj, targetKey) {
var temp = sourceObj[sourceKey];
sourceObj[sourceKey] = targetObj[targetKey];
targetObj[targetKey] = temp;
}

        swap(obj1, "key1", obj1, "key2");
        swap(obj1, "key1", obj2, "key4");
    
    
     });```
near stratus
analog imp
near stratus
analog imp
#

now this works if you have the role while adding it to the cache

#

but if you add the role to a member afterwards, it will not remove the restriction. i'm honestly a bit stumped

analog imp
analog imp
#

wondering if i have to readd the role to the emojis everytime a guildmember is updated, one way for it to work. but now i'm looking at a lot of requests on an event

near stratus
#

@eternal osprey
introducing proper code blocks

{
    "2172646" : {
        "id":800,
        "name":"Necrozma",
        "level":9,
        "catchChance":1,
        "spawnId":1300980,
        "owner":"363191104465666048",
        "catchTime":"01/13/2021 12:04 PM",
        "nickname":""
    }
}
#

so it's even easier

#

@eternal osprey here is your complete code after all this time

let o = <Object>;

o["7252525"].owner = "New Owner ID"; //Setting the owner ID

fs.write("myfile.json", JSON.stringify(o), e => {
    //Handle error
});
#

@eternal osprey you there ?

eternal osprey
#

hey!

#

i am here

eternal osprey
#

in my code

#

@near stratus

timber fractal
#

So i have this collector ```js
collector1.on(collect, m => {

})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
eternal osprey
#

never worked with those

near stratus
analog imp
lusty quest
#

i think he got a Brainfart and thought it where a thing in js

analog imp
#

meanwhile i'm thinking i actually found a library issue in discord.js overthink

timber fractal
#

it just says nothing

#

no error

#

or something

earnest phoenix
#

No error, just saying specify a user to unban waitWhat , what’s wrong?

#

const member = message.guild.member.cache.get(args[1])right?

near stratus
earnest phoenix
#

Yes so I can replace it with const member = message.guild.member.cache.get(args[1])

#

Right?

lusty quest
#

also its possible that the member is no longer in cache

near stratus
#

yes

earnest phoenix
#

Hmm

pearl trail
#

fetch banned user from guild

earnest phoenix
#

So what should I do?

near stratus
#

And also change your username

#

It sounds weird

earnest phoenix
#

Why lol?

near stratus
#

it actually means you're a pig in PewDiePie language

earnest phoenix
#

LOL

zenith terrace
#

that whole coding is wrong as well,

"you cannot kick this user if you dont have ban members perm",
.setTitle("The Ban hammer has spoken")
.setDescription(user has been kicked by author) KEKW

pearl trail
#
let bannedMemberInfo = await message.guild.fetchBans(); //fetch member here

const bannedMember = bannedMemberInfo.find(b => b.user.username.toLowerCase() === args[0].toLocaleLowerCase()) || bannedMemberInfo.get(args[0]) || bannedMemberInfo.find(bm => bm.user.tag.toLowerCase() === args[0].toLocaleLowerCase());

message.guild.members.unban(bannedMember.user.id)```
This is from my unban code
pearl trail
earnest phoenix
#

multiple users can have the same tag or the same username

near stratus
#

yeah

earnest phoenix
#

you should probably AND that

near stratus
#

wait same tag too ?

earnest phoenix
#

yes

#

a user cannot share the same tag and the same username

#

they're exclusive

#

they can have either the same username or the same tag

near stratus
earnest phoenix
near stratus
earnest phoenix
timber fractal
#

So i have this collector ```js
collector1.on(collect, m => {

})``` But how can i make it so if somebody in the channel sends `m` it sends "hi you choose m" and if someone in the channel says `c` it says "hi you choose c" so than i know how that collector works
earnest phoenix
#

Should I change the bots icon or name or does it look good?

fluid basin
timber fractal
#

that exactly filters the m and c

#

but in that collector it needs to see if its m or c

fluid basin
#

and? whats the issue

#

yeah check if the message contains m or c

timber fractal
#

that for m i want a different code than c

timber fractal