#development

1 messages · Page 1254 of 1

pale vessel
#

wait what

opal plank
#

could do but that'd be very janky

proven lantern
#

you could segment the apps

opal plank
#

i already requested priviledged limits to twitch, just waiting for a response

#

hopefully they accept and i dont have to deal with this shit

#

verified bots have 2000/10s limits

#

while i get 20/10s

digital ibex
#

wait what

#

verified bots get different ratelimits??????

proven lantern
#

different api

opal plank
digital ibex
#

oh

proven lantern
#

make a unique bot per user of your bot

opal plank
#

that sounds like a memory issue

digital ibex
#

discord bot dev community continues to become more and more toxic

proven lantern
#

they can each run on separate machines

opal plank
#

sounds like a vm clusterfuck

proven lantern
#

or 10 per machine

#

50 per machine

#

you can scale

opal plank
#

also 20 tokens per app iirc

thick gull
#

verified bots get different ratelimits??????
@digital ibex i mean thats a smart idea to do

#

cause like

opal plank
#

theres a limit to how many tokens you can generate

thick gull
#

you dont want unverified bots being able to nuke shit

opal plank
#

the 21th will cancel the 1st

thick gull
#

but you want verified bots to do mass actions that are actually user-requested across hundreds servers

digital ibex
#

i understand why

opal plank
#

hundreads?

#

im dealing with thousands...

thick gull
#

yea it was jsut an example

opal plank
#

scaling on twitch is one pain in the ass tbh

#

no sharing

#

no ratelimit checking

#

poorly documented shit

digital ibex
#

i just misinterpreted the thing, the uhh badge and verifying the bot

proven lantern
#

sharing is caring

opal plank
#

snippets provided in docs are outdated

sudden geyser
#

There's no header for rate limits really?

opal plank
#

some of the api old endpoints still work

#

there are shit that i receieve on the message payload which are deprecated

#

but still works

sudden geyser
#

I've seen some bad APIs, like Hypixel's one

digital ibex
#

so in my head, i was thinking u cant verify ur bot anymore

opal plank
#

its one hell of a mess

#

likst, actually dont fuck with twitch

digital ibex
#

but i realised

opal plank
#

recommendation

#

dont do twitch api

modest smelt
#

pls help

opal plank
#

you in for one hell of a nightmare

proven lantern
#

Unknown Emoji

thick gull
#

i want to do something that isnt saturated as fuck like discord bots are

opal plank
#

@sudden geyser theres only for the helix api

#

IRC doesnt return headers for limits

proven lantern
#

add a try catch block @modest smelt

modest smelt
#

ok

digital ibex
#

do something outside of js

#

borboss

thick gull
#

like?

sudden geyser
#

hmm

thick gull
#

im learning java cause thats the only CS course they have @ my school

digital ibex
#

a game or something

thick gull
#

and think it would be beneficial to learn something like that

#

¯_(ツ)_/¯

sudden geyser
#

Web server? Command line tool?

arctic lichen
#

Hi

sudden geyser
#

hi

modest smelt
#

how do i make a try except block such that if it doesn't work, i will get to know the error?

sudden geyser
proven lantern
#

await reaction_message.add_reaction(numbers[i]) put it around here

sudden geyser
opal plank
#

yeah im sure its the library now

#

100%

#

i finished the query and then right after the library threw an error

#

imma start a ticket on their github asking if they have an internal ratelimiter

pale vessel
#

lmao hypixel api just gives EVERYTHING

#

in like one call

sudden geyser
#

Yeah it's a horrible API

#

When they added SkyBlock support

#

They'd give you just the ID of whatnot, so you'd need to make a request for each of them

#

and most of their endpoints and what they return are undocumented

#

I still remember trying to convert a PHP class to a JS one just to get a player's level when I didn't realize someone make a wiki on how to calculate the player's level.

#

A single /player API request can be 2 MB+ in size for someone who plays a lot. It stacks up.

thick gull
#

dude they have apis for games that have been closed for years

#

endpoints*

earnest phoenix
#

hypixel devs are a bunch of rookies

untold plover
#

Oo

earnest phoenix
#

which is why everything is a mess

#

the api is so messy because they just pull every single entry from their database

#

up until recently they used json files to store game & world data

#

then they migrated to mongo

thick gull
earnest phoenix
#

and they're still misusing it... and storing worlds in mongo

#

like actual worlds

thick gull
#

god

#

they're also hiring an anticheat dev

#

:kek;

earnest phoenix
#

it's just a bunch of 15-18 year olds thinking they're senior level programmers

#

when they're just in fact stealing code snippets

#

tbf no one with a degree would work at hypixel for such a low pay

#

hypixel's api is a mess

#

their namings are a mess too

sudden geyser
#

eugune

earnest phoenix
#

@earnest phoenix how do u know its a low pay

#

simon posted job listings

#

it's just a mess

#

kind of minecraft itself

#

built on trash legacy code no one ever bothered to fix

#

so what you end up with is a huge dumpster fire

#

aka why minecraft is so slow and ram intensive and why hypixel has lag spikes every nanosecond

sudden geyser
thick gull
opal plank
#

which lib is that?

#

there are multiple twithc libs

thick gull
#

twitchjs

opal plank
#

tmi

#

twitch-js

#

twitchjs

thick gull
#

the one you put a thing on

opal plank
#

the what

#

oh

#

i see

thick gull
opal plank
#

yeah that one

#

i absolutely hate that their lib swallows to many errors

#

did you bother reading that issue?

#

'Just try/catch everything'

#

feels bad that you cannot see all my private repo commits

#

@thick gull

thick gull
#

did you bother reading that issue?
@opal plank no

quartz kindle
#

oh i remember that lmao

opal plank
#

its kinda bs tbh

pure lion
#

i forgot how to use the express router send help

earnest phoenix
pure lion
#

*pings tim*

#

@earnest phoenix the docs are biiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiig

#

i cba

opal plank
#

i think i have officially bothered everyone i could about this tbh

#

twitch staff, twitch forum mods, librabry devs, proficient devs

#

did i miss anyone?

quartz kindle
#
app.plsRoute("magix", result => {
  result.send("nice website with animation and responsive pls kthx")
})
opal plank
pure lion
#

no i mean

#

the router boye

#

in a separate file

quartz kindle
#

i dont even use express

#

lmao

pure lion
#

cries

opal plank
#

lol

#

im going to get more into front end soon

#

though i'd probably be moving away from express into Koa

#

@quartz kindle have you tried Koa?

earnest phoenix
quartz kindle
#

@opal plank nope

opal plank
#

frick

#

aight

misty sigil
#

and they're still misusing it... and storing worlds in mongo
@earnest phoenix WORLDS

#

WORLDS

#

IN MONGO

opal plank
#

bet postgres can do that

#

with transactions

misty sigil
#

why are world in mongo

#

no

opal plank
#

lmao

faint prism
#

@quartz kindle have you tried Koa?
@opal plank at A KOA rn

opal plank
#

koa seems fun

ionic dawn
#

world in mongo make sense

#

thats why is full of corruption

opal plank
#

ACID compliant db's

#

Im afraid my request might be denied

#

upon reading the guide i found out that i should've specified the ratelimit i wish to be granted

#

though i didnt specify, simply put 'this isnt enough, pliz increase'

#

@umbral zealot do you know if koa has some similar things from express such as slow-down and ratelimit?

umbral zealot
#

well, I mean, probably not built in

opal plank
#

things like those are a pain to code manually

umbral zealot
#

it's something that's either available as a separate package, or you can write the middleware yourself

opal plank
#

thats the issue

#

they are quite complicated to do

#

while i COULD, i rather not

#

web isnt my forte per se

umbral zealot
opal plank
#

they are different

#

this would be the ratelimit

earnest phoenix
#

There are a lot of options for you in terms of rate limiting

opal plank
#

the one im speaking of is slow down, it increased the response of each request

#

its exponential ratelimiting iirc

umbral zealot
#

I mean, you could just add a setTimeout in there lol

opal plank
#

not quite as good tbh

#

this middleware is really powerful

pure lion
#

{"error":404,"message":"Endpoint not found"}
got this error while doing oauth, i want to put it into a separate route dir/file and this error keeps occuring

eternal osprey
#

hey can somebody help me

honest perch
#

with?

eternal osprey
#

how do i make these return values to an embed

#
ar loss = Number(ls.get(userLS)) - (bet);
            ls.set(userLS, loss);
            endGame(user);
            return `\`Croupier stands with\` ${newTotal}\`; Croupier wins, **\`${user.username}\` loses**.\``;
        }
        else if (newTotal == userTotal[0]) {
            
            endGame(user);
            return `\`Croupier stands with\` ${newTotal}\`; **It's a tie**.\``;
        }
        else {
            
            var gain = Number(ls.get(userLS)) + (bet);
            ls.set(userLS, gain);
            endGame(user);
            return `\`Croupier stands with\` ${newTotal}; **${user.username} \`wins**!\``;```
faint prism
#

make an embed with the string results in it

eternal osprey
#

could you give me an example?

umbral zealot
#

"return" means you have a function, and this function will return that string. Just assign that return to a variable, or use the function directly in the embed builder.

faint prism
#
function doThing() {
 return 5+5
}

new MessagEmbed()
.addField('result', doThing())``
#

idk the actual usage of d.js
but that's how you return

eternal osprey
#

hmm okay

#

i will try my best

#

just one moer question

#
unction userHit(user, message, prefix) {
    var cardsObj = ls.getObj(user.id + "blackjackGame");
    var card = new Card(randCard());
    var total = arrCardCalc(cardsObj.userTotal);
    var newTotal = total[0] + aceCheck(card.toInteger, total[0]);
    var userLS = user.id + "profile";
    var bet = Number(cardsObj.bet);
    message.channel.send(`${user.username} drew ${card.val + " " + card.suite}`);
    if (newTotal > 21) {
        
        const embed1 = new Discord.MessageEmbed()
        .setColor('#ff0000')
        .setTitle('Blackjack Casino Game')
        .setDescription('*Shows all the game results!*')
        .addField(name= `${user.username}\` busted; Croupier wins,`, value= `**\`${user.username} \`loses**.\``)
        .setFooter('Command hosted for Kings Family!')
       
        var loss = Number(ls.get(userLS)) - (bet);
        ls.set(userLS, loss);
        endGame(user);
        return (embed1)```
#

wouldn't this just work?

pure lion
eternal osprey
#

i just wanted to know

#

as i want to change my whole code

#

that is really long

#

i also cannot test this specific message

#

otherwise i would have to win the blackjack with 21

#

which is unlikely to happen

silver lintel
#

I'm a noob, should I use mongoose, MongoDB, MongoDB cloud or whatever?

opal plank
#

or be a postgres supremacist

#

¯_(ツ)_/¯

eternal osprey
#
Errors found:
```ReferenceError: embed3 is not defined
At ReferenceError: embed3 is not defined```

umbral zealot
#

well, you didn't define a variable called embed3. ..

eternal osprey
#
const embed1 = new Discord.MessageEmbed()
        .setColor('#ff0000')
        .setTitle('Blackjack Casino Game')
        .setDescription('*Shows all the game results!*')
        .addField(name= `${user.username}\` busted; Croupier wins,`, value= `**\`${user.username} \`loses**.\``)
        .setFooter('Command hosted for Kings Family!')
        
        const embed2 = new Discord.MessageEmbed()
        .setColor('#ff0000')
        .setTitle('Blackjack Casino Game')
        .setDescription('*Shows all the game results!*')
        .addField(name= `${user.username} has blackjack;`, value=`${user.username}\` wins, doubled the winning amount**!\``)
        .setFooter('Command hosted for Kings Family!')

        const embed3 = new Discord.MessageEmbed()
        .setColor('#ff0000')
        .setTitle('Blackjack Casino Game')
        .setDescription('*Shows all the game results!*')
        .addField(name= `${user.username}, \`hit or stand?\n`, value= `${prefix}hit\` or \`${prefix}stand\``)
        .setFooter('Command hosted for Kings Family!')
       
        var loss = Number(ls.get(userLS)) - (bet);
        ls.set(userLS, loss);
        endGame(user);
        return (embed1);
    }
    else if (newTotal == 21 && total[1] == 1) {
        
        var gain = Number(ls.get(userLS)) + (bet * 2);
        ls.set(userLS, gain);
        endGame(user);
        return (embed2);
        
    }
    else {
        
        cardsObj.userTotal.push(card);
        ls.setObj(user.id + "blackjackGame", cardsObj);
        return (embed3);
    }```
umbral zealot
#

Ah it's because you don't undertand scopes

pure lion
#

hey, im having an issue with discord oauth. im trying to separate all my routes and paths into different files, and before this it worked fine but now its returning 404 endpoint not found

eternal osprey
#

huh, what did i do wrong then?

#

because i had it in a if scope?

#

Errors found:

At ReferenceError: user is not defined
okay my code broke```
#

please someone help me out

woven gale
#

+help

ionic dawn
#

im making the "userinfo" command to display badges, is .concat a good method to make the badge stuff?

#

or is better to do array to string?

tight flame
#

It´s is possible to make a portal that people log in with some credentials and then a bot gives him a verificate role on his discord??

earnest phoenix
#

use oauth

eternal osprey
#


const Discord = require ('discord.js');
var ls = require("./ls");
var rand = require("./random");

var user = message.author
const embed1 = new Discord.MessageEmbed()
        .setColor('#ff0000')
        .setTitle('Blackjack Casino Game')
        .setDescription('*Shows all the game results!*')
        .addField(name= `${user.username}\` busted; Croupier wins,`, value= `**\`${user.username} \`loses**.\``)
        .setFooter('Command hosted for Kings Family!')
        
        const embed2 = new Discord.MessageEmbed()
        .setColor('#ff0000')
        .setTitle('Blackjack Casino Game')
        .setDescription('*Shows all the game results!*')
        .addField(name= `${user.username} has blackjack;`, value=`${user.username}\` wins, doubled the winning amount**!\``)
        .setFooter('Command hosted for Kings Family!')

        const embed3 = new Discord.MessageEmbed()
        .setColor('#ff0000')
        .setTitle('Blackjack Casino Game')
        .setDescription('*Shows all the game results!*')
        .addField(name= `${user.username}, \`hit or stand?\n`, value= `${prefix}hit\` or \`${prefix}stand\``)
        .setFooter('Command hosted for Kings Family!')


        module.exports = {
            commands: embeds
        }```my message is undefined?
#

could anyone help me with this one ?

hollow bobcat
#

``` .addField(name= ${user.username}\ busted; Croupier wins,, value= `${user.username} `loses.``)

are you sure of that?
#

shouldn't it be in {}

eternal osprey
#

what?

#

the variables?

#

like user.username

#

they are?

opal plank
#

var

eternal osprey
#

wut

#

all jokes aside

hollow bobcat
#

i mean what is name= for?
shouldn't it be
.addField("Field name","Field Value") or .addField(name="Field name",value="Field value")
?

tight flame
#

use oauth
@earnest phoenix but that is to log in into my website with discord, right?

eternal osprey
#

i think that this is also good

#
        { name: 'Regular field title', value: 'Some value here' },
        { name: '\u200B', value: '\u200B' },
        { name: 'Inline field title', value: 'Some value here', inline: true },
        { name: 'Inline field title', value: 'Some value here', inline: true },
    )```from the docs
misty sigil
#

@earnest phoenix but that is to log in into my website with discord, right?
@tight flame that is also for credentials and can be used for verification

#

shit i have an idea

#

i have a good idea

#

this is the best idea

tight flame
#

so i can do that, if they log in into my website it gives permisions on the discord?

#

but login without discord credentials

misty sigil
#

Not like that

#

with OAuth, yes

#

without, No.

tight flame
#

so my website must have oauth?

misty sigil
#

Yes.

tight flame
#

can have dm with you @misty sigil ?

misty sigil
#

no

tight flame
#

oh okay

eternal osprey
#

lmao

#

rejected

#

10/10

drifting wedge
#

first try with custom backgrounds

#

looks ok ig?

tight flame
#

Anyone know how to use the OAuth of external API to change permisions to a user in discord

eternal osprey
#

hey boys

#

message is not defined

#

probably in the var user = message.author

#

but how do i fix it.

tight flame
#

Anyone know how to use the OAuth External to verificate a user in discord (by changing his permisions)

earnest phoenix
#

Anyone wanna break my bot???? And then figure out how to improve it

#

Ping me if yes

opal plank
#

should be fairly easy

#

Anyone wanna break my bot so it gets rate limited again and possible have its token revoked?

misty sigil
#

🤙

#

call me

#

i do it

#

i break all bot

#

no matter what size

opal plank
#

everything i touch breaks

misty sigil
#

no matter how much hours in code

#

i break it

#

WITH HAMMER

opal plank
#

bet

#

cant be worse than ratelimits

misty sigil
#

destroys ur server and deletes all the code

opal plank
#

laughs in github and backups

misty sigil
#

sad

opal plank
#

bold of u to assume i have permissions enough to break the server on ubuntu

misty sigil
#

ar em ar eff

opal plank
#

click me and try break it if you want @misty sigil

#

ads are getting smarter

misty sigil
#

typescript bot

opal plank
#

tupusscriptus

#

indeed

modest smelt
#

i have a question

opal plank
#

just ask

modest smelt
#

how do i find the id of a user

#

in discordpy

opal plank
#

wdym?

modest smelt
#

through a bot

#

like they specify a user

#

i give their id

opal plank
#

do you KNOw the user?

modest smelt
#

no i mean like this:

#
@client.command()
async def userId(self, ctx, member: discord.Member = None):
    if member == None:
        user = ctx.message.author
        await ctx.channel.send(f"The user ID for {user} is: {user.id}")
    else:
        user = member.message
```haven't finished
#

what should i do?

#

@opal plank ?

opal plank
#

not sure tbh

#

py not my area

solemn latch
#

erwin best py dev, dont lie

modest smelt
#

do u know @solemn latch

#

?

#

i rly need help

solemn latch
#

nah, js dev here

modest smelt
#

can someone help?

solemn latch
#

the docs can

modest smelt
#

kk

earnest phoenix
#

Anyone wanna break my bot so it gets rate limited again and possible have its token revoked?
@opal plank lol

opal plank
#

in case you missed the joke

eternal osprey
#
client.on('message', message => {```
#

literally have this in my code

#

message is still not defined

earnest phoenix
#

O

#

Lol

modest smelt
#

anyone here fluent with json?

#

DM me pls

#

i need help with that

vernal rivet
#

@eternal osprey what do you mean it's not defined?

distant basin
#

what is a shard?

misty sigil
#

@modest smelt what do you mean fluent with json

earnest phoenix
#

@misty sigil why u said ill come here

modest smelt
#

if you can code well in json... @misty sigil

misty sigil
#

json isnt a

#

a

sonic lodge
#

programming language

modest smelt
#

ik

misty sigil
#

a programming language

#

but

#

but

modest smelt
#

if u can help me with some problems

#

thats what i meant

misty sigil
#

ok what do you need

modest smelt
#

basically i have this code

misty sigil
#

@earnest phoenix this is where development help is

modest smelt
#

that welcome people into the server

#

and what it does

misty sigil
#

Yes?

modest smelt
#

w8

#

think abt it this way

misty sigil
#

ok

modest smelt
#

{"747929495427874836": 749316268414337104}

#

this is a json file

#

the keyname is the guild id

misty sigil
#

Please

#

no

modest smelt
#

and the value is the value

vernal rivet
#

No

modest smelt
#

?

earnest phoenix
#

@misty sigil is there already an veryfieng bot

misty sigil
#

dont do it

#

dont use json for a database

#

smh

#

@misty sigil is there already an veryfieng bot
@earnest phoenix what?

earnest phoenix
#

Like

modest smelt
#

why?

earnest phoenix
#

İ dont want my server raid again

misty sigil
#

there are many.

earnest phoenix
#

But they r stupid

#

They r gonna be offline everytime

misty sigil
#

its made by tim so it gets my stamp of approval

#

the same tim behind discordjs light

modest smelt
#

ok lets talk about that l7er

#

l8er*

#

can someone help me make a customizable prefix?

earnest phoenix
#

Brehh@misty sigil

#

The bot thinks am a bot

#

Robot

#

@misty sigil can i send u an dm

misty sigil
#

uhhhhhhhh

#

uh

#

no

#

can someone help me make a customizable prefix?
@modest smelt Use a database

earnest phoenix
#

Plz

#

Pleaseee@misty sigil

misty sigil
#

No.

earnest phoenix
#

Then i can say here?

#

@misty sigil

misty sigil
#

Yes.

earnest phoenix
#

İs there an bot like mee6 dyno carl Owo chips in once

modest smelt
#

once?

earnest phoenix
#

Yes

modest smelt
#

wdym

earnest phoenix
#

All those bots have other commands

modest smelt
#

i am making a bot

#

that does a lot of things

#

currency bot

#

moderation

#

tickets

#

welcoming

earnest phoenix
#

What are tickets

modest smelt
#

basically only admins and u can talk

#

like if u have a question

#

my bot is called The Everything Bot!

#

it can also make polls

low shard
#

You do a welcome and you don’t know how to do setprefix command

#

Lmao

modest smelt
#

my welcome command is not fully functional

#

there are still some bugs

low shard
#

Lol

earnest phoenix
#

İ just want moderation and verification bot etc

modest smelt
#

what does ur bot do

#

@earnest phoenix u can invite my bot (if u want to...)

earnest phoenix
#

Lemme see

modest smelt
#

DM me

low shard
#

No Invites here

modest smelt
#

?

misty sigil
#

i wouldnt advise it they use a json database

modest smelt
#

im working on invites

low shard
#

@modern sable

misty sigil
#

your database will end up corrupted

#

and large

#

and useless

modest smelt
#

we're converting to mongo

modern sable
#

@modest smelt dont ask others to invite your bot

low shard
#

Yep

modest smelt
#

ok sry

#

im just advising them

#

if they want, they can

low shard
shy turret
#

i asked this question before but i didnt get too much support:

low shard
#

Read.

shy turret
#

how do i use keyv with sharding

#

i decided that I will completely start over my discord bot

low shard
#

@shy turret NiceLogo

#

Your logo it’s fake discord

#

Super copy discord

#

👀

shy turret
#
how do i use keyv with sharding
i decided that I will completely start over my discord bot
split hazel
#

how many servers is your bot in

shy turret
#

"one" (for my test bot) im starting over because i know im gonna need sharding soon

#

and yes i know when im actually gonna need to start sharding

#

im gonna need to make sharding when my bot is 2.5k servers

#

so im just preparing for it

#

my actual bot is around 200 servers but still...

low shard
#

Dam

#

25k

#

You can dream

sudden geyser
#

did you mean 2.5k

shy turret
#

yah

#

2.5k

#

i forgot the dot

#

i was just about to edit the msg lol

low shard
#

Oh

#

2.5

#

Btw you can dream

#

It’s so high to get it

#

Hard *

shy turret
#

ikr

#

but quality better than quantity

low shard
#

He

#

He

#

Tfff

#

Ye

shy turret
#

how do i use keyv with sharding

#

discordjs btw

split hazel
#

how do i use keyv with sharding
You asking that question makes me worried

#

there isn't much code you have to change

shy turret
#

i never done sharding before

split hazel
#

each process will simply open a connection to the database

shy turret
#

wait so..

#

i could just

#
let Keyv = require("keyv");
let db = new Keyv('sqlite://database.sqlite');

basically ^ to my bot.js

#

(yes i do have a index.js alr)

stark abyss
#

does anyone know how to get and make changes to multiple user stuff in json file

{
    "298588307368050698": {
        "weeklyDonation": "69"
    }
}```
#

something like that

split hazel
#

if you're sharding via running index on every shard then yes

stark abyss
#

if i have lots of user how can i change the weekly donation at once

split hazel
#

but I wouldn't recommend spending the effort sharding now, you should do it once you're certain your bot will grow above 2.5k

shy turret
#

if you're sharding via running index on every shard then yes
@split hazel so if i added the shard manager on index.js and i made bot.js be the bot file, i can add:

let Keyv = require("keyv");
let db = new Keyv('sqlite://database.sqlite');

on bot.js?

low shard
#

Bro someone donate 69 just pay to some developer to do what you want

stark abyss
#

wait what

split hazel
#

that should work yes

stark abyss
#

it's a weekly donation for a game

shy turret
#

what if im making a website dashboard

#

too

#

and that needs access to the db

split hazel
#

the database doesn't stop you from opening multiple connections

shy turret
#

something i learnt today hm ok

stark abyss
#

so no one can help me?

low shard
#

Speedy

split hazel
#

they're designed to handle multiple connections

low shard
#

It’s you speedymquin

#

?

stark abyss
#

wait what

low shard
split hazel
#

do you mind not shitposting

shy turret
#

@stark abyss I highly recommend not using json dbs but

let file = require("./NAME.json");
file.USERID["weeklyDonation"] = "THING";
stark abyss
#

I am just json file because the max number of user is gonna be no more then around 25

#

this is different then what you think

shy turret
#

keyv is a lot easier than json dbs

stark abyss
#

oh

#

I think you misunderstood me

#

I know how to get one's thing

#

i wanna get all of the userid and then change their weeklydonations

#

like reseting it to 0

sonic lodge
#

use Object.keys() on the object to get the array of user ids

#

loop through the array and set each individual user's value to 0

stark abyss
#

you may have to teach me how to use Object.keys()

#

Object.keys(userid)?

#

wait what is it doing?

sonic lodge
#

it returns an array with all of the object's properties

stark abyss
#

okay

sonic lodge
#

for example

Object.keys({a: 1, b: 2, c: 3}); // ['a', 'b', 'c']```
stark abyss
#

ah so I can for loop it

shy turret
#

now how is it possible to get a guild by id wait i just found out

#

nvm i dont know how to do it with the manager variabl

split hazel
#

assuming you're still doing the sharding thing you need to use broadcast eval

#

since your guilds are no longer all in the same process, they're split in multiple ones

shy turret
#

so instead of <client>.shard.broadcastEval('')

#

i would use <manager>.broadcastEval('')

stark abyss
#
 fs.writeFile ('./donations.json', JSON.stringify (donation, null, 4), err => {
        if(err) return console.log(err + " error found")
        message.channel.send("Message Written! ")
      })
``` I am doing that and it puts it in 
```css
{
    "298588307368050698": {
        "weeklyDonation": "69"
    }
}```
But I don't want the number 69 to be a string because I want to add to it
#

i don't understand how json works thx in advance

opal plank
#

screeches in database noises

stark abyss
#

do i just get rid of stringify

vernal rivet
#

I wouldn’t use json for heavy weight database stuff. Json has a hard time handling heavy weight data, data that changes constantly. I would recommend you think about using either mongodb, MySQL, SQLite, or quick.db instead.

opal plank
#

spits

#

why did you not recommend postgres or cassandra?

#

i feel offended

vernal rivet
#

I mean you can use those as well

pale vessel
#

npm i jsoning 😎

opal plank
vernal rivet
#

And it was because I never actually used them

opal plank
#

postgres >

pale vessel
#

discord used cassandra

#

not anymore

stark abyss
#

calm down i am using it for max 25 players

#

only my server

vernal rivet
#

Quick.db is the easiest to use

stark abyss
#

but also not the best

opal plank
#

correct

#

postgres best

vernal rivet
#

shrug it gets the job done

opal plank
#

definetly going to recommend using postgres for a 25 max row table

#

its like using a an industrial level cutting saw to break a thin stick in half

stark abyss
#

so anyone gonna help me

#

help

pale vessel
#

what's donation?

stark abyss
#

a json file

#

empty

pale vessel
#

it's a string because that's how it was in the first place. is it from your args?

stark abyss
#

oh

#

yeah it was

pale vessel
#

you can parse the string as numbers, Number(string) and store that

stark abyss
#

wait wat

pale vessel
#

just need to make sure that it's an actual number since it could be NaN

stark abyss
#

ok

#

you can parse the string as numbers, Number(string) and store that
didn't understand this part

pale vessel
#
args[0]; // "hello"
Number(args[0]); // NaN

args[0]; // "22"
Number(args[0]); // 22```
#

it tries to convert strings to numbers and return NaN if it fails

earnest phoenix
#

How do I get emoji information?
ex: /info papagan

#

for example message.guild.emojis.cache.get(args [0]) searches by emoji id.

sudden geyser
#

You need to parse the raw argument to get the ID.

pale vessel
#

discord.js has emoji.identifier so you don't need to type it manually

#

never mind, it doesn't have the <>

#

well anyway you can use emoji.toString()

#

args[0] == emoji.toString()

wise wigeon
#

Hey guys, is there a problem with discord.js for loading users cache ? It's taking so long with my bot.. It loaded ~10k users in 24hours.. Because of this, my bot is getting a very high ping xD Like 1k ms, even more.. 😅

stark abyss
#

ty

#

i don't know if you should be doing that, wouldn't that be api abuse? (take no word from me i have no clue how it works)

wise wigeon
#

No don't worry it's okay :p I've never had this problem before.. Very weird

stark abyss
#

idk all i can offer is some good luck

#

why are you cacheing all of them though wouldn't it be better just to cache when u need Think

pale vessel
#

if you have enough resources, caching seems nicer

#

less bandwidth

wise wigeon
#

nope it's not a problem like that and the problem was not here days ago :/

silver lintel
#
var url =
      "mongodb+srv://Person47:" +
      process.env.MONGOPASSWORD +
      "@void-bot-data.mwq2n.mongodb.net";

    MongoClient.connect(url, {useNewUrlParser: true, useUnifiedTopology: true}, function(err, db) {
      
      if (err) throw err;
      var dbo = db.db("mydb");
      dbo.createCollection("customers", function(err, res) {
        if (err) throw err;
        console.log("Collection created!");
        db.close();
      });

      var myobj = { name: "Company Inc", address: "Highway 37" };
      dbo.collection("customers").insertOne(myobj, function(err, res) {
        if (err) throw err;
        console.log("1 document inserted");
        db.close();
      });

      dbo.collection("customers").findOne({}, function(err, result) {
        if (err) throw err;
        console.log(result.name);
        db.close();
      });
    });

MongoError: a collection 'mydb.customers' already exists

sonic lodge
#

the collection already exists

silver lintel
#

how do i delete it

stark abyss
#

why don't you go to the collection on the website and delete it manually?

silver lintel
#

how?

#

do i view it with mongodb

stark abyss
#

didn't you go the website to create a cluster?

silver lintel
#

yes

sonic lodge
#

<collection>.drop()

stark abyss
#

or that..

sonic lodge
#

came from the first google search result

stark abyss
#

@silver lintel for future reference though if you go the mongodb website then cluster and if u hit the collections you can view and delete data

#

unless yours is different idk

silver lintel
#

:O

#

yes i can

#

thank you

stark abyss
silver lintel
#

yes

stark abyss
#

yeah if you hit the collections you can view all the stuff and edit

silver lintel
#

mhm

#

MongoError: Cannot use a session that has ended

#

even tho it hasnt ended

slate socket
#

Who can i help me with my code pls ?

stuck basin
#

.p

silver lintel
#

what lib

faint prism
#

Who can i help me with my code pls ?
@slate socket maybe. you're not really giving any information

slate socket
#

No lol its just for the statut but its ok i found

#

Lol

near drift
amber thistle
#

whats the best api to fetch song lyrics?

sudden geyser
#

Dylan it means the file or directory could not be found at that path.

#

can you verify to see if it does

near drift
#

Dylan it means the file or directory could not be found at that path.
@sudden geyser I have to create a file called index.html ?

sudden geyser
#

at that path, yes

near drift
#

Ok

#

Done

#

Now?

#

Now what i have to do? it says the same error

main chasm
#

what is index html ?

near drift
#

Lite said me to create it but idk what is it for

opal plank
#

do my eyes decieve me or is that an actual person using glitch for websites rather than hosting discord bots? zoomeyes

near drift
#

¯_(ツ)_/¯

opal plank
#

kudos

main chasm
#

yeah bots or website?9

opal plank
#

glitch is MEANT for sites

silver lintel
#

welp i use it ;-;

near drift
#

:v

main chasm
earnest phoenix
#

Anywho

#

Anyone know how to make this more optimize

#

Since utd spagetti rn

umbral zealot
#

Well, to start with, nobody wants to debug tiny-ass screenshots taken from a phone.

#

when half the code isn't visible, too.

earnest phoenix
#

@umbral zealot i didnt to debug lol

#

I only ask if theres a way to opitmize it or not

umbral zealot
#

Well, whatever it is you wanna do with that code we can't help with that screenshot 😛

earnest phoenix
#

Heres the source code then

umbral zealot
earnest phoenix
#

Its private

#

And i cant change bisibility

#

And the owner is offline

umbral zealot
#

don't think a lot of people here will want to download a zip to look at your code. you're making it real hard to help you right now

earnest phoenix
#

Fine lemme just make a fork and give the link

umbral zealot
#

that's still private (I don't think you can make forks of private repos public) ¯_(ツ)_/¯

earnest phoenix
#

Fuck

#

Nvm then

#

Thanks for the help ig

umbral zealot
#

¯_(ツ)_/¯

summer torrent
#

what does it do

faint prism
#

advert?

umbral zealot
#

yeah this really isn't the place to advertise your bot

earnest phoenix
#

No it's just so I have someone to test it for development but damn ok

#

I just need some feedback

#

but ig not

umbral zealot
#

Well then you should have lead with that 😉

faint prism
#

That's what friends are for. Or testing on your own servers

earnest phoenix
#

@faint prism I have 1 friend and 7 testers that don't test

#

Soooooooo

#

I am the only coder and I have 1 artist

slender thistle
#

Not allowed

earnest phoenix
#

?

slender thistle
#

That falls under advertising

earnest phoenix
#

damn ok

solemn leaf
#

@earnest phoenix

#

test it yourself

#

🧠 = huge

opal plank
#

or advertise in the proper place

solemn leaf
#

let me test

#

and give me eval commands

opal plank
#

usually when you are the one developing your bot you'd patch what you know is wrong

#

its not like you purposefully leave shit half baked lol

#

'oh, yeah, this command crashes my bot, but thats intended'

slender thistle
#

-helptest

gilded plankBOT
#

We aren't a server full of guinea pigs, and are not obligated help you with features that can easily be tested with alts or friends. If you don't have either - at least you can make alts without problems.

opal plank
#

whole point of other people testing is people see shit you overlooked

earnest phoenix
#

I'd just want someone to test if it looks good and runs well from others standpoints. And asking myself is kinda bad

solemn leaf
#

@opal plank I have a random command like after 6 days it stops my bot and I don't know hwo to fix so I just setup a macro to restart it

#

¯_(ツ)_/¯

earnest phoenix
#

But idc

#

anymore

opal plank
#

@solemn leaf thats really stupid though

solemn leaf
#

the error

#

is some long ass message

#

that Im not gonna ever read to fix

#

so

opal plank
#

lazy dev

#

gotcha

solemn leaf
#

no I mean

#

like the whole error

#

doesnt fit on my screen

opal plank
#

-std-output-all

#

so it doesnt truncade

solemn leaf
#

ok

opal plank
#

or use a global error handler to output message somewhere

#

process.on('error', (err:Error) => channel.send(JSON.stringify(err)))

solemn leaf
#

lmao

#

I dont know which command

#

its to long

#

to even see it

opal plank
#

lazy dev

solemn leaf
#

I got an idea

opal plank
#

i gave you how to do it

#

and you still refuse

solemn leaf
#

Ill use canned air

#

and use it on my scroll wheel

#

how you know im not gonna use?

opal plank
#

lazy and stubborn i see

solemn leaf
#

but I cant use it

#

bcs I dont use ts

opal plank
#

you arent suppose to copy paste you dork

#

thats precisely why i put shit in ts

#

so i hear complaints of people copy pasting

#

LEARN from it

solemn leaf
#

LOL

#

ok

sonic lodge
#

dude you're a genius

solemn leaf
#

its over 10k text

#

laugh

opal plank
#

then write a txt file and send the file to the channel

solemn leaf
#

you can do that?>

faint prism
#

that's why I write in C# snippets lol

opal plank
#

message.payload.attachments

#

yeas

#

@faint prism Non copy paste team! High-five

solemn leaf
#

erwin

opal plank
#

thats me

solemn leaf
#

send it in rs

opal plank
#

send what in?

solemn leaf
#

rust

#

no one uses rust pretty much

opal plank
faint prism
#

I'll do COBOL

solemn leaf
#

nah

#

send it in html

opal plank
#

i'll do one better

#

haskell

faint prism
#

html
not a programming language

#

could do Haskell though lol

opal plank
#

CSS best programing lang

solemn leaf
#

C++

opal plank
#

no, css

solemn leaf
#

c

faint prism
#

could do c++ one too

opal plank
#

css*

solemn leaf
#

no just c

opal plank
#

c++ is actually good

#

you arent getting the point

faint prism
#

or c

solemn leaf
#

send it in glua

opal plank
#

aaaaanyway

#

write a txt file locally and then attach it to message payload

#

it has a key for attachments

#

just attach it there

solemn leaf
#

ok

opal plank
#

fsWrite then target the local

#

if you really fancy it, delete afterwards

faint prism
#

wtf why

opal plank
#

if he plans on using it once, might aswell

#

but it'll simply overwrite

#

if you are smart enough to keep the same name

faint prism
#

if he's using it once why not just keep it in memory

opal plank
#

not sure if you can use buffer

solemn leaf
#

if im using it once

#

why not just local server it

opal plank
#

attachments need a file iirc

#

not sure if you can buffer it in

faint prism
#

you should be able to

#

I send mine via memory stream

solemn leaf
#

Hold up

faint prism
#

and send in a byte array

opal plank
#

new Buffer.from(error)
attachments: buffer
?

solemn leaf
#

imma store it on my video storage

opal plank
#

been a while since i dicked with buffers

#

i think i only used it twice for my bot to stream directly to twitch and display the presence on my client

faint prism
#

faster than making an I/O call to your secondary storage because it's "ez"

opal plank
#

i really shot myself in the foot rn

solemn leaf
#

when your headphones come out of your jack and plays on the surround speakers cooldoge

#

what

#

you shot yourself in the foot

opal plank
#

yes

solemn leaf
#

dead ass shot yourself

opal plank
#

i completely forgot i had mized my juice with vodka and chugged almsot half a liter of it without realizing(cuz theres no alchool taste)

solemn leaf
#

so wait

#

how do I add it into an attachment

opal plank
#

message payload

solemn leaf
#

so

#

process.on('error', (err) => message.payload.attachments(new Buffer.from(JSON.stringify(err))))

opal plank
#

you have no idea what you're doing, do you?

#

you cant attach anything on message cuz message doesnt exist

solemn leaf
#

no of course not

opal plank
#

and as you may know

#

.on means its a listener

#

just clike your message event

#

client.on('message')

#

thats an event

solemn leaf
#

so

#

bot.on

#

ok

opal plank
#

process.on is also an event

#

you dare nest events i'll legit slap you

solemn leaf
#

why is myleft speaker being bass

#

ok

opal plank
#

so

solemn leaf
#

i would nest

opal plank
#

you dont

#

thats the whole point of it

solemn leaf
#

bot.on(process.on))

opal plank
#

i literally said not to nest events you dork

solemn leaf
#

ok

opal plank
solemn leaf
#

it joke

opal plank
#

outside of bot.on

solemn leaf
#

ok

opal plank
#

not nested on anything

solemn leaf
#

ok

opal plank
#

thats an event listener

#

therefore bad habits to nest them inside eachother

#

'message' doesnt exist

#

now what?

solemn leaf
#
var idk = new Buffer.from(JSON.stringify(err))
process.on('error', (err) => message.payload.attachments(idk))

opal plank
#

message exists only on bot.on('message', message => {})

solemn leaf
#

?

opal plank
#

err doesnt exist either

solemn leaf
#

I got this

opal plank
#

you're just copying my stuff at this point

#

you clearly dont

#

try to understand what im saying

#

2 different listeners

solemn leaf
#

ok

opal plank
#

what is THIS doing?

#

process.on('error', (err) => message.payload.attachments(idk))

solemn leaf
#

that was joke

opal plank
#

be serious

#

]

solemn leaf
#

oh

opal plank
#

im wasting my time trying to teach you basics of js which you should already know before making a bot

#

at least be considerate

solemn leaf
#
bot.on('error, (err) => { var idk = new Buffer.from(JSON.stringify(err)) })
process.on('error', (err) => message.payload.attachments(idk))

soemthing like that?

opal plank
#

no

#

again

#

dont nest events

solemn leaf
#

that is nested?

opal plank
#

i just told you .on() is an event listener

#

you got 2 inside eachother

slender thistle
#

Is that really nested

solemn leaf
#

I thought I closed it

opal plank
#

oh

#

bad indent

#

yikes

faint prism
#

it is closed

opal plank
#

formet it

solemn leaf
#

lol

#

sorry

opal plank
faint prism
#

yeah

opal plank
#

my bad, im the one who missed that

faint prism
#

vodkuh

opal plank
#

shhhh

faint prism
solemn leaf
#

ok

opal plank
#

you dont need bot.on

#

you want a global error emitter

#

aka your process

slender thistle
#

You're drunk, Erwin. Go home

opal plank
#

it'll catch any unhandled errors

solemn leaf
#

so

opal plank
#

Shiv you home. Go drunk.

solemn leaf
#

wait

opal plank
solemn leaf
#

can I just do

opal plank
#

again

#

here

#

process.on('error', (err) => message.payload.attachments(idk))

#

message doesnt exist

#

how you going to send a message to a channel if message doesnt exist?

vernal rivet
#

is error an event?

opal plank
#

indeed

vernal rivet
#

alrighty then

solemn leaf
#
process.on('error', (err) => { 
    var idk = new Buffer.from(JSON.stringify(err)) 
    message.payload.attachments(idk)
})
opal plank
#

its not technically error

#

its uncaught/unhandled rejections

#

but for simplicity sake im saying error here

#

again

#

message doesnt exist

solemn leaf
#

message does

opal plank
#

comes to the 4rth time

#

its not nested

vernal rivet
#

whats wrong?

opal plank
#

therefore message doesnt exist

solemn leaf
#

module.exports.run = async (bot, message, args) => {

opal plank
#
process.on('error', (err) => { 
    var idk = new Buffer.from(JSON.stringify(err)) 
    message.payload.attachments(idk)
})
client.on('message', message => {})```
#

you seem to be missing scopes

solemn leaf
#

I was running off of my eval

opal plank
#

message doesnt exist in process

solemn leaf
#

ah

#

ok

vernal rivet
#

ok, what is the queston you are trying to answer erwin?

opal plank
#

so, 5th time

#

how do you send a message to a channel without message?

solemn leaf
#

you dont

opal plank
#

wrong

#

think again

vernal rivet
solemn leaf
#

attachment

opal plank
#

wrong

vernal rivet
#

without message, idk if that is possible

solemn leaf
#

@vernal rivet pst billy pass me the answers

opal plank
#

what can process fetch thats outside of its scope?

#

dont

#

....?

solemn leaf
#

im thinkng

vernal rivet
#

i mean i am not the one answering that question i am just here to help the person that is answering it

opal plank
#

aight

solemn leaf
#

message.channel.send.payload.atttachemenets?

#

/

opal plank
#

message doesnt exist

#

6th time

solemn leaf
#

oh

#

cant I call it with the thing

opal plank
#

hats above cant access below, and vice versa

vernal rivet
#

oh ok i see what your talking about now, this is in process.on() method got you

opal plank
#

thats called scope blocks

solemn leaf
#

ok

opal plank
#

err only exists on process.on because you declared it

vernal rivet
#

aki do you understand what scopes are?

opal plank
#

message only exists where you decalred it, insice client.on message

solemn leaf
#

soemthing about somehting seeing varibles?

opal plank
#

getting warmer

#

there is a variable in your code you can access

vernal rivet
#

that is a better place to start erwin

opal plank
#

which one is it?

#

lemme give you a hint, where are your channels cached?

solemn leaf
#

in the guild

opal plank
#

not wrong but technically wrong

solemn leaf
#

erm

opal plank
#

what is a common variable for both listeners that i showed?

solemn leaf
#

.on

#

?

solemn leaf
#

client.on("message", async message => {

#

?

opal plank
#

okay now you just throwing random stuff

#

answer is

#

client

faint prism
#

message won't exist in the process.on event handler

opal plank
#

client.channels.cache

vernal rivet
#

^^^

solemn leaf
#

oka

vernal rivet
#

therefore