#development

1 messages ยท Page 1023 of 1

earnest phoenix
#

...well yeah

elfin flower
#

@earnest phoenix
client = discord.Client()
if you are using discord py

slender thistle
#

if

finite bough
#

he/she is using js i think

earnest phoenix
#

^

finite bough
#

ready.js

elfin flower
#

ok

#

I only know one thing about js and thats math.random() lol

earnest phoenix
#

lol

#

Yeah, it's this code that should display users its watching over, just comes back with error.

blazing ravine
earnest phoenix
#

Mmm?

blazing ravine
#

what i need to make to

#

return the undefined

#

the i use one not work ;/

elfin flower
#

hmm

earnest phoenix
#

Error return?

blazing ravine
#

no

#

showing undefinned in inviter

#

when i make

earnest phoenix
#

Mmm

blazing ravine
#

if inviter == undefinned return msg.channel.send

#

and this not work

elfin flower
#

await message.guild.edit(name = "name") didnt work

blazing ravine
#

soul any idea ?

solemn latch
#

the problem is not down there
the problem is invite doesnt exist

blazing ravine
#

yes

#

...

#

when is undefined

#

i want

#

to return

#

the error

slender thistle
#

await message.guild.edit(name = "name") didnt work
@elfin flower show your full code

solemn latch
#

ye

blazing ravine
#

with other message

#

to the channel

slender thistle
#

Could you not spam like that

blazing ravine
#

but not work

solemn latch
#

so do that

elfin flower
#

wait no

#

oh god im

#

stupid

solemn latch
#

your doing it in the wrong place @blazing ravine

elfin flower
#

the bot doesnt have manage server perms

blazing ravine
#

if(!inviter == ) return member.guild.channels.cache.get(wChan).send("๐Ÿ“ฅI can't find who Invited " + `${member.user}`); im using this

elfin flower
#

๐Ÿ˜‚

blazing ravine
#

but not work

solemn latch
#

the error is invite doesnt exist,
your doing the check if inviter exists.
but the problem is invite doesnt exist

blazing ravine
#

hm

solemn latch
#

also, your perfoming the check after the error

blazing ravine
#

how to return the error ?

solemn latch
#

which makes no sense

#

your error is client was client was undefined right?

earnest phoenix
#

Yes

blazing ravine
#

my error this

solemn latch
#

client needs to be defined before client.on events are added

blazing ravine
#

this is undefinned

#

when some1 created invite

#

with colldown

#

work only for forever invites

#

but i trying to make when giving error undefinned i want to return with console.log or msg.channel.send

solemn latch
#

your error happens on this line

blazing ravine
#

ye

solemn latch
#

your solution to the error you put on the next line

earnest phoenix
solemn latch
#

how is your soltuion ever going to run

blazing ravine
#

i put but didnt work]

solemn latch
#

if the error happens before it

blazing ravine
#

nope

stable grail
#

"verify your id"

blazing ravine
stable grail
#

what does it mean?

solemn latch
#

yes

#

line 1529

#

the line i copied

stable grail
#

i got 75 servers and i want to verify it but it says "verify your id"

sudden geyser
#

that file must be huge

solemn latch
#

your solution is on 1530
which will never work

blazing ravine
#

yes

#

how to fix it

#

i want it to work i need help

solemn latch
#

perform a check before that line

#

to check if invite exists

blazing ravine
#

idk how

solemn latch
#

๐Ÿค”

#

if(invite)

#

lol

blazing ravine
#

hmm xd

#

and return ?

solemn latch
#

i dont know, its your code

#

๐Ÿค”

blazing ravine
#

yes

#

fixed

#

yesssssssssssss

elfin flower
#

what are bytes

#

lol

finite bough
#

a measure of size

elfin flower
#

ok

solemn latch
#

a byte is 8 bits

elfin flower
#

8bit

solemn latch
#

a bit is a 0 or a 1

elfin flower
#

Do I locate the pic i want the icon to change into with a string?

solemn latch
#

I feel like most the devs here use js

#

๐Ÿค”

#

any time a python question is asked it feels like it no one responds

quartz kindle
#

because js people are louder lmao

#

they write more guides, more content, advocate more, scream louder online, etc

spare mirage
#

js is better

pure lion
#

Ehhhhh

amber fractal
#

better is subjective

solemn latch
#

well, we gotta scream.
we are the best
๐Ÿ‘

#

lol

pure lion
#

:D

amber fractal
#

I've used the most popular languages in js, python and java and I can tell you it isn't just as simple as saying "Yeah this is objectively better"

quartz kindle
#

js is the best for the same reason america is the best
all others are faster, smarter, more powerful, do a lot of things better, but js is best just because

amber fractal
#

Idk about more powerful I think we displayed our power quite well in ww2

pure lion
#

Can we not talk about this

#

Here

solemn latch
#

if anyone ever thinks a programming language is objectively better, they are goofballs.
its just a tool, like any other

elfin flower
#

uh

slender thistle
#

Tbh js community just feels more immature, but I haven't taken a look at the official d.py server in months now

elfin flower
#

my friend uses js and i promised him he can introduce js to me

#

tomorrow

quartz kindle
#

thats cool

elfin flower
#

btw im repeating this again for no reason

#

i only know math.random() in js

opal plank
#

might need some assistance here

pure lion
#

Ye?

elfin flower
#

wat

opal plank
#

how would i handle a command fired from outside? express with a local server?

pure lion
#

Where is outside

opal plank
#

or local execution without re-login

elfin flower
#

a question randomly popped up in my head lol

pure lion
#

Ok this is time for me to learn :3

elfin flower
#

how do i break a loop without putting break in the loop

pure lion
#

Uh

slender thistle
#

return

quartz kindle
#

you can return

slender thistle
#

an if statement, technically

quartz kindle
#

but break is literally made for that, so why wouldnt you wanna use it?

opal plank
#

Lets say i have my discord bot on. All handlers and jazz handled properly.
though i'd need to execute a code using that bot instance, but externally. Lets say i have another bot, and when i type command on bot B, it needs to be executed on bot A instance. I could login on bot B as A, execute, then close, but that'd be useless gateway connections

elfin flower
#

okay

opal plank
#

express listening to a webhook?

#

how would i pass something cross clients, that'd be my question

pure lion
#

I have no clue but I want to learn so I'm sticking around

quartz kindle
#

@opal plank you want bot B to receive messages from the gateway and bot A to reply?

opal plank
#

basically the goal is to have Bot A and Bot B. Bot B sends messages thru Bot A(to prevent ahving to relogin)

#

2 separate bots, on separate guilds

#

the execution must be done externally of discord

quartz kindle
#

but both are logged in

#

no?

opal plank
#

indeed(though im using different applciations, only one is discord, the other isnt discord related)

quartz kindle
#

so bot A is a discord bot

#

and bot B isnt

opal plank
#

correct

#

E

quartz kindle
#

does bot B need to receive messages from discord?

#

or it receives from elsewhere?

opal plank
#

Event emitter and llisterner might be my only option. No, Bot B is completely separate from discord. Bot A(discord) is idle
Bot B(logged onto another IRC app) recieves command, then emit events to Bot A, bot A then can send message onto a specific channel on discord

quartz kindle
#

so something like an IRC <> Discord bridge

opal plank
#

kinda yeah

#

because both events will be emitted locally, i thought i could do something locally aswell

quartz kindle
#

you can have bot B connect to bot A via some sort of IPC, message broker or websocket

#

or if you dont need any logic from bot A, you can have bot B send the response via webhook

opal plank
#

there needs to be no logic involved, i just gotta send an event and then listen on bot A

#

bot B job is just to fire the event to bot a(where code will be executed)

quartz kindle
#

so IPC i guess

opal plank
#

Inter Process Communication?

quartz kindle
#

yes

pure lion
#

Can you elaborate? I wanna learn

opal plank
#

hopefully it doesnt require port fowarding, cuz that fucks me up

quartz kindle
#

IPC is a connection between two or more processes, it can be unidirectional or bidirectional

#

so the processes can send messages to each other

solemn latch
#

webhooks wouldnt require port forwarding

#

if it was local

pure lion
#

How do I set one up Tim?

opal plank
#

yeah i'll read the docs for it

#

ty Tim

quartz kindle
#

ipc connections are typically done via unix/windows sockets when on the same machine, or via tcp/websockets if using remote machines

#

there are also fully featured messaging systems called message brokers, such as zeromq and rabbitmq

#

the difference is that message brokers feature multiple ways of controlling and ensuring delivery, such as holding on to a message and retrying later in case the target does offline

#

message brokers usually run in their own contained server, like a database or sorts

pure lion
#

Okay, so if I wanted to make my two bots(A and B) log to the same db through bot A, I would use one of those?

#

Basically what I'm asking is what data can be sent?

quartz kindle
#

if you just need database access you dont need that

#

unless your database cannot handle multiple connections

solemn latch
#

๐Ÿค”

pure lion
#

Bad example, what would I need it for?

quartz kindle
#

direct process to process communication

pure lion
#

a okay

finite bough
#

use mongodb

quartz kindle
#

for example

pure lion
#

It was an example [shiemi]

finite bough
#

oh mb

quartz kindle
#
// bot1.js
bot2.send("bla")

// bot2.js
bot1.on("message", message => {
  console.log(message) // bla
})
pure lion
#

Nah mine, bad example

#

@quartz kindle ooooooooooo this could be very useful

quartz kindle
#

IPC is used in many different ways, for example, discord sharding managers use it to communicate with shards

#

node has its own internal IPC system that communicates with child processes and worker processes

pure lion
#

More on shards, could it be used to transfer more data between them?

opal plank
#

this is actually super handy, i can set the types of events aswell

#

thought it was going to be a simple fire event

quartz kindle
#

the data you can transmit is limited to primitives

#

since its a network connection

pure lion
#

Dam

opal plank
#

it can send JSON which is going to be more than useful

quartz kindle
#

you can send text or binary, for example stringified json

pure lion
#

What if I were to start sharding now? (31 servers)

quartz kindle
#

you would be increasing your resource usage for no reason

cinder patio
#

It's pointless

pure lion
#

Okay just curious

opal plank
#

isnt 1000 the recommended ?

pure lion
#

2k

quartz kindle
#

1500

opal plank
#

long way to go before then

pure lion
#

You can't join more than 2500 without sharding

digital ibex
#

you would be increasing your resource usage for no reason
tim, how does this happen? confusion

solemn latch
#

sharding is using multiple processes to run your bot

pure lion
#

When you shard the bot is split in to separate processes(?)

quartz kindle
#

there are multiple ways to shard

#

discord.js gives you two options out of the box: sharding manager and internal sharding

#

the typical way is using the sharding manager, which creates a child process for each shard

#

so if you have 4 shards, you have 4 child processes

digital ibex
#

with eris, does it do that too?

#

im guessing yes

quartz kindle
#

each child process is a full independent instance of node.js, which takes up a minimum of 50mb memory

digital ibex
#

minimum? what happens if its below 50mb?

solemn latch
#

a guy i know is swapping his bot to eris, i belive eris has the ability to have multiple shards per process

signal vortex
#

๐Ÿฟ this is a good thing for more learning I'ma sit here and take it all in

solemn latch
#

i think the dank memer bot dev said they have 3 or 4 shards per process, and they use eris

pure lion
#

Bruhhhhh

opal plank
#

deno lib iirc

quartz kindle
#

then you have internal sharding, which instead of creating child processes, it creates websocket connections inside the same process, so you have a single process handling multiple connections to discord. its much more efficient, but since node is single threaded you are limited to only fully utilizing 1 cpu core, so if you have multiple cores, you'd be losing out in performance

#

discord.js also offers an experimental worker mode with the sharding manager

digital ibex
#

oh, does eris do internal sharding?

split hazel
#

yes

digital ibex
#

oh, is there a way to make it not internal shard or something?

split hazel
#

im not sure if eris offers other sharding solutions, but there are 3rd party sharders

digital ibex
#

theres only one way to shard with eris, so i'd have to change the code myself, right?

split hazel
#

such as eris-sharder

quartz kindle
#

worker mode uses node.js's new worker processes, which is a mix of both, it creates worker processes instead of child processes, and worker processes can share memory with its parent process, so they are like threads instead of fully independent processes. they can take advantage of multiple cpu cores without creating fully independent node.js instances

pure lion
#

๐Ÿฟ ๐Ÿ˜„

digital ibex
#

oh

split hazel
#

which creates clusters and splits the shards evenly amongst them

#

much more efficient since it utilises multiple cores

pure lion
#

I'm learning so much here school is a lie drop out and do bot Dev lolololol

solemn latch
#

hopefully worker mode is done before i need sharding ๐Ÿค”

quartz kindle
#

the most efficient possible sharding setup is to mix internal sharding with workers and/or children, but that requires manual configuration of shards, no js library does that out of the box

earnest phoenix
#

They're turning into weebs @opal plank

slender thistle
#

Well move to general or shitpost if it's offtopic

opal plank
#

im not going into a prolonged discussion with this

slender thistle
#

Still

opal plank
#

just wanted an awnser

digital ibex
#

I'm learning so much here school is a lie drop out and do bot Dev lolololol
how stupid do u have to be to say that..

split hazel
#

though separate processes can be unreliable at times

#

prone to crashing and random freezing if you fuck something up

solemn latch
#

i dont even know what mod im talking to anymore

slender thistle
#

Tbf I wasn't explained anything of that sort in college and I'm going for degree in Comp Sci

solemn latch
#

and with those untypeable chars ima just have to tag @ mods when i need something

pure lion
#

how stupid do u have to be to say that..
This stupid apparently
(/s)

slender thistle
#

Usernames

quartz kindle
#

right click > mention

solemn latch
#

๐Ÿค”

pure lion
#

HM

quartz kindle
cinder patio
#

I actually made a custom lib built up on Cyber's Nakamura that combines internal + worker threads

quartz kindle
#

i made one that works with pm2 cluster mode lol

modest maple
#

i use k8s cuz, its better

#

lol

digital ibex
#

im having a bit of a problem with my dashboard, u can press enter and things r gonna save, so i press enter (when nothing is provided in the input bit) it says the prefix is . how can i make a minimum character limit thing on the input thing with js or if html, html

pure lion
#

Aight I'm gonna go learn how to interact with APIs and shit and make my own lib

This is not a bad idea at all

quartz kindle
#

good luck, it will drive you insane

cinder patio
#

ngl it was pretty easy

pure lion
#

Sorry forgot to mention from scratch

cinder patio
#

but it's probably trash lol

digital ibex
#

it should say 'The prefix for server is prefix' any ideas?

pure lion
#

Fuck it I'm gonna make my own coding language too

earnest phoenix
opal plank
#

not FROM scratch, WITH SCRATCH, make a xScratch Lib

solemn latch
#

make the operating system first

quartz kindle
#

Lol

cinder patio
#

Does anybody know what the 10005 discord gateway error means, I keep getting it randomly and I don't see it in the docs anywhere

opal plank
#

THAT will drive you nuts

pure lion
#

make the operating system first
Not before I make a pc from scratch, transistor by transistor

opal plank
#

@cinder patio

quartz kindle
#

10005 Unknown integration

pure lion
#

@opal plank ye?

#

DISCORD OS :DDDDDDDDDDD

opal plank
#

wrong person

solemn latch
#

lol

cinder patio
#

What does that even mean

pure lion
#

Idk

#

You sign in with discord and that's it

#

Boom

quartz kindle
#

its a rest error, from an http request

cinder patio
#

No I'm talking about the error

pure lion
#

Epic

#

I'm talking to myself too don't worry :D

quartz kindle
#

try tracing it, see which request it came from

opal plank
onyx summit
#

it should also give you the path of the request

cinder patio
#

Whaaat I'm sure it came from the websocket, I'll look into it tomorrow

opal plank
pure lion
#

*eats popcorn*

opal plank
#

dude that'll let me recode half of my current shit @quartz kindle

#

ty so much for that

quartz kindle
#

lol np

pure lion
#

Thx too Tim, I've learned so much here lol

quartz kindle
#

which reminds me, i need to finish my ipc library

earnest phoenix
#

I'm starting to think Tim created the stack overflow or whatever that was... God of coding bruh

#

So i was looking into oauth2 documents, but i saw something that i couldn't figure out... It needs a redirect_uri which i have no idea what it's supposed to be... Other things are clear, any ideas

pure lion
#

Would there be a way to read a fetched text file?

#

Using fs

quartz kindle
#

Lol

pure lion
#

Alright tomorrow I'm going to write a coding language

#

Because who needs simplicity

#

It's gonna be h-script, and be based off the number 8

#

And the letter h

quartz kindle
#

@earnest phoenix redirect_uri is the url the visitor should be redirected to after logging in, ie: back to your website

pure lion
#

I already have the syntax planned out

quartz kindle
#

lmao

#

so pretty much like a bunch of other esolangs?

earnest phoenix
#

@quartz kindle oh i get it... Thanks tim

pure lion
#
client.on('message', async msg => {
        if (msg.content.startsWith(`-transcript`)) {
            msg.channel.send(`WORKS`)
                //
                //var CHmsgfetch = await msg.channel.messages.fetch()
                //var ticketChnMsgs = (CHmsgfetch.map(m => ({ author: m.author.tag, content: m.content })).reverse())
                //fs.writeFile('node_modules/ticket.txt', JSON.stringify(ticketChnMsgs, null, '\n'), (err) => {
                //if (err) throw err;
                //})
                // msg.channel.send(new Discord.MessageAttachment('ticket.txt', 'ticket.txt'))
        }
    })

Trying to help someone but uh...

#

It's not sending works to the channel

sudden geyser
#

Does client refer to the actual client used to connect to Discord? What library are they using?

pure lion
#

Djs

quartz kindle
#

writeFile is async

pure lion
#

I'm in pain rn I want this to be over lma9

#

Ik it's commented out rn

#

We're just trying to get it to send a message

#

No errors, no nothing

quartz kindle
#

"works" doesnt work?

pure lion
#

Doesn't send /shrug

quartz kindle
#

but does it receive?

#

console.log something

pure lion
#

Nope

#

Ok

amber fractal
#

is the bot online?

quartz kindle
#

is your computer turned on?

amber fractal
#

is your fridge running?

pure lion
#

I'm deadass laughing

#

No the bot is not online

quartz kindle
#

lmao

pure lion
#

Jk it is

#

Anyway he's not here rn

#

So esolang

#

Sounds fun

#

:D

sudden geyser
#

there's an esolang dedicated to gucci gang esketit

pure lion
#

Why

quartz kindle
#

lmao

pure lion
#

Nvm it's an esolang I don't get to ask why

quartz kindle
#

i dare you to write a bot in Chef

pure lion
#

...what is chef?

quartz kindle
pure lion
#

OMG I CANT

#

IM DYING

#

BEST LANGUAGE 11/10

sinful belfry
slender thistle
#

MOod

opal plank
#

wtf am i looking at

sinful belfry
#

lmao

pure lion
#

Nah fuck this I'm writing a bot in hnary

opal plank
#

im going to modify js to set arrays indexes to start by default at the last digit of the timestamp of when the instance goes on

#

arrays start at 9

#

cuz fuck lua and everything else

sudden geyser
#

Luca is written in Lua.

#

How dare you disrespect our lord.

earnest phoenix
#

Your lord*

cursive laurel
#

Hey, I'm trying to make a rich embed with multiple fields, but whenever I try doing so, the description shows as undefined. Is there something that I'm missing?

pale comet
#

I believe you need to end your variable with ; no?

cursive laurel
#

At the end of each field?

pale comet
#

the last one

cursive laurel
pale comet
#

Oh

#

your field

#

Your fields have 2 values

#

Name and Value

#

they both have to be filled out

pure lion
#

You can only set the description once

cursive laurel
#

So how come I see bots with multiple fields in them?

pale comet
#

you can have multiple fields

pure lion
#

Fields are added as (<string>, <string>)

pale comet
#

just not multiple descriptions

cursive laurel
#

Ahh okay

robust arrow
#

set can only be used once
add can be used multiple times

slender thistle
#

.addField accepts 3 arguments: name (field name), value (value of the field), and inline (a boolean arg that should be self-explanatory)

pale comet
#

(I don't use discord.js I just know a little so I might get something wrong)

cursive laurel
#

Since this is the first time I'm experimenting with message embeds

pale comet
robust arrow
#

is that djs?

pale comet
#

yes

robust arrow
#
            const embed = new Discord.MessageEmbed()
                .addField('field title', 'description of field')
                .setThumbnail(message.author.avatarURL())
                .setColor(0xffffff)
                .setFooter('footer');
``` this is how I make embeds
pale comet
#

yeah p much the same I just do my fields differently because that's just how I learned :P

robust arrow
#

same

pale comet
earnest phoenix
#

hey guys, how u doing

#

I have a question

#

basically can i make my bot send a message in a specific channel after 15 mins of inactivity using discord.py?

slender thistle
#

on_message event with asyncio.sleep or discord.py tasks even

solemn latch
#

Keeping your program alive on glitch?

earnest phoenix
#

no

#

a chat revive feature my client requested

ancient falcon
#

Would anyone happen to know how I can check if a certain column (using WHERE) exists in MySQL using python's mysql-connector?

solemn latch
#

Yikes, those message things so people look at your servers suck

earnest phoenix
#

lol not my prob, my client asks for sth and i provide

solemn latch
#

Ye

earnest phoenix
#

not my business why he/she wants it

quartz kindle
#

yes its possible, and quite easy to make

earnest phoenix
#

oh?

#

care to elaborate?

slender thistle
quartz kindle
#

define an object/struct/dictionary or something

#

add a channel to it, as a key, with a timestamp as a value

#

on every message you receive, check the channel it comes from, if it matches a key, update its timestamp

#

then run a timer somewhere that sends a message if said timestamp was not updated for 15 min

earnest phoenix
#

oh

#

ok

quartz kindle
#

or you can store the timer itself in the object/dict

#

and reset it on every message

earnest phoenix
#

ill stare at ur message for a while and translate it to code

#

ty โค๏ธ

slender thistle
earnest phoenix
#

yes

#

@quartz kindle plz Can you help me in dm ๐Ÿ˜… or say if you are busy

#

i might need a task here fir the timer

quartz kindle
#

@earnest phoenix client.on("debug",console.log)

#

add that to your code

earnest phoenix
#

can i use on_message with a discord.py task or only events?

slender thistle
#

Do you need multiple channels or just one?

earnest phoenix
#

one

ancient falcon
#

I have carefully read your source and, unfortunately, it does not quite seem to be answering my question. As thus I assume I have poorly formulated it and will proceed to reformulate it.
I'd like a way to either execute IF statements within the MySQL query or a way to get a list of all the columns existing within a table. Hope I've formulated it better this time and I haven't missed something in the link you sent.

quartz kindle
#

you mean like the DESC table query?

#

or SHOW COLUMNS FROM table

ancient falcon
#

Oh yeah something lke SHOW COLUMNS FROM table,

#

how is that returned when using the mysql-connector-python as an array?

slender thistle
#

@earnest phoenix .cancel() and .start() the task on sent message, the task having a decorator tasks.loop(minutes=15, count=1)

quartz kindle
#

should return as an array of objects/dicts/tuples or something similar

#

each row contains column name, type, attributes, etc

slender thistle
#

Does mysql-connector not use tuples for returned data compared to sqlite3?

ancient falcon
#

From what I've seen yeah.

#

Well, I'll experiment with that, thank you!

quartz kindle
#

i keep forgetting about tuples, they dont exist in js lul

slender thistle
#

Just a blind guess without reading the docs tbh, just assumed that mysql-connector would utilize tuples for... consistency, I guess?

#

And probably differences in performance compared to lists

wise verge
slender thistle
#

Uhhh what

earnest phoenix
#

@earnest phoenix .cancel() and .start() the task on sent message, the task having a decorator tasks.loop(minutes=15, count=1)
@slender thistle .how do and where do i use cancel() and .start()?

slender thistle
#

In the on_message event

earnest phoenix
slender thistle
#

You create a task with that decorator outside of the event and then cancel/start it on each message sent

earnest phoenix
#

so like async def on_message(.start())?

#

im so confused

slender thistle
#
@tasks.loop(minutes=15, count=1)
async def eee():
    send message

async def on_message(message):
    some stuff here
    eee.cancel()
    eee.start()```
earnest phoenix
#

oh

wise verge
#

@earnest phoenix i mean on top.gg page

earnest phoenix
#

oh u will need to make a new page i think

#

like a new bot profile

#

idk

wise verge
#

owhh

earnest phoenix
#

try editing it

wise verge
#

k i'll try

#

ty

lucid pasture
#

does anyone know a command to send a dm to a user? like (insert bot command) --> sends dm to user with info

slender thistle
#

What library?

earnest phoenix
#

@earnest phoenix client.on("debug",console.log)
@quartz kindle this will fix my error ? Explain a little plz ^^'

lucid pasture
#

@slender thistle js

solemn latch
#

Isnt it just user.send

lucid pasture
#

it might be ill check

solemn latch
#
slender thistle
#

message.author.send?

lucid pasture
#

ill try both

#

thanks for the help

crystal socket
#

anyone have grafana setup for d.py?

solemn latch
#

Author is just a User

earnest phoenix
#
@tasks.loop(minutes=15, count=1)
async def eee():
    send message

async def on_message(message):
    some stuff here
    eee.cancel()
    eee.start()```

@slender thistle what do i put in the message thing in on_message? and what stuff below that?

placid iron
#

If you guys get errors using JSON then just look at it and remove everything from the with statemt except loading it up

lucid pasture
#

yea it was message.author.send/msg.author.send

slender thistle
#

in the message thing?

earnest phoenix
#

how I add a role in v12?

slender thistle
#

The some stuff here is replaced with a check for the needed channel

earnest phoenix
#

in the message thing?
@slender thistle async def on_message(message), the message inside the paranthesis

slender thistle
#

It's an argument that contains the message object, you don't do anything about it

#

You use it in the event itself

earnest phoenix
#

so i put it in as message?

slender thistle
#

It doesn't really make a difference what you call it, it's a variable that you'll use

earnest phoenix
#

OH

#

NOW I SEEE

slender thistle
#

But yes, you should leave it if you don't want errors

earnest phoenix
#

also

#

what do i replace some stuff with?

solemn latch
#

Things and stuff

slender thistle
#

I'd put a check there for the channel ID and if channels match, "restart" the task

earnest phoenix
#

i put that in the eee async

slender thistle
#

the eee is a task that should send the message

earnest phoenix
#

yes

#

i made it check before sending it

slender thistle
#

To handle the actual run of it is done in on_message

earnest phoenix
#

ill do ur way

#

cos it sounds better

slender thistle
#

I mean, you won't have access to the message in the task

earnest phoenix
#

yes

elfin flower
#

yay

#

wait forgot something

#

there

slender thistle
#

using = instead of ==

#

And we don't spoonfeed code

quartz kindle
#

@earnest phoenix this is to see why its taking so long

earnest phoenix
#

Okay

proven lantern
quartz kindle
#

install them with npm

#

or if you're using an app hosting service that auto-installs for you, then yeah add them to package.json

proven lantern
#

cool

#

thanks

earnest phoenix
#

how do i make my bot send a message to a specific channel in discord.py?

solemn latch
#

message.channel.send()
?

earnest phoenix
#

last thing and i think my thing is finished here

solemn latch
#

Or channel.send ๐Ÿค”

slender thistle
#

bot.get_channel and call .send on the returned channel

#

make sure you handle cases where None is returned instead

earnest phoenix
#

ok

slender thistle
#

@earnest phoenix no advertising, rule 4

#

Last warning

#

Okay

earnest phoenix
#

after i get the channel id, how do i send sth to it?

#

plz
@earnest phoenix did he stutter? no advertising

slender thistle
#

You sent the same link multiple times after my warning

earnest phoenix
#

BRUH

#

MUTE HIM

slender thistle
#

And you're still doing it, bye

earnest phoenix
#

imo just mute at this point lol

slender thistle
gilded plankBOT
#

dblMod Banned Blake#8313 (@lucid crane)

earnest phoenix
#

gg

#

after i get the channel id, how do i send sth to it?

slender thistle
#

Anyway, are you saving the returned channel in a variable?

earnest phoenix
#

no, ill send ss

#

since it's only one channel imma be sending to

slender thistle
#

What's your d.py version

#

That's python

#

Not js

earnest phoenix
#

yes

opal plank
#

just noticed

earnest phoenix
#

What's your d.py version
@slender thistle latest version i believe, updated a few weeks ago

slender thistle
#

IDs are integers

earnest phoenix
#

ok

#

so int("id")?

slender thistle
#

And yeah, use bruh.send then

#

... Ehhh nah

earnest phoenix
#

ok

slender thistle
#

Just remove the quotes

earnest phoenix
#

i did it

#

no need for the quotes in the id?

slender thistle
#

Yeah, you're making it a string

#

aka "someid"

earnest phoenix
slender thistle
#

don't forget to await bruh.send

earnest phoenix
#

yes

slender thistle
#

Also, unnecessary int()

earnest phoenix
#

ok

opal plank
#

123 = int
"123" = string

earnest phoenix
#

yes

opal plank
#

iirc int is the same as parse in js

#

int("123") => returns 123

earnest phoenix
#

yuh

slender thistle
#

Yeah, but that's unnecessary in this case

opal plank
#

^

earnest phoenix
#

took it out

#

ight running the bot

celest schooner
#

i was running my bot on a server

#

and i got this error when I tried to run the code

#
        ^

Error: /home/cloud_user/DominationBot/node_modules/better-sqlite3/build/Release/better_sqlite3.node: invalid ELF header```
opal plank
#

js?

celest schooner
#

it was an amazon linux 2

#

yea

opal plank
#

where is that e at?

#

need more code

#

throw e just means it errors, its not enough to debug it

celest schooner
#

i dont think this has to do with the code

#

as the code works

opal plank
#

invalid ELF header

quartz kindle
#

did you copy your node_modules folder from your computer to your server?

earnest phoenix
celest schooner
#

no should I?

quartz kindle
#

no

opal plank
#

I've found that bcrypt compiled on OSX will not quite work on Linux. In other words, if you check in the bcrypt compiled on your local OSX workstation, and try to run the node app on your linux servers, you will see the error above.

Solution: npm install bcrypt on Linux, check that in, solved.

Probably the best way to deal with this is exclude your node_modules in .gitignore... and npm install remotely.
https://stackoverflow.com/questions/15809611/bcrypt-invalid-elf-header-when-running-node-app

quartz kindle
#

you should always install you dependencies from npm

celest schooner
#

i reinstalled it

quartz kindle
#

invalid ELF is related to wrongly build binaries

opal plank
#

yeah prob dependency missing

quartz kindle
#

are you using sqlite directly or a wrapper such as quickdb?

celest schooner
#

well I use github priv repos to transfer files and clone the repo onto the server

#

im using enmap

#

wrapper

quartz kindle
#

do you have node_modules in your git repo?

celest schooner
#

no

#

node_modules
data
package-lock.json
package.json

#

thats my .gitignore file

quartz kindle
#

try npm rebuild enmap

#

see if sqlite gets properly rebuilt

celest schooner
#

tried it and it doesnt work

proven lantern
#

package-lock.json package.json shouldn't be in your gitignore

celest schooner
#

but what if I have to reinstall the packages

quartz kindle
#

package.json contains your packages, you need it to auto install/reinstall them

celest schooner
#

wdym

quartz kindle
#

unless you prefer manually installing them every time

#

anyway wdym it doesnt work

celest schooner
#

same error

proven lantern
#

try removing package-lock.json and package.json from gitignore and checking in the package files into the git repo

quartz kindle
#

just checked enmap docs

celest schooner
#

okay

quartz kindle
#

they dont bundle sqlite

#

you need to install sqlite separately

#

so try npm rebuild better-sqlite3

celest schooner
#

i installed better-sqlite-pool

#

wait

#

just got a bunch of errors

#

when I tried installing better-sqlite3

quartz kindle
#

show log

celest schooner
quartz kindle
#

you're possibly missing build tools

#

apt install build-essential

celest schooner
#

in the directory?

quartz kindle
#

or whatever the equivalent for amazon linuxes is

slender thistle
#

@earnest phoenix add a check for the cancel start stuff

quartz kindle
#

directory doesnt matter, its a system install

#

does amazon linux use yum?

celest schooner
#

yea

#

it says i need to be root

#

should I sudo

#

oh i sudoes

earnest phoenix
#

@earnest phoenix add a check for the cancel start stuff
@slender thistle wym?

quartz kindle
#

this is what the amazon docs say to use

#

sudo yum groupinstall "Development Tools"

#

should be the rough equivalent to apt install build-essential on ubuntu

earnest phoenix
#

im sorry im kinda new to development, like idk the terms well and stuff

#

so what do you mean by check?

slender thistle
#

an if to check only for one channel ID

earnest phoenix
#

ok

#

but wait

celest schooner
#

should I do both

#

wait

quartz kindle
#

Development Tools should include all of those

earnest phoenix
#

wait why do i have start in the first one

#

lemme remove that

slender thistle
#

Parentheses not important but yes

earnest phoenix
#

ok ill try it

#

hopefully it works

cursive laurel
#

Hey so I'm trying to to do a command handler for the first time instead of dumping my entire code on 1 folder and I've been having issues on getting it to work.

#

I'm trying to get a rich embed message setup on a different folder and I keep getting errors of not responding at all.

#

Though if I keep the code on the main folder then it works

earnest phoenix
#

@slender thistle no progress pepecry

quartz kindle
#

you dont need two switch cases

#

you dont need any switch case at all

slender thistle
#

Show code

earnest phoenix
#

ok

celest schooner
#

@quartz kindle it worked thanks

earnest phoenix
slender thistle
#

Someone forgot an event decorator on on_message

earnest phoenix
#

wait why is my count 2

#

Someone forgot an event decorator on on_message
@slender thistle wdym?

#

OHHH

#

@client.event

slender thistle
#

Aye

cursive laurel
#

@quartz kindle I was following along a tutorial

#

ReferenceError: MessageEmbed is not defined

I also keep getting this error popping up

solemn latch
#

You need to require messageembed in your command file

#

If you want to use it

cursive laurel
#

The 1st screenshot which is under a section of the command file has it

quartz kindle
#

@cursive laurel you can do ```js
let command = bot.commands.get(args[0]);
if(command) { command.execute(msg,args); }

#

that replaces the switch case

#

and inside the command file you dont need any switch case

#

just directly create and send the embed

cursive laurel
#

Okay

earnest phoenix
#

Aye
@slender thistle nope

#

no progresssss

quartz kindle
#

and yes, you need to require MessageEmbed again

#

in all your command files

cursive laurel
#

verify is the only command file I have at the moment

slender thistle
#

Oh there's restart method for tasks

hidden lynx
#

How can we add the modules (e. g. The verified thing) to the command collection?

sudden geyser
#

What do you mean?

hidden lynx
#

I mean when you create an extra module in another file. How do you add this to the bot.commands
Collection?

sudden geyser
#

Ah, what language are you using, and what is bot.commands specifically? Is it an array? A map? A type of "collection" from a library (such as Discord.js)?

hidden lynx
#

Yes exactly

#

The discord js "Collection" type

#

I saw some fancy stuff using fs to fetch all files

sudden geyser
#

You can use the .set(K, V) method. The K is usually the command name and the V is the data on that command (such as an object or class representing the command). If your commands are stored in separate files, you can use the fs module's readdir method to read the directory where you store your commands and load them.

If it doesn't make sense, check out this guide: https://discordjs.guide/command-handling/#dynamically-reading-command-files

hidden lynx
#

Omg thanks for the link! That's exactly what I was looking for. Actually a pretty clean way of how the library is handling commands๐Ÿ‘

sudden geyser
#

It's not the library. It's how Node.js and you are handling it.

hidden lynx
#

Yeah but isn't the Collection something specific that comes from the library? Actually just an object, right?

sudden geyser
#

Yes that part is. However, any form of storage could do. You could even go with an plain old object or Map

hidden lynx
#

I don't know too much about Maps. Aren't they similar to objects but with some special way of setting and getting properties?

solemn latch
sudden geyser
dawn pebble
#

yo im new at bot dev can someone give me a hand on a project?
im pretty sure its very simple stuff

sudden geyser
#

Are you having issues with something not working in your code, or just want someone to contribute to your project

dawn pebble
#

im trying to understand how to do something with Message Mention

grizzled raven
dawn pebble
#

im tiring to make a code that warns people that mentions someone in particular

small haven
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'guild'


```py
@client.command(pass_context=True)
async def mute(ctx, member):
    
    role = get(member.guild.roles, name='Muted')
    await member.add_roles(role)
    await ctx.send("Role added")
#

oh god

tidal cedar
#

Member is a string I think

#

Like <@Id here>

sudden geyser
#

Henriq what library are you using, and what have you tried already

tidal cedar
#

Probably need to get the user?

small haven
#

mmm

slender thistle
#

Use a type annotation discord.Member

dawn pebble
#

i think im only using discord.js

small haven
#
 @client.command(pass_context=True)
 async def mute(ctx, discord.Member):
     
     role = get(member.guild.roles, name='Muted')
     await member.add_roles(role)
     await ctx.send("Role added")
#

like that?

tidal cedar
#

Does anyone know of a way to get the last x messages efficiently in discord4j?

small haven
#

or did you mean on

await.add_roles(role)

slender thistle
#

type annotation for the argument member

tidal cedar
#

member : discord.Member

slender thistle
#

not "replace the member argument"

small haven
#

sweet, that worked

sudden geyser
#

henriq have you tried using <Message>.mentions to get a list of mentioned members/users/roles/etc.?

small haven
#

thank yall my dudes. sorry for being a lil dumb

dawn pebble
#

no but im not sure how to do that lol

#

idk if i was clear about what im trying to do

sudden geyser
dawn pebble
#

can u join testing 1 it would be ester to explain if you don t mind

vernal vapor
#

Hey could someone check this and see where the mistake in my html is (it's not working in website)

sudden geyser
#

Sorry, I don't like speaking.

vernal vapor
#

No prob

dawn pebble
#

ok then thank you anyways

vernal vapor
#

Dw I have it

weary ridge
vernal vapor
#

Yaa I missed the div class lol

weary ridge
#

tru lol

autumn summit
#

does anyone know how to make transcripts using discord.py html

ember lodge
#

Someone knows how can i separate the color of a website in 2 pieces?

elfin flower
#

how do i make the bot ban everyone lol

earnest phoenix
#

Thats called api abuse which is against ToS

elfin flower
#

lol

solemn latch
#

Yikes

opal plank
#

How do i make my bot steal all server invites to post it on a website so people raid their servers?

#

||clearly a joke||

solemn latch
#

You've been reported to discord

opal plank
#

lmao

solemn latch
#

Jokes are not allowed

hoary elm
#

๐Ÿ‘€

elfin flower
#

how do i make my bot leak everyones home address and IP

hoary elm
#

Yikes what did I walk into ๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ

solemn latch
#

Tell them to use tiktok aparently

elfin flower
#

i was joking

#

ok

restive pebble
#

lol

earnest phoenix
#

Either ask a serious question else its probably a good idea to keep the channel on topic.

ember lodge
#

So emm..

solemn latch
#

After around 10, I start taking those rules less seriously.
None of the mods care at this point
/s

#

You can define the background color of each div

#

Or row

#

Or span.
Or whatever your using

ember lodge
#

oh thxs

earnest phoenix
#

oP

restive pebble
#

ok

solemn latch
#

The best way I found to learn about css stuff.
Just inspect stuff on webpages you see on how to do it

earnest phoenix
#

__

#

my nickname remove plz

humble gyro
#

@ember lodge use display: flex to have multiple divs next to each other

warm marsh
#

Your discord name is hard to mention therefore you get a lovely easy to mention one.

ember lodge
#

Thank you

humble gyro
#

there's a bunch of css frameworks that help a lot with this

earnest phoenix
#

@humble gyro my nickname remove plz

humble gyro
#

no

earnest phoenix
#

plz bruhh

humble gyro
#

don't ping me for stupid shit like that

indigo folio
#

@earnest phoenix change ur tag

earnest phoenix
#

i dont have nitro

sudden geyser
#

You don't need nitro to change the username part

earnest phoenix
#

tag saying nope

sudden geyser
#

I don't know how it's like on mobile.

earnest phoenix
#

i mean tag tag #

slender thistle
#

You don't need to change the tag. To change your username, you don't need Nitro

earnest phoenix
#

I don't know how it's like on mobile.
@sudden geyser

sudden geyser
#

yeah ty

rain cradle
restive pebble
#

<@!1234567890...>

#

just check because pings starts with these

rain cradle
#

@!โ†What does it mean?

earnest phoenix
#

what

lyric mountain
#

<@!ID>

restive pebble
#

u can check for messages lol

#

<@!1234567890...>

earnest phoenix
#

<@silentid>

lyric mountain
#

Also check for <@ID>

earnest phoenix
lyric mountain
#

Because sometimes it doesn't have !

earnest phoenix
#

my english bad bad

restive pebble
#

nice

sudden geyser
#

Or you could use the dedicated .mentions property on a messaage.

slender thistle
#

How do you check ping?
(on discord.py)
Latency or message mentions

rain cradle
#

Latency

slender thistle
#

Websocket latency: client.latency

#

API response time: calculate time between sending requests and receiving a response

#

P.S. import time and time.time()

rain cradle
#

Sorry, I want to get User's latency.

slender thistle
#

User's latency? I don't think that's possible on Discord

pale vessel
#

like the timestamp difference?

rain cradle
#

like the timestamp difference?
Oh, I'll use it. Thank you.

vernal vapor
grizzled raven
#

opacity:

vernal vapor
#

@grizzled raven in which area body?

#

Or would I have to make a div

grizzled raven
#

how would I make the buttons transparent

#

put the style in the button bigbrain

maiden mauve
#

oi

#

so this worked a long time ago

#

but now its being difficult

sudden geyser
#

is e.code not an integer?

maiden mauve
#

as far as I know e.code has to be an integer

#

all discord errors are integers

#

oh wait

#

you think making it a string

#

oh

sudden geyser
#

Yeah, and you're comparing a number with a string. Also you never actually return'd in the if statement so it'll log anyway.

maiden mauve
#

hahaha

#

wow I went on a mission to strict my code

#

and totally missed thaty

#

it was probably == before

opal plank
#

anyone know SQL syntax rather well or postgres?

#

well, gonna ask either way if someone's lurking
say i have this object

let foo = {name: 'test', location:'somewhere'}```
Now i have a postgres jsonb table
its contains an array of objects inside like foo above.
To query filter it i can do ``filter->>'name'`` to find the proper row that its contained, however:
```js
//in the table
[{name:'bob', location:'bar'}, {a:1, b:2}, {n:1, m:4}]```
lets say i want to  replace  ``{a:1, b:2}`` obj in that table with the ``foo`` mentioned above(order doesnt matter)
the only non destructive way i see to get that would be using operator ``#-`` with the index of that object.
however im not seeing a way in SQL to get index of that object to define it to be deleted without destroying the array and checking individually
or returning the obj to js and then resending it after its been parsed on the code(instead of using SQL query)
any tips?
weary ridge
#

does anyone know how to make a command repeat?

wide sage
#

any better alternative to heroku and glitch without paying any cents?

pale vessel
#

no

winter basalt
#

not that we know of

reef mantle
#

Anyone here?

pale vessel
#

as you can see

reef mantle
#

Ok so

#

I want a code for the bot to change its role color after 5 mins

#

Is it possible? @pale vessel

pale vessel
#

no

winter basalt
#

we dont do spoonfeeding

pale vessel
#

yes but no

reef mantle
#

Why?

pale vessel
#

that's rainbow role

reef mantle
#

Am I doing something wrong?

#

Yea

#

Yea

pale vessel
#

even every 5 minutes, it's not allowed

winter basalt
#

rainbow role bad

reef mantle
#

You mean that code doesn't exist or something?

pale vessel
#

it does

reef mantle
#

I want it pls

pale vessel
#

not happening

opal plank
#

it means you'll get flagged by internal flags and get your bot banned

reef mantle
#

But why and how?

#

Pls someone tell in detail

opal plank
#

api spam/abuse

reef mantle
#

Thank you

opal plank
winter basalt
#

bruh

pale vessel
#

bruh wtf

opal plank
#

the iq here is really low isnt it?

pale vessel
#

that's 5 secs too

opal plank
#

@pale vessel shhh

#

let em be banned

pale vessel
#

๐Ÿ˜ฉ kill me

winter basalt
#

the low iqness

#

is overkill

reef mantle
#

How to change the time? @wide sage

#

Someone said it's 5sec

pale vessel
#

nah i misread

reef mantle
#

-_-

opal plank
#

@wide sage help the noobs api abuse and get their tokens revoked? and spoonfeeding code?

winter basalt
#

ah yes, helping.

pale vessel
#

amazing

opal plank
#

should tag a mod for that one

earnest phoenix
#

"helping"

opal plank
#

the level of sass

reef mantle
#

Thank you guys

#

You really helped me

winter basalt
#

to get banned

#

yep

reef mantle
#

Don't worry my bot will be banned not me

opal plank
#

@reef mantle not like you link your account, right?

reef mantle
#

Ooooof

#

It means I'll be banned too?

earnest phoenix
#

if you're linked to several bots doing api abuse you'll be banned too

winter basalt
#

sometimes i just wanna take a sip of coffee and hope to die out of nowhere

reef mantle
#

:'(

opal plank
#

not like you have to be logged to get a bot right

pale vessel
#

@wide sage come on

opal plank
#

tag a mod

#

-.-

#

let em deal with that kid

winter basalt
#

spoonfeeding api abuse code, not cool

pale vessel
#

bro i'm not doing this shit

reef mantle
#

Wait guys

opal plank
#

@craggy pine read above pls

reef mantle
#

I am not coding it

#

But I wanted to ask

winter basalt
#

spoonfeeding doesn't necessarily mean the same code as youre using

opal plank
#

i'll just let someone take care of that, fuck it

reef mantle
#

Is coding a DM bot ok if it's used in only one server?

#

Is coding a DM bot ok if it's used in only one server?
@reef mantle anyone?

#

-_-

#

I meant is it legal to make it?

#

Ok thanx

opal plank
winter basalt
#

actually what you cant do is anonymous dms and mass dms

spare goblet
#

?

opal plank
#

before and after for context

spare goblet
#

@wide sage rainbow roles r yikes (,:

opal plank
#

api abuse, dm bot, spoonfeeding

spare goblet
#

b abusing discord api

opal plank
#

pick one

spare goblet
#

please don't spoonfeed users or encourage abusing the api

#

if you continue you will be muted

#

no it doesn't

#

and it's against the rules

opal plank
spare goblet
#

well even if it hElPed you, it's still not an etiquette we support and would appreciate if you refrain

opal plank
#

spoonfeeding helps who? teaches people to copy paste code, thats it

winter basalt
#

well its at the least better if you manage to figure out what the code and each line does

opal plank
#

thats what docs snippets are for

#
spare goblet
#

stop arguing
spoonfeeding is not allowed as stated in the rules, periodt

#

breaking the tos is also not allowed, periodt

#

stop encouraging or helping people to do so

opal plank
#

^^

spare goblet
#

@reef mantle also stop asking for something that's against discord api and abuses it, there is that rule for a reason, you were asked to stop but wouldn't until someone spoonfed you

reef mantle
#

I ask cause I don't know what's the abuse and what's okay

#

I am sorry

#

I'll not ask

spare goblet
reef mantle
#

Ok mam

#

Thank you

spare goblet
#

Even if you "not ask" it is still against Discord developer guidelines

#

meaning you'll eventually gotem bannum

wide sage
#

it's been 2 weeks

#

my bot is still being verified

spare goblet
#

we don't handle bot verification? discord does it ?

#

or are u talking about top.gg approval

wide sage
#

or are u talking about top.gg approval
tickYes

winter basalt
#

takes 2-4 weeks rn

wide sage
#

f

spare goblet
#

@wide sage nice, now ads (,:

opal plank
#

bruh

wide sage
#

nope

opal plank
#

read the docs

#

thats it

wide sage
#

not ads

spare goblet
#

you literally just advertised two servers

#

wym

wide sage
#

he can learn from there

opal plank
#

learn from the DOCS

wide sage
#

not advertisement exactly

opal plank
#

where you are suppose to

gusty oracle
#

How much time does discord bot verification take?

opal plank
#

https://discordjs.guide/
https://discord.js.org/#/docs/main/stable/general/welcome

There, thats your learning material. Why would you bring up other servers when both sites provide ample explanation and code examples?

#

@gusty oracle 2-3 weeks

gusty oracle
#

Thanks.....2-3 weeks from?

opal plank
#

from.....when you apply?

wide sage
#

that's nice!

gusty oracle
#

Oh how do you apply lmao?

opal plank
#

which verification you talking about?

#

topgg or discord?

gusty oracle
#

Disc

winter basalt
#

you'd get a message from discord

wide sage
opal plank
gusty oracle
#

Lol ok thanks

#

Mine in 10 servers so

#

No server requirement for top.gg right?