#development

1 messages · Page 776 of 1

green kestrel
#

so for now its text only

earnest phoenix
#

Yes voice recognition was a pain in the ass

#

resources and time wise

green kestrel
#

google has one that does google assistant in voice channels so you can go 'ok google'

earnest phoenix
#

I used the google API for text to speech

green kestrel
#

i could integrate their voice recog api

earnest phoenix
#

the issue is when multiple users speakj

#

shit gets jumbled hard

#

so you are sitting there sorting packets and keeping them in order

#

checking if the pcm is valid

#

converting to something that google likes

green kestrel
#

i have 32gb on my dedicated server, mostly unused, ive worked out i can get about 22000 guilds on that before i need to look into an upgrade or start to cluster it, thats if a certain percentage make use of scripting, and a lesser percentage vote, so they double their allowances

#

so far out of 900 servers or so most of them dont use scripting, scripting uptake is about 10% of the servers

earnest phoenix
#

is spork your bot?

green kestrel
#

yup

earnest phoenix
#

Lemme grab it

#

So what's the intention of it

green kestrel
#

it started out as a chat bot, but i want to build a scripting community around it

#

so that people can contribute extension scripts to it, without having to worry about hosting their own bot

earnest phoenix
#

Oh i see

#

That's similar to how my command handler works

green kestrel
#

but you can do a lot with it without scripting

#

like you can teach it an embed by pasting json into the chat

earnest phoenix
#

Are you not worried about someone using nasty JavaScript

green kestrel
#

at the developer level the bot is C++ and fully modular, i can load new features without restarting... took me 2 months to get that stable though

#

nah, ive got it locked down quite tight

earnest phoenix
#

Can I try

green kestrel
#

please do!

earnest phoenix
#

Yay

green kestrel
#

i'd love to find out what you find

earnest phoenix
#

If I can do anything

green kestrel
#

if you do think youve broken it please let me know, i'll find a way to credit you for the find or something

earnest phoenix
#

Lmk if you ever need a hand because this sounds dope

#

Do you have a way for users to share their plugins

#

Or what we you want to call their ecritps

modest maple
#

that would be a cool idea ^^

green kestrel
#

i might need a hand as it grows, i need people who are willing to make scripts for it to kickstart the community around it

earnest phoenix
#

I'll make some

green kestrel
#

and eventually may need people to extend the C++ side

earnest phoenix
#

Ugh

green kestrel
#

but i'd have to be more strict with that if i did

#

becuase whatever code i allow into there via a pull request could cause all kinds of grief, need to be proper code review on the C++

earnest phoenix
#

But yeah having a way for users to share shit

#

Even if you just throw up a quick bootstrap site would be dope

green kestrel
#

so what you can do now is, you create scripts via the dashboard at sporks.gg

earnest phoenix
#

Ooo

green kestrel
#

then when youre happy with them you can quickly dump them onto codebottle.io (instructions on the wiki)

#

then they show up in the downloader

#

so others can go 'that sounds cool i'll add that in my channels'

earnest phoenix
#

Oh this is fucking cool

#

This is actually insane

#

Jealous I did not think of this

#

Extremely good job man

green kestrel
#

thanks 🙂 i hope you'll help with it

#

if youre really interested i can invite you to my discord... its a quiet place, but hopefully it'll grow

gritty bolt
#

im making a command that uses settimeout for a specific amount of time before preforming an action, so far I have

            message.channel.send("💡 Working...").then((message)=> {
                let days = args[1].substr(0, args[1].indexOf('h'))
                let hours = args[1].substr(days.length, args[1].indexOf("m"))
                let minutes = args[1].substr(hours.length)```
Is this the right way to do this if the command would go sort of like this?

>commandhere 2d23h23m
eternal adder
#

when i get my public eval command i'll be encouraging users to break it aha

sudden geyser
#

does args include the command name?

#

that's kind of confusing

tiny tinsel
#

public eval command 🤔

earnest phoenix
#

Public eval command + Bot administrator

#

Good combo

tiny tinsel
#

eval (bot.token)

earnest phoenix
#

Lol

frank dust
#

Anyone here know how https://discordapp.com/developers/docs/resources/guild#add-guild-member works? I'm trying to make my alt join my guild through oauth but keep getting this error.

Traceback (most recent call last):
  File "/home/geek/Fire/api.py", line 297, in getOauthInfo
    await self.bot.http.request(route, json={"access_token":access_token, "roles":["670811591893188618"]})
  File "/home/geek/.local/lib/python3.7/site-packages/discord/http.py", line 216, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 FORBIDDEN (error code: 50025): Invalid OAuth2 access token```
amber fractal
#

You have an invalid OAuth token

#

you need a proper OAuth token with the guild.join scope

sage bobcat
#

One message removed from a suspended account.

frank dust
#

I do have a valid token with the guilds.join scope though

amber fractal
#

No, you dont

frank dust
#

Yes, I do. I have guilds.join in the scopes in the oauth url and in the scope field when actually retrieving the access token. My bot also has the correct permissions in the guild in question

amber fractal
#

No, clearly you dont because it says you dont

earnest phoenix
#

just because you think it's correct doesn't mean it is 😩

#

you dont have a valid token

frank dust
#

yes I can read what it says but it's incorrect. I have the correct scope, the token is valid, the bot has the permissions it needs.
When requesting /oauth2/token this is the data that's sent

{                                                                                                                          'client_id': 'client_id',                                                                                                 'client_secret': 'client_secret',                                                                                         'grant_type': 'authorization_code',
'code': code,                                                                                                             'redirect_uri': 'redirect_uri',                                                                                           'scope': 'identify email guilds guilds.join'
}``` and the same scopes are provided in the scope parameter of the oauth url. The access token works for requesting `/users/@me` so the token itself is valid
#

Nevermind, someone else was able to tell me the issue

#

definitely made a mistake when asking for help here

amber fractal
#

Then you didnt need to come back here to say that ¯_(ツ)_/¯

earnest phoenix
#

How do I make top 10 leaderboard using MongoDB and discord.js? I tried using this to get the first person’s level but it says cannot find level of undefined.

let lb = await db.collection("users").find({$sort: {level: -1}});
message.channel.send(`${lb[0].level}`);
west raptor
#
{level: -1}```
stable horizon
#

@frank dust don't use the internal system.

frank dust
#

wdym?

stable horizon
#

self.bot.http.request

frank dust
#

what's wrong with that?

stable horizon
#

You shouldnt be using bot.http. Make your own aiohttp.clientsession instead

frank dust
#

ok

balmy lantern
#

Any tips on making a website for your bot?

vital lark
#

@earnest phoenix maybe try find({}).sort({ level: -1 }).toArray()

#

find returns a cursor

earnest phoenix
#

thanks

uneven wyvern
#

How can I find out when a Client got Created? I'm using D.js

twilit rapids
#

Uhh, use the ready event I guess?
Not entirely sure if that's what you mean

uneven wyvern
#

like message.author.createdAt() but for the Client

twilit rapids
#

<Client>.user.createdAt

earnest phoenix
#

does someone here host on vultur

#

if yes then tell my your experience

fluid sapphire
#
client.on('guildMemberAdd', async member => {

    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);

    
    ctx.font = '60px sans-serif';
    
    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');

    message.channel.send(`Welcome to the server, ${member}!`, attachment);
});
```Whats wrong? I don´t know. The bot do nothing
fleet chasm
#

you cant use message in a non message event unless you use it as a variable
instead of message.channel.send get a channel from your bot to send to

summer torrent
earnest phoenix
#

you should also learn to debug

buoyant stirrup
#

for 2 days my bot can't run stable because i can't start it when I tried to start it says shard 0's client took to long to become ready.
yesterday i was able to start but today i have restarted it and it gave same error

quartz kindle
#

you might have something wrong in your code, possibly an infinite loop or a long blocking process

buoyant stirrup
#

but till last 2 days it worked without error

fleet chasm
#

is your token right (might be dumb, but check)

buoyant stirrup
#

Yeah it's right im sure

#

like yesterday it works now

#

but I don't know if it will work tomorrow

earnest phoenix
#
[{id: 0, value: 10},{id: 3, value: 30},{id: 3, value: 100}]
``` How do I get the index number of the object with the ID of 3 which should be "2" using a function?
warm marsh
#

filter or find?

#

That's if you're using JS.

#
// Find
<Array>.find(obj => obj.id === 2);

// Filter
<Array>.filter(elem => elem.id === 2);
quartz kindle
#

or .findIndex() if you want only the index

snow urchin
modest maple
#

read the error

#

at the top

#

undefined

snow urchin
#

there is no "values" in the code

buoyant stirrup
#

you was not fill const

#

@snow urchin

snow urchin
#

i did.. its on the next line

quartz kindle
#

const
ye =

is the same as
const ye =

#

so thats not the problem

snow urchin
quartz kindle
#

now for your problem, look at the stack trace

#

show the full stack trace, with all lines and all information

#

and also which version of discord.js are you using?

earnest phoenix
#

@snow urchin why you had
Discord and discord for the same base module...

sinful lotus
#

a lot of those modules are not needed

earnest phoenix
#

vultr or galaxygate?

earnest phoenix
#

I'm personally going galaxy gate now

topaz fjord
#

galaxygate @earnest phoenix

#

they're pretty cheap and service is great

#

also discord server support >> *

pure gust
#

Anyone able to help me make a simple request function ( to request a web file ( http://ip/:port/info.jason ), and make it - if it gets a response a variable is set to true ( online ) but if no response its set to false ( offline )

FYI - its for a discord bot to see if a game server is online or not.

modest maple
#

whatttt languagee

pure gust
#

javascript

#

like node.js and discord.js im using

sinful lotus
#

its still functions

#

its just a wrapper around functions

sage bobcat
#

One message removed from a suspended account.

sinful lotus
#

depends on your choice

#

for example

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sinful lotus
#

I have this class in my code, I named it VoteManager.
Constructor contains the properties of your class, which can be accessed inside or outside the scope of that class.

it has methods, which is basically functions of that class.

sage bobcat
#

One message removed from a suspended account.

sinful lotus
#

no because you didnt put the constructor right

sage bobcat
#

One message removed from a suspended account.

sinful lotus
#

if you extend a class, and you want to put custom properties inheriting the props of the original class

#

you need to use super() inside constructor() {}

sage bobcat
#

One message removed from a suspended account.

sinful lotus
#

if you dont need to add anything on constructor,

class Owo extends baseOwO {
  owo() {
     console.log("OwO")
  }
}
#

also still wrong

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

what the hell

sinful lotus
#

Except it has super() inside the constructor, which contains the parameters of the original class you extend

sage bobcat
#

One message removed from a suspended account.

sinful lotus
#

basically if I extend a class that accepts one parameter, and I have extra parameter on my extended class

sage bobcat
#

One message removed from a suspended account.

sinful lotus
#

yes of the class you extended

#

while the class that extends from it can have its own parrameters, or use it also to pass the parameters bla bla your choice.

sage bobcat
#

One message removed from a suspended account.

sinful lotus
#

no

#

super is your base class

quartz kindle
#

super = constructor of the base class

sinful lotus
#

there ^

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

constructor of the extended class = base class + new class

sinful lotus
#

or your extended class params only if you decided to put the params of the base class directly to super

#

but usually its like what Tim said above

past pike
#

hey guys i have a question
i want to make a command for fun to check if someone is gay. just for fun
i use this command right now: if (message.content == "!disco is gay") {
But if i type in chat: !disco is person gay I don't get a response.
Someone know how i can fix it? I already searched on the internet but nothing is working

#

It's Discord.js btw

copper cradle
#

change == to ===

#

and try again

#

also

#

send code

topaz fjord
#

imagine using ==

copper cradle
#

ikr

#

wait

topaz fjord
#

also

copper cradle
#

are you tryinh to tun !disco is person gay

topaz fjord
#

That of statement won't run

#

*if

copper cradle
#

or !disco is gay

past pike
#

the first one, i want the message includes !disco is gay, but if i type !disco is person gay, i also get a response. Of course replace "person" with another words

topaz fjord
#

your probably gonna need to use regex to parse that

copper cradle
#

yeah

#

it's checking if the string is !disco is gay

#

nothing else

past pike
#

cannot i replace message.content to something else?

copper cradle
#

well yes but what would be the point

#

just get the person as an argument

#

not as part of the command

earnest phoenix
#

just build a proper command handler 🙃

copper cradle
#

^

past pike
#

and I know what a "proper", "parse" and "regex" means

#

not

copper cradle
#

not what?

past pike
#

i don't even know what proper, prase and regex is

copper cradle
#

just google it

#

I'm not gonna spoon feed ya

faint hare
#

hello folks

eternal adder
#

Does discordjs not have a command handler?

earnest phoenix
#

a built in one? nope

#

there's an addon package someone made i think

eternal adder
#

Ah
Discordpy does, released not too long after the rewrite

earnest phoenix
#

it's the reason why so many d.js bots are shit and often break when handling commands

copper cradle
#

yeah

past pike
#

so? i still use it

quartz kindle
#

its a problem of logic, no need for whatever, just think about it logically

#

message.content === whatever means the message content must match EXACTLY that, not a letter more nor less

#

on the other hand, you can use built in functions such as .startsWith() to check if the message starts with a given content, but not care if you have any extra content in it afterwards

#

so you can use it like if(message.content.startsWith("!disco is gay")) and then get the person afterwards (you need to use the command like this !disco is gay person)

#

if you really want to use it like this !disco is person gay then its more complicated, because you need a more complex matching approach

#

for exameple if(message.content.startsWith("!disco is person") && message.content.endsWith("gay"))

#

but keep in mind that this will make the command fire for any message that starts and ends like that, regardless of the middle content

#

for example !disco is person iEfçuwefoh ouhfqohep qiepiqwep iqwjpei jqpwiejpqiwje pqiwgay

past pike
#

hmm

quartz kindle
#

so then you need another line to check if the content supplied, regardless if in the middle or at the end, is a valid person

past pike
#

then i replace the command so i only need to use message.content.startsWith

#

and a rich embed message

#

i know how i can fix it now

faint hare
#

Is doing a command handler that hard ?

past pike
#

I already fixed it in another much easier way

west raptor
#

making a simple command handler isn't that hard

near ether
#

Is there a reason why my bot is not sending heartbeats?

modest maple
faint hare
#

BTW thanks for the .startsWith

#

I was doing this:
if(message.content.substring(0, Settings.CommandPrefix.length) != Settings.CommandPrefix){return;} // Check for prefix.

blissful scaffold
#

My prefix check is also case insensitive, so it doesn't matter if you write it with capital letters or not

eternal adder
#

@near ether you've got blocking code

manic terrace
#

i'm having trouble with an error:

DiscordAPIError: Missing Permissions

is popping up when my bot tries to delete a message

#

what permissions does a bot need to do that?

eternal adder
#

"manage messages"

manic terrace
#

nice, thanks! my link had that permission but i think i accidentally turned it off in the role permissions

earnest phoenix
#

you should always check for required permissions in code before executing the action

west spoke
#

^

#

Main reason why I dont have any things that delete messages

manic terrace
#

basically the bot just deletes the user's command to keep the channel from flooding, so it only deletes the message with the command

west spoke
#

Why would it flood?

#

that's such a bad idea tbh

#

but go ahead

eternal adder
#

What's wrong with deleting the command itself?

earnest phoenix
#

you're stacking another request on top of the requests the actual command does

#

and i dont know for others but i personally get annoyed when my cmd invocation gets deleted automatically

mossy vine
#

is this man tryna raid or something

restive silo
#

@modern sable

mossy vine
#

@modern sable

#

oh yukine already pinged

modern sable
#

tonkku faster

viral spade
#

Say i have multiple nodejs containers, each container has an id and a sharding manger. Each containers sharding manager only starts one shard with the given id, thus each container is running one shard.

Is the sharding manager even necessary? Cant i just only start the bot and assign the correct guilds with the given shard id in an easy way, without using the sharding manager in between?

manic terrace
#

the bot is ttrpg related, leaving the command in the channel just kinda takes ya out of it

late hill
#

You can connect to the gateway using just 1 specific shard

#

So if the library you use supports that, you won't need the sharding manager

still merlin
#

How would I make a bot exacly work

#

Becuase i created code in node.js

#

how do I like make my bot see the code

#

or do I need to write something to do with my bot

modest maple
#

you'll need to get your bot token and add it to your code

#

and then run the code itself

#

i cant rlly help u more than that cuz im a python boii

earnest phoenix
amber fractal
#

This needs to be pinned

faint hare
#

i'm saving this

vocal coral
#

do you have any tips for making a moderation bot?

mossy vine
#

dont

#

there are more than enough

earnest phoenix
#

I mean they could be wanting to make one for a private server, I've done that, but I don't know whether they intend to publicize it, I'm assuming they do

regal saddle
#

anyone uses Python here?

slender thistle
#

Just state your issue

regal saddle
#

How can i automaticly delete Bot usage?

#

like when somebody writes !help, and after the output the !help gets deleted.

quartz kindle
#

check the docs for the delete method

modest maple
#

its <message object>.delete()

quartz kindle
manic terrace
#

message.delete([timeout]);

#

time out is in milliseconds

#

put 0 or just do .delete() for instant delete

regal saddle
#

wait gimme sec

#

ill test it in 1 sec

modest maple
#

rip tim

regal saddle
#

Discord is heading out notlikenoot

delicate zephyr
#

@earnest phoenix

earnest phoenix
#

yes

delicate zephyr
#

So I'll explain it to you

earnest phoenix
#

Ok I appreciate it bro

delicate zephyr
#

dude

#

Im explaining it to him

#

Im not spoonfeeding

#

smh

manic terrace
#

fair

regal saddle
#

spoonfeeding lol pogchamp

delicate zephyr
#
// If Statement Begin
// First we check the channel type
if (msg.channel.type === 'dm') return // return stops the code here as it forces the function to return a value and stop running any further

How if statements work:

if (condition) {
  // Do stuff
}
#

@manic terrace

#

this is a good example of how you should go about giving people code

#

@earnest phoenix ^ Example + explaination

regal saddle
earnest phoenix
#

When will my bot be verified?

regal saddle
#

about 2 weeks bro

quartz kindle
#

when the mods verify it

regal saddle
#

Tim with the 200 IQ move

#

xD

earnest phoenix
delicate zephyr
#

@regal saddle Bot approval can take up to 1-2 weeks. It can take longer than this so please be patient. If you have any further concerns please feel free to DM a moderator

quartz kindle
#

should work btw lukas, try it

earnest phoenix
#

@delicate zephyr Thanks for your help I will try to make it work;)

regal saddle
#

why got i tag?

delicate zephyr
#

oh oof

quartz kindle
#

luke pinged the wrong person

regal saddle
#

I didnt asked for that lul

delicate zephyr
#

@earnest phoenix Bot approval can take up to 1-2 weeks. It can take longer than this so please be patient. If you have any further concerns please feel free to DM a moderator

#

because I shift click the persons name

#

and Chat moved up

earnest phoenix
#

I'm noob xd

regal saddle
#

no prob doe bud

earnest phoenix
#

;-;

quartz kindle
#

in the mean time make sure your bot works and is online most of the time

#

else it will be rejected

sterile minnow
#

And check modlog for declines to check if ur bot does the Same that u can fix it that u'll get approved

regal saddle
#

what about autorole, mine does not work in python 😦

sinful belfry
#

Does anyone know if there is any restriction to logging in to two different clients with the same api token at the same time

modest maple
#

your bot will just trigger at both code

sinful belfry
#

So there’s no restrictions that you know of in terms of discord api rules

restive karma
#

Pls beg

eternal adder
#

@sinful belfry don't abuse it, for example too many requests will result in your token being revoked a new one bring made, repeat offenses will get your account banned from api tokens

sinful belfry
#

Ok so the only restriction I really need to worry about is the amount of requests that are made by both clients in total?

eternal adder
#

Basically, yeah. Why would you need two connections though?

modest maple
#

@sinful belfry there is a limit into how many times you can connect in a time frame

eternal adder
#

@modest maple that comes under the requests I stated

modest maple
#

if your sharded dont do it because you'll almost instantly get blocked out

#

one shard per 4 seconds is the rate limit iirc

sinful belfry
#

Ah ok thank you.

eternal adder
#

Sharding is needed at times, discord has docs about it. I'll get a link. But why do you need two connections?

modest maple
quartz kindle
#

the limit is 1000 logins per day

#

doesnt matter from where you login

#

i often login from my computer while my bot is running in a vps

sinful belfry
#

Basically my bot has a music command but whenever another command is carried out, the music stutters badly. It’s hosted on glitch and has limited memory. I was thinking of separating the music processes so they are not affected.

quartz kindle
#

yes you can do that

modest maple
#

you will still get the issue most likley

quartz kindle
#

and yes ^ most likely

modest maple
#

music bots take up more ram than other bots so just moving it isnt gonna make much diffrence

quartz kindle
#

and cpu for decoding/transcoding audio streams

sinful belfry
#

Well I mean like moving it to a completely new project.

modest maple
#

still wont help

#

you get a VERY limited amount of reasorces with glitch

quartz kindle
#

well, it will help in his particular situation

sinful belfry
#

Oh so music bots on glitch just aren’t great?

quartz kindle
#

he said his music only stutters when another command is used concurently, so yeah, it will help for a bit

modest maple
#

maybe

quartz kindle
#

but once multiple music commands start running, its gonna crap itself again

#

glitch is good enough for small/light bots

#

but not good enough for music bots

sinful belfry
#

Oh ok.

#

Thanks for the help.

quartz kindle
#

but feel free to try it

sinful belfry
#

I will look into some other ways of resolving this then.

#

Yeah I will check it out and see what happens.

still merlin
#

I use glitch

#

I keep coming across a glitch in glitch, "discord.js; "3" wont work for me

regal saddle
#

its python

modest maple
#

because you need to await stuff

regal saddle
#

i have

modest maple
#

no you havent

regal saddle
#

im retarted i guess

modest maple
#

delete needs awaiting

eternal adder
#

@regal saddle you need to await almost anything you do with the discordpy library as it's all async

modest maple
slender thistle
#

almost entirely async

still merlin
#

Hey ハーリ-さん (CF8) thanks so much for telling me what to do

modest maple
#

i dont do js so i have no idea what you expect me todo

#

nor do i use glitch

regal saddle
quartz kindle
#

@still merlin what do you mean with that? post your code

#

@regal saddle in the message.delete as well

regal saddle
#

bruh.

modest maple
#

we did tell you

regal saddle
#

python kinda weird

modest maple
#

delete needs awaiting

#

and its not

#

its logical

still merlin
#

I ment like how to get my bot to work

modest maple
#

you need to await a promise

still merlin
#

like with a token lol

quartz kindle
#

python is weird, hes right

#

lmao

still merlin
#

I'm using node.js

eternal adder
#

It's not. Either you await it or you have issues with blocking code

still merlin
#

Umi Bot will be in the working soon I'm exited to see what I can do

modest maple
#

well i mean you have to await futures

eternal adder
#

Seeing as discordpy has loads of networking, you'd end up disconnecting from the api almost instantly

quartz kindle
#

@still merlin we cant help you if we dont know what the problem is. post your code, show us what you tried

still merlin
#

Uh lol I have no problem I was helped

modest maple
#

@eternal adder you say it has loads of networking but it is essentially a wrapper for just alot of post and get requests

#

not exactly loads of networking

eternal adder
#

Post and get requests are networking @modest maple

modest maple
#

thats not really loads

quartz kindle
#

what exactly happens if you dont await an async function in python? does it not execute at all?

modest maple
#

it'll throw an error

regal saddle
#

oh bruh im very dodo its await message.delte() im very very dumb rn

modest maple
#

because the code will expect it to return instantly

quartz kindle
#

what if you want to run concurrent async functions?

modest maple
#

you have a event loop

#

and just create tasks

eternal adder
#

Await makes the particular function wait, not the rest of the bot

quartz kindle
#

because like

modest maple
#

await just tells the code to ignore it for a bit and wait for the promise

quartz kindle
#

in javascript, if you dont use await, it wont stop the function from working, it will still work, just your code will not wait for its return

modest maple
#

asyncio is very strict in what you can and cannot do

quartz kindle
#

so if you want to run it and do something else in the mean time you have to explicitly create a task

modest maple
#

if everything is async you can run thousands of tasks concurrently on a single thread if done well

regal saddle
#

await just tells the code to ignore it for a bit and wait for the promise
ah i understand, thx mate

lean palm
#

hey bois is there any website that gives like a general list of capabilities that every bot should have?

quartz kindle
#

there is no such list

lean palm
#

damn

quartz kindle
#

there are guidelines

#

which you should follow

eternal adder
#

In my case, if someone wants me to do it, I'll try

quartz kindle
lean palm
#

thanks

modest maple
#

like

if you wanted to run multiple things concurrently you can do

loop.create_task(func1())
loop.create_task(func2())
loop.create_task(func3())
loop.create_task(func4())
loop.create_task(func5())
loop.create_task(func6())
loop.create_task(func7())

#

and that will run the 7 functions concurrently in the same thread

earnest phoenix
#

Would you know how to make the bot send a file in file mode?

quartz kindle
#

and how would you wait for all of them to complete?

regal saddle
#

message.delete() works thx tim and the other wierd name.

earnest phoenix
slender thistle
#

hey bois is there any website that gives like a general list of capabilities that every bot should have?
Too many bots have the same features so you should rather focus on something unique if you want to make a public bot

#

Imagine not reading content inside parentheses

lean palm
#

yea i have my own features

modest maple
#

if you want to wait for somthing to complete you can use asyncio.wait_for(function, checks=xyz, timeout=n)

lean palm
#

but like i was just thinking in general

modest maple
#

and that will pause the code but not block the other tasks while you wait for one thing to come back

quartz kindle
#

@modest maple i mean, awaiting for a list of concurrent async tasks to complete

modest maple
#

oh the task loops do that automatically

quartz kindle
#

ah cool

modest maple
#

you can use .gather() to get any results from any corutines

#

or if its a one task you could do loop.run_until_complete()

quartz kindle
#

like, in javascript i would do let a = asyncFunction1(); let b = asyncFunction2(); let results = await Promise.all([a,b])

#

just curious about how python would handle something similar

modest maple
#

you can use all sorts of things

#

you can get it to return any values it has mid way through a task or wait until its full complete or just keep looping that task over and over and just keep receiving the futures

#

has pretty much everything on running tasks concurrently ^^

regal saddle
#

message.delete([timeout]); is timeout in secs or milliesecs?

modest maple
#

you dont pass timeout there?

regal saddle
#

yeah timeout = numbers like 1 or 2

modest maple
#

oh there is the ability to add a delay huh?

#

i didnt notice that

regal saddle
#

yeaj

slender thistle
#

Since like 1.2.x

regal saddle
#

yeah*

slender thistle
#

Though isn't kwarg delay

modest maple
#

it is

slender thistle
#

Yeah because it is is totally the same as isn't, thank you keyboard

modest maple
#

xD

#

i read it like isnt it ...? dw

#

ive been slowly making a new command handler and cog system

eternal adder
#

Why not use the provided command handler?

modest maple
#

because it doesnt do very well with process handling and thread handling

#

/ it doesnt really do it at all

eternal adder
#

Interesting

quartz kindle
#

i think .gather is what i was looking for

modest maple
#

yh

quartz kindle
#

python is weird

#

lul

slender thistle
#

Petition to make "pythonic" an official synonym for "weird"

quartz kindle
#

lmao

#

i think php still wins that title tho

sudden geyser
#

str_len

blissful scaffold
#

7

quartz kindle
#

Unexpected T_PAAMAYIM_NEKUDOTAYIM

still merlin
#

Anyone ?

quartz kindle
#

disable code grant in your discord developer settings

blissful scaffold
quartz kindle
#

i knew php was bad, but never though it was this bad lmao

valid holly
#

Anyone tried to read serac emotes from messages ?

quartz kindle
#

is it a custom emoji?

valid holly
#

Yes.

#

Client should read custom emojis within the client or guild.

#

But someone did it, he managed to read emoji id's outside the client.

#

I mainly want to use it to display the full res .png

#

I know I can get the ID from a MessageReaction object.

#

Thus you'ld react with the emote to the bot's message, then the bot would reply with the full res link.

#

^ That's the only way around I suppose, but I was just wondering if anyone tried to read the id from a message object.

quartz kindle
#

@valid holly you can literally make an url from the id

valid holly
#

Yeah, URL stays the same, ID is unique

#

How to read the ID tho ?

modest maple
#

You get emoji

#

Via regex or what ever means

#

Then use some string minipulation and bingo

valid holly
#

I was thinking the same, strip the characters but the emoji.

quartz kindle
#

the id comes in the message

modest maple
#

^

valid holly
#

hol up

modest maple
#

Tim you tried

#

XD

quartz kindle
#

fek

modest maple
#

I can't do it on mobile

quartz kindle
modest maple
#

XD

quartz kindle
#

lmao

#

moderns problems require modern solutions

#

anyway, thats what your bot sees, so just get that number and build the url

valid holly
#

🤝

quartz kindle
#

interestingly, the url works with png, jpg, jpeg and webp

#

and gif if animated

valid holly
#

Shite, I need to read that too and make the exact URL.

quartz kindle
#

https://cdn.discordapp.com/emojis/ID.format

valid holly
#

Now how to determine the file type 😫

warm marsh
#

regex?

quartz kindle
#

all file types work

#

you just chose whichever you want

#

you can also set a specific size, from 16 to 128 (in multiples of 16)

quartz kindle
#

128 is the max for emojis

valid holly
#

🤝 @quartz kindle @warm marsh

valid holly
#

smol

quartz kindle
#

the jpg version is horrendous

warm marsh
#

Why'd I get mentioned?

quartz kindle
#

lmao

valid holly
#

I don't really use JPEG format in anything

#

As it uses different compression from PNG

sudden geyser
#

ew

#

png > jpg

quartz kindle
#

depends

#

there are many use cases where jpg > png

valid holly
#

Unless processing photography, everything else that's graphic I mainly use PNG

quartz kindle
#

i use jpg for everything that doesnt use transparency

#

and doesnt require pixel-perfect compression

#

for everything else there is quantized/indexed png-8

manic terrace
#

tiff > png > jpg

quartz kindle
#

lul

modest maple
#

Tiff is only rlly useful for uncompressed image renders

quartz kindle
#

bmp > all

manic terrace
#

basically yeah; tiff is best for uncompressed images with an attached ICC

outer niche
#
```    ```@bot.event
async def on_member_join(member):
            channel = bot.get_channel(591627450853621771)
            await channel.send("Welcome to the server {}. Glad to have you!".format(member.mention))
            role = discord.utils.get(member.guild.roles, id="@<@&591626978050834487>")
            await member.add_roles(member, role)```
sudden geyser
#

that ain't no snowflake sir

earnest phoenix
#

read the error

quartz kindle
#

is this normal?

#

i dont python

valid holly
#

🤮

quartz kindle
#

should it be just id="NUMBER"?

valid holly
#

@outer niche keep only sknowflake 591626978050834487

outer niche
#

ooooooo oof

quartz kindle
#

and not id="@<@&NUMBER>"

#

lmao

valid holly
#

Prolly he tried getting the ID manually and copied everything

sudden geyser
#

tbh if python allowed @<@&> I'd be worried

valid holly
#

Just toss everything into the script hoping it holds up ASsadcat

quartz kindle
#

speaking of which, discord's recent update with the <!id> made my bot stop working

#

because my mentions were all wrong

#

lmao

sudden geyser
#

what did they change? removed the !?

quartz kindle
#

i've been using <!@> instead of <@!> in forever

#

no they enforced it

outer niche
#

still did not worck

valid holly
#

What's the log ?

outer niche
#

discord.errors.NotFound: 404 NOT FOUND (error code: 10011): Unknown Role @bot.event async def on_member_join(member): channel = bot.get_channel(591627450853621771) await channel.send("Welcome to the server {}. Glad to have you!".format(member.mention)) role = discord.utils.get(member.guild.roles, id="591626978050834487") await member.add_roles(member, role)

quartz kindle
#

it should be await member.add_roles(roles, reason=somereason, atomic=true/false)

#

not add_roles(member,role)

manic terrace
#

(anyone have a good source on how to handle promise catching? i am kind of lost on where to put them?)

sudden geyser
valid holly
#
try{
} catch {
}
quartz kindle
#
try {
  await promise()
} catch(e) {

}

or

promise().then().catch()```
#

if you use await, it will behave as sync code, and exceptions will be caught by try/catch

#

else, use .catch()

outer niche
#

NameError: name 'roles' is not defined await member.add_roles(roles, reason=somereason, atomic=true/false)

valid holly
#

bruh........

quartz kindle
#

dont copy and paste without reading...

manic terrace
#

thankees

quartz kindle
#

@outer niche

#

read

vital lark
#

I don't think most bot devs don't know how to read docs

valid holly
#
await member.add_roles(role, atomic=true)
outer niche
#
async def on_member_join(member):
            channel = bot.get_channel(591627450853621771)
            await channel.send("Welcome to the server {}. Glad to have you!".format(member.mention))
            await member.add_roles(role, atomic=true)
            role = discord.utils.get(member.guild.roles, id="591626978050834487")
            await member.add_roles(roles, reason=somereason, atomic=true/false)

``` so this
valid holly
fallow mango
#

how get wavelink

vital lark
#

what

valid holly
#

Omg this channel is aids

fallow mango
#

how get wave link

vital lark
#

sometimes, yes it is

valid holly
#

I'm really sorry for the people who read it and try to help

turbid obsidian
#

Hi

vital lark
#

hello

fallow mango
#

again how do i install wavelink

valid holly
#

@fallow mango this you mean ?

fallow mango
#

no

#

not hair

#

not literal waves

valid holly
#

ok

fallow mango
#

hey GREEN NAMED PEOPLE How get WAVELINK

vital lark
#

he means lavalink

fallow mango
#

YES

#

FINALLY

vital lark
#

you need a lavalink server

fallow mango
#

how get that

valid holly
fallow mango
#

i mean liike i need wavelink i use python

modest maple
#

You just do pip install wavelink iirc

vital lark
#

you still need a lavalink server

modest maple
vital lark
#

to connect to Lavalink

modest maple
#

And yes you do still need a lava link server

#

And depending on size will probably want a decent knowledge of network to config ipv6

fallow mango
#

i have ipv4

#

yes ik

#

it sucks

#

ipv4 and wireless connection *Me going crazy: ahahahahajha

modest maple
#

I mean ipv4 and WiFi are two different things completely

#

XD

fallow mango
#

ik that

#

(kinda)\

valid holly
#

naaah I'm out kek

manic terrace
#

hey green named people here is a new thing. i gave my bot the MANAGE_MESSAGES permission, but when it deletes a message i catch an error that says DiscordAPIError: Missing Permissions in the log.

#

the good news is that i guess i set my catch up right, cause it worked

tiny tinsel
#

@manic terrace The message is self explanatory.

fallow mango
#

Collecting wavelink
Downloading wavelink-0.3.5-py3-none-any.whl (20 kB)
ERROR: Could not find a version that satisfies the requirement iirc (from versions: none)
ERROR: No matching distribution found for iirc

#

help

#

Collecting wavelink
Downloading wavelink-0.3.5-py3-none-any.whl (20 kB)
ERROR: Could not find a version that satisfies the requirement iirc (from versions: none)
ERROR: No matching distribution found for iirc

modest maple
#

Does it actually have it on its role tho

#

And it will change on different servers

earnest phoenix
#

Does anyone know any code for the bot to have as an accountant? my idea is that if someone buys my vip, if he says! vip @user to tell him how many days he has left, you would help me a lot with your help.

vital lark
#

we're not spoon-feeding / giving code

modest maple
#

We don't spoonfeed here sorry

valid holly
#

🥄

fallow mango
#

Collecting wavelink
Downloading wavelink-0.3.5-py3-none-any.whl (20 kB)
ERROR: Could not find a version that satisfies the requirement iirc (from versions: none)
ERROR: No matching distribution found for iirc

#

what does this mean

modest maple
#

Means it can't install wavelink

#

What version of Python r u using?

fallow mango
#

1.3.0a

#

i mean

#

the latest

modest maple
#

python

fallow mango
#

ik

#

im using latest version of python

#

and pip

modest maple
#

3.8?

fallow mango
#

again

#

latest

lean palm
#

is there a way to pipe a live audio stream to a dispatcher?

modest maple
#

Use somthing like ydl or lavalink for streaming audio @lean palm

lean palm
#

k

fallow mango
#

again
latest

modest maple
#

@fallow mango can you actually check cuz it makes alot or difference

#

The EXACT version

fallow mango
#

oh 3.7

modest maple
#

Welp that rules out one possibility

#

Version is okay

#

Don't go to 3.8 cuz it fucks more stuff up

fallow mango
#

then why not able to installs???

modest maple
#

What command did you use to install it again?

fallow mango
#

i used the command my freind told me

#

and

#

Collecting wavelink
Downloading wavelink-0.3.5-py3-none-any.whl (20 kB)
ERROR: Could not find a version that satisfies the requirement iirc (from versions: none)
ERROR: No matching distribution found for iirc

#

bam errors

modest maple
#

What command did you use

#

No point saying

#

The one my friend told me

#

Cuz that doesn't help

fallow mango
#

pip install wavelink iirc

tiny tinsel
#

pip install wavelink

fallow mango
#

got it

#

now i need a lavalink server

#

how get that\

modest maple
#

Read through the docs

#

They explain getting started and using wavelink

tiny tinsel
fallow mango
#

k thx

tiny tinsel
#

Scroll down you'll find an example.

modest maple
#

Ngl I never thought I'd have the day where I quickly download wavelink on my phone to test somthing xD

tiny tinsel
#

The problem is wavelink iirc doesn't exist.

#

It is wavelink

modest maple
#

XD

fallow mango
#

IT USES COGS

#

N9OIOOOOOOOOOOOOOOOOO

modest maple
#

That doesn't rlly effect much

fallow mango
#

o

#

it the bot class

#

im fine

#

i use client

#

it was specifing stuff

modest maple
#

The basic setup is stil the same in terms of connecting and make a LL server in initialisation

fallow mango
#

it uses cogs

#

i dont

#

i no nothing of cogs

#

i

#

i

#

i

modest maple
#

Stop spamming

#

First off

#

Second off

#

Read the actual code

#

You don't need to know how cogs work to understand where it's creating the server and making the connections

fallow mango
#

i dont see anything about lavalink server

fallow mango
#

i neeed a vps now dont i

stable horizon
#

No?

fallow mango
#

i understand nothing

stable horizon
#

You need to run another process

fallow mango
#

my brain is smaller than an aom

#

atom**

stable horizon
#

That doesn't constitute requiring a vps

modest maple
#

I think you might wanna take a raincheck on making a music bot and get more comfortable with python OOP

#

Cuz it's really not the most advanced thing in the world to setup

stable horizon
#

Errr

fallow mango
#

😦

stable horizon
#

Python doesn't have a ton to do with the ll server

modest maple
#

Wavelink allows you to create the LL nodes

#

It is just calling functions from classes

eternal adder
#

I'd strongly recommend switching to using cogs and if you're not using rewrite, switch to that

modest maple
#

You have to use cogs, it makes some stuff simpler but can limit more complex stuff

#

But then again he's not rlly doing complex stuff

eternal adder
#

You don't have to use cogs
And cogs can do everything you can do without

earnest phoenix
#

Um, any tips to reduce memory?

vital lark
#

wdym

earnest phoenix
#

The VPS' memory.

#

it is going crazy

stable horizon
#

Cache less things

sudden geyser
#

check what memory-intensive work you're doing and see if you can make it better

topaz fjord
#

don't use d.js

sudden geyser
#

eris gang

topaz fjord
#

any other lib than d.js gang

vital lark
#

yes

earnest phoenix
#

why is eris more memory saving than djs?

outer niche
#

Can anyone point me in the right direction for making a ticket system in discord.py

earnest phoenix
#

?

vital lark
#

because Eris doesn't cache as much

#

you'll have to do a lot of heavy modification to get less memory in discord.js

earnest phoenix
#

is it possible to reduce chaching in d.js? because switching to eris is kinda hard

vital lark
#

uh

slender thistle
#

@outer niche imagine the ticket system in your native language, apply logic and common sense

topaz fjord
#

bruh

viral spade
#

How can i check if my bot can send messages to a user?
So i can avoid getting "DiscordAPIError: Cannot send messages to this user"?

#

(discordjs)

earnest phoenix
#

check if the bot has the SEND_MESSAGES permission

last lava
#

Are all discord users' ids 18 chars long?

amber fractal
#

No

#

Early ones can have less

#

Newer ones can have more

last lava
#

okay thx

vital lark
#

@viral spade try doing it in a try/catch block

valid holly
#

No

#

@earnest phoenix SEND_MESSAGES is permission owned by a GuildMember

#

He is trying to send a message to an User

last lava
#

as in dm? nvm

valid holly
#

Best way to do it is to send the message to the user then() catch() the Promise Rejection

vital lark
#

or use a try/catch block

#

which does the same thing

valid holly
#

Or use Noel’s method

#

Yup

earnest phoenix
#

Yes its owned by a guild member but you can check if the bot has that permission

#

At least in djs

#

Idk about other things

valid holly
#

Read the docs

vital lark
#

why would you check permissions in a private channel

last lava
#
if(!message.channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
``` I just did this for an earlier proj
valid holly
#

DMChannels are messages between 2 users

#

Users don’t have permissions

#

Permissions are only relative to guild channels and members

earnest phoenix
#

Oh he wants to know if the bot can send messages to a USER, I'm as dumb as rock

#

._. Sorry about that

outer niche
tiny tinsel
#
test
``` @outer niche like this?
#

@outer niche Try SH markdown.

outer niche
#

@tiny tinsel can't seem to get it to work

tiny tinsel
#

@outer niche

Because It is syntax highlight ermm.

outer niche
#

what

tiny tinsel
#

It is shell highlight.

outer niche
#
hi```
#

still no

tiny tinsel
#

@outer niche Wait

#

Try diff -message

outer niche
#
hi
tiny tinsel
#
-We do not provide hosting for bots
#

You need the - though.

outer niche
#
-hi hi hi
tiny tinsel
#

Make sure there is no whitespaces after diff.

glad charm
#
-We believe in you```
outer niche
#
-yaaaaaaayyyyyyyyy
tiny tinsel
#

That's what Discord use for syntax highlight.

#
# Test
#
- Hey
outer niche
#

@tiny tinsel i can not fined how to get blue

tiny tinsel
#

markdown

outer niche
#

what

tiny tinsel
outer niche
tiny tinsel
#

But just check highlight.js you have all available languages because that's what Discord use.

outer niche
#

that website is cunfusing

tiny tinsel
#

Just go to languages

#

common (38) I think

#

Or something like that.

outer niche
#

Yeah except I don't know how to like read any of that stuff in there

tiny tinsel
#

You don't have to. Just check the highlights.

outer niche
#

I have no idea what is I highlight in there and what is not

manic terrace
#

whats it called in javascript when you want your bot to do something if it has permission and then do the next thing, OR skip the first thing and still do the second if it doesn't have permission

#

like basically i want the bot to:

listen for the command -> check to see if it has permission to delete the member's command, and do it if it can -> do the command. but if the bot does not have permission to delete the member command, i still want it to execute

#

right now the bot listens for the command, and attempts to delete it. if it cannot delete, it catches the error and tells the log, then executes the command. i'd like for it to skip trying to delete if it cant

sudden geyser
#

if (...) {...} else {...}?

#

it's confusing for me to understand

bright karma
#

when I want the bot to delete a message I just do message.delete().catch(() => null) because this will catch the error and continue execution even if the bot wasn't able to delete the message GWaobloChildPepeShrug

manic terrace
#

and it doesn't clog the log with the error stack?

#

cause that's also fine.

#
if (message.content === `${prefix}two stats`) {
        message.delete([0]).catch(err => {
        console.log('Two Stats Bot could not delete a command!\n' + err.stack);
            });
        message.channel.send(`\`${message.author.username}\` ${grammar.flatten('#statSentence#')}`);
        }
#

here's the full command, to maybe help make sense

bright karma
#

if you don't want it to output a stack then you don't need to add the console.log('Two Stats Bot could not delete a command!\n' + err.stack); part. You can just do .catch(() => null) to have it silently fail.

Also you don't need that [0] because delete takes an object of options. { timeout: number, reason: string } (on master)
it takes just a number on stable for timeout

manic terrace
#

giving it the null is a fine solution, thanks! curious though, if i wanted to learn how to do something like if (...) then (...) else if (...) OR (...) what would i google?

#

shit that's confusing even to me

#

and i wrote it

bright karma
manic terrace
#

i'll take a looksie, thanks again for your help!

trim cape
#

top.gg takes to much time verifing bot

sinful lotus
#

because top.gg staff are also humans that cant keep up with the amount you guys submit to us

valid holly
#

or they are busy watching anime who knows

earnest phoenix
amber eagle
#

Hello everyone! Could you tell me whether it is possible to make hyperlinks in messages in the bot? Suppose there is a special word in the message whose meaning not everyone can understand. If you click on it to receive an explanation or at least send a command to the bot to show a new message with an explanation.

twilit rapids
#

That's only possible inside an embed

#

And that then would be [text](link)

amber eagle
#

Ohh indeed, cool. Thx)

stable horizon
#

or webhooks

delicate zephyr
#

@twilit rapids and webhooks lol

twilit rapids
#

He literly said that he wants the hyperlinks in his bot. Not a webhook...

modest maple
#

@twilit rapids but w bhooke

still merlin
#

Im having a issue with some code, I want to make the bot use some yaml like

Credits -
Gmawolfgames - Founder
Jon - lead dev
*person* - artist
#

it thinks its a command for something else

quartz hill
#

How can I tell if all the shards have been spawn?

#

nodejs

vital lark
#

there should be an spawn evernt

quartz hill
#

I don't know much about this. How should I write something?

vital lark
#

you use it as an event

#

with on with the shard manager

cursive gale
#

hey i am trying to make a application command so when a user types .order it says See DMs and then asks them questions in dms then after they answer all the questions it sends both questions and answers to a specified channel can anyone help?

quartz kindle
#

what part of it you need help with?

#

also what lang and lib

cursive gale
#

d.js and i need help with the message await @quartz kindle

plucky belfry
#

anyone here using python rewrite? cause i need some help

eternal adder
#

I'll do what I can to help @plucky belfry

plucky belfry
#

sure

#

i have a problem making a kick command with permissions

#

im not using cogs or anything

eternal adder
#

Okay. I strongly suggest using cogs as it'll make management much easier, along with the range of decorators it opens up such as permission checks.

plucky belfry
#

i dont understand cogs thats why i dont use them

#

the kick command i made worked only once

#

and then it stopped working

#

even after restarting the bot

eternal adder
#

Otherwise, as far as I'm aware, you'll need to manually check permissions. E.g create a function that you pass a user and permission name to, and it'll return true if the user has said permission.

What stopped working about it? It'll print any errors

plucky belfry
#

the thing is

#

i think my errors are disabled or sum

#

cause i made this checks thing

#

which will like rewrite a error message

#

so now no error messages comes if there is a problem

#

i searched google and tried its tutorial but i cant find the solution

#

there is one solution to make a whole new role and if they have that role they are able to use the kick or ban command

#

but i dont want to do that

eternal adder
#

My discord broke and stopped sending messages, hmm

plucky belfry
#

also

eternal adder
#

Have you got a try/except block?

plucky belfry
#

nope

#

and do you know atom?

#

it doesnt work even if i tried to open it

#

so i downloaded sublime as a replacement

eternal adder
#

I know of it, but don't personally use it.

plucky belfry
#

it just doesnt work all of a sudden

eternal adder
#

I use vsc myself, I can't really give support with other ides

plucky belfry
#

hmmm

#

i should probably learn cogs and maybe read the discord doc a bit more

eternal adder
#

One second

plucky belfry
#

well i will leave my bot in 1.4.1 beta for sum time.

#

btw my entire script is messy

eternal adder
#

Cogs will deal with the mess.

plucky belfry
#

but that would take ages

#

to recode everything

#

to a cog

eternal adder
#

Eg I have moderation in one file, memes in another, so on

It doesn't take too long, copy/paste and a little indent changes

plucky belfry
#

my bot has at least 50 feautures

#

wait wat?

#

copy and paste thats it?

#

i thought they use a different types of terms or sum

eternal adder
#

Most of your code can stay exactly the same

plucky belfry
#

hmmm

#

i will watch tutorials

#

i will implement that on my release bot

eternal adder
#

I definitely suggest swapping to cogs. There's some examples out there that show how, the gist of it is creating classes containing your commands, and in the main file it's a case of bot.load_extension("cog name")

plucky belfry
#

since my bot is able to do many basic things, should i add an economy system?

#

i always had troubles with cogs

#

it usually never worked when i went to more advanced commands

#

and i have a lack of knowledge of cogs which makes it hard for me to troubleshoot the problem

worldly ruin
#

Hey all I need a help me coding how to do it I am beginner and want to learn it can anyone help me

plucky belfry
#

watch tutorial

#

from a guy named lucas

worldly ruin
#

Where

plucky belfry
late hill
#

take courses

worldly ruin
#

Ok thnx sir

plucky belfry
#

watch the rewrite series

eternal adder
#

It's up to you if you add an economy system, for that you'll need a database though in order to store things (don't do what I've done) @plucky belfry

#

Sorry discord broke again

plucky belfry
#

the new series starting from 2018

mossy vine
#

dont start with bot development if youre new to coding

eternal adder
#

^

late hill
#

If you really want to learn to code, take a real course

#

Could be an online course

#

Could even be free

slender thistle
#

Why would you take a look at 2018 tutorials for a maintained library

plucky belfry
#

@eternal adder do i have to buy these databases... also currently my bot is running on my pc, therefore not 24/7... so should i invest in a server?

late hill
#

You won't have much of a need for bot development tutorials if you understand the language you're using

eternal adder
#

You should, yes. And no, you can use existing libraries to store/run everything in one place @plucky belfry

#

Are you in the discordpy discord?

plucky belfry
#

no

eternal adder
#

They'd be far more helpful than here. Want an invite, or?

plucky belfry
#

sure

#

an invite pls

warm marsh
#

Would using a localised map for storing private variables be a performance issue or resource hog? JavaScript.

// SomeFile.js
module.exports = (function() {
  let private = new WeakMap();  
  class SomeClass {
    constructor(data) {
      this.prop1 = data.prop1;
      private.set(this, { prop2: data.prop2 });
    }
  }
  return SomeClass;
})();
quartz kindle
#

why declare a class inside a function?

warm marsh
#

So I can use a WeakMap for private variables.

#

doing:

// ...
let c = new SomeClass({ prop1: 1, prop2: 2 });
c.prop1 // 1
c.prop2 // undefined / salt
quartz kindle
#

if you're using modern js, you can make private variables using #

warm marsh
#

Is there a way to state what version I'm using?

#

As when I googled around before I saw that but I tried it and got an error.

quartz kindle
#

are you using node.js?

warm marsh
#

Yeah

#

13.x

quartz kindle
#

private fields were added in node 12 afaik

#

as for your original question, it wont be a problem, unless you are creating thousands of instances

warm marsh
#

Nah, It's only used once.

quartz kindle
#

because each instance is re-declaring the class

warm marsh
#

It's how I've currently got my Client extension class setup.

#

Private fields are declared inside the constructor instead of anywhere in the class like other languages?

quartz kindle
#

they are declared outside of the constructor

#
class Rectangle {
  #height = 0;
  #width;
  constructor(height, width) {    
    this.#height = height;
    this.#width = width;
  }
}```
warm marsh
#

Alright. I will go try this.

#

Works, Thanks!

topaz fjord
#

oh God that hurts

#

that private field declaration

warm marsh
#

Yeah. I with they used a keyword.

royal bison
#
<img src="https://user-images.githubusercontent.com/44723767/69565051-70d8ae80-0fb4-11ea-9b57-ba4813f05807.png"
            height="125" alt="Akira">
```The height doesn't affect the image at all
scenic kelp
#

try with "125px" or another unit, might be your problem

royal bison
#

didn't seem to work

quartz kindle
#

i cant see the page because your bot is not approved yet

royal bison
#

It appears very different in GitHub 😅

quartz kindle
#

but if you put that img in a blank page, it works properly, and the height is 125

#

so there is css in that page that is interfering with it

royal bison
#

Well I don't really have control over that

quartz kindle
#

you do

#

you are allowed to use css in the description

#

in style tags

royal bison
#

Ill try

quartz kindle
#

css overrides inline attributes

#

you can also inline style attributes in the tag itself

#

style="height:125px"

royal bison
#

ah right thanks

#

Now it's perfect

earnest phoenix
#

hello, is there any code so that a user can only write a command a number of times per day?

modest maple
#

It's called a cool down

quartz hill
#

How can I learn users on all non-bot servers. nodejs

tiny tinsel
#

What?

tulip wave
#

@quartz hill can you explain a bit more about what you are trying to do?

quartz hill
#

My eng very bad :D
I will take the member size on all servers. but no bot only users

tulip wave
#

You can get the the count of all members and take away the bot count

quartz hill
#
let msize = 0;
await client.guilds.forEach((guild) => {
  msize += guild.members.filter(member =>!member.user.bot).size;});

#

I wrote this, but I think it's counting the same user again. If it's on a different server.

trim cape
#

my bot is not approve yet