#development

1 messages · Page 1674 of 1

subtle river
#

its "rewards.php"

#

not "reward.php"

umbral zealot
#

great so does it work with that link?

#

did you also add that link in the authorized oauth2 URIs in your discord dev portal?

subtle river
#

It works, thanks!

umbral zealot
#

Awesome!

old cliff
#

anyone?

blissful coral
#

hm

#

did you try changing tokens to see if it was the same time for them all

wise coral
#

Hi. What's bot token?

blissful coral
#

What?

lusty quest
#

if you have to ask this you probably want to read a guide or two in how to make a discord bot, sure we could explain it, but this can be annoying for both sides.

crimson vapor
#

im gonna say they aren't a dev

opal plank
wise coral
#

No thank you.

opal plank
#

english do be hard sometimes

tired panther
#

@opal plank detritus supports normal js?

#

or do I have to use ts

opal plank
#

well, technically yeah, but its fully made in ts

#

you can always use js syntax with ts

tired panther
#

perfect

opal plank
#

though you wont be getting intellisence n shit without ts, but thats up to you

#

its optional

subtle river
#

Sorry, how do I get the player's ID or name+tag using the identify scope?

lusty quest
#

oauth?

subtle river
#

oauth, yes.

lusty quest
#

should return a member object on authentifiction

subtle river
#

where does it return it to?

opal plank
#

if you got an id from the return request you can always ping the api for a user object

subtle river
#

I get a "?code=XXXX" in the url

opal plank
#

you should return to your site/app after they finished authorizing

#

that should contain their id

lusty quest
#

depends on how you login, i use passport and it returns the member object on authentification

subtle river
#

it does

#

it returns to the site

opal plank
#

with that you can request discord directly if you want

subtle river
#

how...?

opal plank
#

with the /users endpoint

subtle river
#

Sorry... this is for javascript?

opal plank
#

this is json

#

or any http request lib

lusty quest
#

its for all languages that can support it

opal plank
#

regardless of your lang

subtle river
#

ah

#

I see

#

so I need to make a json for it to send to?

lusty quest
#

if you use js i can recommend looking into passport and discord-passport, this makes oauth quite easy

subtle river
#

or does it make it automatically?

opal plank
#

you need to request it

lusty quest
#

if you want to make it barebones you have to send an json to the api

opal plank
#

ugh, let me help you a bit more

#

it seems yuo dont know http very well

#

send a GET request to https://discord.com/api/v8/users/${id_here}

subtle river
#

sorry... I'm still learning html / js as my main language is python but I need to use js for the website

#

wait but I dont have the id

opal plank
#

you do tho

#

you get it with the return

subtle river
#

return... what-?

opal plank
#

right there

pale vessel
opal plank
#

shush

#

@subtle river are you even doing the request after you recieve your code?

subtle river
#

I don't know how to do that

opal plank
#

that code is useless if you dont request the data for it

#

thats basically a temporary token

subtle river
#

ohhhhhhh

#

thanks for your time

opal plank
#

np

#

be sure to check the docs for more info

oblique pagoda
#

Do you guys have a genshin impact bot idea?

earnest phoenix
#

Shards are compulsory for bots?

#

djs?

oblique pagoda
#

idk man

earnest phoenix
#

@oblique pagoda wrong server dude

opal plank
opal plank
#

enforced by discord

#

after 2500 you NEED sharding

#

and after 150.000(115k now i think, or something, they changed recently) you need a special request for discord

#

it is recommended you start sharding past 1.5k servers

#

that gives you quite a bit of time to change your code

quartz kindle
#

is there any discord server for discussing node.js/v8 internals?

#

most servers are only about standard/high level node/js

opal plank
#

not that im aware of

quartz kindle
#

oh well then

opal plank
#

v8 is some pre-historic shit

quartz kindle
#

im getting my ass kicked by the v8 compiler

opal plank
#

why u even using v8

earnest phoenix
quartz kindle
#

duh

opal plank
earnest phoenix
#

Node extends the v8 engine

quartz kindle
#

i'll take a look there

#

im having weird issues with optimization/deoptimization

opal plank
#

OH

#

you talking about the engine

earnest phoenix
#

Lul

quartz kindle
#

im testing 10 million iterations of a function that does type detections with a typeof switch

#

and with extremely small changes, its suddenly 3x slower for no reason

#

changes that are not even relevant

#

like you change something in a piece of code that only runs if typeof is number

#

and it makes another piece of code elsewhere 3x slower

tired panther
quartz kindle
#

and even more weird, i've had it happen with things as random as changing the character length of a function by adding random lines that do nothing

earnest phoenix
quartz kindle
#

like this line

#
if(Number.isInteger(data)) { return Math.abs(data) < L48 ? packInteger(data, 0) : packLargeInteger(data, 0); }
#

run it with a small number 10 million times, takes 200ms

#

run it another 10 million times with a large number so that it triggers packLargeInteger instead, and it takes 600ms

#

run the first test again, and now it takes 500ms instead of 200ms

#

just because the large one ran once

#

the function parts are deoptimizing each other

earnest phoenix
#

That's weird

quartz kindle
#

like wtf

earnest phoenix
#

Maybe there's an issue in crankshaft/TurboFan?

quartz kindle
#

who knows

#

thats what im confused about lul

earnest phoenix
quartz kindle
#

wasnt crankshaft repaced by turbofan already?

earnest phoenix
#

yes

quartz kindle
#

im on node 15, which is running v8 8.6 i think

#

even though latest v8 is 8.9 >.>

earnest phoenix
#

Latest v8 has some weird changes

#

Are you trying to contribute to v8?

opal plank
#

Tim node dev confirmed

quartz kindle
#

ew

earnest phoenix
opal plank
#

node-light

earnest phoenix
#

like v8-ligth

#

He wouldn't touch it LULW

#

The fucking thing is too complicated

opal plank
#

petition for time to append light every new update

#

v1 = djs-light
v2 = djs-ligh-ligh
v3 = djs-light-light-light

quartz kindle
#

lmao

opal plank
#

for each minor update, you add a letter instead of the full word

earnest phoenix
#

nah tim can work with big trash like "djs"

opal plank
#

v1 = djs-light
v2 = djs-ligh-ligh
v3.3 = djs-light-light-light-lig

earnest phoenix
#

I already contributed to v8 but the amount of pain is unbearable

#

Like holy shit

opal plank
#

imma port node to ts

#

no more js

#

frick that

earnest phoenix
#

Good luck

opal plank
#

everyone on ts now

earnest phoenix
#

Well if you contribute to v8 that means you automatically contributed to node also

#

As node uses v8 LULW

#

@quartz kindle Bro what u trying to make tho

opal plank
#

more benchmarks, probably

quartz kindle
#

no im working on a binary serializer

opal plank
#

JustTimThings™️

earnest phoenix
#

Usual Tim stuff

quartz kindle
#

yes

#

faster and smaller than json.stringify

#

:^)

cinder patio
#

yeah cause it's not in json format

quartz kindle
#

faster than messagepack

#

actually i didnt test yet but im pretty sure it is

earnest phoenix
#

Bro, imagine if I add ArrayPrototypeRandom() to the v8 engine

#

No more pain of writing that <array>[Math.floor(Math.random() * length)] pepehmmNoBG

cinder patio
#

You can't just add it to v8

#

you have to propose it

earnest phoenix
#

yes

#

You gotta also get in contact with TC39

#

why do not make your own function and require it?

cinder patio
earnest phoenix
#

"Why not recreate all array methods and require it?"

#

I mean, just a small thing to add

#

Just like Array.prototype.pop()

quartz kindle
#

make an npm lib that adds it to the Array prototype globally

#

because prototype pollution is nice :^)

earnest phoenix
#

Prototype pollution is stinky

safe creek
#

what are goods sites to code on to make an webpage for your bot?

cinder patio
#

sites?

#

it's just html and css

safe creek
#

no but for full on web dev

cinder patio
#

I'm not sure what you mean

#

websites are made using html, css and js

#

or, at least the frontend of the site

ivory geode
#

you meant to use templates like wordpress?

safe creek
#

ye no shit xd

#

i mean

cinder patio
#

all you need is a text editor and a browser

ivory geode
#

^

safe creek
#

just dw facepalm

cinder patio
#

alright

heavy patio
#

Hello, could I get some help please? (with that)

pale vessel
#

Is this the linked Discord server?

#

That's weird

#

well, are you stuck somewhere?

thick nexus
#

how i do uhh subcommands

pale vessel
#

If you're using a framework it might have a documentation for it

pale vessel
#

Ah

#

Shivaco moment

heavy patio
#

I'm trying to do the "Using webhook" one

slender thistle
#

I'M A LITTLE BUTTERFLY

heavy patio
#

I've copied it and put my dbl token as said, but clicking on the "test" button in the website doesn't do anything

slender thistle
#

Ok so

#

What did you set your webhook arguments to?

heavy patio
#

ok so, that's actually something I wasn't sure about

#

I didn't put anything

slender thistle
#

dblpy runs the webhook if you set webhook_port at the very least

#

auth and path have default values, empty string and /dblwebhook respectively

heavy patio
#

I only have webhook_port=5000 which is the default one

slender thistle
#

Did you set auth and/or path?

heavy patio
#

no

slender thistle
#

Eh, let's leave that for later then

heavy patio
#

should I just delete them?

slender thistle
#

What URL did you enter on top.gg?

#

Delete them in what sense?

#

Do you have them set in DBLClient with the values the example gave you?

heavy patio
#

I've copied the webhook url of the channel

heavy patio
slender thistle
#

Discord webhooks are not supported by top.gg

#

What webhook really means in this case is a webserver running on your machine

#

Preferably a VPS

tired panther
#

How do I specify on mongodb that it should fetch guilds with certain passed ids?

heavy patio
#

oh, ok

#

then isn't it possible to make my bot send a message when somebody votes?

slender thistle
#

It is possible, you just need to make sure port 5000 is open (accessible) on your bot's machine and that you enter the URL and Authorization key properly

pale vessel
heavy patio
#

but not with a webhook, right?

slender thistle
#

Not with a Discord webhook

safe creek
#

How would i add an error page to an invalid link an user has entered to go to my site like https://sitehere/E and then it would show an 404 error on glitch.com?

slender thistle
#

See, the catch here is that you will receive requests in real time as someone votes and then you can make your bot send a message

safe creek
#

im sorta confused how i would intergrate that as i have an 404 page made and ready to be used

slender thistle
#

P.S. that's why dblpy uses events like on_dbl_test and on_dbl_vote

#

_test is for test requests, aka whenever you press Test on top.gg, and _vote for when an actual vote is sent

earnest phoenix
#

What should be the command for
If we like to use uptimerobot on replit

#

anyone else having issues with setActivity()

#

no error

#

just doesnt set any activity

sterile lantern
#

which would i use if im using repl.it to connect

#

and no i have no issues with setActivity

regal creek
#

Hm, just installed jdk 7, manually on ubuntu 18.04. But it says permission denied. Any idea on how to fix it / what the issue is coming from? I don't have much information on what is wrong but it has read, write and execute permissions on the folder.

earnest phoenix
#

everything else works fine tho

somber trout
earnest phoenix
#

it showing 20 but it's not 20 it's 43 now 😓

sterile lantern
#

js

earnest phoenix
#

same

somber trout
# sterile lantern js

idk then, i use py the second one down gives u a line of py to use to connect just look up how to connect js to mongodb

earnest phoenix
#

i do use it

sterile lantern
#

Why not Compass?

earnest phoenix
#

is it bad if my console log is spammed w/ this?
(node:9940) UnhandledPromiseRejectionWarning: Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.

earnest phoenix
pale vessel
#

Use https://top.gg/api/widget/707098046164631553.png?<something random>

sterile lantern
pale vessel
#

That's how you invalidate the cache

#

It could also be value of a parameter

earnest phoenix
earnest phoenix
sterile lantern
#

Alright.

earnest phoenix
#

oh got it 😓

#

RIP what happen to API?

pale vessel
#

What do you mean?

#

The API is fine

earnest phoenix
pale vessel
#

It's your browser caching

earnest phoenix
#

🤔 oh

slender thistle
#

or rather Discord in this case I believe

pale vessel
#

Electron I guess

earnest phoenix
#

yea

#

discord made with that only

slender thistle
#

Well it's just a caching """issue"""

#

so /shrug

earnest phoenix
#

¯_(ツ)_/¯

feral aspen
#

Question

#
all function calls will be resolved before the return executes
#

What do they mean by this.

#

Do they mean the functions will be called before the return inside the function executes?

slender thistle
#

Yeah

feral aspen
#

👍

lyric mountain
#

that thing is as outdated as square wheels

sterile lantern
#
data.Punishments.unshift({
            PunishType: 'Warn',
            Moderator: message.author.id,
            Reason: reason,
        });
        data.save();```

i am saving punishments in mongo db like this
#

how would i fetch it and have it list in an embed

regal creek
sterile lantern
#

so e.g: +punishments @/user
responds with

punishtype: warn
mod: mod
reason: reason

2nd punish if applicable```
regal creek
#

ftb horizons

vivid fulcrum
#

@sterile lantern i have no idea how to work with mongo, but logically you would have a case id or something so you can identify that specific entity

#

something like an incrementing number is enough

bold musk
#

Hey guys, do any of you happen to know if there is a bot that will automatically add certain reactions to a message in a specified channel?

vivid fulcrum
#

wrong reply

#

oop

#

sorry

#

i hate mobile

bold musk
#

Ahahahah np

lyric mountain
#

hard to find one that does that for that reason

bold musk
#

It's a channel with a slowmode of 10 mins, its to post specific things

dusky sundial
#

It's unlikely that someone would have a made a bot like that, because there's a chance people aren't using slowmode, thus getting their bot rate limited

#

You can always ask someone to make a custom bot for your server specifically, but very rarely would people do that for free. There are websites like Fiverr where you can easily find bot developers for that sort of stuff.

bold musk
#

Ah okay makes sense, would you happen to know anyone who would be able to do that?

#

Happy to pay

dusky sundial
#

I don't know anyone, but like I said, any freelancing website like Fiverr is probably your best bet

bold musk
#

Alr thanks man, appreciate it

slender wagon
#

is discord-oauth2 a good package for a dashboard?

sterile lantern
#
 punishments.find({ GuildID: message.guild.id, UserID: user.user.id}, async(err, data) => {
            if(err) throw err;
            if(data) {
                message.channel.send(new Discord.MessageEmbed()
                    .setTitle(`${user.user.tag}'s warns`)
                    .setDescription(
                        data.content.map(
                            (w, i) => 
                            `\`${i + 1}\` | Moderator : ${message.guild.members.cache.get(w.Moderator).user.tag}\nReason : ${w.Reason}`
                        )
                    )
                    .setColor("BLUE")
                )
            }```
#

(node:1075) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined

#

const punishments = require('../models/ModSchema');
punishments is defined as so ^

vivid fulcrum
#

unrelated

#

but i said it above

#

you need a case id or something

sterile lantern
#

why would i need a case id tho

vivid fulcrum
#

this is not enough, it isn't unique

sterile lantern
#

im doing ;warnings user

#

so it displays the user's warnings

#

essentially i just want it to print that array

vivid fulcrum
#

ah, so that's only warnings

#

i thought it was bans and mutes and that type of shit as well

sterile lantern
#

well

#

even if it was

#

it's saved under Punishments

#

the array

#

so it should fetch all of the punishments and list them

#

but its not working for some reason

vivid fulcrum
#

console.log data and see the structure of the object

sterile lantern
#
[
  {
    Punishments: [ [Object], [Object], [Object] ],
    _id: 6060e6444889770358d9d389,
    GuildID: '730819054297808897',
    UserID: '781165252862541865',
    __v: 2
  }
]```
vivid fulcrum
#

so its an array

sterile lantern
#

so from that i just want it to list in an embed as follows

#

yeah

vivid fulcrum
#

there is no .content property

sterile lantern
#
${user.tag}'s punishments:

Type: type
Moderator:mod
Reason: reason

Type: type
Moderator:mod
Reason: reason
#

i want it to print that

vivid fulcrum
#

approach it logically

#

data is an array of objects, what do you do now

sterile lantern
#

oh

#

also it only listed one

vivid fulcrum
#

that object isn't the punishment array

#

it has a property that contains the punishment array though

#

look closely

sterile lantern
#

thonk

#

hm

#

data.punishments?
idk

vivid fulcrum
#

yes

sterile lantern
#

so i map data.punishments?

vivid fulcrum
#

wait

#

no

#

what

#

data is an array

sterile lantern
#

ah

vivid fulcrum
#

data is an array of objects that has the actual array you want

#

find can match multiple items to those conditions

#

i think you can use findOne

sterile lantern
#

findONe

#

One*

#

i see

#

but

#

now i get

#

data.map is not a function

vivid fulcrum
#

if you used findOne

#

you will get an object

sterile lantern
#

stringify?

vivid fulcrum
#

bro are you dumb

sterile lantern
#

i mean, it is an object

#

so nvm about that

vivid fulcrum
#

findOne, which finds one object and returns it to you

on the other hand, find returns all objects that matched that condition, in order to return you all of those objects, the return type needs to be an array

tldr findOne returns an object, find returns an array of those objects

#

logical thinking bro

#

i have no clue how mongo works nor have i ever worked with it

azure prairie
#

bruh I still can't find out how

sterile lantern
#

hm so wait

azure prairie
#

how to check how many mentions are in a message

sterile lantern
#

i used .find

#

but it still only listed one

vivid fulcrum
#

are you retarded

#

you genuinely just ignored what ive been saying for the past few minutes 🙄

azure prairie
#

bruh

sterile lantern
#

hmm

#

lemme do some testing

slender thistle
#

findOne finds one, find finds multiple aka an array of objects, be it empty (nothing was found) or one (an array with one element)

#

.findOne stops when a document matching a query was found, .find returns ALL documents matching a query

sterile lantern
#

pog*

torpid otter
#

I got questions should I put permission of manage messages to be allowed to poll on do my poll command

sterile lantern
#

upto u

#

finallyyyyyyy

#

it was because my variables were un-capitalized

#

😔

boreal iron
#

You should probably use the username and tag instead of pinging the user two times

sterile lantern
#

The ping doesn't work in the embed lmao

#
`\`${i + 1}\` | **Moderator**: ` + "`" + `${message.guild.members.cache.get(v.Moderator)}` + "`" + `\n**Reason:**` + "`" + `${v.Reason}` + `\n**Type**:` + "`" `${v.PunishType}` + "`"```
#

how come my formatting doesnt work

#

is it because its in the map

#

nvm

#

how come this happens

#

the formatting for the 2nd warn is weird

boreal iron
#

You should really invest some time into looking how to use template literals

sterile lantern
#

??

boreal iron
#

Not needed to use them and concatenate other strings with it

sterile lantern
#

hmm ok

boreal iron
#

... well actually can’t write an example on mobile oldEyes

#

Fuck discord mobile

#

still

#

Oh just another tip, instead of using single code snaps just use one codeblock for each warn

#

Will also allow you to use (much) spaces to format and move the text where u want

#

That’s the advantage of a monospace font

#
1  |  warn
      reason
      whatever

#

God damn... took me like a minute to write this on mobile

hot flax
#

I updated my discord.js but does anyone know the fix of this?

quartz kindle
#

you tried to fetch a message that doesnt exist

#

probably a deleted message

hot flax
earnest phoenix
#

The bot can join multiple channels right?

Like 1 in each server?

ripe shadow
slender thistle
#

1 voice channel per guild

earnest phoenix
#

Yeah thought so, just was making sure they hadn't updated that cause my bot left a channel and joined another, thanks tho!

slender thistle
opal plank
#

is there a way to regex or only have one extension blacklisted from a gitignore?

#

for example, exclude every .gz ending file in a folder?

quartz kindle
#

doesnt *.gz work?

boreal iron
#

/.*\.gz/gi

opal plank
#

@quartz kindle worked, ty

soft glade
#

does any know how to make a bot written in python send a message to ever channel in a server

boreal iron
#

no spam support here

onyx hare
#

ik theres a simpler way i just havnt found it yet.. how can i get the activity show with him showing as dnd?

client.on("ready", () =>{
    console.log(`Logged in as ${client.user.tag}!`);
    const newLocal = 'Star Wars | c2help';
    client.user.setActivity(newLocal, {type: "WATCHING"});
    client.user.setStatus('dnd').then(console.log)
   
 })
opal plank
#

in which language and library?

#

<client>.guilds.fetch('id')

#

but d.js should have it cached every guild by default

sterile lantern
#

So when I save a punishment (warn, ban, etc) I want to assign a case ID

#

So one user gets warned, their case ID is 1

#

A different user gets banned, their case ID is 2

#

Essentially just increment

#

Would I save a value in the DB as 0 and when the command is successfully ran increment it by 1 and assign it to the case?

#

Assuming it would allow me to do !viewcase 1

lyric mountain
#

Yes

#

Though at this point you're more and more getting into relational data

lyric mountain
#

Context please?

boreal iron
lyric mountain
#

He's using mongo

boreal iron
#

Would be a different method to go for document based engines

#

Well nvm then

snow urchin
lyric mountain
#

This is one of tge cases where sql would be more straightforward

#

Shrug

#

Obviously

#

You can't use emotes inside codeblocks

snow urchin
#

its not inside a codeblock

#

smh

lyric mountain
#

Oh nvm, that's an embed

snow urchin
#

ya

lyric mountain
#

Permission issue

snow urchin
#

erm.. no?

lyric mountain
#

Check if "use external emotes" is granted

#

Can you let me finish a single sentence?

snow urchin
#

its in the guild the emoji is in

lyric mountain
#

That's an animated emote

#

Use <a:name:id>

#

@snow urchin worked?

snow urchin
#

mhmm

lyric mountain
#

Remove the flextape from the mouth first

sterile lantern
#

yeah I’m using mongo

#

I just want the case ID to increment

#

and then I’m able to do ;removecase 1

#

if it’s not possible I just generate a random case ID

opal plank
#

@sterile lanternand whats stopping you from using increments?

lament rock
#

Google how to do incremental columns in mongo. If not possible, increment yourself. Random might produce a similar key

sterile lantern
sterile lantern
opal plank
#

how so?

sterile lantern
#

well I mean I have to increment a value then assign it to the case each time a new case is made

#

e.g the value can be cases and its default value is 0

#

I’ll probs try and see if it’s easier to do increment or random

lament rock
#

if makeID is a native mongo method, then it might be impossible.

opal plank
#

you can either do it in raw SQL or in postgres natively
set a colum having an auto incrementing value, thats it
OR
SELECT id FROM cases ORDER BY id LIMIT 1
done, you now have the latest entry from your database, just add 1 onto and insert a new one

lyric mountain
#

Postgres?

opal plank
#

you can likely do the same but in mongo

lament rock
#

Auto increment should be possible in any database

sterile lantern
#

makeID is just this

#
   var result           = '';
   var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
   var charactersLength = characters.length;
   for ( var i = 0; i < length; i++ ) {
      result += characters.charAt(Math.floor(Math.random() * charactersLength));
   }
   return result;
}

console.log(makeid(5));```
opal plank
lyric mountain
opal plank
#

and yes, postgres

lament rock
#

That logic could return a key which already exists

sterile lantern
#

If it exists then it won’t save

#

And it’ll generate a new one

#

🤷‍♂️

opal plank
#

stop using var btw

#

and increments will be much better

#

imagine it this way

lyric mountain
#

Erwin

opal plank
#

imagine you generate 2 equal id's

#

you'd have to check mongo if it had it or not

#

so technically you wouldnt be saving 1 query

lyric mountain
#

Why are you using ``text``?

opal plank
#

its better to just get the biggest entry you have

#

why wouldnt i?

lament rock
#

Wait until you hit the MAX_SAFE_INTEGER for case count blobpain

opal plank
#

its to highlight something

#

yeah good luck getting to bigint

lyric mountain
#

Like, ain't it supposed to be text?

opal plank
#

what are you on about ?

lament rock
#

Dyno could probably hit MAX_SAFE_INTEGER

opal plank
#

is their bot dyno?

lament rock
#

no. Just saying

opal plank
#

then dont worry about it

lyric mountain
opal plank
lyric mountain
#

Weird

lament rock
#

That's your client's rendering. It shows as a single tick code block for everyone else

lyric mountain
#

Maybe desktop version ignores the double tick

lament rock
#

are you on android with an amoled display

lyric mountain
#

Yep

lament rock
#

That's why

opal plank
#

that might be why

#

cant get darker

#

cuz the background is already black

lament rock
#

pixels turned off

lyric mountain
opal plank
#

oh no

#

is that a discord bug?

#

i cannot believe it

lyric mountain
#

Maybe

opal plank
#

i was being REALLY sarcastic btw

lament rock
#

They'd reject the report for being "too minor"

opal plank
#

just reply with no u and theres nothing they can do

lyric mountain
#

Minor bugs in discord: "I sleep"

Minor users in discord: "wAiT tHaTs IlLeGaL, gOtTa Be BaN"

lament rock
#

Miner users in discord: MiningforSnowflakes

opal plank
#

minor bugs wont get them sued by COPA mmulu

robust rose
#

Discord admins: Wanna have a burger-

safe creek
#

uh

#

so

#

i tried installing pycrypto and

#

got this shit?

#

its over 2k words

lament rock
#

put it in a pastebin so that people don't have to download the attachment

umbral zealot
lament rock
#

I wasn't exactly referring to pastebin. An alternative like hastebin would be better

opal plank
#

looks shit too

opal plank
lament rock
#

just the general concept of it is what I'm looking for

umbral zealot
#

Sure, that works too.

mellow anchor
#

g

solemn leaf
#

which is like x10k more space

lyric mountain
#

personally I hate when I have to download text files

#

esp when I'm at mobile

solemn leaf
#

I just auto save mine to something that gets wiped each time I boot my pc

#

really eff

lament rock
#

what is it really that much to ask people to put their stuff into a website which displays the Content-Type as text/plain so that people who want to help don't have to download a file and then open it? Or perhaps people on mobile such as iOS (like me) would have to save the document to their files app and it gets auto uploaded to iCloud for whatever stupid reason, then they open that document and multi-task between Discord and their files app, then the extra pain to go through and delete the file from iCloud AND iCloud trash AND their phone once they're done helping a user?

#

certainly the issue is storing the file /s. Of course my drive can contain it, but I don't want to download files unnecessarily.

umbral zealot
#

A full 40 minutes after they asked the question and we're still talking about this? lol

lament rock
#

Judging by how they haven't responded at all, I could care less about their problem now. I never looked at their text file. Just responding to whoever is actually talking to me

umbral zealot
#

I Guess ¯_(ツ)_/¯

lyric mountain
#

holy cheese that's a long argument

lament rock
#

You have to consider mobile users exist

#

mobile is pain

umbral zealot
#

If we could have bots here we could just make a bot that uploads all message.txt attachments to a paste system. But we do'nt, really.

lament rock
#

Would be nice

#

Was the reason why Discord asked this place to remove all bots possible ever made public

umbral zealot
#

It feels like it was a pretty direct (albeit extremely late) response to bot farms.

lament rock
#

Would make some sense, although very late indeed

lyric mountain
#

a gist system is so fckn easy that there's no reason discord doesn't have one to begin with

#

like, keep gists for what, 3 days?

umbral zealot
#

And it's even more ironic that they're already hosting the file on a CDN, and they're never deleted unless you delete the message, so...

lyric mountain
#

actually, images get yeeted after some time

#

had issues with users that saved profile backgrounds to discord then used their links

#

some time later the image url simply doesn't work anymore

lament rock
#

idk man. Image is still there. Probably a logical issue on your end

lyric mountain
#

weird

#

like

#

I manually tried to access the url

#

also checked if the message still exists

#

maybe the image url get changed?

lament rock
#

I made a dumb choice of using toLowerCase on string values which could include links and that broke links

#

That was a nuisance for some time

sacred aurora
#

messageReactionAdd event not called

#

how can i fix that

lament rock
#

make sure you have the correct intents for message reaction add. If you use them in DMs, there's an intent for that. If you use them in guilds, there's another intenet for that. Using both means 2 intents have to be present

sacred aurora
#

what's the intent name

#

im not using it in dm

#

GUILD_MESSAGE_REACTIONS?

#

oh wait

#

its actually working.. but for new messages

#

if i react on old messages its not being called

umbral zealot
#

That is because those messages aren't cached, you'll probably need to use the raw event

#

oh wait no that's the old way

sacred aurora
#

yup

#

now its working thanks

rocky hearth
#

what does this versioning mean?

{
  "engines": {
    "node": ">=12"
  }
}
#

does it mean, that it also support 14.x and 15.x?

pale vessel
#

it supports node v12 and upper

lament rock
#

I only remember having to specify a node version for Heroku

#

perhaps some native deps or libs which make use of some esnext features might specify it

earnest phoenix
#

Hey my bot economy system is returning undefined or null if a user has no cash in his account.How to return 0?

pale vessel
#

use the nullish coalescing operator ?? if you're on node 14+, else use the logical or operator ||, like obj.balance || 0

earnest phoenix
#

Oh ok

earnest phoenix
pale vessel
#

use the latter

earnest phoenix
#

ok

pale vessel
#

balance || 0

earnest phoenix
#

Oh ok

pale vessel
#

if the balance is undefined or null, it will be 0

earnest phoenix
#

ohok

#

ty

#

This will not affect my bot verification right

lament rock
#

Should not

earnest phoenix
#

Ok

earnest phoenix
#

@pale vessel

if(command === "balance") {
const bal = db.get(`balance.${user.id}.wallet`)
if(!bal) bal = 0;
message.channel.send(`${message.author} You have ${bal}`)
}```
pale vessel
#

that should work too

#

you could use db.get() || 0

earnest phoenix
fiery copper
#

Lets say I'm trying to get the author and content of a message, how would I do that?

pale vessel
#

Check your library's documentation

#

what library are you using?

fiery copper
#

Discord.js

#

Docs weren't too specific on what to do

pale vessel
#

it should be, go to their docs and search for Message

fiery copper
#

Ik it's something along the lines of ${message.author}

pale vessel
#

you can see all available properties and methods that's accessible

#

yeah it is

#

you can even guess the same for content

fiery copper
#

Ik content is just message.content

pale vessel
#

well then you just answered your own question

#

i don't see the problem here

marble juniper
#

you answered ur own question

#

lol

#

I think before you ask here you should ask yourself

mystic canyon
#

Someone tell me how do my pe
Own bot?

#

Eo

#

XD

vivid fulcrum
#

what

pale vessel
#

someone had a stroke

dusky lagoon
#

Can't i just steal .js date from a website and then use it in a bot

vivid fulcrum
#

what's the context behind this question

dusky lagoon
#

idk

pale vessel
#

okay

earnest phoenix
#

hey

#

i'm making a welcomer event for my bot

#

and i search how to give role AFTER the new member accepted the community rules

pale vessel
#

there's member.pending

#

if it's false then they accepted the rules

earnest phoenix
#

hmm ok thks i'll try

pale vessel
#

it's is_pending my bad

#

not sure if it's there in libraries yet

#

i believe that's new

opal plank
#

@pale vessel detritus has it

pale vessel
#

dang

#

that's actually pog

#

discord.js doesn't have it

opal plank
#

Detritus > d.js

pale vessel
#

moment

opal plank
dusky lagoon
#
fs.readdir("./src/", (err, directories) => {
    Logger.log(`Loading a total of ${directories.length} categorie(s).`, "log")
    directories.forEach(dir => {
        fs.readdir("./src/" + dir + "/", (err, commands) => {
            commands.forEach(cmd => {
                if (cmd.endsWith('.js')) {
                    try {
                        let command = require(`${"./src/" + dir}${path.sep}${cmd}`)
                        Logger.log(`Loading Command: ${command.name}.`,"ready")
                        client.commands.set(command.name, command);
                    } catch (e) {
                        Logger.log(`Unable to load command ${commands}: ${e}`,"error")
                    }
                }
            })
        })
    })
})``` how can i add aliases to it
opal plank
#

if there is, set() them too

#

OOOOOOOOOOOR

#

advertisement

#

you could use detritus

#

this single line is all u need

dusky lagoon
#

a.. ad.. ADVERTISEMENT HOW DARE YOU

opal plank
#

detritus much better than d.js

#

just saying

dusky lagoon
#

pffff

opal plank
#

tis a proven fact

#

not an opinion

dusky lagoon
#

Well the problem is more that i can add alias: [] but it doesn't connect like even if i type $h instead of $help it doesnt incorporate

opal plank
#

prefixes should be different than aliases

dusky lagoon
#

ohw i mean without the prefix

opal plank
#

aliases is the command name itself

dusky lagoon
#

i know

opal plank
#

then?

dusky lagoon
#

ofcourse i know but ii was a demonstration

opal plank
#

whats the snippet you using for the alias?

earnest phoenix
opal plank
#

1 line

#

vs all that struggle

#

its worth it

dusky lagoon
opal plank
#

then you arent setting any aliases

#

cant expect it to work if you didnt code it to set alias too

dusky lagoon
#

But doesnt the command handler find the aliases

opal plank
#

you WROTE the command handler

#

if you didnt write it to do that, how do you think it would do it by itself?

dusky lagoon
#

I know but im mentaly dumb

opal plank
#

hence why you should try detritus sometime

dusky lagoon
opal plank
#

its a lot easier to do all that automatically

dusky lagoon
#

yeah ill check it out

opal plank
#

here

#

you'll know this when you see it

pale vessel
#

is it the ram usage difference

#

don't forget the support server invite too

opal plank
#

@dusky lagoon which lib you think this is?

#

this is low level detritus, which you should be using exactly the same (expect the permissions) for your bot

earnest phoenix
#

\u200B \u200B \u200B \u200B

#

🗿

#

What is that for

opal plank
#

this is a more advanced one to not have to repeat itself

#

you can do this too instead of repeating the same thing over all commands

dusky lagoon
#

mine is also connected to a terminal logger so that makes it a lil complicated i think

opal plank
#

those are all things you can use out of the gate from detritus

#

without having to code it yourself

earnest phoenix
opal plank
#

shush

earnest phoenix
#

Soon it might reach 1000+

opal plank
#

i dont get why not use it tho

#

its more spoonfed than d.js

#

but good

earnest phoenix
#

I'm not saying its bad, the lib is pog

opal plank
#

just taking at piss at my gag, i see

earnest phoenix
opal plank
#

i expect you to join the army of jeovah witnesses too @earnest phoenix

earnest phoenix
#

Gladly

opal plank
#

those are rookie numbers

#

gotta pump em up

earnest phoenix
#

yes

#

Detritus pogging

opal plank
#

another sheep converted

#

welcome to the cultlub

earnest phoenix
#

Erwin loli moment

earnest phoenix
#

It doesn't embed for me either

earnest phoenix
#

Dog be sus on trampoline?

opal plank
earnest phoenix
#

OH MY FUCKING GOD

#

sus

opal plank
#

we clearly talking about detritus

earnest phoenix
opal plank
#

dont know what you talking about mate

#

detritus best lib

#

command handler internal

#

veri gud

#

10/10

#

would do it again

#

5 star on google reviews

earnest phoenix
#

Bro, imagine if detritus is sus

opal plank
#

stinky

earnest phoenix
#

Too bad, discord.urmom is on its way to slay its opponents

opal plank
#

lel

earnest phoenix
#

How to add playing -help on bot?

mystic canyon
#

Help me

#

To create a bot to my server

cinder patio
#

Do you know how discord bots work?

earnest phoenix
#

Yes

drowsy epoch
upbeat void
earnest phoenix
#

Node js

upbeat void
#

@earnest phoenix
Correct method for it (if using discord.js) would be
client.user.setActivity('text')

earnest phoenix
#

Thanks

upbeat void
#

client.editStatus(status, game) for Eris

earnest phoenix
earnest phoenix
#

It is saying your repl should have a port open

#

@upbeat void

upbeat void
upbeat void
earnest phoenix
#

What should I do?

earnest phoenix
#

Which method would you use if you had to fetch things from db every message

#

Me?

earnest phoenix
old cliff
#

why does my bot account takes 2 minutes to start? while my other bot accounts start within 5 secs

upbeat void
#

with quick.db

#

db fetchs differ upon what you're using

upbeat void
earnest phoenix
#

i use atm mongodb with changestream

upbeat void
earnest phoenix
#

bc i need sync between dash and bot

upbeat void
#

I'm not familiar with mongodb's changestresm sorry! I gave you the basic idea tho

old cliff
#

only 1 specific bot account

upbeat void
#

Per message would be

client.on('message' , () => {
// However you fetch stuff from mongodb : changestresm
}```
upbeat void
old cliff
#

no

upbeat void
#

Hm

#

Prolly your application is ratelimited

old cliff
#

¯_(ツ)_/¯

upbeat void
#

You can request discord for a removal request ig

#

If it is that

cinder patio
earnest phoenix
solemn quartz
#

Guys i need help with editing the bot's message

#

I can do it with normal messages, but how to in embeds??

dusky sundial
#

In what language?

tulip ledge
solemn quartz
solemn quartz
#

if i want to change the description just embed.setDescription?

long crow
toxic jolt
#

im getting this error pls help

#

i have a shard.js

#

discord.js v12

umbral zealot
#

There's pretty much nothing we can do to help other than "use try/catch, or catch(), to prevent errors" since that's as generic an error as you'll ever get

#

the only thing it says here is that a promise error wasn't caught, and this could be literally anywhere within your code

toxic jolt
#

I guess it could be related to shard.js

umbral zealot
#

It could literally be related to any line of any file in your entire bot

toxic jolt
#

what the

#

await manager.spawn().catch(e => console.log('Shard Error: ' + e))

#

i make it this

#

now it worked smoothly

cinder patio
#

I doubt it worked smoothly as you're getting a promise rejection error

#

right now you're just ignoring the error

toxic jolt
#

commands loading, token connected.

#

How did this fix with catch? I do not understand.

#

I think it's magical xd

#

omg
1 gb download in 3 minutes

#

for one bot

hasty lotus
#

does anyone know a npm package to publish issue on a github repo ?

#

i'm trying to do a bug command, that with a verification from the bot's staff automatically opens an issue on the repo

tulip ledge
#

can anyone help me? I cant push my project to github

! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/Vigintillionn/LoL-cd-bot.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I did hit pull but it still wont work

hasty lotus
quartz kindle
solemn quartz
#

Can anyone help me? What did i do wrong here

if (message.content.toLowerCase().startsWith(config.prefix + "mlg" + " " + "water" + " " + "bucket")) {
 if (guild.id !== config.serverID) {
   message.channel.send(NESG)
 } else {
   let mwb = new Discord.MessageEmbed()
   .setColor(colore)
   .setDescription(`Mlg water bucket \n \n \n \n ${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}`);
   message.channel.send(mwb)
   .then(m => {
      mwb.setDescription(`Mlg water bucket \n ${Dream3} \n \n \n ${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}`)
      setTimeout(async () => {await m.edit(mwb)}, 2000)
    })
   .then(m => {
      mwb.setDescription(`Mlg water bucket \n \n ${Dream3} \n \n ${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}`)
      setTimeout(async () => {await m.edit(mwb)}, 2000)
    })
 }
    }```
hasty lotus
umbral zealot
#

Are you looking to create new issues, or act on new issues that were created?

hasty lotus
#

create new one

umbral zealot
#

simple enough to find

tulip ledge
solemn quartz
#

wait ima send the error

#

it doesnt even stop the bot

#

there's just an error in the terminal

hasty lotus
#

thant do a pull request

hasty lotus
solemn quartz
#

yes im copying it

tulip ledge
#

so do I do git branch -M <other name>?

hasty lotus
solemn quartz
#
(node:4700) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'edit' of undefined
    at Timeout._onTimeout (C:\Users\39328\Desktop\Dream\index.js:51:39)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4700) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4700) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
umbral zealot
hasty lotus
#

probably the second one

solemn quartz
#
if (message.content.toLowerCase().startsWith(config.prefix + "mlg" + " " + "water" + " " + "bucket")) {
 if (guild.id !== config.serverID) {
   message.channel.send(NESG)
 } else {
   let mwb = new Discord.MessageEmbed()
   .setColor(colore)
   .setDescription(`Mlg water bucket \n \n \n \n ${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}`);
   message.channel.send(mwb)
   .then(m => {
      mwb.setDescription(`Mlg water bucket \n ${Dream3} \n \n \n ${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}`)
      setTimeout(async () => {await m.edit(mwb)}, 2000)
    })
   .then(m => {
      mwb.setDescription(`Mlg water bucket \n \n ${Dream3} \n \n ${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}${GrassBlock}`)
line 51>>      setTimeout(async () => {await m.edit(mwb)}, 2000)
    })
 }
    }```
tulip ledge
#

why do I always get this btw? On my other PC I never got this

#

and do I put in my username or email?

hasty lotus
#

which one is the 51 ?

solemn quartz
#

i wrote line 51>> on that line

hasty lotus
#

oh yeah sry

hasty lotus
#

yep

#

but

#

both of the .then callbacks are doing the same thing

umbral zealot
#

So it's saying m is undefined, which.. it is.

hasty lotus
#

maybe you only need one 🤔

umbral zealot
#

you're not returning m from the first promise callback

#

There's no reason to have 2 .then() chained here

solemn quartz
hasty lotus
#

bruh

#

😂

umbral zealot
#

No, the second one fails and the first works. you're confused

solemn quartz
#

i want the embed to get edited 2 times

hasty lotus
#

in your first callback

umbral zealot
#

You clearly don't have a correct understanding of how asynchronous code works.

hasty lotus
#

just do two timeouts

umbral zealot
hasty lotus
#

one of 2000ms

solemn quartz
#

it waits 4 second and changes nothing, then this

hasty lotus
#

and one of 4000ms

quartz kindle
#

this is why the second one "works":

solemn quartz
quartz kindle
#

the first one sets the embed, then starts a time out, and returns immediately
the second one sets the embed again, overriding the previous one, then errors
once the timeone of the first one finishes, it finally sends the embed, that was modified by the second one before the second errored

#

the timeout is a "fire and forget" kind of thing, it does not wait 2 seconds before continuing. the second .then is started immediately after the first .then finishes "starting" the timeout

solemn quartz
#

So how do i fix it?

quartz kindle
#

use async await, and use a promisified timeout or delay

tulip ledge
#

alright

#

so now

#

how do I merge my 2 branches?

#

to 1

#

I looked up how

#

but when I go to pull requests all I see is this

quartz kindle
#

make a PR request from the new one to the old one

tulip ledge
long crow
#

any idea on why memory usage keep increasing

quartz kindle
#

caching

long crow
#

few hours later

tulip ledge
#

it doesn't show any merge button

quartz kindle
#

new pull request

tulip ledge
#

then what?

long crow
#

@quartz kindle does partials contribute to it?

quartz kindle
tulip ledge
#

I just get this

quartz kindle
tulip ledge
#

and then my code

#

what do I do there?

quartz kindle
#

you have 2 branches right? one of them is newer and one is older

tulip ledge
#

yes

quartz kindle
#

so the newer should be applied to the older

#

old < new

tulip ledge
#

yes

#

and then what?

long crow
#

still riddled what does djs or my code cached

quartz kindle
#

then there should be a list of changes

tulip ledge
#

yes

quartz kindle
#

and from there you can create a PR

tulip ledge
#

no this is the end

quartz kindle
#

which branch are you currently on?

tulip ledge
#

not sure

quartz kindle
#

go back to the repository page and select the new branch

#

from the drop down menu

#

then create a PR from there

quartz kindle
tulip ledge
#

same thing

long crow
quartz kindle
quartz kindle
tulip ledge
#

I click that

long crow
#

lemme check, you mean the intents right?

quartz kindle
#

yes

quartz kindle
long crow
#

ah yeah, if you meant GUILD_PRESENCE

quartz kindle
#

copy the entire code from the new branch then delete the branch

#

then paste the code onto the original branch

#

and git push

quartz kindle
zenith terrace
#
tim.lockIn(development)```
quartz kindle
zenith terrace
#

oh no

long crow
#

so it contribute to those heapUsed? 🤔

quartz kindle
#

they are stored in guild.presences.cache

crimson vapor
long crow
#

under what event? or how