#development

1 messages · Page 1325 of 1

mental tulip
#

had to turn it into an array

sonic lodge
#

@vale garden you need to call embed.attachFiles() and pass in an array with your attachment

vale garden
#

what

sonic lodge
#

embed.attachFiles([attachment, another_attachment_if_you_want, another_if_you_need])

vale garden
#

bro but

#

does that put the image inside the embed

sonic lodge
#

to make the image display, attach it first with attachFiles, and then you can set the image to the attached one in setImage

next flax
#
    at Object.run (/home/runner/Thunder/commands/image/shit.js:14:36)
    at Client.<anonymous> (/home/runner/Thunder/server.js:100:17)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (/home/runner/Thunder/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/runner/Thunder/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/runner/Thunder/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (/home/runner/Thunder/node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (/home/runner/Thunder/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)```
#
const canvacord = require("canvacord");
module.exports = {
        name: "shit",
        noalias: [''],
        category: "image",
        description: "Sends a shit image",
        usage: "shit <user>",
        accessableby: "everyone",
    run: async (client, message, args) => {

let user = message.mentions.users.first() || message.author;
let avatar = user.displayAvatarURL({ format: "png", dynamic: "false" })
let image = await canvacord.Canvas.shit(avatar);
let attachment = new Discord.MessageAttachment(image, "shit.png");
return messsage.channel.send(attachment);
    }
}```
#

why its not working

sage bobcat
#

One message removed from a suspended account.

next flax
#

What?waitWhat

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

next flax
sage bobcat
#

One message removed from a suspended account.

next flax
#

Yes

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

next flax
#

so what should i do

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

next flax
#

ok

sage bobcat
#

One message removed from a suspended account.

next flax
#

i saw from a video

#

-_-

sage bobcat
#

One message removed from a suspended account.

next flax
#

see its probably the same

#

just triggered and shit are changed

#

@sage bobcat

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

next flax
#

but its a module that makes canvas cmds very easy

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

next flax
#

so what should i do

sage bobcat
#

One message removed from a suspended account.

white lichen
#

do i use msg or message

#

in discord.js

sage bobcat
#

One message removed from a suspended account.

next flax
#

docs on shit cmd

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

white lichen
#

msg or message

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

next flax
#

in the docs

#

its j

#

s

white lichen
#

also thats js

#

look at the source

#

.js file extension

sage bobcat
#

One message removed from a suspended account.

sonic lodge
#

according to the docs, shit is a static property of Canvacord

#

so you would use it as Canvacord.shit

next flax
#

docs say

#

canvacord.Canvas.property

drifting wedge
#

Can any1 send picture of how to like the galaxy gate control panel for vps looks like!

next flax
sonic lodge
#

the source code says otherwise

next flax
#

i m kinda confused now

sonic lodge
#

try canvacord.shit instead and see what happens

next flax
#
    at Object.run (/home/runner/Thunder/commands/image/shit.js:17:1)
(node:513) 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:513) [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.```
sonic lodge
#

there's three ss

next flax
next flax
sonic lodge
#

it was originally messsage.channel.send(attachment);, but you fixed it now

drifting wedge
#

If I get a galaxygate vps, how would I make a webserver?

next flax
#

@drifting wedge panel i guess

#

i never used galaxy gate

polar girder
#

how do i fix the error "Client is not a constructor'???

sonic lodge
#

show your code

polar girder
#

wait to send it to u?

#

@sonic lodge

sonic lodge
#

just send it here

polar girder
#

oh ok like all of it or a bit?

sonic lodge
#

put it in code blocks, or if it's really long, put it into a hastebin

polar girder
#

ok

#

@sonic lodge

sonic lodge
#

i waited this long just to say: case-sensitivity

#

change client to Client

polar girder
#

ok thx i did thaty and the errors poped up so thx anyways

#

is there anything else wrong with it?

sonic lodge
#

if there's anything else wrong i can't tell

polar girder
#

there something wrong with the ytdl but i think i can fix it but thx anyways

sonic lodge
#

you need to be careful with your spelling and capitalization in programming

polar girder
#

yeah i mispelled connection lol

#

i was typing to fast again

#

thx its running now!!!!!!

#

@sonic lodge

earnest phoenix
#

defines "connectiob"
uses "connection"

restive furnace
#

@drifting wedge same what you would do it in ur pc??

vestal walrus
#
whitelist = ["762848911446376480", "727696378305970217"]

def is_in_server_list(server_list):
    def predicate(ctx):
        return ctx.guild.id in server_list
    return commands.check(predicate)

@client.command()
@is_in_server_list(whitelist)
async def server(ctx):
    await ctx.send('Check!')```

Anyone know why this won't work?
pale vessel
#

shouldn't it be [762848911446376480, 727696378305970217]?

tardy hornet
#

help

#
2020-10-16T05:39:48.930315+00:00 heroku[worker.1]: State changed from up to down
2020-10-16T05:39:48.935833+00:00 heroku[worker.1]: Idling because quota is exhausted
2020-10-16T05:39:54.868101+00:00 app[worker.1]: Error waiting for network: Resource temporarily unavailable
#

what can i do?

trim hare
#

same here dude

earnest phoenix
#

rent a vps

#

you crossed your quota

tardy hornet
#

you crossed your quota
@earnest phoenix wdym

earnest phoenix
#

heroku isn't 24/7

#

there's a quota for each month

#

and you crossed it

#

meaning you can't use it until the next month

tardy hornet
#

i started using the up like 6 days ago

heady heron
#

can someone check, https://juix.io and try click store, for me it just wont change from my coming soon page but i changed da code

tardy hornet
#

i started using the up like 6 days ago
@earnest phoenix

sick fable
#

So I basically coded a command and I just want to addd a function like if I type ,warn @user mention . It should send the message that please Provide a reason.

#

Anyone to help?

#

Ping me if you want to helo

#

Help*

tardy hornet
#

So I basically coded a command and I just want to addd a function like if I type ,warn @user mention . It should send the message that please Provide a reason.
@sick fable i can help,

#

send the code

sick fable
#

@tardy hornet k wait

#
@client.command()
async def warn(ctx, user: discord.Member, content):
	embed=discord.Embed(title=f"Succesfuly Warned {user.name}!" , description = f"**User warned by** : ``{ctx.author.name}``\n**Reason** : ``{content}``" , colour=discord.Colour.green())
	await ctx.send(embed=embed)
	emb=discord.Embed(title = f"You have been warned From {ctx.guild.name}!" , description = f"**Reason** : ``{content}``" , colour = discord.Colour.teal())
	await user.send(embed=emb)```
#

@tardy hornet

tardy hornet
#

just do

#
let reason = 'no reason specified';
  if (args[2]) reason = args.splice(2).join(" ");
sick fable
#

@tardy hornet thanks (:

tardy hornet
#

@sick fable yo, check out your dms

earnest phoenix
#

python is so weird i accidentally read f"** as fuck

silver lintel
#

how can i view all the servers my bot is in djs?

earnest phoenix
#

client.guilds

earnest phoenix
#

Please help me how to prevent the bot from registering everyone here in the command!!
well if he sees everyone or here in the message, he did not send

if(args2 === '@everyone'){
      message.reply('давай без этого')
      return
}```
lyric stag
marble juniper
#

@lyric stag you don't have a closing bracket for the else statement in the info case

forest drift
#

message.channel.messages.fetch({around: "766566025440788481", limit: 1})
im trying to get this to work where i can execute it in any channel but it only searches a specific channel. I've tried multipe .cache.get('channelid') but cant seem to get it to work

merry thunder
carmine summit
#

Post

#

Via the api

silver lintel
#

how do i see if someone votes for my bot on topgg? djs

earnest phoenix
#

whats a good way to tell when a channel is "active"? would it be tracking like historical data on it and then seeing if it goes above the average?

#

that seems super resource intensive to do

#

yes and yeah it is

#

you can do your best to minimize the impact though by only keeping necessary data

#

hmmm

#

i see i see

opal plank
#

@earnest phoenix if you'd like, i can provide the parameters i use to detect when a GUILD is active, while not the same case, you might wanna use some of it

earnest phoenix
#

sure

opal plank
silver lintel
#

:O

naive tide
#

How can i copy the vote link of any server

silver lintel
#

Ooh thanks

opal plank
#

@earnest phoenix here, there are a couple more but the gist is

earnest phoenix
#

oh its just if a threshold is met in a timespan

opal plank
#

basically, yeah

#

though there are other checks which arent implemented yet

#

this is just what i use to auto-leave bot hells

wind siren
#

Is there anyone who can help me develop a simple music bot

opal plank
#

then on message, add +1 onto that channel

#

the idle_timer is one week iirc, once that timer runs out, it checks if it had at least 20 messages

#

while this may not be the best example for your case, this might help

earnest phoenix
#

yea i was thinking a threshold that scales depending on members would probably be good

opal plank
#

something simple like this

earnest phoenix
#

so like a 5 member server has a threshold of like 10 while a 100 member serve rhas a threshold of like 500

opal plank
#

i do something similar for my spawn crates

#

get % of the maxmimum amount of members

#

like 10% per se

#

though i would recommend also capping it

#

for example, this server has 100k members, igve or take

#

making it a 500k message threshold is quite absurd

#

add a maximum and minimum for the server

earnest phoenix
#

logmarithic functions op

opal plank
#

start with 5 members and go up to 1k

#

dont even need tbh

earnest phoenix
#

@opal plank why is there a semicolon in an object declaration

const constants = {
 // ...
};

WHY

opal plank
#

if(1000 < memberCount || memberCount < 10) => use minimum/max threshold

else % of memberCount

#

what? @earnest phoenix

earnest phoenix
#

why is there a semicolon at the end

#

hes just being complicated

#

its es6 stuff

opal plank
#

why would there not be a semicolon ?

earnest phoenix
#

semicolons arent needed

#

interpreter assumes

#

yeah

opal plank
#

wut u guys on about?

earnest phoenix
#

save a single byte of storage space by removing semicolons boi @opal plank

pale vessel
#

bruh

earnest phoenix
#

that byte of storage space is translated to ram when interpreting

#

save ram instead :^)

#

yeah

#

waiy

opal plank
#

bruh my linter auto puts it

earnest phoenix
#

javascript is compiled when it's run?

opal plank
#

spaces and semicolons arent needed, im well aware

earnest phoenix
#

js isnt compiled at all

#

its interpreted

opal plank
#

though the linter dislikes not having spaces nor semicolons

#

by the same logic, remove all spaces in your code

earnest phoenix
#

removeum now or I'll steal bobux

#

also if yall are real gamers

opal plank
#

you wanna be a chad huh?

#

bet

earnest phoenix
#

the nodejs foundation themself

#

use that standard

opal plank
earnest phoenix
#

for programming

opal plank
#

if yall wanna be chads, work like that

earnest phoenix
#

in vs code install standardjs and set it to auto format on save

opal plank
#

fuck that, i like sanity, thank you very much

earnest phoenix
#

clean code > your sanity

opal plank
#

clean code

#

no spaces

earnest phoenix
opal plank
#

work with that

earnest phoenix
#

that isnt clean

opal plank
#

no spaces though

earnest phoenix
#

its effecient but not clean

opal plank
#

thats how its intepreted by the compiler

#

@earnest phoenix too lazy to go fix it

#

you got the gist

pale vessel
#

no i got the repo

earnest phoenix
#

i don't even use TypeScript i was just testing your laziness mmulu

opal plank
#

that much should've been clear from the very beggining

#

VERY lazy

earnest phoenix
#

you got the gist
@opal plank
no i got the repo
@pale vessel lmafo

pale vessel
#

lmafo

opal plank
#

i code and drink alchool all day, what else did u expect code

pale vessel
#

sjon

opal plank
#

the only thing i dont cut edges is work

#

which speaking of which im still indecisive about how to do this for the company

earnest phoenix
#

i code and drink alchool all day, what else did u expect code
@opal plank i expected you fucking up twitch with your slave thingy

opal plank
#

i already did

#

and then went to harass not only the staff, but the lib devs too

earnest phoenix
#

alchool

opal plank
#

alcohol

#

anyways, i should get back to coding

#

got shit to do

#

oh, speaking of which

#

52k channels

#

and a TON of errors

#

welp, time to improve the fuck out of it

earnest phoenix
#

can you eval smth for me

client.messages.get("766574469870387201").react("⭐");
snow oar
#
client.messages.get("766574469870387201").react("⭐");
#

Hmm

earnest phoenix
next flax
#

how is blue fox host

tardy hornet
#

@opal plank any idea why i cant run my bot?
2020-10-16T09:07:42.898736+00:00 app[worker.1]: Error waiting for network: Resource temporarily unavailable

earnest phoenix
#

sa

gentle lynx
#

why does amounts.size return 0

opal plank
#

@tardy hornet where you even getting that error at?

gentle lynx
#

it should return 2

opal plank
#

theres no stack on that error

#

i assume thats heroku?

unkempt mirage
#

Development how to add bot

#

In top gg

#

ANSWER OR UR MOM GAY

#

Pls 🥺

#

😭

#

🥝

gentle lynx
unkempt mirage
misty sigil
#

dude

unkempt mirage
#

Yes

misty sigil
unkempt mirage
#

Cant !

misty sigil
#

Why

tardy hornet
#

@tardy hornet where you even getting that error at?
@opal plank heroku

opal plank
#

@tardy hornet that error is likely being thrown cuz a heroku error, i dont think thats being thrown by node

tardy hornet
#

ik

opal plank
#

and if you next question is: How do i fix it?
i dont know, i dont use heroku

vestal walrus
#
@client.listen('on_message')
@is_in_server_list(whitelist)
async def msgfilter(message, member: discord.Member = None):
    for word in filter:
        if message.content.count(word) > 0:
            await message.channel.purge(limit=1)

            embed = discord.Embed(
                    
            colour = discord.Colour.red())
                
            embed.set_footer(text=f"Test")
            embed.add_field(name='Filter', value=test', inline=False)
            await message.channel.send(embed=embed, delete_after=10)
            return
        await client.process_commands(message)```

Why does this still repeat commands? It only filters servers within the whitelist and works but when you use commands it keeps on sending forever
pale vessel
#

@gentle lynx use amounts.set("prop", "value") for maps, not amounts["prop"] = "value"

gentle lynx
#

it still doesnt work

earnest phoenix
#

what is the difference between an Array, an Object and a Map

carmine summit
#

object = {}
array = []
map = idfk

misty sigil
#

arrays don’t have keys

opal plank
#

maps are indexes basically

#

a unique key(usually string) and then a value(of any kind)

#

as the name suggests, its a map, you get one key, it leads you to one value

#

its a 1-1 MAP per se, in the very sense of the word

sinful lotus
gentle lynx
sinful lotus
#

turn that function and callback into async await style, then remove the timeout, this way you can make sure its already done before sending the size

#

even you add timeout, you dont know if the task is already done after 1 second

gentle lynx
#

alright ill try it, thanks

earnest phoenix
#

to add onto above js objects are just dynamic maps

gentle lynx
#

@sinful lotus i did this and its still an empty message

#

did I do something wrong? I've never used an async function

earnest phoenix
#

a map is a complex object, you can't send it and expect it to resolve to whatever you want

#

you need to format it to a string accordingly

sinful lotus
#

the sql statement is what you want to transform into something awaitable

gentle lynx
#

should i console log it

sinful lotus
gentle lynx
#

i removed the sql code, no longer need it

sinful lotus
#

you should parse the "amounts"

#

as cry said

gentle lynx
#

logged it, still empty

sinful lotus
#

then your for in loop didnt loop

earnest phoenix
#

i noticed sometimes bot statuses just turn off randomly for some reason when i have it in the ready event, am i going crazy?

sinful lotus
#

@earnest phoenix probably some ws disconnect

gentle lynx
#

uh

earnest phoenix
#

does the ready event not fir when reconnect?

gentle lynx
#

I added await though ?

sinful lotus
#

you dont need to asycn await if you ddont have the sql statements anymore, I said that because you had an async operation earlier @gentle lynx

#

@earnest phoenix depends, on internal sharding I dont think it fires

gentle lynx
#

well even when i removed the sql statement, it is still empty

earnest phoenix
#

interesting

sinful lotus
#

@gentle lynx as I said for in loop is probably not looping

earnest phoenix
#

is internal sharding built in these days? IE automatically implamented or do you still have to declare it

sinful lotus
#

d.js has internal sharding built in by making the client shards option into auto

#

@earnest phoenix ^

gentle lynx
#

@sinful lotus damn youre right

#

why is it not looping though?

earnest phoenix
#

yea was wounding if you still had to declare 'auto' or not

#

gotcha

sinful lotus
#

thats what I cant answer, probably the object you are trying to loop is empty

#

or just use Object.entries(yourObjectHere)

#

then loop from that

#

personally I dont use for in loop for looping

#

@gentle lynx ^

foggy cove
#

I'm trying to figure out how to make my music bot leave a voice channel if a specific account Rythm joins in the same voice channel

gentle lynx
#

the object is undefined lol

#

my bad.

sinful lotus
#

then tthats the problem

gentle lynx
#

ugh

#

me dumb

earnest phoenix
#

happi

gentle lynx
#

so can I now remove the loop?

sinful lotus
#

@foggy cove just get rhythm id, listen to voice state update, do some code there when rhythm joins dc your bot

gentle lynx
#

async loop*

carmine summit
#

WHY IS IT SO ORGANIZED?

sinful lotus
#

you dont need it at the first place @gentle lynx

gentle lynx
#

ah ok

#

thanks

sinful lotus
#

I said that because you had the

#

db operation

#

makes things easier

earnest phoenix
#

@carmine summit litterally no reason to be lazy programming bots especially ones you want to eventually scale etc

sinful lotus
earnest phoenix
#

program with quality

#

do you keep your bot and functionality etc in one process / sharded ?

#

im taking the whole rest api -> integration route

foggy cove
#

@sinful lotus oh yeah that makes sense, ok I have a clear goal on what to do now, thanks!

sinful lotus
#

rest api
websockets
and
process

earnest phoenix
#

gotch gotchu

sinful lotus
#

most of my game apis are on rest api

#

game data api* rather

#

so I can reduce the load on bot

earnest phoenix
#

i mean thats the proper way to do things anyways

#
  • if you have like a microservice styled backend modular scaling
#

uwo

#

owu

#

docker and k8s op

sinful lotus
#

yes tho I dont use those

#

still lazy to do some major porting to those

#

tho im pretty sure the code is pretty much ready

earnest phoenix
#

i mean practically speaking if you have the whole endpoint -> integration style it wouldnt be hard to convert

#

just a few configs here and there

#

and learning the techs

#

ye

sinful lotus
#

besides I migrated stuffs to api so they would have their own dedicated system to update theirselves without relying on bot's resources

#

specially fuzzy searching

earnest phoenix
#

if not k8s at least look into docker

sinful lotus
#

yeah Im thinking about docker

earnest phoenix
#

pushing to github -> travis pulling and testing then publishing to docker -> and server auto pulling the image from docker

#

is so based

#

cicd potential is big boy

sinful lotus
#

tho I will still setup it that

#

I will manually pull it when I want to

#

since I push to master without testing stuff

earnest phoenix
#

have a dev branch and master branch

#

have 2 process pull from each respective one

#

have a dev bot and prod bot

gentle lynx
#

its looping but why is it not even setting 1 => 3

sinful lotus
#

what are you trying to achieve

#

I have a dev bot but it also pulls from master

gentle lynx
#

so

#

i want to put inj the hashmap

#

evertyhing in items

#

so like
IRON_INGOT => 2
WOODEN_STICK => 1

earnest phoenix
#

smh dev bot pulls from dev branch and merge to master once stable is pog

sinful lotus
#

smh just push to master and dont update prod bot until its stable gang

#

@gentle lynx what I can only thing is, the second .set() is messing something on your code

#

move that outside the loop probably

#

or just remove that

#

idk what that supposed to do

gentle lynx
#

i moved it and its still empty 😬

#

its not even bloody setting

sinful lotus
#

is it looping

#

if its not setting then it might not be even looping again

gentle lynx
#

its empty

#

should i log it

sinful lotus
#

log your loop, log the amounts, and properly format amounts

#

dont just send the amounts without parsing it

gentle lynx
earnest phoenix
#

just had a pog idea that a million other people have had

#

if api healthcheck goes down bot dms me

gentle lynx
#

u know wht

#

screw it

#

im not using a map

#

😫

sinful lotus
#

just fix that undefined thing

twilit rapids
#

Seems like whatever crafts[craft].items[item] is, is undefined

sinful lotus
#

ur undefined @twilit rapids

gentle lynx
#

i think i know why

#

crafts[craft].items[item] gives me the value not the key

#

oh wait no

sinful lotus
#

just do Object.entries() loop

gentle lynx
#

item gives me the value

sinful lotus
#

it will give you
[ key, value ] of that object

#

less confusion

gentle lynx
#

so it's doing
crafts["IRON_SWORD"].items[1]
i want to do
crafts["IRON_SWORD"].items["IRON_INGOT"]

#

its undefined because there is no key called 2 or 1

opal plank
#

idk what you doing, but isnt it better to use an array for this case?

#

just a recommendation

#

that way you can also keep its shape

#

['','IRON','', '','IRON', '', '','STICK','']; all 9 slots from the crafting area

gentle lynx
#

sec

sinful lotus
#

also another recommendation is the Object.entries loop so you get less confused on key and value or rather item and its number

opal plank
#

i usually prefer to loop keys tbh

#

thing[key]

gentle lynx
opal plank
#

but i havent tested its performance

gentle lynx
#

fixed 😄

sinful lotus
#

mostly preference, for me I use Object.entries then loop from it because of readability

opal plank
#

fair

#

also var bad

gentle lynx
#

your mom

opal plank
#

@gentle lynx you can take your jokes to #general or another server if you'd like to ask for support while being rude like that

gentle lynx
#

I- FLooshed

mossy cloak
gentle lynx
#

i didnt mean to be rude

#

sorry.

restive furnace
mossy cloak
#

I Did Not Say That

#

Man

restive furnace
#

what?

mossy cloak
#

I Say About The Error

restive furnace
#

what error

#

i just see deprecation message

gentle lynx
#

so i created this class, how do I use it in another file?

wary flame
#

Export it, require it in the other file

gentle lynx
#

yeah how

wary flame
#

At the bottom of the class add module.exports = User, in the file you want to use it: const User = require('path to user class file')

#

You can probably also use es6 import/export but idk how that works

misty sigil
#

module.exports = user

#

require("PathToFile")

gentle lynx
#

just User?

wary flame
#

Yes

gentle lynx
#

module.exports = User

wary flame
#

Unless you want to export more then just the class

gentle lynx
#

User is not defined

wary flame
#

That needs to be in the file where you define the user class

gentle lynx
#

oh

#

my bad

misty sigil
#

Then require it

gentle lynx
#

yup

#

require it in the file i want to use it in, right?

sinful lotus
#

also I doubt that would return anything

#

as I said you are using callbacks

#

that will return undefined

wary flame
#

Yes, require in the file you want to use it in

#

Also as Atri said you should use promises becouse you are working with callbacks

#

Or use callbacks

sinful lotus
#

it looks like this

const util = require('util');
util.promisify(this.message.client.con.query)(sql)
    .then(console.log);
gentle lynx
#

the file i want to use the class in is under the commands folder, the class file is outside the folder

#

how do I get the path?

sinful lotus
#

require('../file') is the easiest

wary flame
#

../folder/file

gentle lynx
#

thanks

wary flame
#

../ means go down one folder

earnest phoenix
#

didnt tonk maintain the dbalapi?

sinful lotus
#

well its archived now

wary flame
#

Its depracted now

earnest phoenix
#

ah yes

#

depracted

sinful lotus
#

I have my own system for stats so not a problem

earnest phoenix
#

axios machine go brrrrrrr

gentle lynx
#

also I doubt that would return anything
@sinful lotus yeah it doesnt return anything

gentle lynx
#

uh

sinful lotus
#

rewrite the last part

#

to look like that

#

but instead of .then

#

just do return code here

gentle lynx
#

you mean the get function?

earnest phoenix
#

i shouldnt be writing a help command at 6am

#

i shouldnt be coding at 6am*

sinful lotus
#

everything tbh

#

you use callbacks on pretty much everything

gentle lynx
#

ok

earnest phoenix
#

@sinful lotus every function i ever write is almost always a promise :^)

wary flame
earnest phoenix
#

promise gang gang gang

gentle lynx
#

i dont really get it

#

should it look like this?

sinful lotus
#

you forgot to return the util.promisify

#

also

#

.then(result => // do something)
if you want to chain promise

wary flame
#

Why are you setting an empty presence anyways

#

Also read the error

gentle lynx
wary flame
#

presence.activities[0] is undefined

gentle lynx
#

doesnt work

earnest phoenix
#

whats a good way to counteract ready not firing on ws reconnect

gentle lynx
#

im sorry im really dumb

earnest phoenix
#

maybe i update presence on an interval?

sinful lotus
#

@earnest phoenix just fire ready once

wary flame
#

What should I do
@earnest phoenix just dont set an empty presence

earnest phoenix
#

and if the ws disconnects?

sinful lotus
#

@gentle lynx what doesnt work

twilit rapids
#

Are you using shards

earnest phoenix
#

internal sharding atm

gentle lynx
sinful lotus
#

@earnest phoenix depends on your implementation, even ws disconnects, doesnt matter

gentle lynx
#

whenever I use the get function

earnest phoenix
#

ideally ide like to have full uptime of the status :p

twilit rapids
#

Your issue is your status disappearing right

sinful lotus
#

well tap on shardReady @earnest phoenix

earnest phoenix
#

i'm bored

#

oooh shardready is probs a good op

#

imma go make a huge ballpit in matter.js

#

@twilit rapids yea status just drops randomly

sinful lotus
#

if that fires more than one thats an re-ident

earnest phoenix
#

and then occasionally comes back on

#

if i restart manually it does

sinful lotus
#

basically

#

just do

#

when it fires once, thats a ready shard

#

when it fires again thats a reident

twilit rapids
#

Just have an interval in the ready event to update it every 30 minutes or something sip

#
setInterval(function () { client.user.setActivity(`poggers bro`, { type: 'LISTENING' }); }, 30 * 60 * 1000);
sinful lotus
#

setInterval KEKW

twilit rapids
#

¯_(ツ)_/¯

earnest phoenix
#

smh

sinful lotus
#

but yeah

twilit rapids
#

Or do it every 4 seconds if you're fancy

earnest phoenix
#
setInterval(() => client.user.setActivity('poggers bro', { type: 'LISTENING' }), 30 * 60 * 1000)``` ftfy
sinful lotus
#

shardReady first fire = shard ready

#

shardReady fired after first fire = shard reident

earnest phoenix
#

ill jsut throw it onto shardready

sinful lotus
#

and when shard reident, do your thing

#

also that gives the id of the shard that fired ready

#

so use the options in setActivity

#

to just set it on the shard t hat reidentified

real otter
#

Hi, guys, anyone was worked with lavalink?

sinful lotus
#

to save some ratelimits

earnest phoenix
#

whats a lavalink

#

i dont think anyone here knows what that is

#

especially not music bot owners

sinful lotus
#

I dont know lavalink

#

probably @twilit rapids knows

twilit rapids
#

what's a lavalink

real otter
#

It's module for create and join server

#

It's for music bot

twilit rapids
#

Well what's the issue you're having

sinful lotus
#

sorry havent heard it

opal plank
#

lavalink is basicaly ip routing iirc

sinful lotus
#

only @twilit rapids have a music bot here

earnest phoenix
#

have you tried turning it on and off again?

sinful lotus
#

so he might know it

twilit rapids
#

what's a music

opal plank
#

actually, wait, i might be wrong

#

lavalink is used for music mainly

#

though iirc it can be used for routing ipv6's

earnest phoenix
#

how do you download individual files from GitHub without cloning the whole repo

sinful lotus
#

just fetch the file

twilit rapids
#

Lavalink is a standalone audio sending node @opal plank

real otter
#

@twilit rapids My friend has such a problem, his code is exactly the same, but when he tries to start music, his bot enters the voice channel and immediately exits (everything works for me even if I put his node)
He use lavacord/discord.js

twilit rapids
#

Check your bot's and Lavalink's logs

opal plank
#

@twilit rapids yes, that bit i know, but i think it can route ip blocks

real otter
#

1 moment

opal plank
#

i remember someone using lavalink for that

twilit rapids
#

If you see the number "429" anywhere then get an IPv6 subnet

earnest phoenix
#

just fetch the file
@sinful lotus lmao

opal plank
#

aaah, found it

earnest phoenix
#

I'm signed-out on GitHub Web in incognito mode

opal plank
sinful lotus
#

yes

#

it does

twilit rapids
#

Yes I know that

#

I use that at a rather decent scale in prod

sinful lotus
#

imagine using ll in prod

opal plank
#

i havent used it at all tbh

#

im thinking about doing it though

sinful lotus
#

I use it but maintain it some build that makes my head goes rm -r saya_brain

opal plank
#

cuz my host has a 39 ip block iirc

twilit rapids
#

Would be smart to just show the error rather than sending a file with your IP

earnest phoenix
#

just realized there is a Raw version for every single file you upload on GitHub so I can just press Ctrl + A on this file and paste it on my computer and save it mmLol

#

my ip is 127.0.0.1 ddos me

sinful lotus
#

yes it has

#

and just fetch that

#

link

real otter
#

@twilit rapids Where ip?

twilit rapids
#

In the file

opal plank
#

wait, we posting our ips now?

#

bet, lets leak ips

real otter
#

Oh

#

Yes

twilit rapids
#

@real otter seems like you're getting Failed to match ytInitialData JSON object

sinful lotus
#

my ip is 127.0.0.1

real otter
#

Didn't notice

twilit rapids
#

Ask about it in the JDA server

earnest phoenix
#

ill show you mine if you show me urs 😊

twilit rapids
sinful lotus
#

ads

twilit rapids
#

In the #lavalink channel

earnest phoenix
#

I just made a repl called plain-anarchy-to-fix-my-boredom

real otter
#

Ok, thx

sinful lotus
#

actually I can show you my ip

twilit rapids
#

@sinful lotus also you use ll in prod smh

real otter
#

I just work with lavalink for 2-3 days and don't know how to fix it

sinful lotus
#

@twilit rapids mine is called lavaweeb

twilit rapids
#

s m h

opal plank
#

WavaWink UwU is the good shit to use in prod

twilit rapids
sinful lotus
#

not weeb enough

#

Im not interested on making that

twilit rapids
#

but yeah ipv6 is funny business

#

youtube go brrr

sinful lotus
#

ur a funny business

twilit rapids
#

ok

opal plank
#

kyoso

#

u use Ts?

twilit rapids
#

no

opal plank
#

which lang?

twilit rapids
#

js

earnest phoenix
#

what is the difference between Kyoyu and Kyoso

opal plank
#

hmmm

sinful lotus
#

ts is fine but I think its better to just use another language than ts for me

opal plank
#

i might wanna yoink that lavalink from ya

twilit rapids
#

you mean the wrapper I use?

opal plank
#

i need to route my traffic within the twitch slaves, possibly assigning each websocket to a different ipv6

twilit rapids
#

Lavalink is open source

#

just download it from their github lol

opal plank
#

i know

#

its just gonna take a while to get used to it

twilit rapids
#

You mean you wanna use my node

fluid basin
opal plank
#

yoinks

twilit rapids
#

hahaha

#

no

opal plank
#

lmao

fluid basin
#

would it slow it down though

#

hmm

opal plank
#

just lazy rn to see an example

#

i'll google it later

#

i still need to finish the dynamic spawner

fluid basin
#

but timo dont need flex

twilit rapids
#

they have examples on their github

opal plank
#

this crap isnt properly counting the channelLimit

fluid basin
#

u only have 1 region

opal plank
#

clearly properly distributed and respecting the limit

sinful lotus
#

5k what?

fluid basin
#

smh why has no one made a central sharding system

opal plank
#

channels

#

define central sharding system

fluid basin
#

as in master/slave

twilit rapids
#

centtal

fluid basin
#

but master handling all conn

opal plank
#

thats what i did though....

#

the slaves connect to the channel that they were commanded to, then they route all traffic to master

sinful lotus
#

I mean I have 200k channels per process if thats what you mean

fluid basin
#

eh

opal plank
#

master is what handles everything

fluid basin
#

no like

#

every slave can access any guild

earnest phoenix
#

is there a CLI GFM parser

opal plank
#

thats not discord @sinful lotus

fluid basin
#

any guild the bot is in

opal plank
#

why do that though?

fluid basin
#

so master balances the guilds

sinful lotus
#

wait what channels is that

fluid basin
#

why not

sinful lotus
#

enlighten me

opal plank
#

usually the holdback is on the connection

#

channel as in twitch channel(aka a stream channel)

fluid basin
#

owh

sinful lotus
#

oooooo

fluid basin
#

makes sense

opal plank
#

the problem that requires sharding is the buffer becoming too large

#

so they ask you to split it

fluid basin
#

allocate more ram

opal plank
#

as far as everything else goes, there isnt need for the shards to talk between eachother

#

they only talk to the master

#

which handles everything and dispatches events

sinful lotus
#

not the same system, but I also deploy kinda something like that

#

I dont broadcastEval instead I have my ipc

opal plank
#

though my problem rn is that
A) its not respecting each shard limit of 5k channels
B) its not spawning more as needed

#

and they are not being equally routed

sinful lotus
#

but yeah you need to respect the 5k thingy soon

fluid basin
#

oof

sinful lotus
#

probably use some penalties system?

opal plank
#

18k on one, 6k on another

#

like i said, thats not discord, and twitch doesnt do sharding

sinful lotus
#

I mean

opal plank
#

this is all choice from me

sinful lotus
#

yeah I mean I know its not discord

#

thats why implement some penalties system

#

so you can add or loadbalance your channels

#

respecting the 5k limit

opal plank
#

i already have the in place, though it just isnt being respected lmao

#

probably an if or something missing somewhere

sinful lotus
#

like for example, the closer the slave to 5k limit, the higher the penalty on it

opal plank
#

OOOH thats what you mean

sinful lotus
#

yes

opal plank
#

mine works more with spawning X amount on startup, then filling them as needed with the startup splitting the load

#

the problem is: they ARE being evenly split

#

the issue comes when the channels they were ordered to join fail

#

if they start getting too much stress they may get ratelimited

#

which halts the whole thing

sinful lotus
#

if they join fail, probably implement some back buffer queue

#

and try again after some x time?

opal plank
#

i need to add a retry on them

#

i was thinking rather than buffer, add a retry

sinful lotus
#

something like the same logic of discord.js queue system on rest

opal plank
#

on('failure') => timeOut(1000); => continue

sinful lotus
#

that when 500 happens, they put it on back of queue and try again after other things are done

opal plank
#

i could do a queue system too

#

though ive seen some people put the websocket to 'sleep' too

sinful lotus
#

also if its fine to move the failed join in another slave

#

on join retry

#

that would be more better

opal plank
#

i might end up going on that approach tbh

#

though that might lead to an infinite loop

sinful lotus
#

like if it will retry the request, check the slaves for penalty then do it on that slave

opal plank
#

i need to dispatch it with a RETRY_COUNT too

#

to make sure it just doesnt forever loop onto every slave trying

sinful lotus
#

yes then mark it as failed if it failed on retry count

#

breaking the reconnect loop

opal plank
#

what i SHOULD be doing is separating the dispatcher tbh

#

its QUITE the hassle to have it on the index

#

since i cant delete the cache for it

#

deploying updates on the go without having to restart and re-query everything

#

actually

#

hmmmm that might be more troublesome that i hoped for tbh

#

actually

#

thinking about how to deploy updates on the slaves

#

i could put their functions outside and re-require it

#

i see this is gonna get hard and advanced really fucking quick

sinful lotus
#

put it on a map and replace the data on map as you see fit GWovoRaphiXD

opal plank
#

Command => index => Dispatcher => slave => command => run command file => Dispatcher => emitter => index again

#

thats becoming quite the chain tbh

sinful lotus
#

if it works fine that way then its probably ok GWovoRaphiXD

silver lintel
#

How to make the bot say a message everytime it joins a server js

opal plank
#

u need intents for it fyi

#

but use GUILD_CREATE event emitted by discord

#

if you using discord.js
listen to 'guildCreate' event on your client

#

but like i said, you need to be verified to do that now

#

GUILD_MEMBER updates are priviledged now

#

welp, time for a TON of booze and another 5h of coding

raw silo
#

Hi, is there a way to find a channel by name?

#

I want to send a message to a specific channel, but don't have access to message object

#

if possible i'd like to avoid hardcoding channel id

faint prism
#

Yeah, you can loop over all the channels and use lambda to check the channel name

#

But if you're going to be hardcoding the channel name, might as well do it with the id

#

Unless it's a command ig

raw silo
#

it actually did work, I got confused by not seeing name property here - https://discord.js.org/#/docs/main/stable/class/Channel

earnest phoenix
#

Array.prototype.fill only changes elements that are already there and I want to just fill everything from index A to index B with whatever I want
Is there a method to do this?

faint prism
#

why not a for loop

#

for (let i = A; i <= B; i++)

earnest phoenix
#

imagine using for loops in javascript

#

js arrays objects, and maps are op

pale vessel
#

i'd use .map()```js
function fillArray(arr, fill, from, to) {
arr.map((x, y) => y >= from && y <= to ? arr[y] = fill : null);
return arr;
}

fillArray([0, 1, 2, 3], "yes", 1, 2);```

#
// [ 0, 'yes', 'yes', 3 ]
earnest phoenix
#

i mean i already figured out how to do that but they should add a way to replace elements of the array and create new ones without the extra lines of custom code we bois make (and girls)(i'm bisexual)

faint prism
#

replace elements of the array and create new ones
You want to enlarge the array size?

earnest phoenix
#

nope

#
var orginarr = ["yeet","lol","reeeeee"];
// fill only replaces the existing elements within the range
var fillarr = originarr.fill("nope", 0, 100);
console.log(fillarr); // ["nope","nope","nope"];
var smtharr = originarr.smth("yes", 0, "100");
console.log(smtharr); // ["yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", ...];
#

wouldn't it be just a simple for loop

faint prism
#

That's what I said

earnest phoenix
#

i don't think so

faint prism
#

why don't you think so?

earnest phoenix
#

because i have no brain to think

pale vessel
#

just extend the array prototype

earnest phoenix
faint prism
#

I've got an SQL questions myself.
If you had a piece of logic in some C lang that called a SQL database, would it be more performant to rely on the DBMS to perform arithmetic or rather should the program retrieve the record from a general query and perform the arithmetic itself?

#

I suspect relying on the dbms is faster

carmine summit
#

uhhh

earnest phoenix
#

quick.db error

#

uninstall and reinstall the whole package

#

(your stored data won't be deleted)

carmine summit
#

ok

#

no fix

#

@earnest phoenix no fix

earnest phoenix
#

can switch statements return data or are they void functions?

#

@carmine summit F

#

are you using glitch on light mode or is that repl

#

@earnest phoenix former

#

because glitch loves to fuck sqlite

#

switch can either break or return a value

#

so this is possible?

switch (_i) {
    case 1:
    return "smth";
    break;
    case 2:
    return "smthelse";
    break;
}
#

there's no need for the break there

#

but yes

carmine summit
#

its repl

faint prism
#

return would exit the function

earnest phoenix
#

^

#

ok

carmine summit
#

its an experiment bot

faint prism
#

so break is technically unreachable there

carmine summit
#

dunno if its gon work

earnest phoenix
#

i dunno how to fix it tbh

#

i just reinstalled like fuck and it smh fixed

#
let _i = Math.floor(Math.random() * 2);
    let thingtodraw = switch (_i) {
        case 1:
        return Bodies.rectangle(Math.floor(Math.random() * 1000), Math.floor(Math.random() * 1000), 50, 50);
        case 2:
        return Bodies.circle(Math.floor(Math.random() * 1000), Math.floor(Math.random() * 1000), 50);
    }
    thingies.push(thingtodraw);
Uncaught SyntaxError: Unexpected token 'switch'

wat

faint prism
#

= switch wat

opal plank
#

just let thing;

#

then assign the value WITH a switch

carmine summit
#

I remember past me not using functions and loops...

opal plank
#
let thing;
switch(something) {
case 'a': thing = 1;
break
}
return thing```
earnest phoenix
#

if return is usable inside a switch statement and you can't directly assign a value to a variable what's the point

faint prism
#
let val;
switch (thing)
{
  case 1:
    val = whatever;
    break;
}
earnest phoenix
#

I remember past me not using functions and loops...
@carmine summit past you should cease to exist

carmine summit
#

c'mon we all have been there atleast once

slender thistle
#

this

faint prism
#

I'd shake my past self's hand for being interested in coding tbh

carmine summit
#

@faint prism Your PFP makes me uncomfortable

earnest phoenix
#

why is shivaco's pfp stuck

opal plank
#

sweet days those were, where we simply played with variables and if statements. Now here we are, clustering shit and breaking/ddossing twitch. No regerts mmulu

earnest phoenix
#

ddossing twitch wtf

#

@faint prism didn't you hear the news? c#8 allows inline switch

carmine summit
#

ddossing twitch KEKW

faint prism
earnest phoenix
#

yup

#

you can further extend this behaviour with when operators

opal plank
carmine summit
#

what browser tf is that?

faint prism
#

what a perfectionist lol

earnest phoenix
#

what browser tf is that?
@carmine summit the only browser in the world that is good
lemme introduce you to Brave

carmine summit
#

ya know what

#

im not gon use quick.db

#

its too glitchy

opal plank
#

if you dont use AOL, we cant be friends

carmine summit
#
const Database = require("@replit/database")
const db = new Database()
```boom
#

ez fix

earnest phoenix
#

@faint prism c#9 introduces the not operator

#

so that's fun

#

you'll be able to do when not

#

you can see how they're favouring functional language design

tardy hornet
#

my terminal just sent that

#

(node:15156) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 closing listeners added to [VoiceConnection]. Use emitter.setMaxListeners() to increase limit

#

and now its doing some weird crap

earnest phoenix
#

well did you read it

#

you just temporarily fucked your RAM

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

yup

sage bobcat
#

One message removed from a suspended account.

tardy hornet
#

wdym?

earnest phoenix
#

i've been using it in my code for discord opcodes

tardy hornet
#

what did i do

opal plank
earnest phoenix
#

cs8
you guys mean es8?

#

you added way too many listeners to the same event

#

we're talking about csharp

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

opal plank
#

rly? no one screeched seeing that pic?

tardy hornet
#

did someone hacked my bot?

earnest phoenix
#

ok

sage bobcat
#

One message removed from a suspended account.

tardy hornet
#

so what is that?

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

rly? no one screeched seeing that pic?
@opal plank me did, but on the inside

sage bobcat
#

One message removed from a suspended account.

tardy hornet
#

wdym too many

opal plank
#

okay good, i wanted a reaction @earnest phoenix

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
tardy hornet
#

talking to me?

earnest phoenix
sage bobcat
#

One message removed from a suspended account.

tardy hornet
#

im using cases

sage bobcat
#

One message removed from a suspended account.

opal plank
#

lib is capable of 20 joins every 10 seconds, and each promise holds for 10 seconds, so doing 40(double) is a safe way to allow each shard to work with that many

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

tardy hornet
#

but i have like 70 commands

earnest phoenix
#

✨ read your errors ✨

tardy hornet
#

the error is 312 lines

earnest phoenix
#

@opal plank what are you even trying to do

tardy hornet
#

im not gonna read it

opal plank
#

trying? nonono, done already

#

clustering

tardy hornet
#

@sage bobcat so just delete some commands?

opal plank
#

i need to create and destroy a listener everytime i push a promise on the IPC pipe

earnest phoenix
#

the error is 312 lines
im not gonna read it
@tardy hornet because 99.99% of the errors is just javascript telling you where the error happened and node.js takes like 100000000000000 lines to show one file path

tardy hornet
#

ik

#

lol

#

@sage bobcat so just delete some commands?
?

earnest phoenix
#

i need to create and destroy a listener everytime i push a promise on the IPC pipe
pretty much the same with react components mounting and unmouting ThisIsFine

opal plank
#

except 300 iq libs. on('error', => console.log('oops')), you'd be surprised how many libs do that shit

tardy hornet
#

erwin

opal plank
#

thats me

tardy hornet
#

you are a good coder

opal plank
#

im not

tardy hornet
#

any idea what can i do?

opal plank
#

remove event listeners

sage bobcat
#

One message removed from a suspended account.

opal plank
#

im 99% sure you dont need more than 1 listener

sage bobcat
#

One message removed from a suspended account.

opal plank
#

post error again

tardy hornet
#

im using cases

opal plank
#

nothing related to cases

sage bobcat
#

One message removed from a suspended account.

opal plank
#

its event listeners

sage bobcat
#

One message removed from a suspended account.

tardy hornet
#

its 312 lines, im gonna send the first line

opal plank
#

post error again

tardy hornet
#

(node:15156) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 closing listeners added to [VoiceConnection]. Use emitter.setMaxListeners() to increase limit

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

opal plank
#

^^

earnest phoenix
#

^^

#

imagine going to the doctors and complaining you cough too much... but you left out the whole part where you smoke a pack of cigs a day

sage bobcat
#

One message removed from a suspended account.

opal plank
#

you using VSC ? @tardy hornet

tardy hornet
#

whats vsc

sage bobcat
#

One message removed from a suspended account.

opal plank
#

visual studio code

faint prism
#

g00gl3

tardy hornet
#

visual studio code
@opal plank yes

earnest phoenix
opal plank
#

good, then do this

sage bobcat
#

One message removed from a suspended account.

opal plank
#
ctrl + f

now type   on('

then show me the results

sage bobcat
#

One message removed from a suspended account.

opal plank
#

i just wanna see how many listeners they have

earnest phoenix
#

lmgtfy became sellouts (uses your data and redirects you to their own engine instead of google) use http://letmegooglethat.com/ just to serve a bit of salt mmLol

faint prism
#

yup

fluid basin
#

wait really

#

thats sad wtf

sage bobcat
#

One message removed from a suspended account.

faint prism
#

I saw that and all the ads

opal plank
#

@tardy hornet ctrl + f
then search for .on('