#development

1 messages ยท Page 1544 of 1

silent cloud
#

DISCORD_TOKEN: 'null'

#

and all

golden condor
#

They are seperate tabs...

opal plank
golden condor
#

I meant vscode

lyric mountain
#

Terminal then

opal plank
#

vsc already highlights it for you

#

thats what im saying

golden condor
#

Doesn't detail it, though

opal plank
#

if you want compiling code, you'd have the terminal open either way

#

it does

golden condor
#

Not on the editor

opal plank
#

it does...

#

you simply hover on it

golden condor
#

Yeah ik

opal plank
#

those errors are just good when compiling, which you'd usually have a watch for that

golden condor
#

But this extension highlights the line in red and shows the error next to it

opal plank
#

rather than hovering?

golden condor
#

Yes

opal plank
#

i thought it threw the error from compilation, not just syntax, if it was the former i'd be interested in it

#

hovering vs reading right away doesnt seem to give much benefit, but thats purely opinion based

golden condor
#

It just looks nicer as well imo

opal plank
#

i personally prefer to keep the workspace cleaner, adding more text doesnt seem like a good idea

#

at least for me

golden condor
#

I like it

#

I think it looks nice

#

And it's helpful

#

This font is also nice

lyric mountain
#

I'd recommend intellij font

golden condor
#

That's what I'm using

#

JetBrains Mono

lyric mountain
#

Oh

#

Mono fonts look too similar, and I'm used to use ligatures

golden condor
#

I have ligatures too

#

But there is none in the ss

#

I hate this ejs error because it's an invalid error

#

And I can't get rid of it

lusty quest
#

some vsc theme suggestions? currently use material theme but its boring

mellow kelp
#

im using material theme ocean constrast or something

earnest phoenix
#

atom one dark

#

my favourite theme so far

silent cloud
#

so

#

i fixed that

#

it was easy to fix lol

lusty quest
#

atom one dark looks nice

sudden geyser
#

One Dark feels overused

#

How about SynthWave '84

earnest phoenix
#

glasscord ๐Ÿ˜Ž

sudden geyser
mellow kelp
#

how about discord light theme coolflushed

lyric mountain
#

Discord light is just every color reversed

lusty quest
#

lol get a hdr monitor and use light mode

golden condor
#

Can you use glasscord on Linux

earnest phoenix
#

yes as long as your wm has a blur provider

#

looks pretty good

timber fractal
#

uhm why do i get this error ```js
internal/validators.js:124
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type function ([Function (anonymous)])
at validateString (internal/validators.js:124:11)
at join (path.js:375:7)
at Object.<anonymous> (C:\Users\Lucas\Desktop\discordbots\MCBlock\index.js:19:27)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}```

#

ye but where

earnest phoenix
#

try reading harder

timber fractal
mellow kelp
#

have you tried checking the error

timber fractal
#

yes duh

lusty quest
#

rip

mellow kelp
#

'The "path" argument must be of type string. Received type function'

earnest phoenix
timber fractal
umbral zealot
#

ok so how are you using join()

earnest phoenix
#

glasscord works even with ms teams

#

it's fun

umbral zealot
#

And whatever's related to that

timber fractal
#

wait, how can i use join() with aliases

earnest phoenix
#

+startbot

pure lion
#

wdym aliases

timber fractal
#

like someone told me to do js join(cmd => cmd.alias, `command`, `${file}`) but that gives error

timber fractal
umbral zealot
#

Ok well, that's... a function

mellow kelp
#

that's not how join works

umbral zealot
#

join() is used for paths

timber fractal
#

yes i know

umbral zealot
#

What are you trying to do?

timber fractal
#

define alias

umbral zealot
#

why

#

to do what with it

pure lion
#

i cant even with this channel

mellow kelp
#

im having a stroke

timber fractal
#

someone told to do js const alias = require(join(cmd => cmd.alias , "command", `${file}`)); but that gives error ofc

pure lion
#

you need to hold the commands in a map or discord collection

#

the alias is in the file

#

so you can find the commands by their aliases

umbral zealot
#

join takes in arguments, not a function

#

it joins a path

umbral zealot
#

so I don't know what the hell join is supposed to do here but this ain't it

timber fractal
umbral zealot
#

Can you show us your entire function that reads commands

pure lion
#

you don't need to worry about aliases here

umbral zealot
#

maybe we can figure out what the heck you're trying to do

pure lion
#

you can add them at any time

timber fractal
pure lion
#

do commands already work?

timber fractal
#

yes

pure lion
#

show us your message event

umbral zealot
#

nah not the message event

#

we need to see the index.js file

#

where it loads the commands

pure lion
#

or wherever the commands are loaded i cba

timber fractal
#

wait

#

nvm

#

i send new one

#

F

#

The good one is not sended bcz of my eifi

#

Wifi*

#

I hope u have enough on the ondex.js

umbral zealot
#

no we need to see the code that's loading commands

timber fractal
#

I will sand tomorrow sad me

#

Send*

umbral zealot
#

Can you not try to send again...?

lyric mountain
#

Where's the jojo "continue" gif when we need it

lusty quest
earnest phoenix
#

yup

#

i can give you my css file if you want

#

it's a slightly modified template from the repo

lusty quest
#

what did you modified?

earnest phoenix
#

just a few colors

timber fractal
#

did Dice blocked me lol

umbral zealot
#

I... hmm.

timber fractal
#

lol

#

kinda much code

umbral zealot
#

No, actually, this is very little code for a command loader

timber fractal
#

oh lol

umbral zealot
#

because what you're doing right now really isn't worth keeping, tbh.

lusty quest
timber fractal
umbral zealot
#

The thing is, what you're doing right now to try to load aliases is completely pointless

earnest phoenix
umbral zealot
#

And the best I can do is show you tutorials that do it so you can understand

timber fractal
umbral zealot
#

Then you'll have to adapt it

pale vessel
#

Then use that something else

timber fractal
#

@umbral zealot u cant just say how i can make it respond to aliases too?

umbral zealot
#

I can... I pointed you to the guide that shows you how aliases work

timber fractal
umbral zealot
#

I'm not going to do this work for you or write your code. You're the developer, do it yourself.

lyric mountain
#

Aka "gimme za code"

timber fractal
#

but i tried and that didn't worked and i already tried a few ways

umbral zealot
#

Well if all you tried was shoveling code given by others, that's your problem.

lusty quest
#

yea found the issue it sometimes doesnt load properly

umbral zealot
#

mfw people star a message I wrote 2 months ago telling people to learn javascript... ๐Ÿ™„

timber fractal
umbral zealot
#

Ok well, I've made aliases based on the tutorial I sent you

#

it's not that hard

mellow kelp
umbral zealot
#

But you have to write more code, what you have is not sufficient.

#

The entire idea of using path.join is completely ridiculous, whoever told you to do that should not be trusted with anything important.

pale vessel
#

They might be looking at the wrong tutorial

timber fractal
#

@umbral zealot now i tried this to define command ```js
const args = message.content.slice(fetchprefix.prefix.length).trim().split(/ +/);
const commands = client.commands
const name = args.shift().toLowerCase()

    const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name));``` but now it doesn't respond and it doesn't even give a error
#

@umbral zealot ?

silent cloud
#

Hey guys

#

Yo

#

I have this error, can someone help me?

#
Require stack:
- /home/container/node_modules/canvas/lib/bindings.js
- /home/container/node_modules/canvas/lib/canvas.js
- /home/container/node_modules/canvas/index.js
- /home/container/src/utils/CanvasTemplates.js
- /home/container/src/index.js
- /home/container/src/loaders/ListenerLoader.js
- /home/container/src/loaders/index.js
- /home/container/src/Monika.js
- /home/container/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/container/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/container/node_modules/canvas/lib/bindings.js',
'/home/container/node_modules/canvas/lib/canvas.js',
'/home/container/node_modules/canvas/index.js',
'/home/container/src/utils/CanvasTemplates.js',
'/home/container/src/index.js',
'/home/container/src/loaders/ListenerLoader.js',
'/home/container/src/loaders/index.js',
'/home/container/src/Monika.js',
'/home/container/index.js'```
#

Friend said Canvas thats PAIN

timber fractal
#

Dumb link lol

restive willow
#

Python: if I raise Exception (or raise CustomCommandError / whatever else), I get a CommandInvokeError. Is there any way to retrieve the original error type?

earnest phoenix
#

@give

#

@polar sluiceveaway protect

thick gull
#

what

earnest phoenix
#

idk how to fix it with glasstron

lusty quest
#

i run it on windows

earnest phoenix
#

oh

old cliff
#

guys is there a way to log into a specific shard from outside the shard ? using djs 12

lusty quest
#

if i delete the css and copy a new one in it works for the first time

#

if i close vsc and start it again it just loads the normal theme

old cliff
#

like login to shard 0 from a different server

#

and get some info for a dashboard ?

earnest phoenix
#

you should open up a communication system between those two servers instead

#

either open up a http server on where you're running the shard 0

lusty quest
#

why not api/gateway?

earnest phoenix
#

or open up a websocket server at your backend where you serve your dashboard, ^

old cliff
#

logging in without sharding would work or not ?

earnest phoenix
#

up to 2500 guilds

#

after that, it's impossible

old cliff
#

like at one place sharding is happening

#

but at the dashboard its logging in without it

#

would that work ?

lusty quest
#

depends on how you implement the dashboard i guess

#

if you rely on having a Bot instance running it could be annoying

earnest phoenix
#

again,

you should open up a communication system between those two servers instead
either open up a http server on where you're running the shard 0
or open up a websocket server at your backend where you serve your dashboard

#

any other solution is not scalable and not recommended

old cliff
#

what do bots like mee6 do ?

earnest phoenix
#

exactly what i said

old cliff
#

ok

earnest phoenix
#

they communicate with their servers

restive willow
earnest phoenix
#

and then npm i canvas

old cliff
#

so I should make an api sort of thingy at shard 0 and send data on dashboard requests

earnest phoenix
#

correct

#

be sure to protect it with an authorization key

old cliff
#

yeah thats common sense

lethal trout
earnest phoenix
#

are you relying on cache

lethal trout
#
 let messageUser = await Messages.findOne({
        userID: message.author.id,
    });

    if (!messageUser) {
        messageUser = new Messages({
            userID: message.author.id,
            messages: 0
        });
        await messageUser.save().catch(e => console.log(e));
    };

    await Messages.findOne({
        userID: message.author.id
    }, async (err, dUser) => {  
        dUser.message += 1;
        await dUser.save().catch(e => console.log(e));
    })
#

here

#

it is in main.js

old cliff
#

it would have been 100x easier if I could do broadCast eval from dashboard only
but life is hard

timber fractal
#

so i have this to run commands ```js
const args = message.content.slice(fetchprefix.prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase()
const command = client.commands.get(commandName)
|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));

    if(!command) return;


    try {
        client.commands.get(command).run(client, message, args);

    } catch (error){
        console.error(error);
    }``` but if i use a command it says `cannot read property 'run'of undefined` , how can i fix it?
timber fractal
#

idk how i tried so much

old cliff
#

where did u add commands ?

#

did u do something like this ?

client.commands = new Discord.Collection();
fs.readdir("./commands/", (_err, files) => {
    files.forEach((file) => {
        if (!file.endsWith(".js")) return;
        let props = require(`./commands/${file}`);
        let commandName = file.split(".")[0];
        client.commands.set(commandName, props);
        console.log(`๐Ÿ‘Œ Command loaded: ${commandName}`);
    });
});
timber fractal
lethal trout
#

wow noone helping me

old cliff
#

ok

golden condor
#

What do you need help with

old cliff
#

do ```js
command.run(client, message, args);

instead of
```js
client.commands.get(command).run(client, message, args);
#

@timber fractal

#

or change to

#
client.commands.get(command.name).run(client, message, args);
golden condor
old cliff
#

the command is an object

lethal trout
old cliff
#

while you want to get the command by its name

#

not its whole object

lethal trout
#

nvm i fixed it

golden condor
#

K

sacred trout
#

Wtf?

solemn latch
#

pretty common

sacred trout
#

How to fix?

#

Hepped to you? @solemn latch

solemn latch
#

wait a few weeks

sacred trout
#

Like 2 weeks?

solemn latch
#

2 maybe 3 weeks

sacred trout
#

Bruh

#

This happened to you?

earnest phoenix
#

which discord presence for vscode is the best

opal plank
#

huh?

sacred trout
#

Repl best lol

earnest phoenix
#

repl

#

?

opal plank
#

discord presence for vscode?

earnest phoenix
#

yes

#

which is the best

opal plank
#

theres isnt a best

#

you want rich presence?

#

or just the normal status?

earnest phoenix
#

rich presence

opal plank
#

like mine?

earnest phoenix
#

i dont see urs\

#

oh wait

#

ye

#

like that

opal plank
sacred trout
#

You mean like the buttons and stuff?

earnest phoenix
#

no

#

discord presence

sacred trout
#

Nvm

opal plank
#

speaking of buttons, i need to figure that out

sacred trout
#

Use

#

Discord crp

opal plank
#

imma use the raw sdk

#

prob gonna try with cpp

earnest phoenix
#

the one by noel right

sacred trout
#

Hmm

earnest phoenix
#

the one i have rn

opal plank
#

also what?

#

discord crp?

#

c.... rich presence?

#

custom rich presence?

earnest phoenix
#

oh

#

lol

blissful coral
#

Wait I got it too

#

POG

opal plank
solemn latch
#

youve been noticed

earnest phoenix
#

Anyone Indian bot developers here?

blissful coral
#

Wow that's nice

opal plank
#

though, legit, whats the thing about CRP that you mentioned @sacred trout ?

sacred trout
#

Umm

#

You cam add custom game

#

Wirh buttons and image

opal plank
#

which you do with the SDK, yes

sacred trout
#

Lol idk

opal plank
#

then why'd you tell me if you dont know it?

sacred trout
#

Lol

#

XD

opal plank
#

if you dont know dont say it

#

reee

sacred trout
#

Research

earnest phoenix
#

i think they meant

#

rpc

#

instead of crp

sacred trout
#

Yea

#

XD

opal plank
#

yeah thats a different thing

sacred trout
#

Idk this

opal plank
#

i assume i could use it for the fancy thingies

supple lion
#

hi

opal plank
#

but i'll probably have to deploy it on an app

earnest phoenix
#

rpc is an old deprecated protocol for communicating with the discord client

#

game sdk is being actively maintained though

opal plank
#

^^

#

correct

#

i wonder if i can run it on node to be completely honest

earnest phoenix
#

probably

supple lion
#

bot km trucksbook discord me please

opal plank
#

node should be able to run cpp tho, right?

earnest phoenix
#

yes, if you use n-api

#

there should already be some libs interfacing it

opal plank
#

let me check that rq

supple lion
#

please help

opal plank
#

oh, i see

stuck pike
#

Sup Ervin where did your bot reached in servers

golden condor
opal plank
#

where did my what?

stuck pike
#

The bot

opal plank
#

you mean how many servers its in?

supple lion
#

romana?

stuck pike
#

The genshin one

stuck pike
golden condor
#

No I don't speak Romanian sorry

opal plank
blissful coral
#

pretty pog

opal plank
#

should be hitting 1k in a few hours

stuck pike
#

Aah yes my man lucky

opal plank
#

xD

stuck pike
#

Ggs!

opal plank
#

ty

golden condor
#

gg erwin

opal plank
#

i got 16$ but cant use em yet

stuck pike
#

I like your pfp

opal plank
#

ty

stuck pike
#

Without ad this servers

#

Pretty pog

opal plank
#

im gonna attempt to get some ads rolling soon, but they are so expensive

#

and being outbid last second is pretty annoying

stuck pike
#

I can agree

opal plank
#

might write my own code to outbit

stuck pike
#

I m thinking to write my whole boy again in typescript

supple lion
#

@golden condor bot that would show me at odds how many kilometers I did in the trucksbook

stuck pike
#

The problem Is idk typescript

opal plank
#

ts is definitively worth it

golden condor
#

hwat

opal plank
#

ts is javascript

stuck pike
#

Yea but better

opal plank
#

ts just has types, thats about it

earnest phoenix
#

ts is js but js isn't ts

stuck pike
#

Lol

golden condor
#

I wanna do that but ts will just scream at me

opal plank
#
//js
let a = 1;


//ts
let a:number= 1;
stuck pike
#

Bruh then ts is better

earnest phoenix
#

you theoretically don't need that type declaration

opal plank
#

bad example, but puts the idea out

stuck pike
#

Sometimes Js makes no sense

opal plank
#

yeah, inferred types

#

dont do that as its basically the same as pleonasm, but it shows the point

supple lion
#

bot that would show me at odds how many kilometers I did in the trucksbook

golden condor
#

I don't like doing discord bots in ts

#

what is trucksbook

stuck pike
#

Hm ima see to Typescript today rip my today's sleep Adios guys

earnest phoenix
#

types are highly needed when working with something like discord's api, at least for me

golden condor
#

Oh

opal plank
#

who needs sleep anyway

earnest phoenix
#

since the entirety of the api is reliant on entities

opal plank
supple lion
golden condor
#

what

#

that's a bot that does that

blissful coral
#

@opal plank dude

#

how do you feel?

#

notable member

opal plank
#

good, i guess?

blissful coral
#

ah yes another role to add to my collection

golden condor
#

does notable member let you change your nick?

supple lion
#

@golden condor no trukyapp

opal plank
#

i dont think it has any perks apart from the fancy color

blissful coral
#

No perks that I know of

golden condor
#

o

blissful coral
#

Unless there is tags and we don't know

opal plank
#

which is my favorite color, so im not complaining at all

blissful coral
#

-support

#

nope

supple lion
#

instal please me

golden condor
#

cyan is pretty pog

crimson vapor
#

yea

#

its also pretty poggers how you have it

golden condor
opal plank
#

well, theres something that hasnt been done in the bot community

#

finally a unique thing

supple lion
#

@golden condor Well, I saw it on a discord channel

golden condor
#

Possibly a custom bot

blissful coral
#

or at least some tags

supple lion
#

@golden condor I give you in private to see?

opal plank
blissful coral
#

Yeah nvm we aren't getting tag perms LMAO

golden condor
#

there isn't a public one

opal plank
#

nor do i think we deserve changing nicknames, its the only thing that boosting grants you apart from purple color

golden condor
#

Feel as though bot reviewers are more likely to get tags first

opal plank
#

would be nice to have, but i dont think it fits the bill

#

i need more data

#

but i cant think of anything else to add

supple lion
#

help

#

please

opal plank
supple lion
#

@opal plank no

opal plank
# supple lion <@!188836645670223872> no

Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

blissful coral
#

Just link the message lul

mellow kelp
#

this should be a copypasta at this point

opal plank
blissful coral
#

lul

opal plank
supple lion
#

@opal plank
thanks

opal plank
#

no preblomo

earnest phoenix
#

Hey how to make a website for our bot?

supple lion
#

@opal plank please can you make me one for discord

opal plank
supple lion
#

?

#

@opal plank ? monei

opal plank
supple lion
#

@opal plank monei 10 eur ? wat monei

#

nustiu bine engleza

#

sunt roman

quartz kindle
#

Lol

opal plank
#

no idea whats going on anymore

lyric mountain
#

10 euro for a bot lul

rocky hearth
#

I accidently renamed all the variables present in node_modules. And now everything is messed up. What do I do now?? ๐Ÿ˜ฆ

lyric mountain
#

Delete mode modules

rocky hearth
#

Can I prevent this to happen? I'm using vscode and working on a react project.
I wanted to rename the div to button. But it did that everywhere

lyric mountain
#

Just dont do a global replace-in-files

earnest phoenix
#

set up your .gitignore properly

lyric mountain
#

Do it in the sources folder

earnest phoenix
#

vsc is going to ignore everything that's in the gitignore

lyric mountain
#

Btw, why'd u rename all divs to Button?

rocky hearth
#

I wanted just the openig and closing tags

#

It did work before

lyric mountain
#

Shift F6 then

#

Or right-click + refactor

#

Also iirc, if you change the opening tag then the closing tag changes too

rocky hearth
#

I already hv a git repository, but hvnt yet commited anything. Can this be an issue?

lyric mountain
#

Yes if you care about your progress

rocky hearth
#

na na, I mean in this regards - renaming tags

lyric mountain
#

No

rocky hearth
#

I'm using a monorepo. How do I delete all the node_modules?

#

in one cmd, on mac

lyric mountain
#

Click + delete button

earnest phoenix
#

rm -rf /node_modules

lyric mountain
#

./

earnest phoenix
#

^

lyric mountain
#

rm -rf / KEKW (DONT)

earnest phoenix
#

lmfao

rocky hearth
earnest phoenix
#

don't... actually run that

lyric mountain
#

Don't even think about it

#

Unless you want to format ur pc

rocky hearth
#

LOL, kidding. ik that

earnest phoenix
#

๐Ÿฅฒ

#

anyway

#

you just need to set up your .gitignore

#

i usually steal one from visual studio

#

(i have over 1k modules)

rocky hearth
#
node_modules
private
*.lock
.vscode
.DS_Store
lib
.eslintcache
*.local

I do have set this

lyric mountain
#

4 apocalypse knights

rm -rf /
chmod 777 -R /
delete system32
apply force on CPU

earnest phoenix
#

:(){ :|:& };:

rocky hearth
#

rm -rf / does mac really allow this?

lyric mountain
#

Only if u do sudo ig

earnest phoenix
#

surely they would add some extra protection

#

mac's audience are people who aren't tech savvy per se

#

so surely they would add protection to prevent dumb people from running that

opal plank
#

and its giving me flashbacks

earnest phoenix
#

it's a forkbomb

#

i memorized it by heart

#

lmfao

golden condor
#

Just killed my computer

#

Using that command

opal plank
#

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

email validation regex, just fyi

earnest phoenix
#

and yet it isn't 100% effective

#

๐Ÿ˜ญ

golden condor
#

Perhaps you should put a warning sign on commands

#

for some people who don't know what they do

#

because people will run stuff lol

misty sigil
#

its their fault for running it ยฏ_(ใƒ„)_/ยฏ

golden condor
#

Yeah well it's also the person's fault for posting it

misty sigil
#

dont run stuff you found randomly in a discord channel?

rocky hearth
#

Did u really ran that?

opal plank
lyric mountain
earnest phoenix
#

.endsWith("@gmail.com")

lyric mountain
#

Lul

golden condor
timber fractal
quiet topaz
#

could someone please tell me, where there is a ) missing?

earnest phoenix
#

are you sure thats where the error is coming from

quiet topaz
#

its the console output

earnest phoenix
#

click on main.js to the side of the error

lusty quest
#

did you use a linter? iirc es-lint marks the error

restive furnace
quiet topaz
#
let vid = "youtube.com/watch?v=vQ7Pg1_YYDo"
let typeVid = "mp3"
let infoYT; 
async function getInfoFromVid(vidUrl, typeOfVid) {
 return await ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})
}

infoYT = getInfoFromVid(vid,typeVid);
console.log(infoYT)

function escapeFile(input) {
  
  return input.replace(/\"|\||\/|\\|:|\*|<|>|!|\?/g," ");
  
}

ytdl(vid)
.pipe(fs.createWriteStream(escapeFile(await getInfoFromVid(vid,typeVid))));
#

thats my code

#

like i defined fs and ytdl etc at the top

earnest phoenix
#

are you in an async function

quiet topaz
#

i think

earnest phoenix
#

share your entire file

quiet topaz
#
const fs = require("fs");
const ytdl = require("ytdl-core");

let vid = "youtube.com/watch?v=link removed"
let typeVid = "mp3"
let infoYT; 
async function getInfoFromVid(vidUrl, typeOfVid) {
 return await ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})
}

infoYT = getInfoFromVid(vid,typeVid);
console.log(infoYT)

function escapeFile(input) {
  
  return input.replace(/\"|\||\/|\\|:|\*|<|>|!|\?/g," ");
  
}

ytdl(vid)
.pipe(fs.createWriteStream(escapeFile(await getInfoFromVid(vid,typeVid))));



earnest phoenix
#

you aren't

#

use promise/then pattern

nocturne spire
#

Hnmm

quiet topaz
#

ok

#

.then will wait?

earnest phoenix
#
getInfoFromVid(...).then(result => {
//consume the result with createWriteStream and whatnot
});
#

iirc you can't wait synchronously for a promise in js

quiet topaz
#

but i did .then at return await ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})

earnest phoenix
#

๐Ÿšถโ€โ™‚๏ธ ๐Ÿฆฝ

cinder patio
#

Why are you mixing up await and .then

quiet topaz
cinder patio
#

It's time to read up on em then

lyric mountain
#

Imagine promises being "do this for me" and await being "do this for me but I'll stay here to see the result"

quiet topaz
#

now i get this:

#

but why input.replace isnt a function?

cinder patio
#

Show updated code

quiet topaz
#

const fs = require("fs");
const ytdl = require("ytdl-core");

let vid = "youtube.com/watch?v=link removed"
let typeVid = "mp3"
let infoYT; 
async function getInfoFromVid(vidUrl, typeOfVid) {
 return ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})
}

infoYT = getInfoFromVid(vid,typeVid);
console.log(infoYT)

function escapeFile(input) {
  
  return input.replace(/\"|\||\/|\\|:|\*|<|>|!|\?/," ");
  
}

ytdl(vid)
.pipe(fs.createWriteStream(escapeFile(getInfoFromVid(vid,typeVid).then((res)=>{return res}))));


golden condor
#

its not a string

cinder patio
#

You're not using then correctly

quiet topaz
#

so i should first do toString(input)?

cinder patio
#

no

#
  // here res is the string returned from getInfoFromVid
})}:```
#

Also all those functions seem to be used only once, that's a bad practice. There's no need to create a function if you are going to be calling it only once

quiet topaz
#

i will call them more often, but i just started the code

rocky hearth
#

does the properties of dataset on an element always returns a string?

cinder patio
#

context?

#

Is this from a library or

rocky hearth
#

just the regular html dom element

cinder patio
#

I think so

#

if it's not set then it will be an empty string but I'm not 100% sure

harsh blade
#

Yo,
How can i restrict a command only for a specific role?

cinder patio
#

check if the person who sent the message has the role

harsh blade
#

How?

cinder patio
#

what language and lib are you using?

harsh blade
#

Discord.js v12

cinder patio
#

message.member.roles.cache.has("roleId")

#

Replace roleId with the actual role ie

#

id*

#

you can also check for a name or other properties using .find

harsh blade
#

Isnt this correct

client.on("message", message => {
  if (message.member.roles.cache.has("roleId"));
  if (message.content == ",pticket") {
#

just change the id

cinder patio
#

No because you don't so anything after the if statement

#

you just do nothinf

#

nothing* jesus I hate typing on mobile

harsh blade
#

Kinda looks weird

lyric mountain
#

If with semicolon lul

harsh blade
cinder patio
#

put the second if statement inside the first one

if (...) {
  if (...) {

}
}

or alternatively: if (... && ...)

lyric mountain
#

It is actually, ifs do nothing if you end it with a semicolon, you either need to use return or brackets

#

So yeah, if with semicolon lul

harsh blade
#

ok?

#

Now my command isnt working :/

lyric mountain
#

Are your if clauses correct?

#

Like, not inverted

harsh blade
#
client.on("message", message => {
  if (message.content == ",pticket") {
  if (message.member.roles.cache.has("802999483239235584")) {
lyric mountain
#

Use equals btw

#

U sure that's the right role id?

cinder patio
#

That ID looks wrong also

harsh blade
#

Yeah

#

my wifi ooooooof

#

802875302748356628 role id

lyric mountain
#

That's not what's there

harsh blade
#

oh wtf

lyric mountain
#

Just as a note, but is that command supposed to be runnable only in one server?

harsh blade
#

Yeah

#

Its a private bot for my hosting company

#

i want to make priority tickets for donators

lyric mountain
#

Nvm then

harsh blade
#

xD

lyric mountain
#

Did it work after u changed the id?

harsh blade
#

Nope

cinder patio
#

Also, are you using a different message listener for every command by chance?

#

Also, does the command have any arguments?

harsh blade
#

Yeah

#

its fetching it from another file

lyric mountain
#

Nice catch google

harsh blade
#

the command is working just fine without the "role check"

#

Creates the ticket and everything

lyric mountain
#

Double check the id

cinder patio
#

Was the yes for the arguments or the message listeners?

lyric mountain
#

Copy it and put in this format in the chat: <@ID>

#

If it pings the role then it's right

harsh blade
#

@daring socket

lyric mountain
#

Not here

#

In the server the role is in

harsh blade
#

id dosent ping the role

lyric mountain
#

Check if the id is right then

opal plank
#

cuz its not a role like that

#

roles are @&

#

<@&ID>

harsh blade
#

Oh

opal plank
#

<@&ID_HERE> @harsh blade

harsh blade
#

Maybe i need to add something in the thing that reads the role?

harsh blade
#
  if (message.member.roles.cache.has("<@&802875302748356628>")) {
cinder patio
#

no

opal plank
#

no not like that

harsh blade
#

bruh

opal plank
#

just to POST a role mention

#

cache is a map with id

harsh blade
#

i know that

opal plank
#

JUST the id

#

you dont

lyric mountain
#

That is to check if the id is valid

harsh blade
#

ik that but i got confused sorry

opal plank
#

you dont check if an id is valid by passing a mention

#

regex it or split it

lyric mountain
#

I mean to check if the id is valid via discord chat

opal plank
#

preferrably split it

#

you cant

lyric mountain
#

Like, if it pings the role then it's valid

harsh blade
#
  if (message.member.roles.cache.has("802875302748356628")) {

aint working

opal plank
#

its cached in client

harsh blade
#

no errors

opal plank
#

only way to check it if its in the guild

#

which doesnt always apply

lyric mountain
#

Lul erwin that not what I meant

opal plank
#

then explain it good pls

lyric mountain
#

It's literally to manually check if you didn't misscopy the id

#

Like, try to see if it pings

opal plank
#

why would you need to do that?

lyric mountain
#

If it does, u copied the right id

opal plank
#

what?

lyric mountain
harsh blade
#

i did copy the correct id

opal plank
#

oh

harsh blade
#

this time

opal plank
#

right click => copy id

#

thats it

cinder patio
#

Then something else is wrong, you're showing two lines of your code, and they look right without any context

opal plank
#

im still unsure what they are event attempting to do

cinder patio
#

restrict a command to a role

harsh blade
#
client.on("message", message => {
  if (message.content == ",pticket") {
  if (message.member.roles.cache.has("802875302748356628")) {
const Logger = require('leekslazylogger');
const log = new Logger();
const { MessageEmbed } = require('discord.js');
const fs = require('fs');
const { join } = require('path');

module.exports = {
    name: 'new',
    description: 'Create a new support ticket',
    usage: '[brief description]',
    aliases: ['priorityticket', 'pticket'],
    example: 'new my server won\'t start',
    args: false,
    async execute(client, message, args, {config, Ticket}) {
        const guild = client.guilds.cache.get(config.guild);
opal plank
#

at first it seemed they only wanted to know how to send a role mention

lyric mountain
#

No, that's something else, I was checking if he got the right id

#

That's why the mention

cinder patio
#

Why... do you have... a message listener... inside a command file

harsh blade
#

hm?

#

it works just fine without the third line

cinder patio
#

That's just wrong on so many levels. I have no clue how you managed to get this crap working lol

lyric mountain
#

Remember: js is weird

#

It lets some things pass

harsh blade
#

Oh forgot to say, this is inside index.js

#

plz dont kill me

lyric mountain
#

Oh my

harsh blade
#

I Tried to add it to a seperate command file but it didnt work

opal plank
#

cuz u did it wrong

harsh blade
#

How?

opal plank
#

let me foward you do the guide

#

cuz literally 80% of people here use a command handler

#

and this one

#

you're simply making a module and importing it with require()

#

thats it

#

require() will just bring you that object, the same that modules.exports export

harsh blade
#

How do i format in vscode again

#

theres a hotkey

earnest phoenix
#

it takes one (1) google search

harsh blade
#

Alr, ive modified the command to be in a command file and i get this error
if (message.member.roles.cache.has("802875302748356628")) {
^

ReferenceError: message is not defined

#

Ive tried defining message which then told me to define client which then told me to define discord and so on

#

so i gave up on that

umbral zealot
#

You should not have a client.on("message") within another handler

#

just follow the guide, one step at a time, and read thoroughly

#

instead of just shoveling code.

harsh blade
#

i read those and checked it against my code but i see nothing wrong?

#

Can't i like fetch the role id from config.js

grizzled raven
#

show codeโ„ข๏ธ

harsh blade
#

its too long to send

#

That code works

#

just fine

#

but i wanna make it "specific role only"

opal plank
odd stratus
#

if(!message.member.roles.cache.has("role_id")) return;

#

Iโ€™m on phone so it doesnโ€™t make me download those files

harsh blade
solemn latch
#

Awoo does rock

odd stratus
#

Itโ€™ll return and not work for that user if they donโ€™t have the role

harsh blade
#

if (!message.member.roles.cache.has("802875302748356628")) return;
^

ReferenceError: message is not defined

#

Same issue

odd stratus
#

Did you put it under line 23?

harsh blade
#

My bad

odd stratus
#

Because message is defined and called there

#

Make sure itโ€™s under

harsh blade
#
                    .setTitle(':x: **Error**')

This is line 23

odd stratus
harsh blade
#

Alr

#

Yup!

#

Working perfectly now

#

Tysm

odd stratus
#

Np

earnest phoenix
#

Hey guys

#

Quick question

#

Does anyone know how to make a server specific variable?

#

That doesn't change on other servers

spice compass
#

anyone knows code for bot to send an embed/message whenever it joins a server. In the channel it can send

opal plank
#

you need to use 'guildCreate' event

spice compass
opal plank
#

and then send a message on one of the channels inside the guild

opal plank
steady raven
#

rip my bot got declined

spice compass
#

yea I wanna be spoonfed too lazy

opal plank
#

if you got a specific question, im more than happy to help

#

otherwise, sorry, but no

buoyant root
quartz kindle
#

never use util.inspect with both getters and showHidden on a discord.js client

#

lmao

quartz kindle
#

good luck

steady raven
quartz kindle
#

lmao

opal plank
#

out of curiosity, what would happen?

quartz kindle
#

i opened an issue on the nodejs repo

#

this should give you an idea

steady raven
#

ok

earnest phoenix
#

Uh lol

tulip ledge
#

whats the new honerable member role?

gilded olive
#

Honerable helpers?

pale vessel
earnest phoenix
#

guys help

#

bot.user.setPresence({ activity: { name: ${bot.users.cache.size} members , type: 'WATCHING'}, status: 'online' })

pale vessel
#

Right now I just use showHidden

earnest phoenix
#

it say this error
ReferenceError: bot is not defined

mellow kelp
#

have you tried reading the error

pale vessel
#

what did you define your client as

earnest phoenix
#

i want make how much users on all Server

buoyant root
#

bot is no defined read the error

earnest phoenix
#

client.user.setPresence({ activity: { name: ${client.users.cache.size} members , type: 'WATCHING'}, status: 'online' })

#

Try

pale vessel
#

does that even work

misty sigil
#

aye aye fit like me dev friends

earnest phoenix
misty sigil
#

client.user is undefined

pale vessel
#

undefined yea

earnest phoenix
pale vessel
#

you need to make sure you're logged in before using that method

earnest phoenix
misty sigil
#

e.g. use it in the ready event

pale vessel
#

matthew did you have a stroke

misty sigil
#

what

pale vessel
misty sigil
#

oh idk maybe I did

pale vessel
#

o

#

ok

opal plank
#

wait for the ready event

earnest phoenix
#

<o/

opal plank
#

dont try to set presence as soon as you delcare client

misty sigil
#

discord.js should have protection against that

#

after all it is designed to babysit you

pale vessel
#

why

#

true

opal plank
#

when you try to access user before the promise is fullfilled? not sure tbh

pale vessel
#

but if you have a static presence you can just provide it in client options

glacial blaze
#

Guy's i need someone who has a big picture in githup

mellow kelp
#

tf is a github big picture

pale vessel
#

big picture in github

glacial blaze
#

I mean he can fix errors and know alot about githup

pale vessel
#

githup?

glacial blaze
#

Yupp

pale vessel
#

never heard of that one before

glacial blaze
#

Wtf

#

Oh sorry

#

Github**

quartz kindle
#

lmao

glacial blaze
#

gg

pale vessel
#

ohhh

glacial blaze
#

๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚

pale vessel
#

what do you mean by big picture

glacial blaze
#

Sry

mellow kelp
#

actually

#

what is your actual question?

#

don't ask to ask

glacial blaze
#

I mean he can fix errors and know alot about it

pale vessel
#

oh big picture as in experience

glacial blaze
#

I have error when i use git push

glacial blaze
quartz kindle
#

no he wants a photograph

pale vessel
#

lmao

#

I c

glacial blaze
quartz kindle
#

a big photo of github

glacial blaze
#

Guy's im really have a problem who can help

mellow kelp
#

just freaking ask

glacial blaze
#

I want to upload files to github

#

When i use git push it say. Failed to push. Repository dont find. Or something like that

mellow kelp
#

do you have a remote set

#

check git remote -v

cobalt umbra
#

anyone has any idea how to reward voting on guild base as opposed to just specific user?

mellow kelp
#

you could set up some logic with a vote command or something

cobalt umbra
mellow kelp
#

or maybe use the last guild the user sent a message on

cobalt umbra
#

oh

mellow kelp
#

that seems like a neat and simple solution

cobalt umbra
#

am I limited only for vote during the last 12 hours

glacial blaze
mellow kelp
#

you sure the remote is correct?

#

there might be typos or the url might be incorrect

glacial blaze
#

How i can set another one?

mellow kelp
#

git remote rm <your-remote>

#

to remove

cobalt umbra
glacial blaze
#

Rm?

mellow kelp
#

that's to remove a remote

glacial blaze
#

Ok

#

And then?

mellow kelp
#

add another one

#

git remote add origin https://remote-url.git

glacial blaze
#

It says remote is already exist

#

Wtf

mellow kelp
#

you sure you removed the previous remote?

earnest phoenix
#

Im trying to install discord-rpc with npm

#

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jusmi\AppData\Roaming\npm-cache_logs\2021-01-24T23_53_35_427Z-debug.log

C:\Users\jusmi\Desktop\DiscordRPC>npm install discord-rpc
npm ERR! code EJSONPARSE
npm ERR! file C:\Users\jusmi\Desktop\DiscordRPC\package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected end of JSON input while parsing near ''
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jusmi\AppData\Roaming\npm-cache_logs\2021-01-24T23_53_47_817Z-debug.log

#

This is my error

glacial blaze
#

I get message. No such remote. <my repo url>

#

Can u dm me?

opal plank
earnest phoenix
#

oh ok

pale vessel
#

It's still against the tos because of its nature

earnest phoenix
#

With the cheerio module, I try to extract the desired information from the html information from the dak.gg site, but strangely the data value is not returned and the class name is correct.

#

Well, it's part of the source code

getHtml()
  .then(html => {
    let ulList = [];
    const $ = cheerio.load(html.data);
    const $bodyList = $("div.overflow-hidden").children("div.container.p-0");

    $bodyList.each(function(i, elem) {
      ulList[i] = {
          title: $(this).find('div.profile-header__info.m-3 span').text(),
          url: $(this).find('div.profile-header').attr('data-renew-url'),
          image_url: $(this).find('div.profile-header__icon').attr('src'),
          image_alt: $(this).find('div.profile-header__icon').attr('alt'),
      };
    });
 const data = ulList.filter(n => n.title);
    return data;
  })
  .then(res => log(res));
jovial elk
#

Have anyone encountered the problem of member mentions in embeded message show as "@inavlid-user" on mobile app? But works fine on pc? Any known fixes?

earnest phoenix
#

there's nothing you can do

#

it's a client bug

#

you'll have to wait for discord devs to fix it

#

the mobile devs are heavily incompetent so don't expect it anytime soon

distant cobalt
jovial elk
#

I see, thanks ^^ ill just use normal message instead of embed

jovial elk
#

I replied to cyr xD

distant cobalt
#

lol

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

nah it's a reported bug on the mobile client

#

there's been talk for about a week now

distant cobalt
#

I found an error that just appeared

jovial elk
#

I noticed the mentions show up eventually but takes time

distant cobalt
sudden geyser
#

Thatโ€™s the important part.

sudden geyser
proven lantern
#

my program is waiting for a response from this fetch forever. it was working before. are the discord service having issues?
await msg.guild.members.fetch({user: allPlayerIds})

    at C:\Users\Box\IdeaProjects\team-up-bot\node_modules\discord.js\src\managers\GuildMemberManager.js:265:16
    at Timeout._onTimeout (C:\Users\Box\IdeaProjects\team-up-bot\node_modules\discord.js\src\client\BaseClient.js:83:7)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7) {
  [Symbol(code)]: 'GUILD_MEMBERS_TIMEOUT'
}
quartz kindle
#

what is allPlayerIds

opal plank
#

was about to ask that

solemn latch
#

have you two become more active since getting notable member? or is it just easier to notice you now

quartz kindle
#

likely the latter

mellow kelp
#

pog

quartz kindle
#

i havent been around that much today, and im gonna gtfo to sleep now c ya

quartz kindle
proven lantern
opal plank
#

i lurk a lot, thats what i meant to say

#

i was finally able to code my status

#

SDK is a bitch to fuck around with

#

like, my status here in my profile, and it pulls metrics from my bot

#

and it auto updates

dusky sundial
#

Still no response from discord :( I need my intents

#

Yup

#

Sent the application last Sunday

#

Well replied

#

Sorry, it's 4am

#

Hmm, I haven't gotten anything. I'd assume they would at least tell me, even if it was denied?

#

Yeah, I guess they don't do replies on weekends anyways

sacred trout
#

    @commands.command()
    async def rank(self,message,ctx, user:discord.User = None):
      if user is not None:
        db = sqlite3.connect('leveling.sqlite')
        cursor = db.cursor()    
        cursor.execute(f"SELECT user_id,exp, lvl FORM levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
        result = cursor.fetchone()
        if result is None:
          await ctx.send(f"{user.mention} is not yet ranked!")      
        else:
          await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
        cursor.close()
        db.close()
      elif user is None:
        db = sqlite3.connect('leveling.sqlite')
        cursor = db.cursor()
        cursor.execute(f"SELECT user_id,exp, lvl FOR levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
        result = cursor.fetchone()
        if result is None:
          await ctx.send(f"{user.mention} is not yet ranked!")
        else:
          await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
        cursor.close()
        db.close()```
#

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "rank" is not found

#

please help

pale vessel
#

amd?

#

you mean and

sacred trout
#

bruh

pale vessel
#

also you shouldn't use f-strings for database queries

sacred trout
#

the tutorial guy is using

#

so i used as well

#

still the same error @pale vessel

pale vessel
#

well the command isn't found

sacred trout
#

the whole code

pale vessel
#

you use on message and commands.command()?

sacred trout
#

yea?

pale vessel
#

i'm sure you need to process the commands first, iirc

sacred trout
#

cause cogs

pale vessel
#

since you're using events

sacred trout
#

commands.Cog.listner()>

#

?

pale vessel
#

@slender thistle don't you need to process commands or something in order to use commands with message event?

sacred trout
#

what do i do?

slender thistle
#

Do it last outside of any ifs

sacred trout
#

??

#

??

pale vessel
#

bot.process_commands()?

#

seems like you have to provide message too

sacred trout
#

where?

blissful coral
#
ctx.drawImage(background, x, y) //Draw Background
    ctx.font = applyText(canvas, message.author.username.toUpperCase())

    ctx.fillStyle = '#000000'

    ctx.fillText(message.author.username.toUpperCase(), canvas.width / 2.5002, canvas.height / 6.5)
    //Curve Profile Picture
    ctx.beginPath();
    
    ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
    
    ctx.closePath();
    
    ctx.clip();
    
    const pfp = await Canvas.loadImage(message.author.displayAvatarURL({ format: 'png' }));
    //Draw PFP
    ctx.drawImage(pfp, 25, 25, 200, 200)```
How can I make the drawImage draw directly in the center of the canvas?
pale vessel
#

calculate the center of the canvas?

blissful coral
#

Yeah but what param is it

pale vessel
#

drawImage(image, x, y, width, height)

lyric mountain
#

It's actually width / 2

#

And height / 2

wicked sapphire
#

Is there any special differences between .findOneAndDelete() and .deleteOne(). I'm referring to MongoDB specifically.

pale vessel
#

i'm pretty sure findOneAndDelete() returns the deleted document after deleting it

opal plank
#

Probably will need to offset it too

pale vessel
#

while deleteOne() just deletes it

#

OR that it's an alias

#

who knows

opal plank
#

if you pick the very middle, thats where it'll start drawing

#

not the middle of whatever image or what you're doing on

#

if you placing an image or something, fairly certain you'll need to offset it by diving the image lenght/height /2

lyric mountain
#

Yeah there's that too

blissful coral
pale vessel
#

what do you mean

blissful coral
#

1st one is with the / 2 and stuff that is canvas height - pfp height

#

second one is 25, 25, 200, 200

gilded olive
#

lots of information needed

sacred trout
#

yes

gilded olive
#

are you sure it is?

sacred trout
#

f setup(client):
client.add_cog(Level(client))
print("Fun cog is loaded")

#

class Level(commands.Cog):
def init(self, client):
self.client = client

drifting wedge
#

uhh how do i put something in the center of a container?

#

like vertical and horizontal

gilded olive
#

well did you load it in your code when your bot is run

#

using load_extension()

pale vessel
#

so drawImage(image, canvas.width / 2 - 200 / 2, canvas.height / 2 - 200 / 2, 200, 200)?

sacred trout
#

YEs

gilded olive
#

you can try debugging bot.cogs

blissful coral
#

image disappeared when I tried that

opal plank
#

@gilded olive are you using teyvat api?

gilded olive
#

it's a list of str so you can use the .join method on it

pale vessel
#

how big is the image