#development

1 messages ยท Page 1247 of 1

opal plank
quartz kindle
#

but you can literally sort it already reversed

earnest phoenix
quartz kindle
#

if you just sort the other way around

#

also, querySelector exists

earnest phoenix
#

how i can make string to object ?

faint prism
#

a string is an object

opal plank
#

JSON.parse()

earnest phoenix
#

ok

opal plank
#

other way around is JSON.stringify()

earnest phoenix
#

nah not working

opal plank
#

it does

earnest phoenix
#

I don't get HTTP request shit
I put them straight to my brain knowledge archive which is slower than an HDD

faint prism
#

what

earnest phoenix
#

yeah

opal plank
faint prism
#

It's a protocol, ie: a standard that is well documented

earnest phoenix
#

JOSN.parse works

faint prism
#

lol

#

I'd be confused if it did

earnest phoenix
#

how i can get the image that acttached

#

@earnest phoenix thx. i removed the reverse think and changed "a-b" to "b-a" and its worked ๐Ÿ™‚

#

i literally gave you the entire fucking code you needed to use

#

._.

#

now its sorting it without affecting elements who havnt got changed

fleet crystal
#

Hi

earnest phoenix
opaque seal
#

I'm having some really weird issues with my two bots hosted on the same VPS.
Basically, doesn't matter which one I start, any of the two will say:

Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready
And then after a bit they start working but with a ping of like 1 second

#

Just, why?

earnest phoenix
#

your vps is too weak to handle it

opaque seal
#

It's a google VPS

earnest phoenix
#

micro?

opaque seal
#

I'm using only 50% of ram

faint prism
#

specs?

opaque seal
#

one sec

#

So no issues there

#

Could have been an issue with google's internal servers, maybe it was their connection problem

sage bobcat
#

One message removed from a suspended account.

opaque seal
#

why do you have two pm2 processes named index
@swift umbra they are two different bots

#

Quanti core e thread ha
un sec

#

n1-standard-1 (1 vCPU, 3,75 GB di memoria)

#

I don't know how to see CPU's specs

obtuse jolt
opaque seal
#

CPU Platform
Intel Haswell

obtuse jolt
#

what no its mine

opaque seal
#

ah ok

#

CPU Platform
Intel Haswell
.

faint prism
#

error: "mod mail" is undefined

#

what are you talking about

wicked pivot
#

how to set a number of voice users?

slow otter
#

How do I see how many servers my bot is on?

misty sigil
#

@slow otter what library

slow otter
#

discord.js

thick gull
#

sharded or no

slow otter
#

no

stark abyss
#
    message.channel.send(editTimer).then(msg => {
code
})
``` How do i get a embed sent after that^?
#

I want to lookout for new embeds in code

#

or message

thick gull
#

what

stark abyss
#

So I am tryna get new messages in that code section

#

like using a collector or something

#

messages sent from user/bot

silver lintel
#

I'm wondering if it's Discord.MessageEmbed() or Discord.messageEmbed()

stark abyss
#

first one

silver lintel
#

Oh ok thanks

astral yoke
#

const { readdirSync } = require("fs");
const categories = readdirSync('../../../handlers/command') why does this error

thick gull
#

no
@slow otter client.guilds.cache.size iirc

slow otter
#

ok tnx

lucid pasture
#

i havent booted a bot in a while, can anyone tell me why my bot keeps spamming

thick gull
#

wdym?

slate oyster
#

Fix your code?

thick gull
#

You havenโ€™t hosted it?

#

or

lucid pasture
thick gull
#

looks like a code issue

lucid pasture
#

mabie im using something outdated

slate oyster
lucid pasture
#

this is what its spamming, and its the only command

#

bot.on('message' , msg=>{ if (msg.content = "BThelp") msg.channel.send("Hi! I am BotTale, the robot hosting a video game. Updates coming soon!") })

misty sigil
#

well

#

you see

#

that if statement and the msg.channel.send are unlinked

lucid pasture
#

im stupid i realize what ive done

thick gull
lucid pasture
#

thanks for the help tho

wicked pivot
#

Hi, I'm trying to create some sort of voice channel that will create temporary voice rooms I don't know if you've seen this before. in short I put some info that I could need in a json and from there I don't really know how to do this to say that I don't know how to get if a user joins a voice on which he is blacklisted he is automatically kick

#
{"users":{"363402633752477696":{"id":"363402633752477696","ChannelID":"755899365662523472","blacklist":["175987611465154560"]}}}```
how is it stored in my variable
valid frigate
#

hmm now this is an interesting predicament

#

how do i teach someone new to coding in python how to code exactly without spoonfeeding them

#

weird question to be asking but they want to get into bot development (which i advised against but not stopping them)

hard ginkgo
#

There are tutorials on yt that walk people through it

valid frigate
#

yes however i chose to tutor someone but really have no idea where to start

#

its for psuedo "internship" but i am not a good teacher

hard ginkgo
#

Try watching how other people teach

valid frigate
#

ngl good idea

#

its crazy how the people who make programming tutorials never get stuck on anything

#

i want that kind of confidence some day

hard ginkgo
#

I've watched some get stuck

valid frigate
#

coding livestream must be hell

hard ginkgo
#

At least it teaches people that even experts make mistakes

valid frigate
#

yeah

#

i see this as an opportunity for me and my peer to learn

silver lintel
#

how do you check if a variable is an integer in javascript?

honest perch
silver lintel
#

ty

opal plank
#

cant u just typeof() ?

#

@silver lintel try typeOf(var)

silver lintel
#

i just used isNan()

opal plank
#

works too

gentle zenith
#

Can anyone make me bots in channels

#

.....

vapid berry
#

ive got a d.py question thats related to cogs and antispam and that stuff

#
    @commands.Cog.listener()
    async def on_message(self, message):
        if message.author.bot:
            return
        try:
            authors_last_message = self.last_messages[f"{message.author.id}:{message.guild.id}"]
            if message.content == authors_last_message and not message.author.permissions_in(message.channel).manage_messages:
                try:
                    await message.delete()
                except discord.Forbidden:
                    pass
        except KeyError:
            pass

        self.last_messages[f"{message.author.id}:{message.guild.id}"] = message.content

i have this event, it works, it deletes messages that a user spams, but it only deletes the same message, so if a user spams the same letter it will delete, but if a user just slams their keyboard and spams that, it wont delete, how can i set it to delete messages rapidly sent by a user?

#

Feel free to ping me if you know

sharp thicket
#

Hello how do i check if message.content has a discord server invite link?

opal plank
#

.test() or better yet, indexOf(url) @sharp thicket

sharp thicket
#

like

opal plank
#

look up what those methods are if you dont

sharp thicket
#

if(message.content.includes( indexOf(url)))

#

?

opal plank
#

again

#

look what they do

sharp thicket
#

sorry i did not see that message ๐Ÿ˜„

#

it brings up something about embeds thats not even in docs lol

sharp thicket
#

it didn't bring that up lol

digital ibex
#

because thatโ€™s javascript

opal plank
#

indeed

#

also includes() is part of array, not string

#

if(message.content.includes( indexOf(url)))

sharp thicket
#

Ik im stoopid

hasty mulch
#

The ping command Iโ€™m using for Python is increasing

#

Says 200+ ms when it responds instantly

digital ibex
#

includes works on strings too

#

200ms is 2 tenths of a second

quartz kindle
#

200ms is still pretty much instant

#

for a chat app like discord that is

#

for an online game its an eternity

opal plank
#

oh yeah

#

sure is

hasty mulch
#

I know, but itโ€™s at 30 on restart

digital ibex
#

im stupid my english retard today

hasty mulch
#

Then jumps about an hour long

quartz kindle
#

how are you measuring it?

hasty mulch
#

I think Iโ€™m using a fake latency command

#

bot.latency

#

@quartz kindle

quartz kindle
#

thats the websocket ping

#

should be correct

#

however websocket ping has no impact on sending

#

only on receiving

hasty mulch
quartz kindle
#

its basically the ping for how long it takes for a message to be sent from discord and received by your bot

hasty mulch
#

So, that is normal?

quartz kindle
#

yes

#

also

hasty mulch
#

Idk why itโ€™s like that

quartz kindle
#

websocket ping is measured by comparing the hearbeat latency, which happens only once every 45 seconds

ember lodge
#

Someone knows a npm library to do this text: "๐“ซ๐“ธ๐“ต๐“ญ ๐“ฒ๐“ผ ๐“ซ๐“ฎ๐“ช๐“พ๐“ฝ๐“ฒ๐“ฏ๐“พ๐“ต"

quartz kindle
#

and it takes 3 of them to get an average

ember lodge
#

?

quartz kindle
#

thats why if you run the ping command twice in a short time, it will show you exactly the same value

opal plank
#

could you not use epoch to measure it?

quartz kindle
#

since heartbeats only come once every 45 seconds

opal plank
#

send payload with epoch, expect api to return epoch too

quartz kindle
#

you mean to the gateway?

hasty mulch
#

Yeah, idk how to do that

opal plank
#

not for discord specifically

#

but if i were to get an epi

#

api*

#

wouldnt use epoch be a good approach to measure latency?

#

pc(epoch now) => api(recieved epoch) => parse => api send(epoch 2) => pc(recieve epoch 2 from api and 1)

quartz kindle
#

you have to compare 2 timestamps generated in the same machine

#

since 2 machines, in this case discord and your bot, can have their clocks not synched

opal plank
#

hmmm

#

i though epoch was global

slow otter
#

How do I see how many people are seeing my bot?

quartz kindle
#

it is, but relies on your clocks being synched

opal plank
#

hmmm i see

#

@slow otter which language?

hasty mulch
#

Oh, now that I have woken up the box from idle, itโ€™s back down to the 30s

slow otter
#

@slow otter which language?
@opal plank discord.js

quartz kindle
#

@hasty mulch its normal to oscillate up and down

opal plank
#

you want the accurate or the estimate?

quartz kindle
#

and since it only updates every 45 seconds, it will take a while for you to see changes

opal plank
#

for estimate you simply loop your guilds.chache and add members

#

if you want precise, map members in each guild

slow otter
#

you want the accurate or the estimate?
@opal plank estimate

opal plank
#

that way you remove duplicates

quartz kindle
#

only online users or also offline?

opal plank
#

then use for(guilds cache) {sum}

#

there are better loops you can use tbh

slow otter
#

ok tnx

modest smelt
#

hey i need help

opal plank
#

reduce() prob best in this case i assume?

modest smelt
#

im making a RPG bot

#

and i want to make an inventory

#

how do i do that?

opal plank
#

database + memory

modest smelt
#

i use json files to store peoples info

opal plank
#

NO

modest smelt
#

wdym

opal plank
#

JSON bad

#

use a database

modest smelt
#

which one?

#

idk sql

opal plank
#

whcihever you prefer

#

postgres, cassandra,mysql, sqllite, mongodb

modest smelt
#

idk any database

opal plank
#

then pick one and learn

modest smelt
#

which one do u suggest?

#

mongo?

opal plank
#

depends on what you're going to be using in the future

#

||though postgres stands above all as the superior database||

quartz kindle
#

sqlite is simple to use, and easy to setup, and it makes you learn SQL which is a good skill to have, and you can apply to other databases as well

opal plank
#

im a postgres supremacist

modest smelt
#

can u teach me postgres?

opal plank
#

i can aid you,not teach you

modest smelt
#

in the meantime can u help me make an inventory

#

through json

#

for an rpg bog

opal plank
#

json will just rbing you problems

modest smelt
#

bot*

#

how?

opal plank
#

try to write and read the file at the same time and see what happens

#

json gets easily corrupted

ember lodge
#

Someone knows a npm library to do this type of text? : "๐“ซ๐“ธ๐“ต๐“ญ ๐“ฒ๐“ผ ๐“ซ๐“ฎ๐“ช๐“พ๐“ฝ๐“ฒ๐“ฏ๐“พ๐“ต"

modest smelt
#

also how do i make a nuke command

#

if i want to nuke a channel how do i do that?

opal plank
#

i'd recommend sticking to something rather than going all over the place tbh

fast loom
#

@modest smelt depends on what do you mean by nuke

slow otter
#

How can I put the users who are using it in the bot status

valid frigate
#

total user count?

#

you could call client.users.cache.size?

#

i forgot

opal plank
#

thats only online and cached users

#

@slow otter do you want an estimate or accurate number?

slow otter
#

accurate number

opal plank
#

then for every guild you have, map the members

#
let map = new Map()
for(guild of guilds cache){
for(member of guild) {map.set(member.id)}
}
map.size```
 will bring the accurate number
slow otter
#

tnx

opal plank
#

thats cuz it'll override entries that are already there

fast loom
#

Actually I wonder

#

is there a way when you create a channel through the bot

opal plank
#

yeah

fast loom
#

the channel itself to not show up on top but bottom

modest smelt
#

@modest smelt depends on what do you mean by nuke
@fast loom it will basically delete the channel

#

and then make a new one

fast loom
#

since if I remember correctly... Categories were showing on the botton and channels on top

modest smelt
#

with the same permissions

fast loom
#

yeah it should be possible to make it

modest smelt
#

how?

#

in discordpy

fast loom
#

you can just create a method

#

with overwrites and everything

modest smelt
#

uh...

fast loom
#

and when you type the nuke command

modest smelt
#

idk how to do that

#

im not what u would call the best

fast loom
#

it will check if the channel exists and then delete it, after that re-create it

modest smelt
#

how to do that tho?

#

no

opal plank
#

what?

modest smelt
#

๐Ÿ˜•

fast loom
#

@modest smelt text me in pm tomorrow

#

if nobody give you an answer

modest smelt
#

ok

fast loom
#

I'll check my code and give you an example

solemn leaf
#

Can someone help me with db

modest smelt
#

how to nuke a channel in discord py @opal plank

solemn leaf
#

what

opal plank
#

dunno,i work with typescript not py

modest smelt
#

oh

#

ok

solemn leaf
#

LOL

queen needle
#

Oof

opal plank
fast loom
#

@modest smelt I told ya. overwrite permissions and channel.delete + guild.add.text_channel (overwrites)

valid frigate
#

nuking mean deleting

modest smelt
#

how to do that?

fast loom
#

look them up in google or wait til tomorrow

modest smelt
#

ok

#

its 11:54 PM rn

#

i will w8 for 7 more min

solemn leaf
#

so Im doing this

 let ID = await db.get(`ID_${message.guild.id}`)

Checking if it is nil if so I have it send a message to add the id in the arg 0
once I did that it didnt work

    let ID = await db.get(`ID_${message.guild.id}`)
    if(!ID) {
        if(!args[0]){
            message.channel.send("Need valid ID")
            return;
        }

        db.set(`ID_${message.guild.id}`, args[0])
modest smelt
#

and then i will ask for help

#

5 more min

opal plank
#

its so annoying that i had to tone the ratelimit down

#

its taking 15 minutes longer to cache all channels

solemn leaf
#

erwin could you help me ๐Ÿฅบ

opal plank
#

with/

#

?

solemn leaf
#

db

opal plank
#

which?

opal plank
#

i havent used quickdb

#

as i said earlier lol im a PostgreSQL supremacist

solemn leaf
opal plank
#

join our cult,we got ACID compliant db's

#

FUUUUUUUUUUUUUCK

modest smelt
opal plank
solemn leaf
#

hahahahahahahah

opal plank
#

fucking rate limits mate

#

imma go overboard to see wtf is going up with this

solemn leaf
#

no god

#

no god please no

#

@earnest phoenix

#

noo

opal plank
#

fuck it,im trying

#

May our token not be revoked for absolutely abusing twitch's api

fast loom
#

haaha

#

so how many requests can you make to a specific api per day?

#

or it's different

valid frigate
#

i make a call to the twitch api every 60 seconds to poll for if a specific streamer goes live so id say not like once every second

modest smelt
#

can someone help me nuke a channel

#

using discordpy

slender thistle
#

P.s. why

fast loom
#

@modest smelt

1. That's how you overwrite permissions + Creating the channel
 guild = message.guild
    overwrites1 = {
        guild.default_role: discord.PermissionOverwrite(change_nickname=False,
                                                        add_reactions=False, attach_files=False, read_messages=False,
                                                        external_emojis=False, manage_messages=False,
                                                        read_message_history=False,
                                                        send_messages=False, send_tts_messages=False, embed_links=False,
                                                        manage_channels=False),
        discord.utils.get(guild.roles, name=VIP_ROLE): discord.PermissionOverwrite(
            add_reactions=True, attach_files=True, embed_links=True, external_emojis=False),
        searcher: discord.PermissionOverwrite(change_nickname=False,
                                                                         read_messages=True, manage_messages=False,
                                                                         read_message_history=True,
                                                                         send_messages=True, send_tts_messages=False,
                                                                         manage_channels=False)
    }

 channel1 = await fGuild.create_text_channel("channel-name", overwrites=overwrites1)

##################################################################################
3. That's how to delete a channel/category
await channel.category.delete()
await channel.delete()
#

now that you have all the example code, go adapt it to w/e you need

#

and you're good to go

modest smelt
#

ok

fluid widget
#

hello can any one help me for my bot pls

#

I have a problem that I don't know how to sweeten my server

fast loom
#

@fluid widget what's the bot problem ?

fluid widget
#

@fast loom

quartz kindle
#

update your node

fast loom
#

^

fluid widget
#

I did an update but when I run it on node index.js It works and there is no problem
But when i'm on pm2 start index.js I ask for some of the commands to come to me with this problem, and I don't know how to solve it@quartz kindle

quartz kindle
#

when you update node, you need to reinstall pm2

fluid widget
#

Can you tell me how to uninstall pm2

#

if you can

solemn leaf
#

how can I get a number

#

in a string

#

like

#

response.data.Groups.1

fluid widget
#

@quartz kindle

quartz kindle
#

you dont need to uninstall it, just install it again

#

npm install -g pm2

#

also, check if your node version is really updated

solemn leaf
#

how can I have a number in my string?

quartz kindle
#

node -v

fluid widget
quartz kindle
#

Groups[1]

fluid widget
#

@quartz kindle

solemn leaf
#

thanks

fluid widget
#

@quartz kindle look up

solemn leaf
#

wait

#

response.data.Groups[1]

#

Im doing api

quartz kindle
#

permission denied

#

try with sudo

modest smelt
#

@modest smelt

1. That's how you overwrite permissions + Creating the channel
 guild = message.guild
    overwrites1 = {
        guild.default_role: discord.PermissionOverwrite(change_nickname=False,
                                                        add_reactions=False, attach_files=False, read_messages=False,
                                                        external_emojis=False, manage_messages=False,
                                                        read_message_history=False,
                                                        send_messages=False, send_tts_messages=False, embed_links=False,
                                                        manage_channels=False),
        discord.utils.get(guild.roles, name=VIP_ROLE): discord.PermissionOverwrite(
            add_reactions=True, attach_files=True, embed_links=True, external_emojis=False),
        searcher: discord.PermissionOverwrite(change_nickname=False,
                                                                         read_messages=True, manage_messages=False,
                                                                         read_message_history=True,
                                                                         send_messages=True, send_tts_messages=False,
                                                                         manage_channels=False)
    }

 channel1 = await fGuild.create_text_channel("channel-name", overwrites=overwrites1)

##################################################################################
3. That's how to delete a channel/category
await channel.category.delete()
await channel.delete()

@fast loom im not sure how to use this

solemn leaf
#

@quartz kindle Im using api and the stuff in it is named 1 - 19

quartz kindle
#

yes

solemn leaf
#

it was nothing

#

just look at that

fluid widget
solemn leaf
#

bcs

#

sudo isnt a npm

#

oml

#

sudo is

#

super user do

#

so

#

sudo npm

#

please understand how to use lunix before programmin with it

fluid widget
#

@solemn leaf i only use windows and i change to lunix

quartz kindle
#

sudo npm install -g pm2

solemn leaf
#

@quartz kindle

#

this is my problem

#

the allies are numbered

fluid widget
solemn leaf
#

eee russian

#

or something

#

the text is upside down

fluid widget
#

no iths arabc

#

its arabic

modest smelt
#

lol

quartz kindle
#

@solemn leaf which data do you want?

solemn leaf
#

I want the data from the number

#

so ill

#

prob do something like

#

string would be 1 - inf until there isnt anymore allies

fluid widget
quartz kindle
#

if that link is response.data then response.data.Groups[0] gives you the entire first group

#

this is Groups[0]

solemn leaf
#

says it is empty

quartz kindle
#

what is empty?

solemn leaf
#

wait

#

nvm

quartz kindle
#

@fluid widget what is your node version?

#

do node -v

solemn leaf
#

how can I have it loop for a certain amount of times

fluid widget
#

12.18.4

solemn leaf
#

if you copied over the code

#

locations might be different for your command handler

fluid widget
#

@quartz kindle

quartz kindle
#

did you reinstall pm2?

fluid widget
#

yes

quartz kindle
#

do pm2 update

fluid widget
#

how

#

yes i update pm2

quartz kindle
#

did you type pm2 update?

fluid widget
#

yes

quartz kindle
#

did it show something about reloading?

fluid widget
solemn leaf
#

@quartz kindle how can I loop something for a certain amount of times

fluid widget
#

@quartz kindle

faint prism
#

everyone wants a piece of Tim

quartz kindle
#

the error is in pm2 logs?

solemn leaf
#

then feilds.flat isnt a thing

fluid widget
#

yes @quartz kindle

solemn leaf
#

@faint prism hi

quartz kindle
#

add console.log(process.version) in your code, then do pm2 restart index2 && pm2 log

solemn leaf
#

tim

#

yo

#

how can I loop something for a certain amount of times

earnest phoenix
#

for loops

faint prism
#

^ this tbh

quartz kindle
#

for(let i = 0; i < N; i++)

solemn leaf
#

so

#

wait

faint prism
#

or foreach if you're not modifying the collection

solemn leaf
#

or(let i = 0; i < Number?; i++)

quartz kindle
#

yes

faint prism
#

Number?; ?

fluid widget
#

@quartz kindle

quartz kindle
#

why

#

i didnt tell you to do that

#

you dont need to install pm2 locally

fluid widget
#

ok

faint prism
#
arr = [elem1, elem2, elem3]  // length = 3
arr[0] == elem1
arr[1] == elem2
arr[2] == elem3

for (i = 0; i < arr.length; i++)
  arr[i]...;  // iterate over each item in array

fluid widget
#

@quartz kindle

quartz kindle
#

then it working lol

#

looks like those are old errors

fluid widget
#

yes its working

#

thx man

mental willow
#

in python, how do i check if a member was mentioned?

#

this is what i have

async def kudos(context, user: discord.Member):
    if user:
        do this
    else:

``` and it says that User is a required argument that is missing when i want to check if someone was mentioned, and if they are, carry out the `if user` and if not, go down to the `else:`

@ me if you can help ๐Ÿ™‚
ionic dawn
#

Hi guys, how you doing

#

any problem with ur bots

errant perch
mental willow
#

@ionic dawn yes

ionic dawn
#

@mental willow not a py guy mate, can't help you xd

#

@errant perch whats showing undefined

#

and what are you trying there?

errant perch
#

trying to log the users that react to a embed

ionic dawn
#

thats not the way to go

errant perch
#

how do

earnest phoenix
#

anyone watch anime or play cod or fortnite

ionic dawn
charred kindle
#

What permissions does my bot need to give roles?

#

Oh wait

#

Nvm

#

I was being an idiot and realized the role I wanted to give was higher than the bot role

mental willow
#

xD

opaque hawk
#
const suggestionChannel = client.channels.cache.get('755967690828415057');
  suggestionChannel.send(suggestionEmbed);``` why does this happen
opal plank
#

is this valid?

#

if (max === 5 || 10 || 15 || 20)

#

or do i actually need max === 5 || max === 10 || max === 15 ....

earnest phoenix
#

im off punishment

solemn leaf
#

(!args[0] || args[0] != 'membercount' || args[0] != 'allies' || args[0] != 'set')

#

Im doing this for a if

#

an*

#

it sends the message if the command is roblox member count

#

but if it is roblox h

#

it doesnt send which is good

opal plank
#

@swift umbra just checking the same thing like 4or 5times

#

i dont want divisible

#

if i wanted 33 or 5 or 10

#

anything actually

#

@swift umbra

thick gull
#

is this valid?
@opal plank I donโ€™t think so mmLol

opal plank
#

frick

tired nimbus
#

can sqlite tables be passed in paramters?

opaque hawk
#

What is wrong with ts const suggestionChannel = client.channels.cache.get('755967690828415057'); suggestionChannel.send(suggestionEmbed);

tired nimbus
#

javascript

solemn leaf
#

@opaque hawk Const cant be changed

opaque hawk
#

so you suggest let

solemn leaf
#

var or let

opaque hawk
#

eww imagine using var in es6

#

Still get the "Object is possibly undefined" error

#

nvm

earnest phoenix
#

yerrain discord.ts has a discord also

#

dm me if needed

opaque hawk
#

nah

#

Does anyone know how to cast types? I uhh... excel in typescript but cant even remember how to cast to TextChannel

#

;-;

tired nimbus
#

can sqlite tables be passed in paramters?

earnest phoenix
#

(suggestionChannel as TextChannel).send()

valid frigate
#

the life of a developer

thick gull
valid frigate
#

@opaque hawk i believe you can do message.channel as TextChannel

silver lintel
#

how do you detect the amount of bot users in a guild? in discord.js

valid frigate
#

oh shit it was already answered oooooooooooh

thick gull
#

<guild>.members.cache.size?

#

I mean it wonโ€™t show offline users is โ€œlargeโ€ servers

#

probably

opaque hawk
#
(suggestionChannel! as TextChannel).send(suggestionEmbed);``` `Cannot read property 'send' of 'undefined'`
#

why it no worko

torn ravine
#

probably

opaque hawk
#

In english, why does it not work

ionic dawn
#

@opaque hawk

#

are you sure thats returning a channel?

opaque hawk
#

yes

ionic dawn
opaque hawk
#

.

#

I mean, do I have to put the server in there as well, like /server/channel

ionic dawn
#

if it was returning a channel the error wont pop up

opaque hawk
#

or just the channelID

ionic dawn
#

you can get a channel by its ID

opaque hawk
#
let suggestionChannel = client.channels.cache.get('755967690828415057');```
ionic dawn
#

suggestionChannel.send(suggestionEmbed)

#

try just that

opaque hawk
#

I did

ionic dawn
#

same error?

opaque hawk
#

no

ionic dawn
#

then?

#

Whats a "Character Game"

#

whatever you can do on py/java/etc you can do it on js

#

there's always a way

opaque hawk
ionic dawn
#

yerrain

#

why you have that !

opaque hawk
#

t y p e s c r i p t

ionic dawn
opaque hawk
#

xD

warm prairie
#

is there a query that will give me the users currently "live" in the voice channels of my server?

ionic dawn
#

(suggestionChannel).send(suggestionEmbed); Thonk

opaque hawk
#

I had to cast to type TextChannel

#

same error

ionic dawn
#

what tf you have to specify is a text channel

#

if you have the channlID

#

dnst make any sense

opaque hawk
#

because apparently "JavaScript doesn't give two hoots what any means and what it can be changed to"

#

So I have to cast suggestionChannel as TextChannel

ionic dawn
#

does djs use .fetch to take channels now?

#

mayb I stand incorrectly

opaque hawk
#

It's outdated as of x12

#

v12*

shut trellis
#

Heyy

opaque hawk
#

It uses get

ionic dawn
#

cache.get yeah but..

#

do you use any other lib to use TS?

#

never used ts

opaque hawk
#

actually i am thinking of find but fetch doesn't work

ionic dawn
#

is just like a framework?

#

nah, find is to find by name

opaque hawk
#

TS is just an extension to JS in a sense

shut trellis
#

Can anyone tell me when my bot will be available publicly on discord. Gg

opaque hawk
#

How long ago did you apply?

ionic dawn
#

your bot dsnt need to be verified to can be used publicly

shut trellis
#

@opaque hawk before 2 days

ionic dawn
#

only if its over 100 servers

#

btw discord bot verifications took +40d

opaque hawk
#

yeah

#

not 2

ionic dawn
#

mine gets verified a few days ago

shut trellis
#

@ionic dawn Yea but this time it dosnt show on discord. Gg

ionic dawn
#

and I applied 35d ago

#

I mean... you can just click on discord dev, create, and make a bot in a minute

shut trellis
#

I mean discord. Gg is a bot list website where i share my bot publicly.

ionic dawn
#

you dont need discord permission to use it

opaque hawk
shut trellis
#

Oo ya sorry top. Gg haha

ionic dawn
opaque hawk
#

oh ok

shut trellis
#

Ysss

opaque hawk
#

So now

ionic dawn
#

hows that channel going yerrain

opaque hawk
#

back to .fetch()...

ionic dawn
#

it does work?

opaque hawk
#

no

ionic dawn
opaque hawk
ionic dawn
#

try that

#

client.channels.cache.get('ASDFASDF').send(yourembed)

#

directly

opaque hawk
#

That was the first thing I tried and that didnt work

ionic dawn
#

fck

#

can I see more code? that code is good, there's no sense on that not working

#

I mean, im using that code for a few things on my bots and it does work

opaque hawk
#
import { Message, MessageEmbed, Client, TextChannel } from "discord.js";

export const name = "suggest";
export function execute(message: Message, args: string[]) {
  const client = new Client;

  args[0] = args.join(' ');
  
  const suggestionEmbed = new MessageEmbed()
  .setColor("#ffff00")
  .setTitle(`${message.author.tag} suggests:`)
  .setDescription(args[0]);

  let channels = TextChannel;

  let suggestionChannel = client.channels.cache.get('755967690828415057').send(suggestionEmbed);
  // (suggestionChannel!).send(suggestionEmbed);
}```
#

The whole file

ionic dawn
#

but its inside of a let

shut trellis
#

Can anyone tell me what's the meaning of your bot currently listed on dbl?

opaque hawk
#

I use const and the same error pops up

#

I remove that all together and it still doesn't work

#

So now the line is just ts client.channels.cache.get('755967690828415057').send(suggestionEmbed);

ionic dawn
#

(client.channels.cache.get('ASDFASDF') as TextChannel).send(yourembed)

opaque hawk
#

good idea

#

guess what

#

I have no errors

#

now I leave it up to the compiler to see what it thinks

#

I hate casting types

shut trellis
opaque hawk
#

That means that those are the bots that you can view on top.gg

shut trellis
#

Awwwww okay

ionic dawn
#

@opaque hawk

opaque hawk
#

thanks

#

wheeze

#

it shouldn't be undefined tho

slender thistle
#

It shouldn't but it apparently is

#

Wonders of JS? GWahreeVampyYay

opaque hawk
#

:)

#

you know it

slender thistle
carmine summit
#
if (command == 'vc') {
      let newName = args.slice(0).join(' ')
      message.member.voice.channel.setName(newName)
}
```no work
wintry niche
#

hey

shut trellis
#

But u know when u search my bot name then it dosnt show

wintry niche
#

who know u login ur bot acc?

opaque hawk
#

kinda like a twitter post I saw
"I HATE PROGRAMMING
I HATE PROGRAMMING
I HATE PROGRAMMING
I HATE PROGRAMMING
I HATE PROGRAMMING
I HATE PROGRAMMING
IT WORKS
I LOVE PROGRAMMING"

ionic dawn
#

@shut trellis if your bots isnt verified by top.gg only you can see your own bot

shut trellis
#

When will my bot appear?

carmine summit
#
if (command == 'vc') {
      let newName = args.slice(0).join(' ')
      message.member.voice.channel.setName(newName)
}
```no work
opaque hawk
#

who know u login ur bot acc?
@wintry niche wdym

shut trellis
#

So that anyone can invite my bot

ionic dawn
#

@carmine summit ๐Ÿ†—

wintry niche
#

@opaque hawk u have bot?

opaque hawk
#

yeah

wintry niche
#

u login ur bot acc

ionic dawn
shut trellis
#

@ionic dawn awwww okay i got it

delicate shore
#

I need to upload a txt file on link - www.mydomain/verify/bsdfbwefw.txt

opaque hawk
#

like userbot? or how to make your bot login

delicate shore
#

How can I upload

#

a text file

carmine summit
ionic dawn
#

its your own website @delicate shore

#

?

delicate shore
#

Yes

#

yes

opaque hawk
#

@wintry niche

wintry niche
#

@opaque hawk ?

ionic dawn
#

The bot is in the same host?

delicate shore
#

no

opaque hawk
#

like userbot? or how to make your bot login
@opaque hawk

ionic dawn
#

F

delicate shore
#

why

ionic dawn
#

if it was is just a simple write

visual robin
#

What's the code for
Seeing how many servers the bot is in? Can any one tell

wintry niche
#

yea i have bot host programme u host on bot acc

#

login

#

bot

#

accc

delicate shore
#

I host on glitch

ionic dawn
#

hmm, you can use ftp protocols probably

delicate shore
#

my website

ionic dawn
delicate shore
#

but my bot on Galaxy Gate

opaque hawk
#

i dunno, maybe use login('botTokenHere')?

carmine summit
shut trellis
#

Then how long does it take for verifiey by top. Gg?

opaque hawk
#

5 weeks

ionic dawn
visual robin
#

What's the code for
Seeing how many servers the bot is in? Can any one tell
@visual robin bruh

ionic dawn
#

probably that helps

opaque hawk
#

i dunno, maybe use login('botTokenHere')?
zion

shut trellis
#

@opaque hawk awww really wow thanks for informing me.

ionic dawn
#

if you have access to ftp on your website host you can send files to specific folders

#

@visual robin spoonfeed

opaque hawk
#

o-o

visual robin
opaque hawk
#

spoonfeeding is not looked upon with great kindness here

ionic dawn
#

asking people to make your work

#

not cool

carmine summit
shut trellis
#

@ionic dawn oliy

carmine summit
#
if (command == 'vc') {
      let newName = args.slice(0).join(' ')
      message.member.voice.channel.setName(newName)
}
```no work
slender thistle
#

They literally only asked how to do that

ionic dawn
#

he asked for the code

slender thistle
#

@visual robin what library, library version

ionic dawn
#

the message literally says: "Whats the code for"

opaque hawk
#
(client.channels.cache.get('755967690828415057') as TextChannel)``` why is that undefined
slender thistle
#

And it's not a big snippet of code they're asking

opaque hawk
#

i hate js for this reason

#

or rather, ts

ionic dawn
#

@carmine summit mayb im wrong but I think its voiceChannel

slender thistle
#

There's no separate way to say "optional" in TS?

carmine summit
#

NO

ionic dawn
#

not voice.channel

carmine summit
#

it is changed

#

to voice.channel

#

in v12

ionic dawn
#

oh

#

then letme see the docs a second

#

probably an easy fix

carmine summit
#

no its not

#

it worked first time

#

but when i run the code again

#

it doesnt work

ionic dawn
#

what does your command do

opaque hawk
#

There's no separate way to say "optional" in TS?
@slender thistle wdym "optional"

ionic dawn
#

change the channel name by the owner or wha

#

or: -vc <channel name>

carmine summit
#

rename to

slender thistle
#

Ehh... kind of like public int? prop and then class.prop can return null in C#

carmine summit
#

im the owner lol

#

ofc

#

it worked first try

#

now it aint work

ionic dawn
#

well

#

add one more = in the if

#

and the code is actually right, mayb rerun the bot and try in other channel

carmine summit
#

its better to keep it 2

ionic dawn
#

ill try it with a simple bot in a test server

carmine summit
#

bcuz if its 3 it may run to some problems

opaque hawk
#

I still dont understonaf

carmine summit
#

3 is so damn strict

opaque hawk
#

understand

ionic dawn
#

you comparing strings

carmine summit
#

eh

#

?

#

i still rather ==

opaque hawk
#

=== is objectively better

#

and more useful

carmine summit
#

bruh

#

ill use it when i need it

#

ok?

opaque hawk
#

if you use == this bot thinks it is invited to type juggle

#

And if you use === it isn't

carmine summit
#

no wait i think i know what my problem is

opaque hawk
#
(client.channels.cache.get('755967690828415057') as TextChannel)```
 why is that undefined
carmine summit
#

RATE LIMITED

opaque hawk
#

.w.

carmine summit
opaque hawk
#

wheeze

#

I love rate limiting

carmine summit
#

YES I LOVE RATE LIMITING

#

IT LIMITS ME TO RENAME IT 2 TIMES IN A MINUTE

ionic dawn
#

well

#

yes its rate limited

#

tried on test server

#

changed the first 3 times

#

then stops

carmine summit
#

next. how can i detect if a user leaves the channel then there is noone left in the channel

#

aka all left the VC

onyx shore
ionic dawn
#

do what I and most of the people do

#

google for 1h, and then cry a bit and then ask here

#

its been working for me

onyx shore
#

next. how can i detect if a user leaves the channel then there is noone left in the channel
@carmine summit about music command?

carmine summit
#

no

#

see among us is a popular game. And I made a command which renames their VC to their code

#

but havent still made a way that if everyone left the VC its name will reset

#

ima flex my 8k members server real quick

onyx shore
#

Gl

ionic dawn
#

make something that check the channel every x amount of time

opaque hawk
#

The official /r/AmongUs discord server gained 1k members in 12 hours

ionic dawn
#

if a time detects 0 users the rename it

onyx shore
carmine summit
#

make something that check the channel every x amount of time
@ionic dawn NO.

ionic dawn
#

OK.

opaque hawk
#

WHY ARE WE SHOUTING.

ionic dawn
#

IDK.

carmine summit
#

THERE ARE LIKE 30 ACTIVE VC IN MY SERVER

#

SO YEAH

#

BOT GO BOOM IF I DO THAT

ionic dawn
#

oh

onyx shore
#

Bro

ionic dawn
#

bot goes brrrrr

onyx shore
#

A server with 150,00 members is so active

ionic dawn
#

well... idk if theres an event that triggers when a user joins/leave

onyx shore
#

The entire discord lag from it

opaque hawk
ionic dawn
#

didnt deal with voice channels etc

#

lol @opaque hawk

carmine summit
#

well... idk if theres an event that triggers when a user joins/leave
@ionic dawn SEND

ionic dawn
#

imagine moderating that

#

send what

carmine summit
#

IT

#

NOW

opaque hawk
#

the community moderates itself

ionic dawn
#

read the message tho

opaque hawk
#

idk if

ionic dawn
#

the community moderates itself
@opaque hawk PERFECTION

carmine summit
opaque hawk
#

I mean, every so often a member posts its room codes outside of #looking-to-play but that isnt hard to fix

#

I mean yeah an AmongUs Filipino server is going to be big

ionic dawn
#

Among us is based on kill a black guy and then discuss if we should kill or not the other people

opaque hawk
#

yh

ionic dawn
#

but the black guy... oh he always die

carmine summit
#

can i just

#

have the code

#

for the thing

ionic dawn
opaque hawk
#

no

onyx shore
#

I dont know it

forest prairie
opaque hawk
#

noone does

ionic dawn
#

@forest prairie he making an among us bot

eager granite
#

oh my why is among us in here go to off topic

ionic dawn
#

thats why

forest prairie
#

o

onyx shore
#

I can share the music code for discord.js

#

But might take long to share

opaque hawk
carmine summit
#

i need a code that detects if everyone left the VC

fleet jasper
#

so code it

opaque hawk
#

lol

#

Alex with AlexIsOk

ionic dawn
#

@fleet jasper

opaque hawk
#

lmao

onyx shore
#

You can just make a leave command so the bot leave

opaque hawk
#

vo1d with Voided

onyx shore
carmine summit
#

JS

#

i dont know how to

onyx shore
#

Node or discord js?

ionic dawn
#

there is an event that triggers when an user join or leave

#

interesting

fleet jasper
#

I'm just @fast trench's alt lmao

carmine summit
#

discord js

#

there is an event that triggers when an user join or leave
@ionic dawn GIVE it To ME NOW

ionic dawn
#

im bout to block you

forest prairie
ionic dawn
#

walrus lol

onyx shore
carmine summit
#

not reading the docs

opaque hawk
#

read the docs is always a great answer

ionic dawn
onyx shore
#

not reading the docs
@carmine summit you'll never learn if so

carmine summit
#

i alr read the docs

onyx shore
carmine summit
#

didnt found it

ionic dawn
#

you prob dont

dense nest
#

How do I get the channel that I typed in in discord.py

opaque hawk
#

Then you didnt look hard enough

#

So back to mine

fast trench
#

#weneedamoderatortodealwiththiscrap

opaque hawk
#

why do that return undefined/why is it undefined

ionic dawn
#

I could spoonfeed

#

but... meeeeh

dense nest
#

No spoonfeeding

ionic dawn
fast trench
#

but I'm not hungry for your code lol I want my own "unique"

opaque hawk
#
(client.channels.cache.get('755967690828415057') as TextChannel)```
dense nest
#

Spoonfeeding bad

carmine summit
#

I ALRADY READ THE DOCS IT AINT THERE

ionic dawn
#

i was jokng

fast trench
#

I ALRADY READ THE DOCS IT AINT THERE
@carmine summit yes it is

opaque hawk
#

Why is that undefined

fast trench
#

it actually is

carmine summit
#

IT IS HIDING FROM ME

opaque hawk
#

you just have to know where to look

ionic dawn
#

I literally typed: Event that triggers when user join/leave DJS

onyx shore
ionic dawn
#

and the first google thing shows how to do it

fast trench
#

just search voice in the docs and it's right there...I have it pulled up right now actually

ionic dawn
#

your brain is damaged or you are not looking hard enough

opaque hawk
ionic dawn
#

I hate when people is to lazy to do something

#

they just paste code into vc

opaque hawk
onyx shore
#

Im lazy too but im working hard to be a bot dev

fast trench
#

are too lazy not is to lazy lol

opaque hawk
onyx shore
#

Im working on a bot and is terrible

forest prairie
soft eagle
#

so i use discord.js and am sharding how do i set a auto rotating status to work on it without it breaking?

opaque hawk
#

yes

ionic dawn
#

@fast trench hey

carmine summit
#
  const newUserChannel = newMember.voice.channelID
  const oldUserChannel = oldMember.voice.channelID
  const textChannel = message.guild.channels.cache.get('712677731023716452')

  if(newUserChannel === '712677767333937284') {
    textChannel.send(`${newMember.user.username} (${newMember.id}) has joined the channel`)
  } else if (oldUserChannel === '712677767333937284' && newUserChannel !== '712677767333937284') {
    textChannel.send(`${newMember.user.username} (${newMember.id}) has left the channel`)
  }
})```
ionic dawn
#

eng isnt my first language

#

give me a f break will ya?

opaque hawk
#
(client.channels.cache.get('755967690828415057') as TextChannel)``` why is this undefined
#

.w.

fast trench
#

becaue the channel isn't existing

opaque hawk
#

it does tho

ionic dawn
#

not for TS

opaque hawk
#

idk why it says it doesn't

fast trench
#

also why tf do you define it that way

opaque hawk
#

stackoverflow wheeze

ionic dawn
#

apparently typescript way

fast trench
#

rip...well imma go get some chips and go to bed lmao

onyx shore
opaque hawk
#

lmao cya

soft eagle
onyx shore
#

No

ionic dawn
#

rotatin status sucks

#

tried for a few days and theres no way that dnst lag the bot

soft eagle
#

never lagged mine

dense nest
#

How do you get the name of a channel in discord.py? Like the one I type in.

slender thistle
#

on_message or commands extension?

silver lintel
dense nest
#

Idk

slender thistle
#

That statement already scares me

#

show your code at least

dense nest
#

Me?

blissful coral
#

@silver lintel whTs your current code

dense nest
#

@slender thistle

silver lintel
#
const filter = m => m.content.includes('discord');
const collector = message.channel.createMessageCollector(filter, { time: 15000 });

collector.on('collect', m => {
    console.log(`Collected ${m.content}`);
});

collector.on('end', collected => {
    console.log(`Collected ${collected.size} items`);
});
``` just copied from discord guide
blissful coral
#

What version

#

Of discord

silver lintel
#

12

blissful coral
#

Ok

slender thistle
#

Yes, Bleepo

dense nest
#

Ok

blissful coral
#

Did you look at the docs? @silver lintel

silver lintel
#

uh no, lemme just check

#

i want the bot to send a message like:
bot: what channel would you like it in?
user: #idk

dense nest
#
@commands.has_role('Owner')
async def close(ctx):
  channel = ctx.channel.id
  await channel.edit(name=new_name)
  await channel.set_permissions(send_messages=True, read_messages=True, add_reactions=True, embed_links=True, attach_files=True, read_message_history=True, external_emojis=True)```
slender thistle
#

What is new_name defined as?

dense nest
#

Its just a random thing

#

For the name

slender thistle
#

Define channel as just ctx.channel

blissful coral
#

Check the official djs guide @silver lintel

silver lintel
#
// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
  .then(collected => console.log(collected.size))
  .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
``` thats official one
#

ill try

#

thanks

blissful coral
#

:)

silver lintel
#

const filter = m => m.content.startsWith('!vote');

#

how do i make it only so a user can do it and a channel?

blissful coral
silver lintel
#

console still says

#

After a minute, only 0 out of 4 voted.

earnest phoenix
#

anyone know how to get my bots name to change? i changed it in the bot portal but it wonโ€™t change when it joins servers

cinder patio
#

Did you change the name under "Bot" or "Application"

sharp thicket
#

client.user.setUsername('Name');

cinder patio
#

You need to change the name under "Bot"

wind kayak
#

Will any one help me to make a bot together

#

I want to make a brawl stars stats bot

sharp thicket
#

thats spoon-feed and not allowed i think

wind kayak
#

Its not allowed?

sharp thicket
#

what language though?

wind kayak
#

English

sharp thicket
#

bruh

#

what coding language

#

smh

wind kayak
#

Idk

#

I have it

sharp thicket
#

what language do you know?

wind kayak
#

In github

#

what language do you know?
English and urdu

sharp thicket
#

BRUH

#

im talking about coding languages

#

like js python c# c++ lua

#

json

#

css

#

htpm

wind kayak
#

Python

sharp thicket
#

typeScript

#

how do you define something in python?

wind kayak
#

Idk

#

I never used it