#development

1 messages · Page 808 of 1

tulip iron
#

I'm using pandas' plot function

#

I'm hosting the bot on Heroku, how do I save it to the tmp folder?

#

Do I just save it as tmp/graph.png?

manic light
#

guys

#

i need fast help

#

anyone here ?

#

its important for me

quartz kindle
manic light
#

okey srry

#

i cant see my token in discord developer

#

so its discord problem ?

#

or just for me ?

quartz kindle
#

this happens when you open the discord developers page?

#

which page exactly does this happen?

manic light
#

i see that page

quartz kindle
#

have you tried with a different browser?

vernal yoke
manic light
#

yes

#

same

west raptor
#

I'm getting an error also

manic light
#

....

west raptor
#

Seems to be on discord's side

manic light
#

so i cant sleep this night ty discord XD

west raptor
#

Remember guys; discord is a stable platform

#

Nothing ever breaks

quartz kindle
#

looks like its happening to everyone

#

so yeah, discord bad

grim aspen
#

their devs have -2 iq

manic light
#

i was regenerate client secret with miss click

#

i was think it was because of this

sudden geyser
#

And they just released the announcement about the mention changes.

#

omegalul

quartz kindle
#

what mention changes?

prime cliff
#

They broke it because of that i guess

quartz kindle
#

interesting

open olive
#

It was a bit confusing to me but I see it as a reason why bots get declined. My bot is in the approval process at the moment and I'm wondering if someone invokes an NSFW command do we return a response mentioning that it is not an NSFW channel or do we just not send anything?

lyric mountain
#

Just dont allow nsfw on non-nsfw channels

hoary elm
#

@open olive sending a message would probably be best so the user knows what's happening

lyric mountain
#

And take care when using apis

open olive
#

Alright thanks 👍

lyric mountain
#

iirc, not showing an error message can also make your bot be declined

open olive
#

Mhmm, yeah that's how I had it originally and I read the bot decline reasons so I switched it off and then switched it back again to showing an error message. So yeah was confused lol.

#

Trying to get it through the approval the first try lol, but hey there could be something I'm missing.

lyric mountain
#

Basic things are: have a main functionality, alert you users when error occurs and keep it mostly sfw

#

And don't be lazy to write your bot's description

open olive
#

Yeah, mine is sfw friendly, but nsfw is okay so long as it doesn't break discord TOS.

#

and these guys' rules as well.

tulip iron
#

@topaz fjord Thanks for your help, got it to work with the tmp folder 😄

topaz fjord
#

np

#

that's what I would do since you don't have to worry about clearing it

tulip iron
#

I'm just waiting for bot approval now

manic light
slate oyster
#

1412955478 a good permissions number?
Previous value was 8

lyric mountain
#

Isn't 8 admin?

slate oyster
#

Yea

lyric mountain
#

The forbidden permission

slate oyster
#

I'm changing to 1412955478 though

#

That fine?

#

What do you mean forbidden? Discord TOS allows it

lyric mountain
#

They allow it

#

But it makes people not trust in your bot

slate oyster
#

Hmm
Everyone who has used my bot so far has done so without question

lyric mountain
#

Always be specific about your permissions

#

Yeah, but it's a lazyman's solution

#

Like, you don't need voice connect permission if you don't have voice commands

#

Nor ban permission if you don't have ban commands

slate oyster
#

Anyways though
1412955478 seem like a good number? Can't decide if I should enable everyone pings or not

#

Since I filter them anyways
Under a setting that can be enabled/disabled

#

Actually, one of the perms I ticked seems less necessary
So I'ma go 1345846614

#

1345842518

earnest phoenix
#

I just gave mine admin and put in the description it’s for future updates but you can disable everything you don’t need.

warm marsh
#

Quick question,
Would doing a for loop like this cause performance issue and/or use more resources?

const NamedCallback = function(index) {
  // Do something with said index
}
for (
  let index = 0,
      length = 1000;
  index < length;
  index++
) NamedCallback(index);
lyric mountain
#

Depend on what you'll run inside that for

#

It's not the for that's heavy, but what you run inside it

warm marsh
#

A bunch of dom manipulation which is fairly light.

#

Append, hide, show, etc...

lyric mountain
#

Well, then maybe

#

Remember that 1000 iterations are almost nothing when saying about big numbers

warm marsh
#

Yeah, The number is slighly bigger.

#

It's done almost instantly, Just when hiding and showing it takes a while and feels clunky.

lyric mountain
#

Try profiling your code to see possible bottlenecks

#

You're using js right?

warm marsh
#

That's the loop that seems slow.

lyric mountain
#

Profile it to see exactly which method is slowing it down

#

Maybe it's not the loop itself, but some step inside it

#

Remember that js is natively mono thread

#

So maybe you'll have to find ways to split work

warm marsh
#

Will give it a try, Thanks for the insight.

earnest phoenix
#

how do you get: thispart.get_server() like what do you put before?

sudden geyser
#

what?

earnest phoenix
#

^

earnest phoenix
#

linki = client.????(destination=sid, xkcd=True, max_age=mage, max_uses=mus)

#

what do i put here

#

lan?

#

lang*

#

looks like python

#

python

#

ok 1)

#

dont use the client architecture

#

oh?

#

cogs

#

basically you split it into parts

#

and load each part

#
@client.command(pass_context=True)
async def link(ctx, sid, mage, mus):
    server = client.get_guild(sid)
    linki = client.(destination=sid, xkcd=True, max_age=mage, max_uses=mus)
    invites = []
    await ctx.send(linki)
    open("invites.txt", "w+").write(str(linki))
    print(f"Created invites for {str(len(linki))} channels in {ctx.guild.name} and saved them @{getcwd()}/invites.txt .")
#

it is supposed to get an invite from a server using a server id'

#

i have no clue

#

thats an old, obselete model =/

#

well then what is the new model?

#

it lookks like you're there but not

#

hold on

#

wrong link

#

there

#

i mean the client architecture still works, its just a lil clunky

#

i THINK you might be looking for fetch_invites

#

hmm ill tryu

#

i honestly cant find it

#

found it

#
invites: List[discord.Invite] = await server.invites()
#

no so im not on the server

#

is the bot tho?

#

yes

#

why are you trying to generate invites for a server you arent in tho

#

that's a privacy breach

#

rly?

#

@coral trellis i'm right here right?

#

oof

#

but yea.

#

oof

#

look there

#

what if you are in the server and you bot is in the server and you go like server-info?

#

you're already in that server

#

if its for a server you aren't in, then it becomes a problem

#

oh

#

i wonder why that is tho

#

would you want some random bot owner getting an invite to your server

#

sure more people

#

no.

#

?

#

the answer is no.

#

not all servers are public

#

ok 😢

#

ansura is in a couple private servers

#

the tjing is tho ive no idea if it is a private server or not all i know is that my bot is in it

#

who cares?

#

me kinda

#

why?

#

you made a public bot

#

what do you expect

#

it's gonna get into servers

#

i wanna know what people use the bot for

#

so...log commands?

#

🙁

#

there are so many better ways than breaking into a server dude.

#

thats not ok.

#

better ways?

#

yea. like logging commands.

#

seeing what people are using

#

eh ill just make a survey

#
    @commands.Cog.listener()
    async def on_command(self, ctx: discord.ext.commands.Context):
        print(str(ctx.command) + " command called with " + str(ctx.invoked_with))
        print("\t>>>>> " + ctx.message.content)
#

thats in mine

#

but imma update it to not include user, cuz its not useful without guild

#

but all you need is something like that, showing commands

#

my bot wont connect to discord

#

error?

#

language?

#

nope no error and in discord.js

#

you say "doesnt connect" . so the bots not coming online?

#

yes

#

ready event is not triggered

#

does your ide allow you to step through code?

#

no im using glitch

#

hm

#

idk then

#

i'd say stick a bunch of print statements in

#

and see where it hangs

#

*console.log()

#

ye

#

that

#

(i dont use js)

#

429 hit on route /gateway/bot

#

used debug event

#

429 - too many requests

#

logs commands to console

#

O

#

wouldnt you want to just save it in a file?

#

eh

#

i redirect bot output to a file w/ bash

#

oh

charred jetty
#

How to get lavalink password?

earnest phoenix
#

it's whatever you defined it in the config

lethal stratus
#

how do I list all guilds my bot is in

tight plinth
#

Google

lethal stratus
#

I did

earnest phoenix
#

bot.guilds() in dpy

lethal stratus
#

and the only one I found returns "undefined is not a function"

#

@earnest phoenix I am on discordjs and bot.guilds returns [object Map]

tight plinth
#

Djs v12 or v11 @lethal stratus

earnest phoenix
#

well idk how maps work

lethal stratus
#

JSON.stringify turns it into {} with nothing in it

tight plinth
#

What is your discordjs version

lethal stratus
#

idk what version

#

probably latest

tight plinth
#

U should know

lethal stratus
#

gotta fire up ssh to check

tight plinth
#

Eval Discord.version

lethal stratus
#

ah

#

11.5.1 then

tight plinth
#

Ok

#

It should be smth like this

#
let string = ''
bot.guilds.forEach(guild => string += guild.name+'\n')
message.author.send(string)
lethal stratus
#

thanks

#

that helped a lot

tight plinth
#

message.author.send is to send serverlist in ur dms instead of current channel

#

Security

lethal stratus
#

ye

#

I changed it to message.channel.send and did it in my own private testing channel

tight plinth
#

If it works...

#

¯\_(ツ)_/¯

lilac wharf
#

@earnest phoenix if your bot isn't loading into discord make sure you have registered the login :

For example if it's Discord.js you'd do something like client#login(token)

earnest phoenix
#

bruh

lilac wharf
#

?

earnest phoenix
#

i knew that

lilac wharf
#

I was just covering the basic since sometimes some developers forget it.

earnest phoenix
#

ok

small prairie
#

Bot Keeps On Getting Offline NOT server issue one more bot on the same server working just fine NOT code issue no error on pm2 logs

#

d.js

#

v11

#

need to restart to continue

#

can i be hitting ratelimits?

tight plinth
#

Shard issue?

small prairie
#

Unsharded

earnest phoenix
#

Debug it. See if you get a 429

#

Http 429 = ratelimit

small prairie
#

Alright

tight plinth
#

@small prairie glitch.com is shit for uptime and keeping bot online

small prairie
#

how to debug with pm2?

#

using vultr

#

used glitch before

#

it kept crashing their

earnest phoenix
#

I dunno. Apparently one guy used debug events

small prairie
#

migrated to vultr yuesterday

#

same bug here

earnest phoenix
small prairie
#

maybe link the message?

tight plinth
#

Why ytpl limits playlists size to 100?

bitter sundial
#

probably because you can only fetch 100 videos off of a playlist at a time

shadow pecan
#

Why did my.bot get declined for being offline when there were so many times when it was online,

#

I applied for it ages ago and it’s been online for ages

modest maple
#

because your bot should be online 24/7

peak venture
#

How would i find out wether a user is connected to a channel and which channel_id that specific channel has?

finite bough
#

eval

peak venture
#

@finite bough your reply was to whom?

pale vessel
#

Library?

peak venture
#

discordjs

pale vessel
#

message.channel?

finite bough
#

@peak venture message.member.voiceChannel

earnest phoenix
#

what je your version of d.js? @peak venture

#

11.5.1 = message.member.voiceChannel
12 = message.member.voice.channel

peak venture
#

11.5.1 indeed

#

Aught thnx

sweet spade
#

'(node:660) DeprecationWarning: ClientUser#setGame: use ClientUser#setActivity instead'
I taking this error how can I solve that ??

mossy vine
#

use setActivity instead

sweet spade
#

ok

summer torrent
prime cliff
#

It even tells you to use setActivity bruh

mossy vine
#

but a bunch of useless symbols too like ( : ) : # : #

sweet spade
#

(node:803) DeprecationWarning: Collection#find: pass a function instead
I take this error now

mossy vine
#

pass a function instead to .find()

summer torrent
#

did you try to read the error messages

prime cliff
#

Btw isn't it suppose to say depreciated not deprecation Thonkeng

sweet spade
#

yea but I cant understand

slender thistle
#

appreciated
depreciated

blissful scaffold
#

Deprecation/deprecated is correct

prime cliff
#

Never heard anyone say deprecated or seen deprecated used before so Shrug

blissful scaffold
#

As a Java developer I see it a lot

#

I guess it is also often used in other languages

quartz kindle
amber fractal
#

Depreciation =/= deprecation

#

A method being deprecated means it isn't supported anymore

#

I've personally have never seen depreciation over deprecation

#

But I guess, according to 2, it is another term for it mmulu

lyric mountain
#

depreciation is like: don't use that cuz it's shit

#

deprecation is like: use at your own risk, it might not be there on future releases

prime cliff
#

Yea i knew what it meant but hardly anyone used deprecation over depreciated

lyric mountain
#

yep

blissful scaffold
#

I have never seen anyone use depreciated

earnest phoenix
#

depreciated is the wrong word

#

depreciated is not deprecated

prime cliff
#

Wait what

earnest phoenix
#

it really depends on the context it's used in but more often than not, they don't have the same meaning

#

in programming, the correct expression is to deprecate something

#

to depreciate in programming means that you're not very fond of whatever you're depriciating

lofty vine
earnest phoenix
#

however in real life examples, e.g "I was deprecated at that party" and "I was depreciated at that party" have the same meaning, in that context they're synonyms

#

so it's like

#

use whatever

#

but if you want to be understood in development use deprecated ig

amber fractal
#

Then you need to use deprecate mmulu

earnest phoenix
#

english be retarded like that sometimes

#

or, well, all the time

blissful scaffold
#

That semver link is saying the same as what cry said, use deprecated

amber fractal
#

Yes, that's what I mean, if you folow semver you have to use deprecated

earnest phoenix
#

@glad jungle

#

language?

glad jungle
#

D.js v11

earnest phoenix
#

show me your message handler

glad jungle
#

Aaaaaaaa I'm on mobile >.<

earnest phoenix
#

ohh

#

well im assuming you have something like

#
if (message.startswith("/")) {
 jaherqhe
}
#

?

glad jungle
#

Its somthin like js If (!message.startswith(prefix) return

earnest phoenix
#

message is a string right?

glad jungle
#

Its the thing from clinit.on

earnest phoenix
#

well if this works the way i think it does

modest maple
#

you should be able to get the guild object somewhere in that

glad jungle
#

Like message.guild?

modest maple
#

if the message is an object not a string then possibly

#

i dont do enough JS to know for sure

earnest phoenix
#
if (message.startswith("kt!") and /*guild*/.id == 264445053596991498) 
 message = "/" + message.slice(3,len(message))
if (!message.startswith(prefix)) return
#

something like that should work

#

basically, if it sees something like kt!asdf in THIS SERVER it changes it to /asdf

glad jungle
#

Oooooo

#

Fancy

earnest phoenix
#

kinda hacky but it should workk

#

you're on your own, getting the message's guild tho

glad jungle
#

Mind DMing that to me?

earnest phoenix
#

i dont use d.js

#

one

#

done*

glad jungle
#

For stability?

earnest phoenix
#

and wym

glad jungle
#

What's ym

earnest phoenix
#

*wym = what you mean

#

about stability

glad jungle
#

Ohhhh

#

I read

i dont use d.js
As dont use d.js

#

Thats my bad

earnest phoenix
#

ohhhh

lyric mountain
#

jda here

earnest phoenix
#

d.js here

#

minecraft command blocks here

#

NO

lyric mountain
#

gmod e2 here

earnest phoenix
#

Batch here

#

assembly

#

wait

#

you mean *bash

#

bash >>>>> batch

#

I ment batch.

#

learn bash ;p

#

WSL ftw

#

the funny thing is, batch cant even web request without additional libs

#

bruh moment

#

xD

#

i mean technically neither can bash

#

but just about every system has wget and/or curl

earnest phoenix
#

css kinda goofed on mobile tho

digital ibex
#

Hi, can someone help me make a prefix command

#

I've never dealt with databases so, i dont know where to start (eris)

zenith orchid
#

Blooding my eyes.

true ravine
#

Use mysql because it's cool

#

Add a guild id and respective prefix to each row of table

#

On message event, query table and get prefix

digital ibex
#

i have never used mysql or any database

true ravine
#

What lingo you using?

digital ibex
#

and i've read the docs and even they are hard

#

js

true ravine
#

Nice

#

You can use any old bot tutorial to get the mysql bit set up

digital ibex
#

for now i want to use quickdb

true ravine
#

Never used that, went straight to mysql

#

Does the job

digital ibex
#

i've been told to use mongoose

#

well not been told, recommended by people who're really proficient in them kinda stuff

true ravine
#

At the end of the day, a db is a db and so just read the docs of a few different ones and use the one that looks easiest

digital ibex
#

ok

earnest phoenix
#

is it something that i did on my part, thats why its not working?

#

it works..?

#

it logs 10 to console

#

which is the result of 5+5

#

Ohhhhh

#

sorry i didnt see that bit

#

🤦‍♂️

#

yep discords cdn page is down

jagged elbow
earnest phoenix
#

that

#

is not our server listing site

zenith orchid
earnest phoenix
#

I want vote bot

#

What is this page for login

#

Use mysql because it's cool
mysql was cool in 2009 bloblul

#

now its all about postgres

#

i use SQLite

#

it works good

#

What

#

sqlite is fine for small scale

#

i used it in a lot of my projects

quartz kindle
#

99% of bots are small scale

earnest phoenix
#

pretty much yeah

#

stop being annoying, yasser, thanks

#

@earnest phoenix no emoji spam pls thx

#

Holland_12 thank your for help me @earnest phoenix @earnest phoenix @quartz kindle

#

k

unique nimbus
#

How much is "small scale"

quartz kindle
#

< 100k guilds

modest maple
#

<5000 servers i'd day

#

okay then tim xD

quartz kindle
#

lmao

earnest phoenix
#

you'll know it when you notice a drop in performance

unique nimbus
#

ah

modest maple
#

pretty much yh

quartz kindle
#

if you use default discord.js with default caching then its already pretty large scale at 5k lol

modest maple
#

one of the devs seems to of lowered the threshold for when the bot mentions devs if somthing is lagging like shit

#

rip my notifications

quartz kindle
#

your bot sends you notifications when it lags?

digital ibex
#

hi

#

can someone help me set up MongooseDB

modest maple
#

@quartz kindle wasnt my idea

digital ibex
#

if anyone knows of course

modest maple
#

altho does let you know if a Loop fucking axed itself

quartz kindle
#

i mean, its a cool feature, but when 99% of lag problems are discord's fault, doesnt really do much lmao

digital ibex
#

i have never used a database

modest maple
#

nah this is internal timing

earnest phoenix
#

Thonk k

quartz kindle
#

ah cool

modest maple
#

how long the loops are taking to complete etc..

#

and 0.99s is not what i call an issue xD

#

20 secs yes

#

but 0.99 nahh

quartz kindle
#

what could possibly take 20s internally

modest maple
#

ill let you know when we work that out

#

just somtimes

quartz kindle
#

lmao

modest maple
#

theres one loop

#

the 4 main loops

#

seem to occasionally gain like a 20s time or more

#

i have no idea why

quartz kindle
#

@digital ibex mongoose is a library that uses mongodb. you need to have mongodb installed in your system, or you need an account in some online mongodb database if you prefer an online version

digital ibex
#

Oh, sorry. My bad

#

Can you help me use the online version?

quartz kindle
#

not really, i've never used them

#

check their websites, create an account, see what the limits are

#

they should give you an URL that you can put in mongoose to connect

digital ibex
#

Thats the part i got confused with

#

the url where mongo needs to connect

quartz kindle
#

yes, as i told you, mongoose is only a library that connects to mongo, you need to have mongo somewhere

digital ibex
#

wdym mongo somewhere?

quartz kindle
#

mongodb is a database software

#

like mysql, postgre, etc...

#

it offers several ways to connect to it, both offline and online

digital ibex
#

oh

quartz kindle
#

mongoose is a library that uses mongodb

#

mongoose is not a database

#

it just makes the connection and does the commands for you

#

like discord.js does for the discord api

#

if you want to use mongo, you can either install it in your system and run an offline version of mongodb in your system

#

or create an account in some website that offers online mongodb storage

digital ibex
#

oh my

#

uh

#

sounds like a lot

quartz kindle
#

all databases are like that

#

except embedded databases like SQLite

digital ibex
#

o

#

how do i learn that

#

or do that

quartz kindle
#

SQLite is an embedded database, which means it doesnt require to be installed in your system

#

it runs together with whatever program you're using it with

digital ibex
#

okay

quartz kindle
#

you can install an SQLite library, and the library will install SQLite for you, you dont need to install the database separately

#

if you're using node.js i recommend better-sqlite3

#

SQLite is different from mongo, it uses the SQL language

#

so you need to learn how to use it

earnest phoenix
#

How long does the verification process take?

quartz kindle
#

1-2 weeks

finite bough
#
	const channel = member.guild.channels.find(ch => ch.name === 'member-log');
	if (!channel) return;

	const canvas = Canvas.createCanvas(700, 250);
	const ctx = canvas.getContext('2d');

	const background = await Canvas.loadImage('./wallpaper.jpg');
	ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

	ctx.strokeStyle = '#74037b';
	ctx.strokeRect(0, 0, canvas.width, canvas.height);

	// Slightly smaller text placed above the member's display name
	ctx.font = '28px sans-serif';
	ctx.fillStyle = '#ffffff';
	ctx.fillText('Welcome to the server,', canvas.width / 2.5, canvas.height / 3.5);

	// Add an exclamation point here and below
	ctx.font = applyText(canvas, `${member.displayName}!`);
	ctx.fillStyle = '#ffffff';
	ctx.fillText(`${member.displayName}!`, canvas.width / 2.5, canvas.height / 1.8);

	ctx.beginPath();
	ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
	ctx.closePath();
	ctx.clip();

	const avatar = await Canvas.loadImage(member.user.displayAvatarURL);
	ctx.drawImage(avatar, 25, 25, 200, 200);

	const attachment = new Discord.Attachment(canvas.toBuffer(), 'welcome-image.png');

	channel.send(`Welcome to the server, ${member}!`, attachment);
});
#

isnt applyText a function?

summer torrent
#

what is the type of result of Object.values()?

#

object?

quartz kindle
#

array

#

@finite bough the way you're using it suggests applyText is a function you made lol

summer torrent
#

and what should I type to Math.max()? string or number?

#

i think it is number

finite bough
#

I am just following the guide lmao

quartz kindle
#

Math.max supports both

#

it converts strings to numbers before comparing

#

@finite bough which guide?

finite bough
quartz kindle
#

its a user-created function

#

it shows there in the guide

#
const applyText = (canvas, text) => {
    const ctx = canvas.getContext('2d');

    // Declare a base size of the font
    let fontSize = 70;

    do {
        // Assign the font to the context and decrement it so it can be measured again
        ctx.font = `${fontSize -= 10}px sans-serif`;
        // Compare pixel width of the text to the canvas minus the approximate avatar size
    } while (ctx.measureText(text).width > canvas.width - 300);

    // Return the result to use in the actual canvas
    return ctx.font;
};```
finite bough
#

either I am blind or u have godly eyes

#

anyways thanks

quartz kindle
#

i used ctrl + F

#

lol

finite bough
#

LOL

#

on glitch u cant rlly save images as jpg I think u have to save them as assets

#

either way ig it works

quartz kindle
#

save them as png in the assets folder

#

lol

prime cliff
#

Or just use imgur like any sane person

quartz kindle
#

nobody uses imgur

finite bough
#

^

#

I use lightshot

quartz kindle
#

that place has been broken for years, always lags and often fails to load for me lmao

finite bough
#

tim vs imgur

amber fractal
#

A lot of devs here have their own as well

summer torrent
tough kraken
#
Error: Client network socket disconnected before secure TLS connection was established```
#

What is this?

low wasp
#

It's an error

tough kraken
#

how do i fix it?

quartz kindle
#

where do you get that error?

#

what were you doing when you got that error?

grizzled raven
#

in the console
breathing

tough kraken
#

what were you doing when you got that error?
@quartz kindle i was doing nothing
and when the bot was not responding i checked terminal

amber fractal
#

What lib and lang do you use

#

I've never seen that error from a bot before

quartz kindle
#

and what versions

earnest phoenix
#

I've seen that error before but not using a bot

sudden geyser
#

Sounds more like an issue with the host

slate oyster
#

Ug
it's taking me so long to make my bot's rewrite
it's driving me insane

quartz kindle
#

how long? my rewrite is taking over 3 months

slate oyster
#

Oh wow

#

I mean
I've had projects that span months (one that I've had for >year)
But a bot should not

quartz kindle
#

my bot is stupidly complex ig

#

¯_(ツ)_/¯

slate oyster
#

Which bot is yours?

copper cradle
#

timbot

slender thistle
#

What are the possible options to move the "Officia incidunt" image to the right of a div?

quartz kindle
#

float:right / display:inline-block / display:flex

#

grid layout

slender thistle
#

flexbox is cute

quartz kindle
#

absolute positions

slender thistle
#

absolute positions make me wanna cry

quartz kindle
#

xD

modest maple
#

html and css makes me wanna cry anyway

slender thistle
#

Oh Christ's sake... ig justify-around: space-around; does the trick GWahreeVampySmug

low wasp
#

Shiv nyu

#

Nu

#

That's bad

modest maple
#

People who have some experience with Curl

#

how df does one use
curl -X POST -d "grant_type=password&username=<user_name>&password=<password>" -u"<client_id>:<client_secret>" http://localhost:8000/o/token/

#

ignore the username and password bits

digital ibex
#

lmfao

modest maple
#

the issue i have

digital ibex
#

oh

modest maple
#

is dealing with the -X

#

apparently it no likey

#

which is very helpful when the docs tell you to use it

slender thistle
#

@low wasp Oh?

finite bough
#

-bots 180112943612952577

gilded plankBOT
#
Bots <:dblCertified:392249976639455232>

@oak sentineldblCertified
@autumn widget
@frank niche

low wasp
modest maple
#

do i even need -X

low wasp
#

@slender thistle use inline block on both text and image and put the image html on the other side of the text

earnest phoenix
#

^ or use flexboxes or grids, floats are just torture to deal with imo

slender thistle
#

I'm using flexbox

#

Is it generally bad to use flexbox for such stuff?

quartz kindle
#

i believe flexbox is the modern standard

#

should be used for everything

#

except if you want to support old browsers

lyric mountain
#

like telnet

earnest phoenix
#

Grid is fairly new but some find it better than flexbox, but it's kind of not

#

idk

slender thistle
#

And for old browsers what's "better"?

lyric mountain
#

what works

#

and looks nice

quartz kindle
#

for old browsers just use inline-blocks i guess

#

or tables lmao

slender thistle
#

"what works and looks nice"
I'll most likely be too lazy to test it all myself

#

Oh tables yes

earnest phoenix
#

tables clown_vomit

quartz kindle
#

all hail table layout

lyric mountain
#

that's why shiro doesn't have a website

wide ruin
#
Error in data transfer
Traceback (most recent call last):
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websockets\protocol.py", line 827, in transfer_data
    message = await self.read_message()
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websockets\protocol.py", line 895, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websockets\protocol.py", line 971, in read_data_frame
    frame = await self.read_frame(max_size)
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websockets\protocol.py", line 1047, in read_frame
    frame = await Frame.read(
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websockets\framing.py", line 105, in read
    data = await reader(2)
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\asyncio\streams.py", line 723, in readexactly
    await self._wait_for_data('readexactly')
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\asyncio\streams.py", line 517, in _wait_for_data
    await self._waiter
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\asyncio\proactor_events.py", line 280, in _loop_reading
    data = fut.result()
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "C:\Users\pinea\AppData\Local\Programs\Python\Python38-32\lib\asyncio\windows_events.py", line 453, in finish_recv
    return ov.getresult()
OSError: [WinError 121] The semaphore timeout period has expired```
#

is this just a connection error or what?

modest maple
#

Windows Error

#

try 64 bit python

#

quite why youre using 32 bit 3.8 is beyond me anyway

amber fractal
#

what if they use 32 bit windows mmLol

modest maple
#

then ur fucked

earnest phoenix
#

2020
32bit
what is this

#

a nightmare

#

Lol

#

windows 32 bits this is really bad..

#

Change this

tight plinth
#

windows 16 bits,the best edtion

earnest phoenix
slender thistle
#

8 bits

tight plinth
#

4

#

2

#

1

#

0

#

-1

earnest phoenix
#

2 bits

#

2 bits int limit: 3

#

nice

#

You can count to three

shell reef
#

winrate

tight plinth
#

sometimes I do good coding

modest maple
#

what is a 301 status

#

hmmm

sudden geyser
#

Moved Permanently

tight plinth
#

andembeds are dead

modest maple
#

somehow my rest api has permanently moved itself

#

wait

#

hmm

sudden geyser
#

Lumap I think it wants 0.3 ChiakiHmm

tight plinth
#

well...

#

I typed 0.5 and it crashes 🙂

sudden geyser
#

lol

tight plinth
#

nice

hoary elm
#
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1088:14)
(node:28199) 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(). (rejection id: 15)```
#

Anyone know what this error means?

quartz kindle
#

means connection refused lol

hoary elm
#

How would I go about getting it to reconnect is what I mean @quartz kindle bot was working fine yesterday then I woke up today and now this ^^

quartz kindle
#

idk what you're doing

#

is that error from the discord api?

hoary elm
#

Nothing I made no changes to anything.... Yeah

quartz kindle
#

what is in the part you removed?

hoary elm
#

IP Address

#

Don't know if it's mine thats why I removed it

quartz kindle
#

only ip address?

#

no url?

#

or port

hoary elm
#

No just IP

#

yeah there's a port

#

It's uhhh....
:1988

quartz kindle
#

is the ip 127.0.0.1?

hoary elm
#

Yup

quartz kindle
#

thats localhost lol

#

no need to hide it

hoary elm
#

Oh okay

#

Lol

quartz kindle
#

are you on glitch?

hoary elm
#

Yes this project is on glitch

#

It's a small simple bot so 🤷🏻‍♂️

quartz kindle
hoary elm
#

Oh

#

Oh wow 🤦🏻‍♂️ damn debugger

#

Thanks Tim 😂😁

steel heath
#

tim what about dbl promotes you to web dev 😳

quartz kindle
#

wut?

steel heath
#

u help a lot

quartz kindle
#

eh

#

i dont think web dev has anything to do with helping lul

slender thistle
#

You get hoisted

unique nimbus
#

You get people asking you why their bot doesn't work

steel heath
#

saums in dms

earnest phoenix
#

Would doing a setInterval() function to check if a member is unbanned make my bot slower?

summer torrent
#

why do you want to use setInterval for that

earnest phoenix
#

I don't know how else to check if it's time to unban/unmute a member for a timed mute/ban

crimson vapor
#

setTimeout()?

earnest phoenix
#

I'm gonna store the time for them to be unmuted/unbanned in a mysql

summer torrent
#

which lib do you use

earnest phoenix
#

Well no, if the bot restarts, then the setTimeout() gets ended and they don't get unbanned/unmuted

#

discord.js

copper cradle
#

just store the date

crimson vapor
#

I see

copper cradle
#

then every hour or so check if the current date is the same as the one stored in the satabase

#

if so then do your thing

#

not the mos efficient

#

but it works

summer torrent
#

^

earnest phoenix
#

It's every 30 seconds, so people can be banned for x minutes

copper cradle
#

well

summer torrent
#

my reminder listener is 5 second

earnest phoenix
#

The time to be unmuted/unbanned is stored in mysql because if the bot restarts before they are unmuted/unbanned, it would end the setTimeout and they wouldn't be unbanned/unmuted

#

Idk how else to do timed mute/ban

summer torrent
#

save Date.now() + ms("ban/mute time") to database

crimson vapor
#

for mute I did setTimeout

#

but you are correct, any restart would delete the timeout

slate mist
#

Use a cron job

earnest phoenix
#

A what

summer torrent
#

and check with setTimeout ```js
if (Date.now() > time on database) {
Member.unban()
}

earnest phoenix
#

yeah i was planning on doing that

slate mist
#

@summer torrent that's inefficient why would you do that

earnest phoenix
#

I just wanted to know if setInterval would make my bot slower

slate mist
#

Waste of memory

crimson vapor
#

wait

slate mist
#

Just use a cron job

summer torrent
#

@summer torrent that's inefficient why would you do that
@slate mist Do you have a better idea

slate mist
#

Yeah, use cron jobs

summer torrent
#

node-cron?

earnest phoenix
crimson vapor
#

what about you save the time its supposed to be unbanned/muted and if it restarts, you do the settimeout again

slate mist
#

If the bot is being used on a large scale you'll run out of memory using setTimeout for everything

#

cronjobs will save even if the bot restarts

#

as its a system process

summer torrent
crimson vapor
#

how many bytes do setTimeout's use?

slate mist
#

Its nothing with "bytes"

summer torrent
#

@cold lion your bot didn't yet approved

slate mist
#

Bytes deal with strings lol

crimson vapor
#

I mean of memory

#

because you said you would run out

cold lion
#

NMW03 Where VOTE ? :d

summer torrent
#

@cold lion your bot didn't yet approved

cold lion
#

ok ty

slate mist
#

Imagine this

#

you have 9 million users, and 500 thousand temporary mutes, each setTimeout() call creates a task to the task scheduler, which is cached. And as it waits for the task, more tasks pile up, destroying memory

crimson vapor
#

I see

slate mist
#

Its really inefficient especially if you want your bot to be available on a large scale

crimson vapor
#

and cron is better?

#

I assume yes if you suggested it

earnest phoenix
#

ty for the suggestion John, I think i'm gonna go with npm cron if it works out

#

Imma try to figure out how to use it rn

quartz kindle
#

you can use the best of both worlds

#

use an interval that checks every 5 minutes or so, and then fire a timeout for everything that has less than 5 minutes left

#

but this kind of microoptimization is worthless to even think about. your bot will run into a billion other scaling issues before that makes any difference

earnest phoenix
quartz kindle
#

well, its adding an extra dependency for something you can do yourself

#

other than that, you have to see their source code to see what they're doing

earnest phoenix
#

is there a way to do a timed function every x seconds without doing something that will take a lot of memory?

#

Like, would what you suggested help if/when my bot gets tons of users?

quartz kindle
#

again, this kind of thing is not what you should be worried about

earnest phoenix
#

Is there something I should be worried about?

crimson vapor
#

How much memory does a setInterval function use?

#

probably a few bytes

quartz kindle
#

what library are you using?

earnest phoenix
#

discord.js

quartz kindle
#

if you're worried about scaling, discord.js itself is your biggest worry

earnest phoenix
#

Is there a different lib I should be using? Or a different language?

quartz kindle
#

depends on what you want to accomplish

#

also, discord.js can be hacked into being scalable

#

which is what i did

#

if you think about bots with millions of servers, they all most likely use a custom library they developed themselves

earnest phoenix
#

Yeah that makes sense

crimson vapor
#

you think so?

quartz kindle
#

yes

earnest phoenix
#

Mee6's lib on top.gg is "other"

quartz kindle
#

discord.js is a general purpose library, it can do everything the discord api allows you to do

#

but the cost of being able to do everything is that the library is quite heavy

crimson vapor
#

you know that dank memer uses Eris

slate mist
#

Its the caching thats a killer

crimson vapor
#

one of the biggest bots

quartz kindle
#

yes, especially the caching

earnest phoenix
#

is there a way to clear cache with javascript or sum so it doesn't take up memory?

quartz kindle
#

yes there are many ways

slate mist
#

lol

quartz kindle
#

some more advanced than others

slate mist
#

Run garbage collector

#

D.js caches though, which won't be purged by nodejs functions because it's still allocated as usable and not "dump"

quartz kindle
#

d.js caches everything it can to avoid hitting the api

sinful lotus
quartz kindle
#

yes you can

slate mist
#

The most efficient way to clear cache would to literally just delete client.messages

quartz kindle
sinful lotus
#

you just need to learn the library internals

#

and see what you dont use on it

slate mist
#

lol 3.3gb

crimson vapor
#

is there a library that was built off of D.js and is more efficient?

quartz kindle
#

there is mine lol

sinful lotus
#

eris but its based on d.js v8

crimson vapor
#

d.js v12 came out right?

sinful lotus
#

but I doubt it would consume more less than d.js

#

yes

earnest phoenix
#

yeah a bit ago

quartz kindle
#

if you wanna give mine a try, search for discord.js-light

earnest phoenix
#

What version is it based off?

quartz kindle
#

v12

earnest phoenix
#

Is it compatible with discord.js-commando?

quartz kindle
#

no

earnest phoenix
#

oh dang

quartz kindle
#

commando is a command handler

earnest phoenix
#

I'm using commando

crimson vapor
#

oh god

quartz kindle
#

it has nothing to do with the library itself

earnest phoenix
#

whats wrong with commando

crimson vapor
#

I havnt seen commando for a while

sinful lotus
#

never used commando weirdsip

#

I used akairo on my other bot

quartz kindle
#

i mean

sinful lotus
#

my main bot is vanilla d.js tho

quartz kindle
#

i've never used commando either, so idk how it works

#

but it might be compatible

slate mist
#

Why would you use commando

#

Commando is garbage

earnest phoenix
#

Because I'm relatively new into bot development so I don't no any better

crimson vapor
#

I will be honest, commando makes it easier because you dont have to worry about command handling

slate mist
#

how

#

make your own command handler

crimson vapor
#

and sure as hell dont do event handling

quartz kindle
#

i mean

#

if you know what you're doing, its even easier to make your own than to use commando

crimson vapor
#

yes

#

but when you dont

#

its easier to use commando

slate mist
#

I made my own lib

#

granted this is an old version of my own cmd handler

#

but the concept is relatively the same

crimson vapor
#

can you explain the class and constructor, I dont use thoose

quartz kindle
#

its object oriented programming

#

a class is kind of like a basic set of rules that describe a complex object. then you can easily create an invoke instances/copies of that object

#

that object includes functions called "methods", which do things to parts of itself

#

libraries like discord.js are entirely based on those

#

for example, when you do channel.send()

crimson vapor
#

this seems very efficient

quartz kindle
#

send is a method of a channel class

#

and all channels are an instance of the channel class

#

then there is extensions and inheritance

#

where you can define a base class, and then more specific classes on top of it

#

like textchannel and voicechannel

#

which is built on top of the base channel class

#

so for example, if you want a method that works on all channel types, you only define it in the base class, and all extended classes automatically gain access to it, no need to re-write the same function in all different types of channels

crimson vapor
#

smart

#

I would like to learn more about this, where do you suggest?

quartz kindle
#

take a look at the mozilla docs and then experiment with them

crimson vapor
#

ok

#

because right now I am doing module.exports and defining variables

#

probably not very efficient for the bot or me typing

quartz kindle
#

module.exports is fine, everyone uses them

#

using classes doesnt replace it

crimson vapor
#

well I mean for like the name and aliases and stuff, the stuff you have in classes, right?

quartz kindle
#

you can use classes for many things

#

but classes are best suited for something that you will use multiple times

#

and each time it has to be a unique version of it

crimson vapor
#

alright thanks for taking the time to explain this

#

I like it when people explain rather than hand over code

#

its nice for learning

quartz kindle
#

👍

sinful lotus
#

its preferences

#

you can uses classes or a simple object

#

eitherways its up to your preference of coding

quartz kindle
#

you can even use the old version of classes, before the class syntax existed, which is using objects lmao

sinful lotus
#

classes is basically that but easier

#

specially if you like real class based langs

crimson vapor
#

I have a question, did you guys go to school for programing or pick it up as a hobby?

sinful lotus
#

hobby

quartz kindle
#

i picked it up as a byproduct of the things i wanted to do

crimson vapor
#

cool

quartz kindle
#

i learned a lot from discord bots, a year ago i didnt know what classes were or how to use them lol

crimson vapor
#

if I were to use classes, could I do something like let pingCommand = new Command()?

#

in the () being options?

quartz kindle
#

yes

crimson vapor
#

and would that be efficient

quartz kindle
#

the argument in there is what goes into your constructor

sinful lotus
#

calling new is irrc slower

crimson vapor
#

oh yeah I forgot

#

but I could if I wanted to

quartz kindle
#

if you want to use classes for data that doesnt require unique copies of it every time it is used, you can use new Command() in your command loader, and then store the initialized class somewhere so you can simply access it

crimson vapor
#

hmm

sinful lotus
#

just dont call new everytime

#

but if your current structure works

quartz kindle
#

caching classes is pretty standard, like how discord.js caches channels and guilds

sinful lotus
#

I dont see any reason to change it specially if its quite clean

crimson vapor
#

I would like your opnions on the structure of my commands, can I send a screenshot?

sinful lotus
#

just send it

crimson vapor
#

ima use code blocks actually

#

nvm lmao its too big

sinful lotus
#

¯\_(ツ)_/¯

crimson vapor
#

the command to disable embeds

sinful lotus
#

classes is like that but longer

#

and you always call new Class() on initializing it

#

vs on just requiring that

crimson vapor
#

do you do your commands a way similar to mine or classes?

sinful lotus
#

although classes is more flexible on sticking features

#

I use classes because I need the flexibility on features

crimson vapor
#

ok

sinful lotus
#

albeit its longer, the investment returns is good for me

crimson vapor
#

does longer mean more lines?

sinful lotus
crimson vapor
#

I never thought to do commands like this

#

what is MessageEmbed vs RichEmbed?

small prairie
#

If a role is unmentionable it doesn't show up in message.mentions??
D.js

crimson vapor
#

or just different names

quartz kindle
#

MessageEmbed is RichEmbed in v12

crimson vapor
#

oh

#

thats going to be a pain to change

#

might just rewrite at that point

quartz kindle
#

yeah thats what im doing

#

been doing for months lmao

crimson vapor
#

is it possible I could see an older version of a command handler that uses classes and constructors? I dont understand how it would initialize them

quartz kindle
#

wdym an older version?

crimson vapor
#

like one that you updated away from

#

whether is was inefficient or ect

quartz kindle
#

i dont have an older version

#

my old code is absolutely horrendous

crimson vapor
#

gotcha

#

I was expecting a no anyway

#

fuck I think I sound mean

#

im bad at talking to people

quartz kindle
#

just as an example, i didnt know how to use module.exports, so i used eval(fs.readFileSync())

#

lmfao

#

that was 2 years ago

crimson vapor
#

module.exports is used with require I think

quartz kindle
#

yes

crimson vapor
#

alright, back to my quest to understand this

quartz kindle
#

my current command handler also doesnt use classes

crimson vapor
#

so then what do you use?

quartz kindle
#

just module.exports

#

i use classes for users tho

crimson vapor
#

so you moved away or did I mistake you for someone else?

quartz kindle
#

for example, a command goes to the command file, and the command file gets a user class for the message author

crimson vapor
#

and is it then run

quartz kindle
#

the command is run in the file

#

the class is only for user management

crimson vapor
#

smart

quartz kindle
#

so i can access data about the user, save it to a database, etc

crimson vapor
#

does that mean you just run code that runs a command with a different user?

quartz kindle
#

no

crimson vapor
#

hmm

quartz kindle
#

lets say this

crimson vapor
#

if you were just passing the user, couldn't you, or did I misunderstand

quartz kindle
#

picture a channel in discord.js

#

it has channel.send() channel.delete() channel.update() etc

crimson vapor
#

yeah

quartz kindle
#

thats all created by a class

#

now when you get a channel id

#

you can do new Channel(id)

#

and you automatically get all those functions for that specific channel id

crimson vapor
#

wait you can do new Channel(id)

quartz kindle
#

figuratively speaking

crimson vapor
#

oh

#

gotcha

quartz kindle
#

actually you can, but its different

#

anyways

sinful lotus
#

yeah using classes depends on your preferences

quartz kindle
#

i use classes for users, meaning when i receive a message, i can do user = new User(message.author.id) and i automatically get all functions that deal with users, for that specific user

#

i can do for example user.save() to save in my database

#

because i made my save function in the user class

crimson vapor
#

I think I understand a little more

#

you are good at explaining

quartz kindle
#

¯_(ツ)_/¯

#

but basically its as saya says, its all user preference

#

the same can be done with functions, or with objects

crimson vapor
#

I think using classes in many cases could increase the efficiency of the command and typing it

#

but may slow it down

sinful lotus
#

depends again

#

you can cache classes

#

specially if it isnt something that changes all the time

#

ex: d.js makes a new User class, then when this user changed for example, their username, instead of making a new class again, why not just change the property on user class

#

since you are not calling new again, and just grabs the data on already existing class

#

there is no performance drawbacks in this scenario

crimson vapor
#

so using new for commands probably would be okay because it would only slow the boot right

sinful lotus
#

not also

#

while it is slower

quartz kindle
#

and you can change/update the user's properties while keeping all the user functions/methods still attached to it

sinful lotus
#

its slower in a not noticable way

#

unless you use a potato cpu

crimson vapor
#

I dont think a R2600 is potato so im good

quartz kindle
#

any performance impact will be negligible

#

requiring a file is a gazillion times slower than creating a class instance

sinful lotus
#

thats why using classes or just plain objects is more on preference

crimson vapor
#

hmm

#

what about constructors?

#

what are they used for?

#

storing changed data?

quartz kindle
#

they are arguments for the class

sinful lotus
#

basically calling new Class() is also calling a function tbh in some way

#

where in the constructor gets executed when you call that

quartz kindle
#
class car {
  constructor(color) {
    this.color = color;
  }
}

new car("blue") // creates a car with the color blue```
sinful lotus
#

example, in my constructor, I can execute specific things, or just define properties of the class

crimson vapor
#

why did you pass through client? for the command to use?

#

sorry if im asking questions that are annoying

quartz kindle
#

you can attach objects and other classes to a class

#

the same way you can do message.client in discord.js

sinful lotus
#

yes then just use this.client if I need access to client

#

ro msg.client but I prefer this.client pogey

earnest phoenix
#

kinda like function params

crimson vapor
#

smart

#

what about super, if you were to get the command name how would you do that?

#

title*

quartz kindle
#

the super keyword is for dealing with class extensions

#

it refers to the base class

sinful lotus
#

because that class extends base command