#development

1 messages · Page 1455 of 1

crimson vapor
#

windows media player

elfin tulip
mellow kelp
#

bruh windows wants a $1.00 extension to reproduce this video encoding

crimson vapor
#

yeah

#

its so shit

sterile lantern
#

can bots have animated pfps

fiery trellis
#

Nope i dont think so

sterile lantern
#

oof rip

mellow kelp
#

dang

crimson vapor
#

bruh my class starts soon and I can't get to my pc

#

reeee

mellow kelp
#

DANG

#

Im on online classes rn

#

totally paying attention

fiery trellis
#

Did you see it?

crimson vapor
#

2 mins

fiery trellis
#

Ok imma go sleep

mellow kelp
earnest phoenix
#

heyo

#

my reload command doesn't seem to work for some reason

#

It executes fine with no errors but nothing gets changed

#

Even if i tweak a command file and run it it doesn't see the changes

mellow kelp
#

what is that command supposed to do

earnest phoenix
#

Reload commands

mellow kelp
#

hmm

#

idk about that tbh

#

maybe node caches the required modules or something?

sonic lodge
#

^

#

before you require the file again, make sure you remove it from require.cache

mellow kelp
#

oh cool somehow i guessed right

#

didn't know there was a cache

earnest phoenix
#

@sonic lodge how tho

mellow kelp
#

i think it's an object(?)

earnest phoenix
#
delete require.cache
sonic lodge
#

delete require.cache[filepath] iirc

mellow kelp
#

o

#

thats useful

earnest phoenix
#

or i can just delete the entire thing

sonic lodge
#

sure you could probably do that

main trench
#

Quick question would logging words in a db as a array help split the words separately im doing a blacklist command

earnest phoenix
#

still no work 🅰️

mellow kelp
#

🅰️

earnest phoenix
#

nevermind

#

time to go back to press stop on repl then press run again

lyric mountain
main trench
#

Imma assume wrong ping KEKW

lyric mountain
#

nope

#

you asked about loggin words to a db for manual filtering for blacklist

#

in a minute, you'd have a fuckton of words

earnest phoenix
#

Hey

#

How do you know if a a manager's cache in discord.js is empty

lyric mountain
#

does it ever get empty tho?

earnest phoenix
#

I want my bot to go welp there are no emojis in this server mate when i run emote list in a server with 0 emotes

lyric mountain
#

you could check server's emotes

#

then do size on the returned list

earnest phoenix
#

!message.guild.emojis.cache.size

#

?

lyric mountain
#

probably

earnest phoenix
pale vessel
#

Yes

earnest phoenix
#

🅰️

#

How can I get the id of a custom emoji from plain text?
Like message.content is ![pogey](https://cdn.discordapp.com/emojis/622738892856229898.webp?size=128 "pogey") how can i get the id from it

#

Idk how to use regex plz spoonfeed

sterile lantern
#

u want the id from that emoji?

#

couldnt u just args.slice it if it was just one emoji

earnest phoenix
#

@sterile lantern yeah i can but the emote returns with the <pogey part too

#

and the length of the emoji name matters so i cant substring

#

@quartz kindle master i need your halp

sterile lantern
#

hmm is there not a id function for emojs

earnest phoenix
#

there is

#

but you need you resolve it first

sterile lantern
#

o

earnest phoenix
#

and the stuff i have is plain message text

sterile lantern
#

ah ic

earnest phoenix
#

message.mentions.emojis doesn't exist too

sterile lantern
#

oof

earnest phoenix
#

@earnest phoenix try split :

#

oh lol

#

forgot that existed

mellow kelp
#

lets goo

#

someone on stackoverflow marked my answer as correct pogey

main trench
#

I was wonder if I need to log it as an array so a server can have multiple words blacklisted

lofty grove
#

(node:1818) DeprecationWarning: ClientUser#setGame: use ClientUser#setActivity instead

#

what is this problem?

zealous sable
#

Well

#

I mean

summer torrent
zealous sable
#

It tells youy how to fix it

pale vessel
#

How do I fix this again?

wicked narwhal
#

How to change the color of the brief description on my bot's page?

lofty grove
#

How can I do it?

pale vessel
#

LOL

odd stratus
#

client.user.setActivity bruh

pale vessel
#

Just change setGame to setActivity, what don't you get about it???????????????????????

odd stratus
#

I've never heard about ClientUser#setGame. Was that a thing in v11 or?

pale vessel
#

Yes

mellow kelp
#

i guess so

odd stratus
#

Ah makes sense

lofty grove
#

ok i took care of the problem :D

odd stratus
#

Nice

drifting wedge
#

how can i run a function over and over async python? like loop a func

odd stratus
#

Well I don't really know Python so I can't really help

#

Did you try looking on Google?

lyric mountain
#

what kind of db are u using?

main trench
#

Quick.db

lyric mountain
#

ok, sqlite then?

main trench
#

Yep

lyric mountain
#

just create a blacklist table with 2 columns, being serverid and word

#

oh, mb

#

also create an ID column

main trench
#

Aight

lyric mountain
#

each time someone uses that command, create a new entry containing serverid and the word to be blocked

#

sure, you could use an array + single entry, but let's say it'd be one heck of long string

main trench
#

Hmm

lyric mountain
#

also deleting will be many times easier with per-word entry

main trench
#

Blacklisting one word works but when I blacklist 2 it stops working

lyric mountain
#

when retrieving server's blocked words, just query for the serverid

earnest phoenix
#
message.guild.emojis.fetch is not a function

well...how else would i get it

earnest phoenix
#

no

summer torrent
#

no

lyric mountain
#

lul

earnest phoenix
#

should i do resolve

#

and pass the id

lyric mountain
#

you need to treat it as a result set, not a single result

main trench
#

Aight

earnest phoenix
lyric mountain
#

you were emoterolled

earnest phoenix
#

I forgot to remove that puny little shit the >

#

well how do i remove it now

#

forgot that one function

odd stratus
#

Remove what

earnest phoenix
#

imma just do substring(0, string.length - 2)

main trench
#

So just let words = new db.table('words') words.set('words', args[1]) words.get('words')?

#

For a table

pale vessel
#

Why not use arrays?

#

or jason.db /s

crimson vapor
#

^

#

fuck

#

why did you send that

mellow kelp
#

LMFAO

crimson vapor
#

now im ^ to jason.db

main trench
#

I thought about an array but he said use a table KEKW

pale vessel
#

Doesn't quickdb has push method?

mellow kelp
#

how about you use jason.db

main trench
#

Yep

pale vessel
#

That's useful for your use case

crimson vapor
#

is there a table.push

mellow kelp
#

100x times better than json

crimson vapor
#

yeah

earnest phoenix
crimson vapor
#

thats why I added it to jason.db

earnest phoenix
#

the id is correct now

crimson vapor
#

didn't want to fuck with get and set for arrays

pale vessel
#

Check code

earnest phoenix
#

message.guild.emojis.resolve(emoteID); is what I'm using

#

stinky little djs doesn't have fetch

main trench
#

However the problem i found when logging words in an array is it doesn't separate them

#

So if I log 2 words I would need to say "word1 word2" for the bot to detect it

crimson vapor
#

what do you mean

earnest phoenix
crimson vapor
#

why not just pass the emoji?

sudden geyser
#

my god that url font

crimson vapor
#

can you?

earnest phoenix
#

that wouldn't work tho

crimson vapor
#

o

earnest phoenix
#

not a snowflake not a guildemoji or reactionemoji

#

so nope

mellow kelp
#

why

earnest phoenix
#

and the emoji id i passed should work but for some reason it doesn't

#

Lets use cache baby

pale vessel
#

I don't cache my emojis except for some that the bot needs and I use guild.emojis.fetch(false)

earnest phoenix
#

😮

pale vessel
#

Epic

crimson vapor
#

I don't cache shit

mellow kelp
#

same bruh

#

i just kinda

#

well it just works

crimson vapor
#

honestly I had no idea how caching worked

#

until I realized it was just client.X.cache is just an object

earnest phoenix
#

the emote is cached tho

pale vessel
#

Wrong ID probably

earnest phoenix
#

When I escape the emoji the snowflake is different from what my bot saw

#

How da fuck

sage crescent
#

what you want to do?

earnest phoenix
#

The last six is missing smh

#

The emote is cache with that snowflake

#

i may or may not have fixed it for some reason

#

I changed a 2 to 1 and it works now

quiet topaz
#

so i have a bot

#

when i make a new table (drop and then create), only the 2nd time it does work (mysql

#

but not the first time

crimson vapor
#

If I make expressjs middleware if I want intellisense should I extend the Request and Response class and just return the extention?

quiet topaz
#

how to fix it

crimson vapor
#

does it do that every time

#

or did it error once and now it works?

mellow kelp
quiet topaz
#

no, like when i drop and create that table, or the id of the user isnt in it

#

but

crimson vapor
#

ok not what I mean but that was my bad

quiet topaz
#

i have this to prevent this

crimson vapor
#

so say I add req.randomValue = Math.random()

#

how would I add intellisense for req.randomValue

pale vessel
# quiet topaz

What if Discord gets hacked and snowflakes are changed to hello"; DROP TABLE users; --

mellow kelp
#

oh um

crimson vapor
#

I think I would extend it?

mellow kelp
#

you can add a declaration file i think

#

where you make something like

#
declare module 'express' {
  interface Request {
    randomValue: number;
  }
}
mellow kelp
#

thats sql injection

crimson vapor
#

ok oop is so fucking cool

mellow kelp
crimson vapor
#

not useful for everything but hot

mellow kelp
#

if you just make a string, some unwanted input might get in and modify the sql statement

#

using parameters escapes the special characters in the strings so that they don't change the statement

quiet topaz
#

its a bigint

crimson vapor
#

yes

#

but

mellow kelp
#

well there it is

crimson vapor
#

what if someone's ID happens to be 1201209182109281; DROP TABLE users;

mellow kelp
#

Lmfao epic example

crimson vapor
#

im not a fan of sql

mellow kelp
#

well at least you should get used to using parameters

crimson vapor
#

YOU ALWAYS HAVE TO TYPE LIKE THIS

mellow kelp
#

and i find them more readable too

pale vessel
#

Yeah, they're easier to format

quiet topaz
#

how to use parameters

sudden geyser
mellow kelp
#

connection.query('SELECT * FROM users WHERE user_id=?', ['some-id'], (err, rows) => {...

#

you pass a string

#

using ? as a placeholder for parameters

#

then you pass an array of parameters

pale vessel
#

con.query("SELECT id FROM users WHERE id = ?", message.author.id, function(...

sudden geyser
#

And you should use the ? placeholder

#

better safe than sorry

mellow kelp
#

Yeah

#

?? is used for stuff like database and table names

#

? for normal stuff

drifting wedge
#

how can i run a function over and over async python? like loop a func

restive furnace
#

huh so SELECT * FROM ?? WHERE id = ? is a valid query?

crimson vapor
#

make it recursive

mellow kelp
restive furnace
#

cool

mellow kelp
#

indeed

restive furnace
#

but about the parameters

#

does ?? come first?

mellow kelp
#

nah

#

like

pale vessel
#

I don't think it matters

mellow kelp
#

?? is used for database and table placeholders

#

? is used for normal value placeholders

restive furnace
#

like query('SELECT * FROM ?? WHERE id = ?', users, 12345678) would work?

mellow kelp
#

the parameters must be an array

#

or a single value for one thing i think

#

so query('SELECT stuff', ['users', '12345678'])

restive furnace
#

but uhh many languages can handle unlimited paramaters

#

C++: c++ template<typename ... Args> sql::result query(const char* query, Args... args) {}

mellow kelp
#

oh well

#

in js it works with an array

#

since it has a callback instead of a promise

quiet topaz
#

and parameters

mellow kelp
#

they escape special characters that might break your sql statement

#

like '

#

turns to '

sudden geyser
#

It's for unsanitized input.

mellow kelp
#

i mean \'

sudden geyser
#

@quiet topaz Let's say you have this query: SELECT * FROM users WHERE username = ....

If I replace ... for ${username}, and had username equal to bob, it would be SELECT * FROM users WHERE username = "bob".

However, if I did bob" OR 1;--, it would come out as SELECT * FROM users WHERE username = "bob" OR 1;--, which gets every row in the table.

That's only one example of SQL injection, but to solve the problem, you'll use ? to set a placeholder, so characters like " aren't able to escape.

quiet topaz
#

ok thanks, but i dont think, that will solve my problem

crimson vapor
#

does it always error?

#

or only errored once?

quiet topaz
#

only once

crimson vapor
#

idk mysql but maybe the first one errored because the table wasn't created

quiet topaz
#

it is created

crimson vapor
#

idk then

quiet topaz
#

thats should prevent that

crimson vapor
#

well the error is that result[] is returning undefined

quiet topaz
#

yes, but whats the difference between before the error and after

pale vessel
#

Callback hell

#

Async for life

mellow kelp
#

yes

restive furnace
#

promisify those

#

kthx

mellow kelp
#

you can make a function to query stuff as a promise

restive furnace
#

or literally promisify it via util built-in package

mellow kelp
#

oh was that a thing

#

cool

crimson vapor
#

how many callbacks is too many callbacks?

mellow kelp
#

about 3 i guess

pale vessel
#

How much call could a callback call if a call back could call back?

mellow kelp
#

a callback

crimson vapor
#

lets think

#
function callbackHell (a, b) {
    a(b, (b) => {
      b(a, (a) => {
        
      })
    })
}```
mellow kelp
#

no

#

bruh how difficult it must have been to write js without async await

crimson vapor
#
function recusion (i) {
  i = i ? i++ : 1
  loggers.log(i)
  return recusion(i)
}```
mellow kelp
#

loggers

crimson vapor
#

wait let x: Class = new Class() the x: Class part isnt needed is it?

cinder patio
#

yes

#

it's implied

mellow kelp
#

yea

#

@crimson vapor just PR'd the poggers db

#

its pretty epic

crimson vapor
#

ok one sec lemme review the changes

mellow kelp
#

ight

pale vessel
#

Blocking monkaS

crimson vapor
#

ok I just got called out to eat but im gonna need you to format the code the same way as mine I think I used https://www.npmjs.com/package/standard also change to 2 spaces and make sure you use the same error messages and stuff as me

mellow kelp
#

um well aight

earnest phoenix
#

idk why this error is showing up:

  File "main.py", line 117
    async def with(ctx, amt):
              ^
SyntaxError: invalid syntax
 

Code:

@client.command(aliases=["withdraw"])
async def with(ctx, amt):
crimson vapor
#

iirc you need a tab

crimson vapor
mellow kelp
#

bruh

#

i didnt understand most of your constructor lmao

#

almost looks like minified code

earnest phoenix
#

you dont need a tab

#

all my other commands work fine

#

without a tab

#

nvm got it

crimson vapor
mellow kelp
#

nah i got it in the end

crimson vapor
#

oh alr

mellow kelp
#

but bruh you need to separate some code lmao

#

its all joined together

crimson vapor
#

well

#

hmm

#

I need to work on my formating styles

#

so I know what I want

mellow kelp
#

well k

digital mountain
#

Hi.

#

I need help making a bot.

crimson vapor
digital mountain
#

Thxs

mellow kelp
#

@earnest phoenix wait so i have to delete all my comments?

crimson vapor
#

OOF

#

nah ill do it later

mellow kelp
#

bruh

crimson vapor
#

or

mellow kelp
#

ill probably forget what everything does by tomorrow lmao

crimson vapor
#

I could comment my code

mellow kelp
#

yeah

#

that'd be a lot better smh

crimson vapor
#

ill pick one or another

mellow kelp
#

also what did i have to do

#

make everything synchronous?

crimson vapor
#

ummm

#

lemme read your code again

mellow kelp
#

aight

#

my methods have both promises and callbacks

crimson vapor
#

yeah so I havn't used writeFile or readFile so idk

#

ig just keep it for now and I might change it later

mellow kelp
#

well k

#

basically those are promises instead of just synchronous

crimson vapor
#

learning git rn btw

#

poggers

sudden geyser
#

great

mellow kelp
#

pog

#

i remember the dark ages

#

when i used to drag and drop files into github

crimson vapor
#

never done that

#

would rather just make folders for version control

mellow kelp
#

yea

#

i used to do that when i didn't know about git and stuff

cinder patio
#

Use eslint @crimson vapor

crimson vapor
#

eslint be too advanced for me

mellow kelp
#

nah its not too advanced

#

i can set the basics and you configure it

crimson vapor
#

alright

mellow kelp
#

aight

#

you using npm or yarn?

crimson vapor
#

npm

crimson vapor
#

btw

mellow kelp
#

oh yeah

#

kk

#

im gonna make another branch in my repo

cinder patio
#

I cannot live without eslint

mellow kelp
#

i can live without eslint

#

but i can't scale without eslint

crimson vapor
#

I can live without it

#

never had to scale anything

#

@mellow kelp just wondering your status

mellow kelp
#

yes

#

poggersn't

crimson vapor
#

I mean status on code

#

I should have clarified

earnest phoenix
#

How can i get a member's messages count (number)

#

a member

crimson vapor
#

you can search in discord from: member

mellow kelp
earnest phoenix
pale vessel
#

why

earnest phoenix
#

xdd

#

I wanna make a Leveling system

pale vessel
#

That's a bad approach

crimson vapor
#

I agree

earnest phoenix
#

.. okay i wanna make a command. !messages

crimson vapor
#

better idea

earnest phoenix
#

How can i do it?

mellow kelp
#

but what do you want the command to do

#

oh nvm

crimson vapor
#

I don't think its possible tbh

earnest phoenix
#

it possible

#

i saw this command

#

so possible xd

#

Can someone help me? I'm trying to add an add role command, but this error happens:
My code: ```js
let target = message.mentions.users.first()
let role = "788434221965770792" // The role ID
target.roles.add(role).catch(console.error);

events.js:292
throw er; // Unhandled 'error' event
^

TypeError: Cannot read property 'add' of undefined

mellow kelp
#

you sure roles has the method add()?

sudden geyser
#

A User instance doesn't have a roles property.

earnest phoenix
#

i'm pretty sure it can, it has the required permissions and the role is below the bot's

sudden geyser
#

You're looking for a GuildMember, which you can replace .mentions.users with .mentions.members for.

earnest phoenix
#

so which part do i need to replace?

sudden geyser
#

The one I highlighted:

you can replace .mentions.users with .mentions.members for.

earnest phoenix
#

okay, i'll try it

#

thanks @sudden geyser, worked!

crimson vapor
#

are there any rules on just copying people's eslint configs?

mellow kelp
#

nah

#

wait how about you manually add the files lmao

#

i messed up my branch

crimson vapor
#

the eslint?

mellow kelp
#

yea

crimson vapor
#

or everything

mellow kelp
#

the eslint thing

crimson vapor
#

alr

#

just gonna

mellow kelp
#

aight

crimson vapor
#

swipe it from another repo

mellow kelp
#

bruh k

#

but i got a basic config

crimson vapor
#

o

#

nvm u send then

mellow kelp
#

k

earnest phoenix
#

Hey, i wanna do a !messages command what says the all message what user sent. Please help me :/

solemn latch
#

since bots dont have access to search, youd have to log those into a database, which easily could be against discord TOS

earnest phoenix
#

Okay, thanks for reply. Then i use database for this 😄

mellow kelp
#

hol up

#

well you can use a database unless you want to store messages

crimson vapor
#

how many messages can you fetch at once?

cinder patio
#

I believe 100

#

actually 200

mellow kelp
#

and something about up to messages 2 weeks old

sterile lantern
#

whats the limit for webhook requests

#

like how often can it post

solemn latch
#

like 30 requests a minute

sterile lantern
#

it aint letting me send my stuff for some reason

#

is there a way to check if uve been rate limited

#
Timeout {
  _idleTimeout: 10000,
  _idlePrev: [TimersList],
  _idleNext: [TimersList],
  _idleStart: 634,
  _onTimeout: [Function],
  _timerArgs: undefined,
  _repeat: 10000,
  _destroyed: false,
  [Symbol(refed)]: true,
  [Symbol(asyncId)]: 3,
  [Symbol(triggerId)]: 1```
#

this is what i get

#
let webhook = new discord.WebhookClient(wid, wtoken)
#

webhook is defined as such

#

its printing that it went through

#

but its not posting

#

ping if yk the problem

#

nvm

outer niche
#
async def on_ready():
    await Seco.setup_database(Databse directory here)```
I have this event asking for a database directory I'm not sure what that exactly is
solemn latch
#

the docs for your database would be able to tell you.

outer niche
#

That is from the docs

#

That is all it says

earnest phoenix
#

lol

lyric mountain
earnest phoenix
#

Just the number of messages

lyric mountain
#

that's ok then

hollow sedge
#

you dont need to log each message then

lyric mountain
#

yeah, just store a simple counter

earnest phoenix
#

How?

lyric mountain
#

store a number

left oriole
#

Sora .o.

lyric mountain
#

then for each message sent increase it

lyric mountain
left oriole
#

Sorry

lyric mountain
#

dw

left oriole
#

Just got excited when I saw your pfp

lyric mountain
#

normally people who call me like that are Shiro users, so I thought you were one of them

fervent cobalt
#

xD respe

left oriole
#

Nah

languid bloom
#

(discord.py) How can i make a command that resets it's name everytime someones writes it so that i am the only one to know it s name? ex: .1234 and after the command is written it s name changes

left oriole
#

I just like no game no life :3

lyric mountain
#

kinda useless tho

languid bloom
#

i mean

mellow kelp
#

confusion

languid bloom
#

i wanna make simething that if the server owner betrays us i can give everyone admin (on my friends server)

#

lol

lyric mountain
#

don't

sudden geyser
#

jk

lyric mountain
#

that'll not only get you kicked out of top.gg but get u reported

left oriole
#

Whaa

mellow kelp
#

lmao

languid bloom
#

it s a friend server

#

lol

#

like

lyric mountain
#

don't

languid bloom
#

ok

#

just

#

is the

#

verified

#

bot dev

#

badge

#

off?

lyric mountain
#

idk what you said but no more badge

sage crescent
lyric mountain
#

all it takes is one print + report for you to lose ur bot

languid bloom
#

ok

#

why is the badge dissabled tho

lyric mountain
solemn latch
#

people kept making bots to get the badge

lyric mountain
#

literally

earnest phoenix
#

The dev badge isn't given out anymore because of too many people making bots just to get the badge

#

It's just a badge

lyric mountain
#

it was way too simple to get one, so people purchased accounts, purchased team seats, purchased bots, etc just to get one

sage crescent
languid bloom
#

and the bot verify is off?

lyric mountain
#

no

#

you still need to verify

languid bloom
#

nice

lyric mountain
fervent cobalt
#

Hello, I speak Spanish, only I must use a translator to understand them. Say today is Camilo's day and I also want them to accept me

lyric mountain
#

try-catches would probably catch such errors

earnest phoenix
languid bloom
#

variable

earnest phoenix
#

This guy saying the exact same thing in different channels

lyric mountain
earnest phoenix
#

🗿

languid bloom
#

uh

#

yeah

mellow kelp
languid bloom
#

about that

earnest phoenix
#

um okay

fervent cobalt
earnest phoenix
lyric mountain
#

are you talking about your bot?

fervent cobalt
#

quien habla español

sage crescent
lyric mountain
fervent cobalt
#

who speaks Spanish

left oriole
#

Me smug

mellow kelp
#

yo :D

fervent cobalt
fervent cobalt
sage crescent
# lyric mountain yes

the problem is not this, I can catch the error, it is not possible to track down the type of error so that the bot would output the appropriate message - "the bot lacks rights"

left oriole
#

Hola yo soy kouhai :3

lyric mountain
fervent cobalt
#

xD

summer torrent
#

english only

mellow kelp
#

yea

left oriole
#

I'm Dominican owo

summer torrent
#

no one cares smh

earnest phoenix
#

ok this happens if you do not add the if (message.author.bot) return; at your AI's at DM lmao

left oriole
#

Most of my friends irl all speak Spanish pog2

mellow kelp
#

same

summer torrent
#

and?

mellow kelp
#

um

#

idk

crimson vapor
#

@pale vessel you alive?

pale vessel
#

ye

#

almost 4am

crimson vapor
#

nice

pale vessel
#

barely

crimson vapor
#

check out jason.db

#

good code™️

pale vessel
#

poggers db?

crimson vapor
#

yes

#

check out the changes

#

its just about formatted

sudden geyser
earnest phoenix
#

lol

earnest phoenix
crimson vapor
lyric mountain
#

no database = no permanent data = no counter

earnest phoenix
#

okay ty.

crimson vapor
#

you could use something simple like enmap

earnest phoenix
#

:c

crimson vapor
#

basically a map but persistant

earnest phoenix
#

How can i do it with map?

#

xd

pale vessel
#

Nice

earnest phoenix
#

okay okay don't bully me, i try. thats the first.

hollow sedge
#

Who is bullying you

earnest phoenix
#

I preceded

hollow sedge
#

Uh..ok I guess?

earnest phoenix
earnest phoenix
pure lion
#

docs

crimson vapor
#
summer torrent
#
crimson vapor
#

alright I didn't know there were 2 sites

earnest phoenix
#

Thank you

summer torrent
#

@umbral zealot evie.codes or evie.dev

umbral zealot
#

both

woven sundial
#

Hi, I don't remember the website that can generate some images like this one. Does anyone have the website ?

woven sundial
#

oh, thanks. Mention me when you got it please :p

lyric mountain
#

here

crude oriole
#

In guildMemberAdd event:
If i will use:

 member.guild.fetchInvites().then(invites => {
console.log(invites);
}).catch(err => {
console.log(err);
})

How can I check what invite he came in from?

lyric mountain
#

you need to store invites' usage count, then after someone joins you compare the current count against the stored one

#

the one which increases is the invite used

crude oriole
#

ok

woven sundial
delicate kraken
#

How do I deploy the bot?

hollow sedge
#

What host

delicate kraken
#

I do not understand

hollow sedge
#

🥴

delicate kraken
#

host server

hollow sedge
#

You have a VPS?

delicate kraken
#

I'm An Arab and I don't understand you.

#

Is there support that speaks Arabic?

rocky vector
#

ترجمه وتحدث معه @delicate kraken

quiet arch
#

hey guys so im tryna detect when someone joins a specific vc and then let my bot send a message in a specific channel
so i found this code


 client.on('voiceStateUpdate', (oldMember, newMember) => {
    const newUserChannel = newMember.voice.channelID
    const oldUserChannel = oldMember.voice.channelID
    const textChannel = message.guild.channels.cache.get('757258023432486923')
    
  
    if(newUserChannel === '712677767333937284') {
      textChannel.send(`${newMember.user.username} (${newMember.id}) has joined the channel`)
    } else if (oldUserChannel === '779010277823741972' && newUserChannel !== '779010277823741972') {
      textChannel.send(`${newMember.user.username} (${newMember.id}) has left the channel`)
    }
  })```
but it says

 
```TypeError: Cannot read property 'channelID' of undefined
    at Client.<anonymous> (D:\github\pepe-bot\index.js:38:44)
    at Client.emit (events.js:314:20)
    at VoiceStateUpdate.handle (D:\github\pepe-bot\node_modules\discord.js\src\client\actions\VoiceStateUpdate.js:40:14)
    at Object.module.exports [as VOICE_STATE_UPDATE] (D:\github\pepe-bot\node_modules\discord.js\src\client\websocket\handlers\VOICE_STATE_UPDATE.js:4:35)
    at WebSocketManager.handlePacket (D:\github\pepe-bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (D:\github\pepe-bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (D:\github\pepe-bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (D:\github\pepe-bot\node_modules\ws\lib\event-target.js:132:16)
    at WebSocket.emit (events.js:314:20)
    at Receiver.receiverOnMessage (D:\github\pepe-bot\node_modules\ws\lib\websocket.js:825:20)
PS D:\github\pepe-bot>```
does anyone knows how to fix this   or another way to do this?
quartz kindle
#

voiceStateUpdate does not give you members

#

it gives you voiceStates

#

so you are essentially doing voice.voice.channelID

quiet arch
#

so i should do voice.voice.channelID ?

quartz kindle
#

thats what you ARE doing

#

which you should not do

quiet arch
#

im sorry but i dont understand it

quartz kindle
#

do you know how events work?

quiet arch
#

nope

quartz kindle
#

🤦‍♂️

quiet arch
#

hehe

#

u have an article i can read?

earnest phoenix
#

na u can read the docs tho

slate grotto
#

bu kod v12 mi

earnest phoenix
#

uhh what

#

use a sourcebin

slate grotto
#

v12 is this coding

earnest phoenix
#

whats the error?

#

you're using RichEmbed

#

use MessageEmbed instead

quiet arch
#

tim do u know what i should do?

quartz kindle
#

@quiet arch ```js
client.on("something", (someData) => {
// do something with someData
})

look at this code and try to understand what its happening. It creates an event listener called "something", which means whenever your program receives data that is assigned to "something", all the code inside that block will run. When this happens, the event will give you a variable that contains the data it received, so you can do something with it. In the above case, the program receives some data assigned to "something" and gives it to you, and you assign the same "someData" to the data the event is giving you, then you run some code with this data
#

the variable someData is named by you, you can give it whatever name you want, it doesnt change its content

quiet arch
#

ok

quartz kindle
#

in your case, you are listening to the voiceStateEvent which means every time your program receives some data that tells you something changed in a voice channel, the entire code inside that will run

#

and accordingly, the event gives you 2 pieces of data, according to the docs

quiet arch
#

ok

quartz kindle
quiet arch
#

yes

quartz kindle
#

these are the two pieces of data you are receiving

#

so when you do something like .on("voiceStateUpdate", (a,b) => {})

earnest phoenix
#

@quartz kindle what bot do you have?

outer niche
#
async def beg(ctx):
    await open_account(ctx.author)

    users = await get_bank_data()
    user = ctx.author
    earnigs = random.randrange(100)

    await ctx.send(f"Someone gave you {earnigs}$")


    users[str(user.id)]["wallet"] += earnigs
    
    with open("bank.json","w") as f:
        users = json.load(users,f)```
#

So this keeps on wiping the entire Json file instead of adding the money to it can you help me

quartz kindle
#

the a and b are names you chose, you can give them whatever names you want, it doesnt matter

sharp birch
quartz kindle
#

but the contents of a and b will always be what the docs says, regardless of what name you give it

quiet arch
#

ok

quartz kindle
#

the docs say the content is voiceState

earnest phoenix
#

@quartz kindle which bot do you have?

quartz kindle
#

so you can do to the docs and click on the voiceState and read what you can do with it

main trench
#

would this log an array into a db im making a bl command? ```let data = {
staff: [args[1]],
}

    db.push(`wordsdb_${message.guild.id}`, data)```
quiet arch
#

sure ill do that then

quartz kindle
#

voiceState is not a member, its a different type of data

quiet arch
#

but the only thing i dont understand is the error that i get

earnest phoenix
#

Tim can you please answer my question?

quiet arch
#

bc y is channelID' of undefined

quartz kindle
#

because in your case, you named a and b as oldMember and newMember

#

so oldMember and newMember become the names you give to the data

#

but the data is not a member data

#

its a voiceState data

#

and voiceState data does not have .voice

sharp birch
quartz kindle
#

so you are doing voiceState.voice

#

which doesnt exist

quiet arch
#

o

#

ok

sharp birch
#

the token

quiet arch
#

thx

sharp birch
#

I want to turn into the config.json

#

how to do it

#

I always put at .env

quartz kindle
#

"channelID of undefined" means the code tried to do undefined.channelID

quiet arch
#

o

quartz kindle
#

meaning whatever is before .channelID is undefined or invalid

quiet arch
#

so voice is undefined

quartz kindle
#

yes, .voice is undefined

main trench
#

@sharp birch make a file called config.json put this in it { "token": "token here" } then in your main file do ```const config = require('./config.json')

client.login(config.token);```

quartz kindle
sharp birch
#

and then,

main trench
#

thats it

crimson vapor
#

Hello Tim

sharp birch
#

put a token at config.json right?

main trench
#

yep

wicked sapphire
#

easy

main trench
#

where it says "token here" put the token

sharp birch
#

alright

#

the prefix?

#

how about prefix?

solemn latch
#

make another element with the prefix in your config

sharp birch
#

alr

sterile lantern
#

so rn i have a roblox request:
it sends a request to see if the group gained a member,
if it did, send an embed with the group count being updated
but the problem is, it sends an embed even if the group didnt gain a member

solemn latch
#

whats the response look like.

sterile lantern
#
let webhook = new discord.WebhookClient(wid, wtoken)
async function updateCount() {
    let response = await axios.get(`https://groups.roblox.com/v1/groups/${GROUP_ID}/`)
    let response_count = response.data.memberCount 
    //console.log("got request")
    if (count < response_count) {
        console.log(response_count, count) 
     const embed = new Discord.MessageEmbed()
.setColor("#FFDAB9")
.setThumbnail('a link here')
.setAuthor('thing here')
.addFields(
        { name: 'Current Count:', value: response_count, inline: true },
    { name: 'Members left till 27k:', value: GOAL - response_count, inline: true },
    //    { name: 'Goal', value: GOAL, inline: true },
    )
.setFooter("group Member Counter")
.setTimestamp()
webhook.send(embed).catch(async err => {
    console.log(chalk.red('Issue with posting in: ' + err));   
});  
  if (count == 0) {
            count = response_count
            return;
        }
        count = response_count
}
}

setInterval(() => {
  updateCount()
}, 20000)
#

i think it has something to do

#

with setInterval

#

sends this

#

here it remains at 159

#

and sends like

#

every 5 mins

umbral zealot
#

try to parseInt on both

sterile lantern
#

parseInt?

#

parseInt(Goal)

#

?

solemn latch
#

also, wheres count at

sterile lantern
#

count?

solemn latch
#

yeah, wheres it defined

umbral zealot
#

parseInt(response_count) and parseInt(count)

sterile lantern
#

let count = 1

#

count is set to 1

#

its defined above the function UpdateCount()

umbral zealot
#

parseInt should fix it, the API is probably returning a string.

sterile lantern
#

where would i parse int it?

#

where i define it?

#

let response_count = response.data.memberCount

quartz kindle
#

is count accessible on every loop of the interval?

#

or is it reset every time?

sterile lantern
#
  if (count == 0) {
            count = response_count
            return;
        }
        count = response_count
}
}

setInterval(() => {
  updateCount()
}, 20000);```
#

uh wdym

solemn latch
#

or reset in some other manner

quartz kindle
#

where do you define count

sterile lantern
#

above the function

#

lemme send the whole thing

#
const axios = require('axios');
const discord = require("discord.js")
let GROUP_ID = groupidhere
let GOAL = 27000
let count = 1
let wid = process.env.wid 
let wtoken = process.env.wtoken

let webhook = new discord.WebhookClient(wid, wtoken)
async function updateCount() {
    let response = await axios.get(`https://groups.roblox.com/v1/groups/${GROUP_ID}/`)
    let response_count = response.data.memberCount 
    //console.log("got request")
    if (count < response_count) {
        console.log(response_count, count) 
     const embed = new Discord.MessageEmbed()
.setColor("#FFDAB9")
.setThumbnail('this is a joke')
.setAuthor('kewlg')
.addFields(
        { name: 'Current Count:', value: response_count, inline: true },
    { name: 'Members left till 27k:', value: GOAL - response_count, inline: true },
    //    { name: 'Goal', value: GOAL, inline: true },
    )
.setFooter("group Member Counter")
.setTimestamp()
webhook.send(embed).catch(async err => {
    console.log(chalk.red('Issue with posting in: ' + err));   
});  
  if (count == 0) {
            count = response_count
            return;
        }
        count = response_count
}
}

setInterval(() => {
  updateCount()
}, 20000);```
#

i just restarted the project and it sends that

umbral zealot
#

let response_count = parseInt(response.data.memberCount);

sterile lantern
#

same thing for count?

#

well count is just 1

umbral zealot
#

no since count is just an integer already

sterile lantern
#

aight ill see if this works

#

well i think its bc i restarted the project

umbral zealot
#

yes probably

sterile lantern
#

so ill wait a while

solemn latch
#

also, am i crazy, or is this line doing nothing?

  if (count == 0) {
            count = response_count
            return;
        }
#

since the next line sets it anyway, and its the end of the function.

sterile lantern
#

uhh i forgot what i wrote that for

#

i think it was meant to stop if count was set to 0?

#

aight seems to work!

umbral zealot
#

👍

quartz kindle
#

does response.data already return the parsed json object?

#

i dont use axios

#

because i checked the url, and memberCount is already a number in the json response

sterile lantern
#

i dont get why it does it 4 mins later

#

if it checks every 20 seconds

hollow sedge
sterile lantern
#

noblox doesnt have that function

hollow sedge
#

oj

#

oh*

sterile lantern
#

is it bc

#

if (count == 0) {
count = response_count
return;
}

#

of this

#

?

solemn latch
#

i doubt it, the count in both is logging correctly right?

#

ie both counts in your console log are logging as 26844?

sterile lantern
#

yes

#

it logs as

#

26844 1

solemn latch
#

1?

sterile lantern
#

yes

solemn latch
#

1 is incorrect

sterile lantern
#

"1" is printed

#

o

#

i think it prints the count

#

variable

solemn latch
#

your count should be getting set as response count

#

so it can compare them on the next loop

sterile lantern
solemn latch
#

yeah, so first loop it should log 1, then next 26844

weary bane
#

where can I do my bot so where will I write my commands

sterile lantern
#

so idk

weary bane
#

Do you know where to start making my bot, which application or which site?

drifting wedge
#
2|stats    |   File "/usr/lib/python3.8/asyncio/runners.py", line 43, in run
2|stats    |     return loop.run_until_complete(main)
2|stats    |   File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
2|stats    |     return future.result()
2|stats    |   File "/root/arch/ARCH BOT/cogs/botstats.py", line 22, in updatestats
2|stats    |     list1 = json.loads(list1)
2|stats    |   File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
2|stats    |     return _default_decoder.decode(s)
2|stats    |   File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
2|stats    |     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2|stats    |   File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
2|stats    |     raise JSONDecodeError("Expecting value", s, err.value) from None
2|stats    | json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)``` anyone explain this erorr pls?
#

py

gilded olive
#

Would recommend vs code

#

then you would pick a lib

#

For whichever language you use

gilded olive
solemn latch
#

@drifting wedge random thought, no idea. does the json you put in to the decoder have nothing on line 1?
Expecting value: line 1 column 1 (char 0)

drifting wedge
#

nah

#

it works when i python3 it

#

so im confuse

#

but when i pm2 it

gilded olive
#

show me your json file

drifting wedge
#

it gives this erorr

solemn latch
#

weird

drifting wedge
#

uhhhhhh

drifting wedge
#

it works with python3 tho

weary bane
#

I don't understand which site I started to make my bot

gilded olive
#

What?

hollow sedge
#

wait

gilded olive
hollow sedge
#

its a list tho?

solemn latch
#

you dont need a website to make a bot @weary bane

hollow sedge
#

not a file

drifting wedge
#
                        stdout=subprocess.PIPE,
                        stderr=subprocess.PIPE)
    stdout, stderr = process.communicate()
    list1 = stdout.decode("utf-8")
    list1.strip("[]")
    #print(list1)
    list1 = json.loads(list1)```
weary bane
#

If I don't need a website, where will I do it?

hollow sedge
#

can you show what the result of printing that list is

weary bane
gilded olive
#

A text editor

weary bane
#

Text editör ?

gilded olive
#

Read what i pinged you

weary bane
#

It's a practice

gilded olive
drifting wedge
hollow sedge
#

yes

drifting wedge
#

its a {} thing

#

uh

hollow sedge
#

you dont have to show the values

#

ik its a dict

drifting wedge
#

ye

#

it is

#

uhhhh

sterile lantern
#

how exactly would i fix the thing from being spammed

drifting wedge
#

gimme a bit ye?

#

it returns a huge ass list

drifting wedge
#

its HUGE

weary bane
gilded olive
#

my oh my

#

which programming language interests you?

#

If it is strictly bot developing id tell you python using the discord.py lib

sterile lantern
#

if you use discord.js, there a TON of yt tutorials

drifting wedge
#

uhh

gilded olive
drifting wedge
#

@hollow sedge ill send it in a bit

gilded olive
#

Stack overflow + github + their official server

sterile lantern
#

personally js was easier to understand

hollow sedge
#

ok

sterile lantern
#

but everyone has their preferences

gilded olive
#

meh id still recommend py

#

But everyone has their preferences yes

weary bane
solemn latch
#

py imo is harder to find good support for.

hollow sedge
#

thon

sterile lantern
#

attempted to yes

gilded olive
kindred jackal
#

Oi gente

hollow sedge
#

yeah wdym

outer niche
#

Traceback (most recent call last):
  File "C:\Users\culan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0)
hollow sedge
#

good support for discord or in general?

#

if you mean discord, then yes

solemn latch
#

for discord bots

gilded olive
hollow sedge
#

yeah you're right then

gilded olive
#

i would disagree

kindred jackal
#

Oi gente

gilded olive
#

their server provides you full help of whatever you want to accomplish

hollow sedge
#

pretty sure that error has something to do with encoding

outer niche
#

??????

gilded olive
#

There are many repos giving you examples

drifting wedge
#

cloud ill send full dict in a min

hollow sedge
#

ok

gilded olive
#

And other googling questions om stack overflow

solemn latch
#

plenty of repos, not a lot of direct support.

gilded olive
#

Their official server would providr direct support

solemn latch
#

oh, the discord py servers no longer dead?

#

it was dead for a long time

gilded olive
outer niche
#

All my jazz on file requires should be


}``` but it's not working
hollow sedge
#

what

gilded olive
gilded olive
#

I got that error once so i did that and it fixed the issue

#

🤔

hollow sedge
#

i mean...............ok

solemn latch
#

oh heck, the python server is poppin too

gilded olive
#

Idk maybe this may help

hollow sedge
#

nah

gilded olive
hollow sedge
#

that has to do with a request

gilded olive
hollow sedge
#

although...There is no need to decode a response from UTF8 to unicode, the simplejson / json .loads() method can handle UTF8 encoded data natively.

solemn latch
#

yeah, time to bother them until i know python, thats how it works right? KEKW

hollow sedge
#

@drifting wedge

gilded olive
hollow sedge
#

the python server feels too organized imo

gilded olive
#

They try to make it that way

#

Tho most people join there for discord.py support lol

hollow sedge
#

oof

drifting wedge
#

lmao

main trench
#

```let words = db.fetch(wordsdb_${message.guild.id})

let blacklist = [`${words}`]``` this should format the words as an array right? im making a bl command
drifting wedge
#

so i should read it with the long form?

sudden geyser
#

If you mean /python, their help channels are weird but very clean

hollow sedge
#

wdym

#

theres no reason to decode it

#

thats it

hollow sedge
main trench
#

so just let blacklist = [words]

hollow sedge
#

i dont see why you would need to put that between the brackets anyway

#

to make it a list

sterile lantern
#

how would i fix my problem (embed sends even if the response count is not increasing)

main trench
#

since im logging multiple words i need to seperate each word

sterile lantern
#
const axios = require('axios');
const discord = require("discord.js")
let GROUP_ID = groupidhere
let GOAL = 27000
let count = 1
let wid = process.env.wid 
let wtoken = process.env.wtoken

let webhook = new discord.WebhookClient(wid, wtoken)
async function updateCount() {
    let response = await axios.get(`https://groups.roblox.com/v1/groups/${GROUP_ID}/`)
    let response_count = response.data.memberCount 
    //console.log("got request")
    if (count < response_count) {
        console.log(response_count, count) 
     const embed = new Discord.MessageEmbed()
.setColor("#FFDAB9")
.setThumbnail('this is a joke')
.setAuthor('kewlg')
.addFields(
        { name: 'Current Count:', value: response_count, inline: true },
    { name: 'Members left till 27k:', value: GOAL - response_count, inline: true },
    //    { name: 'Goal', value: GOAL, inline: true },
    )
.setFooter("group Member Counter")
.setTimestamp()
webhook.send(embed).catch(async err => {
    console.log(chalk.red('Issue with posting in: ' + err));   
});  
  if (count == 0) {
            count = response_count
            return;
        }
        count = response_count
}
}

setInterval(() => {
  updateCount()
}, 20000);```
#

parseInt'ing it didnt help

gilded olive
#

Then ignore it

hollow sedge
#

eh

#

theres a better way

#

just send the embed whenever it updates

solemn latch
#

@sterile lantern something is resetting your count variable

sterile lantern
#

but i dont know what

#
  if (count == 0) {
            count = response_count
            return;
        }
        count = response_count```
#

?

#

this

solemn latch
#

no

#

i dont think its in your loop

sterile lantern
#

nothing outside of it

#

its just in an index.js file

solemn latch
#

is count used somewhere else in your code?

sterile lantern
#

uh

#

no

#

well

#
 if (count < response_count || count > response_count) {```
#

there

#

then it console.log(response_count, count)

boreal iron
#

wow < or > ouch...

solemn latch
#

what in about other functions, or is this in another function.

boreal iron
#

How about !=

hollow sedge
#

wait that doesnt make sense

#

yeah what @boreal iron said

sterile lantern
#

the project consists of

boreal iron
#

I feel physical pain

main trench
#

```let words = db.fetch(wordsdb_${message.guild.id})

let badlink = new MessageEmbed()
    .setDescription(`You cannot say bad words in **${message.guild.name}**`)
    .setColor("RED")

if(message.content.toLowerCase().includes(words)) {
message.delete()
message.author.send(badlink);
}``` this is the new code i get no errors but it does nothing

sterile lantern
#

index.js

#

and a .env

#

thats all

#

and the index.js is what i sent

solemn latch
#

lol, also why is that your code when the code you gave us is different.

drifting wedge
#
   data = json.load(read_file)``` this isnt a file
sterile lantern
#

wdym?

drifting wedge
#

like mine is a var

#

not a file

hollow sedge
#

who are you talking to

slender thistle
#

Are you ok

sterile lantern
#

i dont understand how it keeps sending

#

or what triggers it

#

the only other file is a .env

#

with the wid and wtoken

solemn latch
#

well, count is being reset to 1

#

which you dont want

sterile lantern
#

count is set to 1 then changed

#

yea