#development

1 messages ยท Page 730 of 1

spice trail
#

whats up?

torpid river
#

Iโ€™m making a rich embed

#

But

#

Every time I type something it responds with the embed

spice trail
#

code?

torpid river
#

Iโ€™ll get the code now, thereโ€™s the image

spice trail
#

bruh i need like more than just the embed code

#

cuz the error / issue has nothing todo with the embed

torpid river
#

Ooooh aight Iโ€™m not the best at coding ๐Ÿ˜‚๐Ÿ˜‚

spice trail
#

...

torpid river
#

Sorry, Iโ€™m trying to make the whole thing bigger instead of sending multiple pictures..

#

๐Ÿ˜‚but idk how

twilit rapids
#

I assume you have that in your message event

spice trail
#

cant u just C+P

twilit rapids
#

Check if the messages starts with a prefix you want and if the command exists

torpid river
#

mk

spice trail
#

yh i think hes not got it within the command area and its just going off every event

torpid river
#

I have it in with my other commands

twilit rapids
#

Please look up some guides to get started with coding, and then guides to get started with making a Discord bot

torpid river
#

oki

twilit rapids
#

Starting without any coding knowledge is a pain and will not get you far

torpid river
#

Iโ€™ve taken so many tutorials but they donโ€™t explain it sadly

#

Should I bring the embed code into like an embed.js channel?

twilit rapids
#

What?

spice trail
#

no

torpid river
#

Aight

spice trail
#

he means you gotta have the embed only respond to the commands

torpid river
#

Ooooooh

spice trail
#

either comparing the string or using .startswith()

torpid river
#

Ok

spice trail
#

id highly advise learning the basics of your programming language and they dont cover it in tutorials as they expect you to know the basics of indentation and parenthesis

torpid river
#

Oh okay, thanks :)

#

So at the top of my embed command I type msg.startsWith

#

Ant then (command))

#

and*

spice trail
#

yes

torpid river
#

Ok

#

If(msg.startsWith(command))

#

Which I think Is right

spice trail
#

your embed it out of the indentation and parenthesis so its still gonna keep triggering at everything

torpid river
#

Crap

#

Where do I put it?

spice trail
#

well think about it

#

what ever command you have

torpid river
#

I have quite a lot of commands.

spice trail
#

you want it to 'encase' the embed

torpid river
#

Ya

#

and how do I do that ๐Ÿ˜‚๐Ÿ˜‚

spice trail
#

if statement {
stuff
}

#

remind you of anything?

torpid river
#

Oh right..

magic raft
#

development

slender mountain
reef dew
#

How do you make a bot?

spice trail
#

step 1)
go to discord dev portal - Make a application and have it as a bot

step 2)
Learn how to program before even attempting to program a bot

Step 3)
Actually start programming the bot

Step 4)
running the program 24/7 to keep the bot online

quartz kindle
#

step 2b)
give up on step 2 and buy DBM

spice trail
#

NO

#

u wanna make a good bot u do not use DBM

#

xD

grizzled raven
#

nah use botghost

quartz kindle
#

step 2c)
give up on steb 2b and use a template engine like botghost

spice trail
#

2d) you die if you use any other thing other than coding it urself u lazy shites

grizzled raven
#

step 3a) start by opening notepad and make your first index.txt file

quartz kindle
#

step 2d)
give up altogether and pay someone to make it for you

torpid river
#

step 2e)
just donโ€™t make a bot

earnest phoenix
#

step 2.5) rm rf yourself

quartz kindle
#

step 2f)
decide to try again and ask in #development how to make a bot

#

and we have come full circle

torpid river
#

Indeed

quartz kindle
#

circular dependency detected

torpid river
#

And Iโ€™m still here trying to figure out why my embed keeps on bloody repeating itself ๐Ÿ˜‚๐Ÿ˜‚

spice trail
#

send ur code

#

like all of it

#

xD

quartz kindle
#

jar already explained it to you

spice trail
#

using C+P

torpid river
#

Aight

quartz kindle
#

your bot is responding on all messages

spice trail
#

^

torpid river
#

Yup

#

Iโ€™m just so confused

quartz kindle
#

you need to set up conditions for when and why a bot should respond or not respond

torpid river
#

And btw Iโ€™m coding on my computer and using discord on my phone ๐Ÿ˜‚๐Ÿ˜‚

spice trail
#

you rlly should learn how to do basic programming before doing discord libs

quartz kindle
#

cant you open discord on the computer?

#

we prefer copy pasting code than posting images of the code

torpid river
#

Iโ€™ll try

#

My friend told me to do module.exports but they didnโ€™t tell me where :/

quartz kindle
#

thats unrelated

torpid river
#

very

#

ik

quartz kindle
#

module is for separating your program into multiple files

grizzled raven
#

how bouts

torpid river
#

How bouts?

quartz kindle
#

how about no?

torpid river
#

Yes ๐Ÿคฃ

#

Aight Iโ€™m sending the coding now

#

code whatever

quartz kindle
#

dont send your token

#

just a reminder

torpid river
#

I wonโ€™t

compact oriole
#

I didnt understand the power of the token as a starter. I put it on github, after an hour some scraper bot booped my server xdc

woeful patrol
#

When will certifications be open again? ๐Ÿค”

torpid river
#

The only thing close to the token is bot.login(botconfig.token);

quartz kindle
#

there is no ETA for cert afaik

compact oriole
#

I use an .env file

woeful patrol
#

^

quartz kindle
#

but i heard you can send a physical letter o oliy

#

to apply for cert

woeful patrol
#

Ye

compact oriole
#

It costs 5 dollars in Finland

#

Its retarted

#

It takes a month to transfer it

#

In Finland

woeful patrol
#

10 dollars in sweden

#

๐Ÿ˜ฉ

compact oriole
#

And now they are boycotting the only state owned postage

#

X::D:D:AS:D

short siren
#

Wnhat country does Oily live in

compact oriole
#

Netherlands

#

Idk

#

Tonkku on suomalainen

quartz kindle
#

find someone from NL and ask them to send the letter for you

woeful patrol
quartz kindle
#

and give them 1$ via paypal

compact oriole
#

I found it on his twitter

woeful patrol
#

rip i got no friends

compact oriole
#

^ same

woeful patrol
#

i wonder when it will be open again

compact oriole
#

-bots @woeful patrol

gilded plankBOT
compact oriole
#

-botinfo 486208458270703616

gilded plankBOT
#
Bot info
ID

486208458270703616

Username

Alisha

Discriminator

4334

Short Description

A easy bot to use that has: Fun | Misc | Leveling | Logs | Reddit | Music | Images | Moderation and Info commands & a lot more!

Library

discord.js

Prefix

as! sa!

Total Upvotes

129

Monthly Upvotes

40

Server Count

1299 Servers

Owner(s)

@woeful patrol

compact oriole
#

Cool bot mate

woeful patrol
#

meh

#

it can be better

#

can fix my levelup tho

#

๐Ÿ˜ฉ

compact oriole
#

I hope my bot gets accepted

earnest phoenix
#

i think my discord had a stroke

compact oriole
#

S T O N K S.pro

woeful patrol
#

๐Ÿค”

earnest phoenix
quartz kindle
#

Tolfx you can try using an email-to-letter service online lmao

woeful patrol
#

Ye i can

quartz kindle
#

they apparently exist, and cost like 1$ on average

woeful patrol
#

ยฏ_(ใƒ„)_/ยฏ

#
        if (xp === xp1) {
            sql = `SELECT level FROM xp WHERE id = '${message.author.id}'`;
            sql = `UPDATE xp SET level1 = ${level1 + 1} WHERE id = '${message.author.id}'`;
            con.query(sql, console.log);
        }```
#

this wont work for some reason

#

big F

compact oriole
#

I hate sql lol

earnest phoenix
#

orm gang

woeful patrol
#

i could use mongoDB but nah..

quartz kindle
#

why are you creating two queries and replacing the first one with the second one?

compact oriole
#

I use firebase or mongo

woeful patrol
#

i dont know why i have sql = SELECT level FROM xp WHERE id = '${message.author.id}';

#

forgot to remove it ๐Ÿค”

quartz kindle
#

lul

compact oriole
woeful patrol
#

tho it should work

#

but it wont .v.

compact oriole
#

it looks good

#

should work idk

woeful patrol
#
client.on("message", message => {


    con.query(`SELECT * FROM xp WHERE id = '${message.author.id}'`, (err, rows) => {
        if (err) throw err;

        let level1 = rows[0].level1;
        let xp = rows[0].xp;

        
        let sql;

        sql = `SELECT xp FROM level WHERE level = '${level1}'`;

        let xp1 = rows[0].xp1;
        

        if (xp === xp1) {
            sql = `UPDATE xp SET level1 = ${level1 + 1} WHERE id = '${message.author.id}'`;
            con.query(sql, console.log);
        }
    })
});```
compact oriole
#

You should mayby add a timeout, so spam isnt revarded idk

woeful patrol
#

nah

#

gonna reset it later

#

now i have it on my testbot

quartz kindle
#

that SELECT in the middle is not doing anything?

woeful patrol
#

not really just had it there from the last code

#

but is helping xp1

quartz kindle
#

well cleanup your code damnit lmao

woeful patrol
#

but i still need it ๐Ÿค”

quartz kindle
#

but its not doing anything in that code?

#

where are you using it?

compact oriole
#

^^^^^^

woeful patrol
#

to help it define

#

xp1

#

but wont do much

quartz kindle
#

wat

woeful patrol
#

or maybe i could do a con.query actually

quartz kindle
#

is xp1 supposed to be in level ?

woeful patrol
#

yes

#

i got two different xp

quartz kindle
#

because you're getting it from xp

woeful patrol
#

hmmmm

quartz kindle
#

your code is basically this

#
    con.query(`SELECT * FROM xp WHERE id = '${message.author.id}'`, (err, rows) => {
        if (err) throw err;

        let level1 = rows[0].level1;
        let xp = rows[0].xp;
        let xp1 = rows[0].xp1;```
woeful patrol
#

let me change it

quartz kindle
#

you should probably look into using JOINs instead of running query after query

woeful patrol
#

ye just figured

#

xd

#

d

#

d

#

d

#

why does that always happen

quartz kindle
#

wut

woeful patrol
#

I think is working ๐Ÿค”

#

jk

#

it only selects the first level but not the others xd

#

how do you select all rows in a table in mysql?

#

let xp1 = rows[*].xp1; i tried this but clearly wont work :^)

quartz kindle
#

remove the WHERE condition

woeful patrol
#

I only have one

#

only for ID

#

and that one i need kappa

#

it worked fine but it will only update on row 0 not the others

quartz kindle
#

you should do something like SELECT * FROM xp WHERE id = message.author.id LEFT JOIN level ON xp.level1 = level.level

woeful patrol
#

hm i can try

quartz kindle
#

not sure if the syntax is correct for the db you're using, but the idea is to get the relevant entries from both tables and return them to you as a single row

torpid river
#

Where can I buy ice cream from?

#

wrong channel

#

crap

quartz kindle
#

Lol

woeful patrol
#

lol

#

doesnt really help sadly

#

d

quartz kindle
#

show code

digital sparrow
#

how to block if bot cant message to the channel?

torpid river
#

I need to make a help command

unique nimbus
#

Okay

static nexus
#

good mornin

summer grove
#

gm

quartz kindle
#

@digital sparrow people already told you how a billion times lmao

#

either check for permissions before you send the message, or catch the error

pliant urchin
#

How do i customise the bot page with css?

summer grove
#

Hello everyone, I'm new here and I'm trying to develop my first Discord Bot.
I will use Node js and wanna know if the library discord.io is still up to date ?

compact oriole
#
summer grove
#

Yeah i saw it too, thank you !

compact oriole
#

np ๐Ÿ˜„

pliant urchin
#

How do i customise the bot page with css?

#

i found no solutions for this doubt

unique nimbus
pliant urchin
#

but how do know the page div classes?

unique nimbus
#

Inspect Element

#

ยฏ_(ใƒ„)_/ยฏ

#

idk

pliant urchin
#

angeryBOYE nice idea to use inspect

compact oriole
mossy vine
#

thats not css tho

compact oriole
#

...

#

It shows how to add css to markdown...

mossy vine
#

no, its completely different than what the original question was asking

#

to customize the bot page just write css between <style> tags

compact oriole
#

yea, it shows how to add html to markdown

mossy vine
compact oriole
mossy vine
#

what does that have to do with css styling anyways

compact oriole
#

You can add <style> params in head

#

so its css

mossy vine
#

that page literally teaches you markdown syntax, nothing to do with the original question ๐Ÿ˜ฉ

compact oriole
#

"how to change the dbl appearance"...

#
  1. You add the code
  2. You make <style> in it
  3. Change the css with !important tag
static nexus
#

im asking so i can do this

#
    if message.content.startswith('sborder'):
        channel = (645259977304571935)
        InviteLink = await discord.(max_age=1, max_uses=1)
        embed = discord.Embed(title="New Order!", description=message.content, color=0x00ff00)
        embed.add_field(name="Order Maker", value=message.author, inline=False)
        embed.add_field(name="Invite", value=InviteLink, inline=False)
        await channel.send(embed=embed)```
#

but when i do create_invite, it says it doesn't exist

wooden moss
#

Why my bot don't have permission to send embed message? XD

unique nimbus
#

all bots has perms to send embed messages

mossy vine
#

no

#

its a permission

#

if your bot doesnt have it it doesnt have it XD

earnest phoenix
#

@unique nimbus embed message = Links permission

digital seal
#

Help plz

slender thistle
#

@static nexus instance of TextChannel

digital seal
#

I need help

patent prism
#

Huh

static nexus
#

so would guild_createinvite work

patent prism
#

create_invite returns an Invite object

slender thistle
#

Nvm it's any channel

static nexus
#

or guild.create_invite

#

I want an invite object

slender thistle
#

I literally said "channel"

static nexus
#

i want an invite

slender thistle
#

not "guild"

static nexus
#

so channel.create_invite

slender thistle
#

Whatever channel variable is

static nexus
#

ok

slender thistle
#

assuming it's anything that is subclass of GuildChannel, yes

static nexus
#

does anyone have a python delivery bot i can study

#

so i can make the order part

compact oriole
#

You should find that on github or just make it yourself

#

You will learn more

#

If you make it yourself

static nexus
#

iik

slender thistle
#

Copying code won't help you learn if you know jack shit what the code does

static nexus
#

i'm making it by myself

#

i'm stuck on the making invite part

#

everything else is 10/10

#

it gets the order, the order maker and if i want even the channel

#

WAIT

#

OMG

#

I CAN JUST GET THE CHANNEL AND MAKE AN ID OFF THAT

spice trail
#

just a note: you dont use channel id to create an invite ๐Ÿคทโ€โ™‚๏ธ

slender thistle
#

I mean client.http is available

static nexus
#

i'd be the first

spice trail
#

what diffrence does it make on the lib?

static nexus
#

nothing

#

but i can use it for adverts

#

๐Ÿ™‚

compact oriole
#

delivery bot?

static nexus
#

yea

#

I used to own(well for a DBM made bot)a discord bot which was a bit famous, and I used to run(before the controversy)discord drinks on my server with discord waffles.

#

since then i've always wanted to create a fully blown discord waffle bot

static nexus
#
if message.content.startswith('sborder'):
        channel = (645259977304571935)
        InviteLink = await discord.TextChannel.create_invite(max_age=1, max_uses=2, reason=None)
        embed = discord.Embed(title="New Order!", description=message.content, color=0x00ff00)
        embed.add_field(name="Order Maker", value=message.author, inline=False)
        embed.add_field(name="Invite", value=InviteLink, inline=False)
        await channel.send(embed=embed)```
returns the error of, when the command sborder is used, 
```File "C:/Users/mouga/Documents/Bot.py", line 30, in on_message
    InviteLink = await discord.TextChannel.create_invite(max_age=1, max_uses=2, reason=None)
TypeError: create_invite() missing 1 required positional argument: 'self'```
slender thistle
#

Don't you think you need an actual channel instead of channel ID

static nexus
#

the channel is where it's sent to

#

it's a food bot

#

currently attached to my demo bot

slender thistle
#

cough
discord.TextChannel isn't exactly what you need

static nexus
#

it worked

slender thistle
#

You need an instance of it, not literally the class

static nexus
#

how do i define self

#

thats my only question

trim saddle
#

why aren't you using the command handler

slender thistle
#

Don't take that error too literally

trim saddle
#

but use msg.guild.channel

slender thistle
#

you are not using a classmethod

static nexus
#

i'm being told left and right to do different things

#

i'm like red in twitch plays discord

trim saddle
#

what

slender thistle
#

What are you told to do exactly

#

How much of basic python do you know

trim saddle
#

you're being told discord.Textchannel doesn't define an actual text channel

slender thistle
#

If you don't know difference between an instance of a class and a class itself... welp, F

trim saddle
#

oof.

compact oriole
#

oof.

knotty steeple
#

??

trim saddle
#

i would also suggest putting a try inside create_invite

spice trail
#

InviteLink = await discord.TextChannel.create_invite(max_age=1, max_uses=2, reason=None)

#

sobble dude

slender thistle
#

That's exactly what I'm talking about just above

spice trail
#

i told you yesterday you gotta give it the GuildID

trim saddle
#

you told him this yesterday?

spice trail
#

its the ONE required perameter

trim saddle
#

wow

spice trail
#

and yh

slender thistle
#

What

compact oriole
#

tf

slender thistle
#

Why guild ID

compact oriole
#

thats so easy

spice trail
#

d.py when making an invite for a server

#

it wants you to pass it the guildID / server

#

cuz he wants to create an invite so he can join the server that the command was sent in

slender thistle
#

It wants a text channel to be called on

spice trail
#

saying "zyx"

slender thistle
#

It doesn't need anything more

spice trail
#

wait yh sorry it is channel id

#

however

#

invitelinknew = await bot.create_invite(destination = ctx.message.channel, xkcd = True, max_uses = 100)

static nexus
#

that just needs a little bit of fixing

#

๐Ÿ™‚

spice trail
#

no that will not just work btw

static nexus
#

it'll work

#

if i can do some stuff

#

trust me

trim saddle
#

skcd

#

what

slender thistle
#

It's a channel object, not channel ID

#

...

static nexus
#

It's providing a wont define self

slender thistle
#

Did either of you read the docs

static nexus
#

not any other error

slender thistle
#

Calm down

spice trail
#

i just took that code line off an example code for it

compact oriole
#

There is a reason why there is Docs

#

To read them

spice trail
#

^

compact oriole
#

I have never had problems after I read the docs

earnest phoenix
#

you should go back to learning basics if you can't understand docs

slender thistle
#

Where did you find the info on bot.create_invite @spice trail

compact oriole
#

The stuff is tested heavily

spice trail
#

@bot.command(pass_context=True)
async def invite(ctx):
        invitelinknew = await bot.create_invite(destination = ctx.message.channel, xkcd = True, max_uses = 100)
        embedMsg=discord.Embed(color=0xf41af4)
        embedMsg.add_field(name="Discord Invite Link", value=invitelinknew)
        embedMsg.set_footer(text="Discord server invited link.")
        await bot.send_message(ctx.message.channel, embed=embedMsg)```
static nexus
#

You are correct. However, after reading them 10 times, I am unable to get something out of it. I just want to generate an invite and post it on another server

spice trail
#

wait

#

wrong code

slender thistle
#

Fucking...

spice trail
#

ree

slender thistle
#

Do you realize we're rewrite here

spice trail
#

its edited now

static nexus
#

rewrite only

spice trail
#

that is rewrite

static nexus
#

In theory if i can apply this to my bot

#

it should work

slender thistle
#

Your code is not rewrite

spice trail
#

please dont just C+P that sobble...

trim saddle
#

wait he's using async?

#

ew

static nexus
#

it. is.rewrite.

slender thistle
#

Jarl is

#

Sob isn't

static nexus
#

i'm using both

slender thistle
#

And Jarl is the one giving wrong shit rn

static nexus
#

idk how tf it's possible

#

but i am

trim saddle
slender thistle
#

You use either, not both

static nexus
#

๐Ÿ’ข

compact oriole
#

async in js if fine, but py async ewe

slender thistle
#

Affax

compact oriole
#

?

slender thistle
#

If you're not gonna contribute to this already-fucked-as-is conversation, don't fill up the chat

#

Thanks

compact oriole
#

1 message lol

spice trail
#

thats the rewrite update isnt it?

slender thistle
#

Your code snippet is async

#

@static nexus use create_invite on message.channel

spice trail
#

you know youre right

#

hmm

slender thistle
#

Since that's an instance of a TextChannel (also subclass of GuildChannel)

static nexus
#

so message.channel.create_invite

slender thistle
#

Yes

static nexus
#

๐Ÿ™‚

spice trail
#

sorry for my input sobble, seems i was giving you the async version

slender thistle
#

rw is more OOP while async version is literally bot.x

static nexus
#

if this works i will be happy as hell

#

it works

#

it works

spice trail
#

remember you gotta give a disclaimer if it goes live to other users and servers btw

slender thistle
#

Hoo-fucking-ray

static nexus
#

IT WORKS!

#

yes i am adding a disclaimer to every description on every bot list and adding it so when discord waffles 2-electric bugaloo joins any server it posts a disclaimer and the commands

trim saddle
#

that was longer than i expected for one line

compact oriole
#

^

static nexus
#

i don't wanna get baned

#

way to long for one line

trim saddle
#

@static nexus i suggest adding a try/except around create_invite

slender thistle
#

Skull, there have been more special individuals for sure

spice trail
#

๐Ÿ‘‹

#

not my greatest moment xD

static nexus
#

at least i have a understanding of discord.py and as a result python now

slender thistle
#

Because someone doesn't know difference between instances and classes

spice trail
#

you still got alot to learn tho sobble

#

xD

static nexus
#

and someone was giving me the wrong version

slender thistle
spice trail
#

^

slender thistle
#

Not the other way around

static nexus
#

cough jar cough

trim saddle
#

shiv

#

what if i told you

knotty steeple
#

i made bots to learn js

spice trail
#

tbf yh, it was off my old bot

#

that shites still on async

#

so

#

xD

trim saddle
#

i learned python and d.py through red

slender thistle
#

I'd rather give a proper advice

trim saddle
#

@spice trail update

compact oriole
#

I learnt js from bots too, there was a certain music bot tutorial

slender thistle
#

making a bot without any coding experience firsthand = shitty bot

trim saddle
#

no point in staying in the past

spice trail
#

and tbf i still taught u how to to specify a classs and subrutine

knotty steeple
#

i mean

spice trail
#

also no point updating

#

bot is offline

knotty steeple
#

ive done really bad stuff in coding at 10

compact oriole
#

^

static nexus
#

i've done a basic python system

#

i mean basic basic

#

like 1 + 1 basic

knotty steeple
#

my github has every dumb stuff ive made

slender thistle
#

Get used to simple things and the language first before going for HaRd LiBraRiES like d.py

spice trail
#

yh

static nexus
#

wait so i shouldnt try this?

slender thistle
#

Go for basic python first

spice trail
#

and d.py isnt the like most forgiving lib in the world

static nexus
#

might as well chuck my entire saturday away

spice trail
#

isnt it sunday?

knotty steeple
#

i only made a furry image downloader cuz i saw my friend making a same one in electron

slender thistle
#

Who said learning coding won't be a waste of time in its own way

spice trail
#

xD

knotty steeple
#

everything is a waste of time

#

including time

static nexus
#

i chucked my saturday coding sobblebot

#

even though it has a system, concidering i am a beginner programmer, which is kinda advanced

spice trail
#

dont delete everything youve done but get more experienced with classes, subrutines etc..

static nexus
#

ik

#

time to have my tea

earnest phoenix
#

what's the best way to store user data?

#

json? mysql? mongodb? what?

compact oriole
#

mongodb or firebase

spice trail
#

wdym by 'userdata'

compact oriole
#

those are my favorites

earnest phoenix
#

as in

#

like

#

storing muted user

#

s

knotty steeple
#

their is no "best way"

#

really

#

but we can all agree no one should use json as a database

earnest phoenix
#

true

spice trail
#

just want a DB that can get changed around and pulled from quick

#

NEVER USE JSON AS A DB

knotty steeple
#

i prefer mysql

earnest phoenix
#

what's the easiest one?

knotty steeple
#

specifically mariadb

earnest phoenix
#

to set up and use?

spice trail
#

probs sql? maybe

knotty steeple
#

sqlite is easy

compact oriole
#

firebase doesnt need "setup"

#

sqlite is good though

#

it uses a file to use the sql

spice trail
#

just a bit slow on requests

knotty steeple
#

firebase isnt a

#

"db"

earnest phoenix
#

i just need a quick and easy solution that will be able to potentially hold mute data of over 1000 members

#

and easily pull the data

compact oriole
#

yea, idk what to call it

earnest phoenix
#

whats the best database to use in my usage scenario?

knotty steeple
#

again

#

no best

earnest phoenix
#

hmm

#

ok

#

ill just use mysql then

knotty steeple
#

cool

slender thistle
#

Which database to use is up to the dev's preferences

#

But all dbs have their own pros and cons

knotty steeple
#

lets see

#

sql injections are fun

blissful scaffold
#

Sql injections are possible with every sql based db if you set it up badly xD

earnest phoenix
#

postgres and an orm framework and you're all g

compact oriole
#

^

earnest phoenix
#

.-.

compact oriole
#

Firebase is a little bit different

earnest phoenix
#

all this sounds super complex

#

i dont want to have to worry about sql injection or anything like that

compact oriole
#

Theres no "sql injection", but theres data injection

blissful scaffold
#

No one said that programming is easy Cold ^^

earnest phoenix
#

if course there is sql injection

#

can that be prevented by just limiting bot commands down to moderators and such?

compact oriole
#

Sql injection is when somebody else adds, removes or modifies data illegally

earnest phoenix
#

you can escape a string for example and inject your own sql commands hence sql injection

#

what

static nexus
#

uwu

earnest phoenix
#

are you on about

#

but what if i dont allow anyone to execute any custom mysq

#

l

#

commands

blissful scaffold
#

Sql injection is also retrieving data illegally

knotty steeple
#

select * from users where id = ?

#

that works right

earnest phoenix
#

what about mongodb?

#

i heard mongodb is pretty good

knotty steeple
#

last time i did sql was some months ago

compact oriole
#

every sql solution has its pros and cons

knotty steeple
#

i have no idea how to setup mongo E

earnest phoenix
#

mongo is glorified json

compact oriole
#

^

earnest phoenix
#

i would avoid it

compact oriole
#

I think its pretty good

#

But i prefer firebase

knotty steeple
#

yes thats true

earnest phoenix
#

mongo is great with object relations

knotty steeple
#

what about reThonk

earnest phoenix
#

but in terms of performance

#

it drops

compact oriole
#

yea

knotty steeple
#

reThonkdb

compact oriole
#

tf is that

knotty steeple
#

rethinkdb

#

lmao

earnest phoenix
#

i just want a simple db man .-.

#

i dont wanna worry about sql injection

compact oriole
#

there is no "simple" sql

earnest phoenix
#

or anything like that

compact oriole
#

every sql has taht

earnest phoenix
#

ok ok ok. how about

#

my mute command

#

it only accepts mute reasons that dont contain any special characters

compact oriole
#

there is and will not be a no sql injection sql

earnest phoenix
#

like , `

#

etc

#

\

blissful scaffold
#

Store data in json files is easy, but it doesn't scale

earnest phoenix
#

and i heard corruption is pretty common

knotty steeple
#

its very common

compact oriole
#

depends on the sql

#

firebase saves data in multiple places

#

and the service

static nexus
#

HOLY SHIT

#

I DID IT

#

IT FUCKING WORKS

earnest phoenix
#

what works

compact oriole
#

caps please

blissful scaffold
#

Your bot is alive?

#

You may now call yourself Frankenstein

compact oriole
#

tf my bot dumb

grizzled jackal
#

He has been warned several times for caps

#

Surprised he hasnt been kicked yet

compact oriole
#

ur muted

blissful scaffold
#

Forgot to put a modulo on the hours affax?

compact oriole
#

yes....

knotty steeple
#

you want to see how i calculate time

earnest phoenix
#

okay so in regards to sql injection

#

whats the best way to prevent it

compact oriole
#

to clean the string

earnest phoenix
#

is there a library for that

#

like can i use

#

common-tags

#

or something

#

use an orm framework to save headaches from handwritten sql

#

especially if you are a beginner with sql

#

big words

#

i have no clue what an orm framework is

compact oriole
#

you can search it

earnest phoenix
#

ok this is hurting my head

#

i literally just want a datbase that can store data about muted users

#

database*

#

ok

static nexus
#

this is now an easy question

#

can u run 2 bots with one script

mossy vine
#

yes

earnest phoenix
#

yes, you can

#

just create an extra Client

#

and log that other client in with a separate token

true basalt
#

hello, im new to proggraming and i was trying to do a discord bot with python

#

i just followed the steps to just simply run a bot but i always get this error: RuntimeError: SSL is not supported.

#

i've looked it up on google but i haven't found the answer yet, if anyone could help me i would appreciate it a lot

static nexus
#

how do we make our bot status show how many servers it in? discord.py

earnest phoenix
#

what have you tried

spice trail
#

And a for loop as a background task

#

For guild in client.guilds: somthing like that I think it is

#

Can't check as not on pc rn

lunar crystal
#

const Canvas = require('canvas');

#
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (c:\Users\hieli\Desktop\Vitas\node_modules\index.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:775:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
slender thistle
#

@spice trail client.guilds is a list

#

Why iterate over it if you could just len() it

spice trail
#

Ik

slender thistle
#

You want the amount of guilds your bot's in, not do something with each guild

spice trail
#

just get the length of the list

#

thats what im saying

#

if u want member count you can just iterate over that list and add up the count

#

server count is just length of said list

#

also i mean client.fetch_guilds instead of client.guilds but theyre both lists

patent prism
#

fetch_guilds is an api call, while guilds isnโ€™t

slender thistle
#

why iterate again...

patent prism
#

Also if you want overall bot users use bot.users

slender thistle
#

Cache though

spice trail
#

getting total member count, atleast how i did it

patent prism
#

Or if it is overall members use bot.get_all_members

#

Which is a generator

spice trail
#

No = 0
async for guild in client.fetch_guilds(limit=300):
        No += 1```
slender thistle
#

len(list(some_generator)) cough

patent prism
earnest phoenix
#

uh

patent prism
#

generators are great

earnest phoenix
#

you are using the wrong thing

slender thistle
#

Technically d.py caches everything by default

#

So unless they're doing some stupid magic, they don't need those API calls

patent prism
#

Yeah there will be a low chance of a guild not being cached

earnest phoenix
#

guilds from the ws have to be cached lol

patent prism
#

Unless you try to get the guilds before the cache is populated

spice trail
#

so instead of iteration to get the whole member count what else could you do?

patent prism
#

len(set(bot.get_all_members()))

slender thistle
#

Literally said that twice

earnest phoenix
#
{
  "discu_chan": [
    {
      "chan_id": "642362119312113702"
    },
    {
      "chan_id": "644685769826369549"
    }
  ]
}```

```js
message.delete()
        var nbr = db.get("discu-chan").find({ chan_id }).size;
        return message.channel.send("Number: " + nbr)```
how to count the number of chan_id?
static nexus
#

just give me the line of code

spice trail
#

bruh dont ask to be spoonfed

static nexus
#

wait no ill get it

#

i had it before

earnest phoenix
#

๐Ÿค”

slender thistle
#

Being spoonfed and willing to learn

#

Two completely different things

static nexus
#

i'm willing to learn

#

but right now i just want a simple line of code

spice trail
#

SobbleToday at 16:05
just give me the line of code``` says otherwise
static nexus
#

i just spent 6 hours with a basic ass system

#

so please just help me

spice trail
#

read the above convo

#

where i got told an 'easier' way of doing it

static nexus
#

stackoverflow - better than u guys

slender thistle
#

You wouldn't have spent 6 hours on a "basic ass" system if you went with basics

earnest phoenix
#

Who can help me?

slender thistle
#

Wdym number of chan_id

#

The amount of characters in the string?

spice trail
#

Sobble is the person who wants spoon feeding throughout making a bot with no basic programming knowledge

#

And I think he means the amount / length of the channels

#

So like if you had a list in python the length of the list

#

?

spice trail
#

XD

#

I'm going off his 'db' which has two channel IDs in it

#

So the 'length' would be 2

#

In my eyes atleast

slender thistle
#

Ngl why the f do you have two JSONs in an array

earnest phoenix
#

I want to count the number of times that is specified chan_id which would allow me to get the number of channels

quartz kindle
#

what library is db?

slender thistle
#

Do you need separate JSONs for that

spice trail
#

Why not just have all the channel IDs in an array only

earnest phoenix
#
var low = require('lowdb')
var FileSync = require('lowdb/adapters/FileSync')
var adapter = new FileSync('./db.json')
var db = low(adapter)
db.defaults({
    discu_chan: []
}).write()```
#

I use lowdb

quartz kindle
#

according to the docs

#

you should use .filter instead of .find

earnest phoenix
#

I test this

quartz kindle
#

it also says that all operations must be executed with either .value() or .write()

earnest phoenix
#

Yes

quartz kindle
#

so the answer should be db.get(something).filter(something).size().value()

earnest phoenix
#

Okay ty

quartz kindle
earnest phoenix
#

Ty Tim

#
var nbr = db.get("discu-chan").filter({ chan_id }).size().value();
                                                ^

ReferenceError: chan_id is not defined```
#

Bruh

quartz kindle
#

chan_id:IDYouWantToFindHere

earnest phoenix
#

Okay

#

But

#

I want him to answer me the number of times that chan_id is

quartz kindle
#

chan_id is a property of an entry

earnest phoenix
#

Yes

quartz kindle
#

if you want to get all of them, just get all entries

#

without filtering

earnest phoenix
#

Hmm okay

#
message.delete()
        var nbr = db.get("discu-chan").size().value();
        return message.channel.send("Number: " + nbr)```
iron gale
#

can we change the bots name color?

earnest phoenix
#

@iron gale in this server, no

iron gale
earnest phoenix
#

Yes you can

#

:)

iron gale
#

how we can

earnest phoenix
#

With css

quartz kindle
#

right click your bot's name

#

click "inspect element"

#

check the highlighted section of the code that appears

#

check the class name

iron gale
#

class name bot name but it's span

quartz kindle
#

is id, not class

#

. is class

#

also, if the text is in a span, then add it to the selector

#

.class span

#

@earnest phoenix if you get 0 entries, that means your db is empty

earnest phoenix
#
{
  "discu_chan": [
    {
      "chan_id": "642362119312113702"
    },
    {
      "chan_id": "644685769826369549"
    }
  ]
}```
#

....

quartz kindle
#

where did you get that from?

earnest phoenix
#

db.json

quartz kindle
#

try adding db.read() after db.defaults({ discu_chan: [] }).write()

earnest phoenix
#
db.defaults({
    discu_chan: []
}).write().read()```
#

?

wooden kernel
#

damn, how i can learn to programing

quartz kindle
#

@earnest phoenix no, db.read() in a new line

earnest phoenix
#

Okay

quartz kindle
#

@wooden kernel start with some online training platform like codecademy

#

or hire a private tutor

#

or sign up for some online course

#

or learn by yourself and become self taught

earnest phoenix
#
db.read({discu_chan: []})```?
quartz kindle
#

get hands on experience, try doing some simple project

#

@earnest phoenix no, literally what i said

earnest phoenix
#

Okay

quartz kindle
earnest phoenix
#
db.defaults({
    discu_chan: []
}).write()
db.read()```
like this?
quartz kindle
#

yes

earnest phoenix
#

Okay

quartz kindle
#

does your json file still have data in it?

quartz kindle
#

yes, but its still there or was it deleted?

earnest phoenix
#

It's still there

quartz kindle
#

try this then

#

remove all of this js db.defaults({ discu_chan: [] }).write() db.read()

earnest phoenix
#

Okay

#

Again 0...

loud salmon
#

yo @static nexus just so you know, we dont allow spoonfeeding on dbl. if you ask for free code more then there will be consequences

static nexus
#

ok gallade

spice trail
#

bruh...

earnest phoenix
#

anyone know why in c
(*var)++ works
but
*var++ doesnt?

(the * being a dereference)

unique nimbus
#

I think it is because you have to define var

#

however I don't know c

earnest phoenix
#

define?

spice trail
#

in c you basically tell it what type the var is first

#

i.e float, str, int

quartz kindle
#
++ptr;    // Pointer moves to the next int position (as if it was an array)
++*ptr;   // The value of ptr is incremented
++(*ptr); // The value of ptr is incremented
++*(ptr); // The value of ptr is incremented
*ptr++;   // Pointer moves to the next int position (as if it was an array). But returns the old content
(*ptr)++; // The value of ptr is incremented
*(ptr)++; // Pointer moves to the next int position (as if it was an array). But returns the old content
*++ptr;   // Pointer moves to the next int position, and then get's accessed, with your code, segfault
*(++ptr); // Pointer moves to the next int position, and then get's accessed, with your code, segfault```
earnest phoenix
#

hol up

#

there is a difference between ++i and i++ ?

quartz kindle
#

yes

earnest phoenix
#

what are they equivalent to ?

quartz kindle
#

++i = increment and return
i++ = return and increment

#
a = 0 // 0
a = a++ // 0
a // 1

b = 0 // 0
b = ++b // 1
b // 1```
earnest phoenix
#

what do you mean by return?

#

return in what context

amber fractal
#

++var will increment before

quartz kindle
#

in the context of what the value resolves to if you access it directly

earnest phoenix
#

ahh

#

okay i think get it now

quartz kindle
#

for example if b equals 0

#

logging b++ will log 0, logging ++b will log 1

#

b will be incremented either way

amber fractal
earnest phoenix
#

interesting

wide ruin
#

diskpart is just blank

#

why isnt it saying anything?

spice trail
#

well is the partition a new simple volume

#

or is it just well

#

blank

compact oriole
#

Whats diskpart

wide ruin
#

lists drives

spice trail
#

disk partition im guessing

compact oriole
#

Oh ok

quartz kindle
#

it takes a little while to load, but should not take more than a couple seconds

#

maybe your diskpart is bad

#

or you have a bad disk

wide ruin
#

its probably the disk

#

i cant edit the files

compact oriole
#

You have Disk Partitioner in Windows

quartz kindle
#

do you experience any kind of extreme slowness randomly?

wide ruin
#

sometimes but not this bad

quartz kindle
#

is it an hdd or an ssd?

wide ruin
#

no clue

quartz kindle
#

how old is it?

wide ruin
quartz kindle
#

oh its an sdcard

wide ruin
#

and idk how old

#

yeah

quartz kindle
#

does diskpart load if you unplug it?

wide ruin
#

yes

spice trail
#

sdcard ded

quartz kindle
#

possibly a bad sdcard yes

wide ruin
#

wait i ran it again with the card and it worked

#

how do i format it?

quartz kindle
#

begin with list disk

compact oriole
wide ruin
quartz kindle
#

then select disk disknumber

#

then clean

wide ruin
#

which disk would it be?

quartz kindle
#

you can see from the disk size

#

should be disk 1

stray wasp
#

Haha shouldn't be disk 0 lul

#

That would be a fat rip

#

If you did that disk

wide ruin
#

and then clear?

stray wasp
#

Yep

quartz kindle
#

clean

stray wasp
#

Type clean

quartz kindle
#

i wrote it wrong

stray wasp
#

Wong

wide ruin
stray wasp
#

Yicks

quartz kindle
#

yup, sd card bad

#

nothing to do but throw it away

wide ruin
#

i mean i can read from it so ill keep it

#

but there is no way to write at all?

quartz kindle
#

copy all the data out of it

stray wasp
#

Time to throw out the trash lul

wide ruin
#

i have

quartz kindle
#

then yeah, nothing much you can do

wide ruin
#

beautiful desktop after copying

quartz kindle
#

you can try doing a low level format / secure erase

wide ruin
#

how would i do that?

quartz kindle
#

basically write zeros to it, see if it crashes

#

there are many programs that can do that

wide ruin
#

does that risk losing everything?

earnest phoenix
#

btw @quartz kindle where did you get that list with ptr interaction ?

compact oriole
#

you may have lost everything already

quartz kindle
#

google "increment pointer in C" > first result (stackoverflow)

earnest phoenix
#

aight thanks

wide ruin
#

so uuh lets hope the microsd has enough space

#

๐Ÿคž

quartz kindle
#

you said you already copied everything out of the card right?

wide ruin
#

yeah

quartz kindle
#

so you wont lose anything

wide ruin
#

its on the card still

#

just cant be edited

#

great for save data

quartz kindle
#

but the data in the card will get destroyed if writing zeroes is successful

#

although i doubt it will

wide ruin
#

so basically theres no point

quartz kindle
#

basically

wide ruin
#

ok

#

i seriously hope r4i3ds can handle this now

#

with random folders and stuff

#

probably should have backed up the microsd

quartz kindle
#

always backup everything

#

you never know when your shit is gonna die

wide ruin
#

learnt that lesson....

#

i mean i accidentally deleted a 3 year old minecraft map by accident

quartz kindle
#

rip

wide ruin
#

ikr

quartz kindle
#

i should have a few 10 year old minecraft maps somewhere

#

lul

wide ruin
#

it was the 2nd map i ever made though

#

definitely put me off mc for a bit

quartz kindle
#

i used to run servers for my family and friends

wide ruin
#

oh nice

#

also tim

#

on a phone, does autocorrect / glide typing get confused when you type b u/i/o t?

quartz kindle
#

no idea, i dont use any of those

wide ruin
#

oh

#

lol i need autocorrect

#

also place your bets

#

is the microsd going to work?

quartz kindle
#

whats its size?

wide ruin
#

4gb

#

but its an r4 card

quartz kindle
#

should work then

wide ruin
#

with homebrew files as well

quartz kindle
#

no difference

#

the cards are the same

#

just check which file system is it formated to

#

does it have linux installed on it?

wide ruin
#

does what have linux?

quartz kindle
#

oh wait

#

i though it was a card you were using in a raspberry pi

wide ruin
#

no

#

its going into a ds

quartz kindle
#

so its basically a 3ds emulator

wide ruin
#

its an actual 2ds i xl

quartz kindle
#

well it says they use FAT32 so it should work out of the box

#

no need to format it

wide ruin
#

ok cool

chrome verge
#

anyone to help me with aiohttp
Look if i wanna to get votes in discord.py
await aioclient.get(url, headers=headers)
Is that the one?

#

pls help

wide ruin
#

lol the only issue is a file name thats too long

quartz kindle
#

welp, make it shorter

spice trail
chrome verge
#

None answers there

#

I wanna know ho to requerst it using aiohttp

spice trail
#

read the docs?

chrome verge
#

I read them nothing

quartz kindle
#

do you know how to use aiohttp in general?

chrome verge
#

no

#

๐Ÿ™‚

quartz kindle
#

then google "python aiohttp examples"

#

or "python aiohttp tutorial"

wide ruin
#

my card does not like new files

chrome verge
#

ok

quartz kindle
#

once you learn how to use it, and successfully tested it on some random website

#

then look at the DBL api documentation

#

@wide ruin just remembered something

wide ruin
#

the card didnt work

quartz kindle
#

did you check both of your cards for the little lock thing they have?

wide ruin
#

yeah

quartz kindle
#

are you sure they are not locked?

wide ruin
#

i tried it in both positions

quartz kindle
#

if none of the cards can be written to, its possible the problem is with the card reader

wide ruin
#

the microsd works fine

#

its the r4 card complaining

quartz kindle
#

wasnt the microsd the one that was broken?

earnest phoenix
#

Resolved js return message.channel.send("Number: " + db.get("discu_chan").size().value())

quartz kindle
#

thats exactly the same thing lmao wtf

#

you didnt change anything else?

earnest phoenix
#

It's just that when I use it in a variable it only returns 0...

quartz kindle
#

try using let instead of var

earnest phoenix
#

Okay ty Tim you're the best x)

#

It works, thank you ^^

west raptor
#

What's the real difference between let and var?

earnest phoenix
#

Idk but
Let > Var

quartz kindle
#

let enforces scoping and prevents it from being redeclared

west raptor
#

Ah

quartz kindle
#

var doesnt prevent anything and doesnt enforce scope, so its vulnerable to accidental redefinition and leaking to outer scopes

earnest phoenix
#

I take notes

#

Here:
Tim > All

#

๐Ÿ˜‚

quartz kindle
#

if only i got paid

#

lul

earnest phoenix
#

Yes x)

patent prism
#

Apply as a Full Stack developer for top.gg today!

quartz kindle
#

nah

#

they got enough talented people

dusky bear
#

Do you guys know of any idlerpg-like bots

earnest phoenix
#

no, maybe ask in general or off topic

dusky bear
#

Just trying to research on the infrastructure of a bot like this and its implementation

mossy vine
#

@dusky bear so basically idle games in discord?

dusky bear
#

Yes

late hill
#

idle miner

lunar crystal
#
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);```
#
    at setSource (c:\Users\hieli\Desktop\Vitas\node_modules\canvas\lib\image.js:91:13)
    at Image.set (c:\Users\hieli\Desktop\Vitas\node_modules\canvas\lib\image.js:62:9)
    at Promise (c:\Users\hieli\Desktop\Vitas\node_modules\canvas\index.js:34:15)
    at new Promise (<anonymous>)
    at Object.loadImage (c:\Users\hieli\Desktop\Vitas\node_modules\canvas\index.js:23:10)
    at Client.client.on (c:\Users\hieli\Desktop\Vitas\node_modules\index.js:33:34)
    at Client.emit (events.js:198:13)
    at Guild._addMember (c:\Users\hieli\Desktop\Vitas\node_modules\discord.js\src\structures\Guild.js:1298:19)
    at GuildMemberAddHandler.handle (c:\Users\hieli\Desktop\Vitas\node_modules\discord.js\src\client\websocket\packets\handlers\GuildMemberAdd.js:12:13)
    at WebSocketPacketManager.handle (c:\Users\hieli\Desktop\Vitas\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
warning.js:25 ```
#

I put the rigth file

mossy vine
#

\\ instead of \

#

i think / would work too, but im not sure

hoary elm
#

Hey everyone, I'm not here looking to be spoon fed but instead just a push in the right direction... I am trying to make my bot run on a @Mention prefix and I have it working but if I try to run a command that requires a user mention like the ban command for some reason the command reads the bots mention ping as the user mention.... Sorry if that makes no sense idk how else to explain it!!

#

discord/node.js btw

dusky bear
#

Try putting the image in the same folder as your code or in a folder within the same folder. That will save you a world of pain.

earnest phoenix
#

@lunar crystal don't use folders with spaces lol

mossy vine
#

@earnest phoenix u know that doesnt matter at all

earnest phoenix
#

And yes use \\ instead of \

#

I think this is important

mossy vine
#

its not important its literally the fix

#

because windows file paths

earnest phoenix
#

Okay okay