#development

1 messages · Page 973 of 1

nocturne grove
#

I guess it's not a valid url if you get that error
@cinder patio it is a valid one

flat obsidian
frosty swan
#

I press the authorize button and then the same screen comes once again


route.get("/", async (req, res, next) => {
    if (!req.query.code) throw new Error('NoCodeProvided');
    const code = req.query.code;
    const creds = btoa(`${CLIENT_ID}:${CLIENT_SECRET}`);
    const response = await fetch(`https://discordapp.com/api/v6/oauth2/token?grant_type=authorization_code&code=${code}&scope=identify&redirect_uri=${encodeURIComponent(DOMAIN)}api/callback`, {
        method: 'POST',
        headers: {
            Authorization: `Basic ${creds}`,
        },
    });
    const json = await response.json();

    const [{ username, discriminator, avatar, id }, tk] =  await getUser(json.refresh_token);
    if (!id) return res.redirect('/login');
    res.cookie("refresh_token", tk, {httpOnly: true})
    res.cookie("theme", "light");
    res.cookie("avatar", avatar);
    res.cookie("userid", id);
    res.cookie("username", username);
    res.cookie("discriminator", discriminator);
    res.redirect(`/`);
});

#

anyone help me ??

earnest phoenix
#

just wait for someone to reply

frosty swan
#

...

quartz kindle
#

@flat obsidian you are trying to use python in javascript wtf

flat obsidian
#

thonkku Im noob

quartz kindle
#

you cant mix languages

frosty swan
#

then learn how to use it first

flat obsidian
#

ok dont tag?

frosty swan
#

sry

flat obsidian
balmy knoll
#

@quartz kindle Hey, I've seen that some people can set the STREAMING status, but without having to insert a link from twitch.tv. I tried, but I couldn't. Do you know how to do that?

quartz kindle
#

@balmy knoll are you sure? im pretty sure url is mandatory, it has to be either twitch or youtube

true ravine
#

Is there a way to stop one of my commands running without stopping my entire bot's process?

balmy knoll
#

@quartz kindle Yes yes, but in fact the scream was there but it referred to the bot's website. But I can't put a link that isn't from twitch.

quartz kindle
#

depends on your code

true ravine
#

So it has been run, but I want to stop it after x

#

Ah okay thanks

coral stirrup
#

async

slender thistle
little hare
#

Guys i want add me bot but She say invalid

earnest phoenix
#

wot

#

you made no sense

pale vessel
#

waitWhat x2

still merlin
#

i cant find a unban method anywhere in the docs. I know ban is in discord.js

little hare
pale vessel
#

why is the then inside the options lol

earnest phoenix
#

you can do message.guild.members.unban(..., ...)

pale vessel
#

OH

#

never mind

little hare
still merlin
#

would it just be .unban instead of .ban in discord.js

lapis bramble
#
(node:8259) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
earnest phoenix
#

You didn't give the bot the right perms

#

you should permission check

digital ibex
#

@frosty swan u fixed it?

frosty swan
#

no

#

u can help me ?

digital ibex
#

i'll try

#

whats ur issue again?

frosty swan
#

I press the button, it waits a bit, then the same screen comes again

#

@digital ibex

pale vessel
#

sounds like a loop

digital ibex
#

ur code?

frosty swan
#

route.get("/", async (req, res, next) => {
    if (!req.query.code) throw new Error('NoCodeProvided');
    const code = req.query.code;
    const creds = btoa(`${CLIENT_ID}:${CLIENT_SECRET}`);
    const response = await fetch(`https://discordapp.com/api/v6/oauth2/token?grant_type=authorization_code&code=${code}&scope=identify&redirect_uri=${encodeURIComponent(DOMAIN)}api/callback`, {
        method: 'POST',
        headers: {
            Authorization: `Basic ${creds}`,
        },
    });
    const json = await response.json();

    const [{ username, discriminator, avatar, id }, tk] =  await getUser(json.refresh_token);
    if (!id) return res.redirect('/login');
    res.cookie("refresh_token", tk, {httpOnly: true})
    res.cookie("theme", "light");
    res.cookie("avatar", avatar);
    res.cookie("userid", id);
    res.cookie("username", username);
    res.cookie("discriminator", discriminator);
    res.redirect(`/`);
});

earnest phoenix
#

on the account you're on do you have any servers on it @frosty swan

marble scaffold
#

Does anyone know how to make a magic 8 ball?

earnest phoenix
#

no spoonfeeding

digital ibex
#

u creating ur own auth?

frosty swan
#

yes

earnest phoenix
#

well the guy isn't even answering my question smh

digital ibex
#

noice

marble scaffold
#

Huh

digital ibex
#

it looks like the if(!id) bit, instead of redirecting them, console.log not logged in or something, see if thats where it breaks

#

@frosty swan

still merlin
#

How do you unban someone with a ID? im trying to use a mention like <@id> but its not workinh

earnest phoenix
#

const unbanID = args[0];

#

and check if the id is banned

#

and if not then return

#

await message.guild.fetchBan(unbanID); you can use this in a try catch

#

@still merlin

woeful pollen
#

Is there a way to slice from args

digital ibex
#

yes

#

.slice

earnest phoenix
#

^

woeful pollen
#

From args

earnest phoenix
#

yes

#

args.slice(21)

woeful pollen
#

I can slice from a number but not from srhs

#

Args.slice?

digital ibex
#

yes

frosty swan
#

I think I solved the problem

woeful pollen
#

Ok ty

digital ibex
#

nice, you finished ur auth?

frosty swan
#

yes

digital ibex
#

hot

#

i need to use my own one lol instead of passport

earnest phoenix
#

gj

frosty swan
#

lol

earnest phoenix
#

lmao yh tbh idk why you joined my server to say kid as well

#

like well done you are still mad

strong tundra
#

meh

earnest phoenix
strong tundra
#

i use next-auth for authentication

#

i like it cause i can use both ssr and csr

#

and it shows the same thing

earnest phoenix
#

nice

strong tundra
#

the only problem really is that my site runs on vercel which uses serverless functions

#

and it takes a bit to connect with the database each request

earnest phoenix
#

oh ok

#

so is the connection slower

#

than usual

strong tundra
#

although i could just use jwts

#

no

#

it's making a new connection on each request

earnest phoenix
#

oh gotcha

earnest phoenix
#

such as this bot

#

@earnest phoenix didn't i tell you already

#

also you can't do it on top,gg

#

hm? then why him can?

frosty swan
#

There are 52 collections and how can we delete them quickly below -_-

slender thistle
#

@earnest phoenix That's a pseudo-element where the background image is a gif

earnest phoenix
#

the bot is on 10 servers and is pending approval at top.gg, I hope it won't give you a change when administrators try it, I will have to wait 3 weeks again

#

the token that changes me alone

#

i need help this is bugged

#

aaaaa

quartz kindle
#

its normal if your token changes when you refresh the page

#

the old token still works

earnest phoenix
#

no

#

the bot is disabled when the token changes

strong tundra
#

i always forget you can do custom css on your page

earnest phoenix
#

and on top of that glich goes crazy and gives me error in everything

#

WTF

#

I have formatted the bot alone

#

Thank God I have it on github

frosty swan
#

I think don't use glicht

earnest phoenix
#

and what do I use

frosty swan
#

instead I suggest VDSs in Google Cloud to host the atom cloud text editor

earnest phoenix
#

pls

#

and the bot is 24/7 ???

frosty swan
#

for free hosting?

#

@earnest phoenix

earnest phoenix
#

yes

frosty swan
#

for 7/24

earnest phoenix
#

ok thanks

frosty swan
#

but don't choose to buy a paid vds

#

bcs i have 12vds

earnest phoenix
#

ok thanks

frosty swan
#

If you want, I can give you one

golden condor
#

That isn't allowed here unfortunately, due to security reasons

#

You aren't allowed to host someone else's bot

earnest phoenix
#

If you want, I can give you one
@frosty swan I don't even know what it is but well

haughty night
#

Someone know where i can find something like "Login with discord" to add to a website

golden condor
#

Yes

#

It's oauth

slender thistle
#

Discord OAuth2

haughty night
#

Alright

#

Thanks

golden condor
#

You have to code it in

haughty night
#

Yae no worries there

golden condor
#

ok

haughty night
#

Thanks

golden condor
#

np

earnest phoenix
#

ok dime un lugar para alojarlo legal

#

XD

golden condor
#

@earnest phoenix Buy a vps

earnest phoenix
#

is legal??

#

or a scam

quartz kindle
#

100% free -> glitch / heroku / repl.it
1 year free -> google / amazon
not free -> vps (virtual private server)

#

@earnest phoenix

golden condor
#

Thank u tim

frosty swan
#

vds is more better

#

@quartz kindle

quartz kindle
#

vds is more expensive

earnest phoenix
#

100% free -> glitch / heroku / repl.it
1 year free -> google / amazon
not free -> vps (virtual private server)
@quartz kindle this is what i need, thanks

frosty swan
#

i give it free xd

strong tundra
#

i hear not to roll your own auth

golden condor
#

VPS's and Dedicated servers are better, which is why they cost more

strong tundra
#

is that accurate?

quartz kindle
#

vds = virtual dedicated server, is the same as a vps but more expensive and more powerful

golden condor
#

o

frosty swan
#

we don't need to say we know them ..

golden condor
#

I thought he just made a typo

earnest phoenix
#

cost 1$ xD

#

1 month

quartz kindle
#

what does?

frosty swan
#

lol

earnest phoenix
#

what does?
@quartz kindle google and amazon, and i think about the vps

#

and how I host it on google

quartz kindle
#

google compute engine f1-micro is free forever if you dont hit the usage limits

#

but you need a credit card to create an account

golden condor
#

If you are looking for cheap but also reliable, here are some ones that might be good:
https://contabo.com/
https://www.skysilk.com/

strong tundra
#

oracle has a free vps but it's really shit

bitter sundial
#

they wont charge you unless you sign up tho

earnest phoenix
#

i have credit card from the deep web

strong tundra
#

also you need a debit/credit catd

golden condor
#

ummm....

frosty swan
#

this is the vps i use

golden condor
#

which

frosty swan
coral trellis
#

@earnest phoenix so a stolen credit card?

strong tundra
#

is this just for your bot

golden condor
#

uh oh stinky

frosty swan
#

yes

earnest phoenix
#

@earnest phoenix so a stolen credit card?
@coral trellis no, is a credit card fake

frosty swan
#

@strong tundra

strong tundra
#

i mean

#

it's your money

frosty swan
#

xd

golden condor
#

REDACTED no, is a credit card fake
@earnest phoenix so it won't work?

frosty swan
#

yes my money

strong tundra
#

how many users does your bot have then

quartz kindle
#

dedicated servers are better than vps or vds, but they are the most expensive

#

if you have money sure, go for dedis

golden condor
#

and unecessary for a bot of small size

earnest phoenix
#

I better use my debit card and now

strong tundra
#

yeah it's very much unnecessary

earnest phoenix
strong tundra
#

you could probably run a decently sized bot off a pi

quartz kindle
#

yes

golden condor
#

yep

frosty swan
#

@strong tundra

#

Our boat opened 1 month ago, now there are 160k users

earnest phoenix
#

okay okay

strong tundra
#

oh

#

mine's at like 50k

quartz kindle
#

160k users as in guild.memberCount?

frosty swan
#

no

strong tundra
#

i don't think anyone uses it though

quartz kindle
#

how do you count your users?

frosty swan
#

yes

#

160k users as in guild.memberCount?
@quartz kindle

quartz kindle
#

ah

#

users is not a very good metric

#

because this server alone has 100k +

#

and other servers have like less than 10 users

frosty swan
#

yes

strong tundra
#

i get users from cache

#

yea

frosty swan
#

yhere are 60k users except 100k

#

@quartz kindle

quartz kindle
#

you have 50k users in your cache?

#

jesus

#

i keep my caches clean

strong tundra
#

that's what serenity saya

#

well

frosty swan
#

my previous bots are up to 450 servers then my account exploded

#

then they made the dm announcement from the bot

quartz kindle
strong tundra
#

lemme go check how i get users

quartz kindle
#

lol

frosty swan
#

do you think atom or viisual studio code?

#

maybe atom is more better

quartz kindle
#

im using sublime text 3

frosty swan
#

xd

strong tundra
#

ok weird

frosty swan
#

i have never used sublimation text

earnest phoenix
#

when you have your bot on 75 servers what do you do, because yesterday I arrived

strong tundra
#

my bot says 50k users in cache

#

but it also is only using 10.55mb memory

#

???

frosty swan
#

lol

quartz kindle
#

you go to your discord developer portal and click on the bot verification

#

@strong tundra how are you measuring your ram usage?

earnest phoenix
#

aaaa

strong tundra
#

getting it from htop

#

i think

quartz kindle
#

which column?

frosty swan
#

I have been waiting for 2 weeks. What time do you think is approved?

quartz kindle
#

mine took 3 weeks

frosty swan
#

..

strong tundra
#

hmm not sure

quartz kindle
#

show a pic of your htop

earnest phoenix
#

the verifications is in 5 days +-

#

on discord

strong tundra
#

i think there's only one memory column on htop in alpine

#

actually no i use top

modest maple
#

@quartz kindle Spotify things it has a grand total of 200 Users lul

quartz kindle
#

lmao

modest maple
#

Idek why theyre even cached

strong tundra
#

still same thing though, one mem column

quartz kindle
#

your top doesnt show virtual/resident?

strong tundra
#

not in alpine i don't think

#

lemme go check on that

frosty swan
strong tundra
#

this is top

golden condor
#

Oracle needs a card

#

:/

quartz kindle
#

weird

strong tundra
#

wait my bot isn't even on there

quartz kindle
#

try installing htop

strong tundra
#

sad

#

im not sudo

quartz kindle
#

nothing @silent cape

#

you need to ask discord

strong tundra
#

anyways i'm too lazy to rebuild to make myself sudo

frosty swan
#

@silent cape You didn't always open the server and add your bot to your servers, right?

#

hmm

#

If you don't have this bot with a friend, are you doing it alone?

#

@quartz kindle Are you using vds or vps?

#

Is it too expensive : P

quartz kindle
#

im using vps

frosty swan
#

@silent cape my suggestion contact the authorities

#

for your bot

slender thistle
#

Discord decided that your bot gained many servers in a short period of time

frosty swan
#

@quartz kindle how many gb upload speeds on average?

slender thistle
#

You'll be able to apply again later

strong tundra
#

very weird

quartz kindle
#

@silent cape

If you're seeing an inorganic growth warning when attempting to verify, that means we determined that a significant number of the servers your bot is in are owned by the same user or set of users. This is considered inorganic and disqualifies a bot for verification. You will need to examine your bot's guild membership and work to fix this issue before being eligible to apply for verification.

Note that our Support team cannot typically undo this flag, and you will need to work to fix this issue on your own.

strong tundra
#

it does say cached

quartz kindle
#

which language/lib are you using?

#

@frosty swan i think 1gb down 500mb up

frosty swan
#

.......

strong tundra
#

qhat the fuck

frosty swan
#

i am getting 2gb upload speed with 1.5gb@quartz kindle

strong tundra
#

lmaooo

#

i'm so stupid

quartz kindle
#

@frosty swan yes but you pay 39 per month

#

i pay 3

frosty swan
#

xd

#

omg

quartz kindle
#

lmao

frosty swan
#

fck

#

how can i delete

#

fck

quartz kindle
#

ctrl z

frosty swan
#

not working

quartz kindle
#

then select and delete lol

frosty swan
#

It took a very long 250 folder.

#

that was good ....................................

strong tundra
#

weird

quartz kindle
#

@strong tundra how are you getting the memory usage?

#

to show in the bot info command

strong tundra
#

oh nvm

#

i don't use top

#
pmap $1 | head -n 2 | tail -n 1 | awk '/[0-9]K/{print $2/1000}'```
#

hmm this might be outdated

quartz kindle
#

you're using rust right?

#

i see rust has a procinfo::pid::Statm struct for that

strong tundra
#

hmm

#

lemme look at that

earnest phoenix
#

wtf

frosty swan
#

lol

quartz kindle
#

lmao

frosty swan
#

ur token gg

quartz kindle
#

you put your token on github?

earnest phoenix
#

no

frosty swan
#

lol

strong tundra
#

wait

#

it's not in std

frosty swan
#

uploaded token in github

#

lol

#

🎉

strong tundra
#

oh i bet it's a crate called procinfo

frosty swan
#

@earnest phoenix

#

why u dont use .env?

#

and .gitignore

strong tundra
#

yeah got it

earnest phoenix
#

first I empty the glich repository, then my token comes out on github

#

what's going on

strong tundra
#

i'm currently in the middle of removing those scripts and using another sysinfo crate called heim

#

seems to be pretty nice

quartz kindle
#

apparently all it does is open the proc files in linux lol

strong tundra
#

lol

frosty swan
#

lol

quartz kindle
#

File::open(&format!("/proc/{}/statm", pid))

frosty swan
quartz kindle
#

also statm measures in pages not in bytes

strong tundra
#

interesting

#

i did not know that

#

is there a way to convert between?

frosty swan
quartz kindle
#

@strong tundra what does it show if you run pmap -x <pid> | grep total?

digital ibex
#

french

strong tundra
tight plinth
#

how many languages ​​should iadd
@frosty swan as many as you can. Ask people to translate for you if you want to add more languages

strong tundra
#

kinda weird

#

top puts the m suffix only on the top one

quartz kindle
#

your bot's pid is 1?

strong tundra
#

yeah

quartz kindle
#

interesting lol

strong tundra
#

this is in a docker container

quartz kindle
#

ah

#

on mine, the closest thing to memory usage as seen in top is the second value from pmap -x total

strong tundra
#

base image is alpine

#

ah

#

interesting

quartz kindle
strong tundra
#

i guess it is taking up 143mb ram then

#

huh

quartz kindle
#

first value should be virtual memory, which is simply a predefined value the process tells the OS to prepare for

#

the actual memory usage should be the resident set

strong tundra
#

ahh ok

#

so that would be 96mb i think

quartz kindle
#

apparently yes

#

although you have a 4th value and i dont

#

so idk whats up with that

strong tundra
#

hmm yeah

quartz kindle
#

i'd say your virtual memory is 147mb, and resident set would be either 96mb or 88mb

#

both of them would make sense

strong tundra
#

they would yeah

quartz kindle
#

30mb should be the shared memory

strong tundra
#

still not sure why my bot says 10.55mb though

#

hopefully it changes once i use heim and use it instead of bash

quartz kindle
#

here's what man pmap says

#

Kbytes: size of map in kilobytes
RSS: resident set size in kilobytes
Dirty: dirty pages (both shared and private) in kilobytes

strong tundra
#

hmm i see

quartz kindle
#

so i guess yours is splitting shared and private while mine isnt

strong tundra
#

oh that last one is swap btw

quartz kindle
#

oh

#

makes sense

strong tundra
#

yeah

quartz kindle
#

so i guess pmap -x | grep total would be a good way to measure it

strong tundra
#

seems like it

ancient sand
#

g

strong tundra
#

ok i switched to heim for my mem/cpu

#

seems reasonable

#

although idk how i have 19 guilds now instead of whatever i had earlier

quartz kindle
#

lmao

digital ibex
#

32 gig of ram for a bot in 19 servers. nice

strong tundra
#

what

#

i also have a plex server and someone else hosts multiple minecraft servers where this is hosted

#

lol

#

also i guess some people left and serenity didn't take it out of cache

#

idk

flat obsidian
#

What's the command for mute at dc.js

digital ibex
#

wym?

flat obsidian
#

I dont know the command for mute at dc.js

sudden geyser
#

what is dc.js

#

are you asking how to make a mute command

restive furnace
#

dc.js wont exists, if you mean discord.js use instead djs or d.js

tight plinth
#

I guess he means DisCord.JS

#

Which is djs

#

What's the command for mute at dc.js
@flat obsidian technically you can't mute with djs like you would ban or kick someone, you have to make a muted role and give it to the user you wanna mute

digital ibex
#

you dont have to make a role

flat obsidian
#

@sudden geyser yes

earnest phoenix
#

Hello, I have a private bot and I realized that it is on 5 servers, how do I get it to get out of those

#

I can do the same bot and put the token on the command line

#

: (

cinder patio
#

Do you have an eval command?

#

Also, make sure you make your bot private in the developer portal

earnest phoenix
#

are private

#

Do you have an eval command?
no

cinder patio
#

Then there's no way it's in 5 server if it's already private. If it's private then only you can invite it

sudden geyser
#
  1. Get the member the command caller wants to mute.
  2. Do some condition checking like if the author has permission to use the command or if they can mute the specified target.
  3. Check if a mute role already exists. If it does, use it. Else, handle it your own way (creating a new role or telling the author no mute role exists)
  4. Apply the mute role and tell the author the member has been muted.

Does it sound vague? That's because we can't just give you the answer. You'll need to attempt it first, or try looking at how other bots have implemented it and go from there as an example.

distant jewel
#

just iterate through the guilds and leave them @earnest phoenix

#

make a command and do it

earnest phoenix
distant jewel
#

what language are you writing it in

earnest phoenix
#

what language are you writing it in
@distant jewel node.js

#

the bopt is v12

flat obsidian
#
  1. Get the member the command caller wants to mute.
  2. Do some condition checking like if the author has permission to use the command or if they can mute the specified target.
  3. Check if a mute role already exists. If it does, use it. Else, handle it your own way (creating a new role or telling the author no mute role exists)
  4. Apply the mute role and tell the author the member has been muted.

Does it sound vague? That's because we can't just give you the answer. You'll need to attempt it first, or try looking at how other bots have implemented it and go from there as an example.
@sudden geyser ExcusemeWtf

clever tree
#

im updateing from discord.js v11.6.4 to 12.2.0.
Why is :

console.log(`${bot.guilds.map(guild => `> ` + `[${++guildindex}] - `.bold + `${guild.name}\n`.red.bold + `Members - ` + `${guild.memberCount}`.red.bold).join(`\n`)}`)

Not a function anymore xd

slender thistle
#

node.js is a runtime environment

#

not a library or a programming language

earnest phoenix
#

i using glich hello express sorry xd

sudden geyser
#

guilds.map was changed to a manager in v12

distant jewel
#

code a command that leaves all guilds

clever tree
#

@sudden geyser How could i rewrite that function with 12.2 ?

earnest phoenix
#

To get rid of the problems, I make another bot and put the token to the command line

distant jewel
#

huh

quartz kindle
#

@clever tree bot.guilds.cache.map

clever tree
#

@quartz kindle thx

dusty onyx
#

haii im looking for a solid way to run a background timer? i used start = time.time() while time.time() - start < 10: so that everything in the while loop happens until 10 seconds are hit, but it never hits 10 seconds for some reason, as i've left it for several minutes and its still inside the loop. any ideas?

distant jewel
#

What do you mean by background timer

#

You want to run some code every few seconds?

dusty onyx
#

a timer that occurs while my other code is being played out, not smth that stops everything like asyncio.sleep

slender thistle
#

asyncio.sleep isn't blocking

dusty onyx
#

and when the time limit is hit it pulls me out of that code

slender thistle
#

So you want to run stuff continuously for 10 seconds

dusty onyx
#

i believe so

jade jungle
#

Hello! I made my own command off of a daily reward command and i want to make the cooldown 10mins and it sort of works but you can do the command and get money however it doesnt give you a cooldown can someone help

File: https://sourceb.in/5068a95d52

distant jewel
#

And thats while your other code is still being run?

slender thistle
dusty onyx
#

the aim of my code is to ask a question, and check for the right answer for 10 secs

quartz kindle
#

@jade jungle you defined a timeout and did nothing with it

distant jewel
#

Why not have a timeout?

slender thistle
#

Hmm

jade jungle
#

@quartz kindle How would I fix this, i'm new XD

slender thistle
#

Maybe you could use client.wait_for?

dusty onyx
#

oh is that in the py api?

slender thistle
#

Mhm

#

Let me grab it from the docs

dusty onyx
#

ah im using that already

quartz kindle
#

@jade jungle there is no automatic way to create a cooldown, you have to code your own cooldown system, which isnt hard, but it requires a few lines of code and a bit of knowledge

dusty onyx
#

to check the msg

#

its the timer aspect im having issues with

quartz kindle
#

unless the code or framework you copied from already has a cooldown system built in

slender thistle
#

timeout=10? Think

distant jewel
#

That would reset / wrong answer tho

#

per*

jade jungle
#

@quartz kindle It has a cooldown but the cooldown isnt working

#

I'm not sure if its because it has .daily at the end or

dusty onyx
#

my full code is

#

`start = time.time()
while time.time() - start < 10:
while not secondphase_correct:
msg = await client.wait_for('message')
if msg.content == right_answer:
secondphase_correct = True
await message.channel.send(f"Uh huh. Well done!")

if not secondphase_correct:
    lives = lives - 1
    await message.channel.send(f"Uh oh! Took too long. {lives} lives left. ")
    if lives == 0:
        await game_over()
        return`
#

if that helps

slender thistle
#

no no no

dusty onyx
#

oop

slender thistle
#

You don't need a while loop if you use wait_for

#

Use the timeout kwarg

distant jewel
#

Wait for only takes one response

#

Aubee wants it so you can put as many answers as you want untill one is right, all in 10 seconds

dusty onyx
#

whats the timeout kwarg shivaco?

#

yea

slender thistle
#
        while not secondphase_correct:
            msg = await client.wait_for('message', timeout=10)``` ![catshrug](https://cdn.discordapp.com/emojis/704089211761983529.webp?size=128 "catshrug")
#

timeout (Optional[float]) – The number of seconds to wait before timing out and raising asyncio.TimeoutError.

dusty onyx
#

can you input multiple messages that arent correct in that time?

#

if so then thats perfect lol

distant jewel
#

Every time they get it wrong the timer resets tho

dusty onyx
#

oop

slender thistle
#

👀

#

I see

dusty onyx
#

also just discord wise how do you get the code in one grey block?

#

when sending it

distant jewel
#

```language
Code

dusty onyx
#

ha

#

ok ccool

distant jewel
#

Why don't you run a task

#

Wait nvm

slender thistle
#

I mean, not providing a timeout will basically make your code hang forever until the bot receives a message from somewhere

dusty onyx
#

no it should stop when the timer gets to 10

#

aaannnd we're back where we started

distant jewel
#

Wait_for is blocking

dusty onyx
#

no it should stop when the timer gets to 10
and move onto if not secondphase_correct: lives = lives - 1 await message.channel.send(f"Uh oh! Took too long. {lives} lives left. ") if lives == 0: await game_over() return

slender thistle
#

Make a global dictionary where the key is user ID and the value is a list (consisting of a boolean value (False by default) and time.time()). After sleeping for 10 seconds, see if correct answer was provided later in the code
In on_message, get ID from the dictionary and if ID is there, compare answers. If correct, edit bot.dictionary[user_id][0] to True

dusty onyx
#

ah,, problem

#

im not in on_message and the game im making is supposed to be very multiplayer, so it needs to allow up to 13 people to have an answer

#

i changed the code before sending it so people wouldnt think it was weird i wasnt using message.channel.send bc that wasnt the focus of my problem

slender thistle
#

You'll utilize on_message and get the message author's ID from the dictionary

#

unless I'm missing the part where multiplayer isn't possible following my logic?

dusty onyx
#

i took it that user ID meant a singular id from one player

slender thistle
#

well that's why I suggested a dictionary catshrug

dusty onyx
#

oh ok

#

ty for your help :)

torn ravine
#

does dispatcher.destroy exist (on v12). I’ve look through the docs

woeful pollen
#

Is it possible for my bot to delet webhooks it made? I can't find the command. I tried .delete but that just deleted the message and not the webhook itself.

distant jewel
#

What lib

balmy knoll
#

If I want to use the eval command to publish all messages that are sent to a specific channel, how can I do it in discord.py?

distant jewel
#

Use jishaku

#

It's a debuging extension

#

jishaku is a debugging and experimenting cog for Discord bots using discord.py@rewrite.
Note that this only works with Python 3.6+ and discord.py rewrite.
You can install it by running the following:

pip install -U jishaku
```or

pip install -U git+https://github.com/Gorialis/jishaku

To get the cog running, simply do

bot.load_extension('jishaku')

You can see the source code yourself here: <https://github.com/Gorialis/jishaku>
glossy elk
#

Why isn't this working? It gives an error if I disable dm but it doesn't return the message.

slender thistle
#

What's msg

glossy elk
#

oh F

coral stirrup
#

lol

glossy elk
#

Still, it doesn't work.

slender thistle
#

Are you trying to DM the message author

glossy elk
#

Yes.

slender thistle
#

message.channel doesn't seem to be the message author

glossy elk
#

Ohhhh

copper cradle
#

dude

glossy elk
#

no no

copper cradle
#

that try catch won't work unless the channel is locked for the bot

glossy elk
#

I forgot to send the author a message inside the try method

copper cradle
#

and that doesn't send the author a message

#

ah

twin marsh
glossy elk
#

F and still doesn't work brb..

#

Yeah alr i don't know.

#

Nvm got it

earnest phoenix
#

Sjsj

tulip ledge
restive furnace
#

code?

strong tundra
#

string.pop()

#

actually idk if pop works on strings

tulip ledge
#

Nevermind I fixed it

#

I have this other annoying issue now

#
            if(arsenal !== "none") {
                for (let i = 0; i < arsenalarr.length; i++) {
                    client.con.query(`SELECT * FROM items WHERE itemid = "${arsenalarr[i]}"`, (err, rows) => {
                        if(err) throw err;
                        if(rows.length < 1) return message.channel.send(`Something went wrong please DM ChickenDev or Tomito`)
                        console.log(rows[0].itemname)
                        if(arsenallist === "") {
                            arsenallist += rows[0].itemname;
                            console.log(arsenallist)
                        }
                        else {
                            arsenallist += `\n${rows[0].itemname}`;
                            console.log(arsenallist)
                        }
                    })
                    
                }
            }

The arsenallist stays at "" but logging the arsenallist it should be overwritten any idea why?

#

So the string is getting overwritten after the message is sent

#

Any idea how I let the for loop go first

#

And then send the message

copper cradle
#

to remove the comma just use a regexp

#

($,)

#

that should do it

#

@strong tundra yes, strings are arrays of characters

tulip ledge
#

Anyone pls help

balmy knoll
#

How can i fix this error AttributeError: 'Message' object has no attribute 'publish'? [discord.py]

modest maple
#

dont do message.publish

balmy knoll
#

@modest maple How can I do that?

modest maple
#

well what ever youre doing

#

dont do it

#

lol

balmy knoll
#

The bot has to post a message that's not his own.

tulip ledge
#

pls anyone help

flat obsidian
#

I cant Im noob

devout wagon
#

can't help without knowing the problem

pale vessel
#

scroll

earnest phoenix
#

sa

robust moth
pale vessel
#

not sure, because it's empty?

earnest phoenix
digital ibex
#

code?

earnest phoenix
#

code?
@digital ibex const { Client, Collection } = require("discord.js");
const { readdirSync } = require("fs");
const { join } = require("path");
const { TOKEN, PREFIX } = require("./config.json");

const client = new Client({ disableMentions: "everyone" });

client.login(TOKEN);
client.commands = new Collection();
client.prefix = PREFIX;
client.queue = new Map();

/**

  • Client Events
    */
    client.on("ready", () => {
    console.log(${client.user.username} ready!);
    client.user.setActivity(Music | ${PREFIX});
    });
    client.on("warn", (info) => console.log(info));
    client.on("error", console.error);

/**

  • Import all commands
    */
    const commandFiles = readdirSync(join(__dirname, "commands")).filter((file) => file.endsWith(".js"));
    for (const file of commandFiles) {
    const command = require(join(__dirname, "commands", ${file}));
    client.commands.set(command.name, command);
    }

client.on("message", async (message) => {
if (message.author.bot) return;
if (!message.guild) return;

if (message.content.startsWith(PREFIX)) {
const args = message.content.slice(PREFIX.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();

const command =
  client.commands.get(commandName) ||
  client.commands.find((cmd) => cmd.aliases && cmd.aliases.includes(commandName));

if (!command) return;

try {
  command.execute(message, args);
} catch (error) {
  console.error(error);
  message.reply("There was an error executing that command.").catch(console.error);
}

}
});

digital ibex
#

uh

earnest phoenix
#

wot

earnest phoenix
#

🤦

flat obsidian
#

Who have bot with mute command?

digital ibex
#

you can search on the website

stoic shell
#

Hello

#

I want to ask about bot getting online for 24 hours.

Can i get the step/tips ?

pale vessel
#

get a vps if you haven't already and use a process manager

#

make sure to handle errors

stoic shell
#

I'm using discord.js code, after copy paste to glitch or github & connected to monitoring web, the code not response

sudden geyser
#

do you know what the copypaste code does

stoic shell
#

What ? I want learning

woeful pollen
#

Is it possible for my bot to delete webhooks it made? I can't find the command. I tried .delete but that just deleted the message and not the webhook itself.

amber fractal
#

what lib

#

and it most likely will be delete, but you're doing it on a message

rigid maple
#

How to find the DBL Api ?

#

Pls ticket me

lost bluff
#

Could someone help me with something. I want to make an info-user command, but the problem is that I don't know how to make for someone else like !info-user @earnest phoenix else

#

I have this already

#
    if(msg.content.startsWith(prefix + "avatar")) {
        const user_mention = msg.mentions.users.first();
        const embed = new Discord.RichEmbed()
        .setColor("RANDOM")
        .setTitle(`Voici l'image de profil de ${user_mention.username}`)
        .setImage(user_mention.avatarURL)
    msg.channel.send(embed)
    } else {
        const embed = new Discord.RichEmbed()
        .setColor("RANDOM")
        .setTitle(`Voici l'image de profil de ${msg.author.username}`)
        .setImage(msg.author.avatarURL)
    msg.channel.send(embed)
    }```
summer torrent
misty sigil
#

bored

#

and looking for a challenge

#

any fun commands you think i'd be able to add to my bot?

#

please, ping me. Thanks

charred jetty
#

How can I get message.mentions.users.first() in v12?

summer torrent
#

same with v11

charred jetty
#

Not working

#

It's saying undefined

summer torrent
#

did you actually pinged someone?

charred jetty
#

Yes

summer torrent
#

can you show code

charred jetty
#

Wait

#

Lol.. there's another user

#

In that lel

#

I foggot that

summer torrent
charred jetty
#

And it's working when using eval command but..

#

Wtf.. now it's working... The same code.. but what was the fking problem...

wicked pivot
#
const moment = require('moment')
setInterval(function(){
    console.log(moment().format('HH:mm'))
    if(moment().format('HH:mm') === "00:19"){
        console.log("ok")
    }
}, 60000)```I would like to take action at a specific time.
torn ravine
#

can anyone help me with node-ytsr. sometimes it comes back blank

#

@earnest phoenix wrong channel

earnest phoenix
#

Is it possible to make it so anyone that has a name like nword in their username automatically gets banned? For discord.js?

copper cradle
#

@torn ravine same happens to me

#

what I do is that I just call the command again from within the command

#

until it's not blank

torn ravine
#

how would I do that?

copper cradle
#

recursion lmao

torn ravine
#

I was thinking I make an embed with the refresh emoji and when you click it, it refreshes the results

copper cradle
#

too much work

#

well not really

torn ravine
#

I have the pagination plugin

copper cradle
#

but I just do some recursion and checking

torn ravine
#

its not that much work

copper cradle
#

if it's empty then I do the job again

torn ravine
#

so awaiting won't work?

copper cradle
#

until it's not blank anymore

#

it depends

#

is use yt-search

#

it does not return a promise iirc

#

tho if for some reason it never goes from blank to having something you may get into a stack overflow

torn ravine
#

just incase

#

how would I recall the command

#

using an emojihandler

copper cradle
#

if your command is a function just call the function lmao

#

let's say

#

function veryCoolCommand() {
    veryCoolCommand()
}
#

it'll get called until it gets to a stack overflow

#

ofc you can make the call conditional

#

using an if statement

#

so if the data you need is stll blank then call the function

wicked pivot
#

mmmh Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info. Arguments: [0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: async() => { await console.log(moment()) debugger; }, _f: undefined, _strict: undefined, _locale: [object Object] Error

copper cradle
#

until it's not blank anymore

torn ravine
#

something like

#

if (videos.length === 0)

#

then do something aout it

copper cradle
#

just if (!videos.length)

#

0 is false

#

so if videos.length is 0 you can negate it and then it'll be the same as <Array>.length === 0

#

remember

#

0 is false and anything above and below is true

tranquil drum
#

Is there a way to send a DM to a user on a different shard with JDA?

#

Actually does anyone know if the latest version of JDA support opening DM channels for fake users?

#

Looking through the code it doesn't look like it throws IllegalStateException on fake users anymore

lime jungle
#

how do you get the user's badges in discord.js v12 ?

#

i tried looking at the docs: nothing

#

but it returns like a bitfield ?

#
UserFlags { bitfield: 64 }```
#

ah yes

#

thanks ^^

jade jungle
lime jungle
#

btw just found out how to do it

#

it returns someting like a number

#

^^

#

and btw with .toArray() you get the strings

#

it's easier i guess

torn ravine
#

how would I execute a statment that uses try again

fast trench
#

what would be giving me this on bot startup? (node:42536) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body content: Must be 2000 or fewer in length. at RequestHandler.execute (C:\wildcat\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (internal/process/task_queues.js:93:5) (node:42536) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)

sick cloud
#

@fast trench a message you're trying to send is >2000 chars

#

check ur code

fast trench
#

it's on start up...the only thing it every does on startup is console log that it's online

#

I stopped getting it...I am randomly having bot problems today and I don't have time for any of it 😅

fast trench
#

now it's not doing it wtf 😩 😂

fiery stream
#

Hey i have a question where do yall store data for rest api

#

In project or database if db what db you guys use?

earnest phoenix
#

you can't store in your project because that's memory

#

you have to use a database

#

i personally use pgsql for APIs

#

love working with it especially when doing REST

tranquil drum
#

Has anyone here done a migration from JDA v3 -> v4?

sudden geyser
tranquil drum
#

I've been using that

#

But they don't talk about .toJSONObject() on MessageEmbed

#

It looks like .toData() is what I'm looking for but I'm not sure about the full ramifications

hardy vector
#

im trying to use this welcome image api but its not working so well

#
client.on('guildMemberAdd', async member => {
    const channel = member.guild.channels.cache.find(ch => ch.name === 'welcome');
    let embed = new Discord.MessageEmbed()
    .setImage(`https://welcome-imgs.some-random-api.ml/img/4/sunset?type=join&username=${member.displayName}&discriminator=${member.user.discriminator}&guildName=Some%20random%20api&memberCount=71&avatar=${member.user.displayAvatarURL}&textcolor=white`)
    channel.send(embed)
})```
#
(node:19416) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.image.url: Not a well formed URL.
    at RequestHandler.execute (/Users/sadashivappakenchannavar/Desktop/dino/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:19416) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19416) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
cerulean hornet
hardy vector
#

flags is undefined

cerulean hornet
quartz kindle
#

no, whatever is before flags is undefined

cerulean hornet
#

I have the flags set: c

quartz kindle
#

what is line 41

#

userinfo.js

pale vessel
cerulean hornet
quartz kindle
#

are you sure member is a guildmember?

pale vessel
#

isn't it fetchFlags?

#

(a promise too)

cerulean hornet
#

are you sure member is a guildmember?
@quartz kindle yes

#

isn't it fetchFlags?
@pale vessel I don't know: c

quartz kindle
#

console.log(member)

pale vessel
#

read docs

#

there's no flags property for a user

#

you have to fetch it first by using user#fetchFlags()

cerulean hornet
#

as ?

quartz kindle
#

there is actually

#

but its not documented for some reason

#

@cerulean hornet did you console.log(member)?

cerulean hornet
#

not yet

quartz kindle
#

the error says "cannot read flags of undefined" which means member.user is undefined, which would only happen if member is not actually a guild member

#

exactly

#

your member is not a member, its a user

#

so doing member.user is the same as doing user.user

cerulean hornet
#

as ?

#

so how can I do it ?

quartz kindle
#

your member is not a member

#

its a user

#

member and user are two different things

cerulean hornet
quartz kindle
#

yes

#

mentions.users and message.author both return a User object, not a GuildMember object

cerulean hornet
#

how can I do now ?

quartz kindle
#

learn the difference between them

pale vessel
#

docs be like

quartz kindle
#

message.author = User
message.member = Member
mentions.users = User
mentions.members = Member
member.user = User

cerulean hornet
#

docs be like
@pale vessel don't talk about it there

quartz kindle
#

User = username, flags, avatar, etc...
Member = nickname, roles, etc...

earnest phoenix
#

@cerulean hornet learn the basics then?

cerulean hornet
#

@cerulean hornet learn the basics then?
@earnest phoenix the basics I know more I got lost in this command

earnest phoenix
#

??

cerulean hornet
#

I'm using a translator sometimes the translation goes wrong: c

earnest phoenix
#

K

quartz kindle
#

but did you understand now? Member and User are two different things

cerulean hornet
#

I'm using google translator, sometimes the translation goes wrong.*

#

but did you understand now? Member and User are two different things
@quartz kindle yes yes

quartz kindle
#

@hardy vector avatar URLs are functions in v12

#

for example displayAvatarURL({format:"png"})

hardy vector
#

now no errors are logged but now it sends an empty embed

#

with no image

quartz kindle
#

what does the api return?

#

if you open that url in a browser

earnest phoenix
#

logs with no errors, yankee with no brim

#

bad timing mb

hardy vector
#

how can i log the url

#

wait nvm

earnest phoenix
#

console.log

hardy vector
#

ik

#

i didnt think before i asked

#

thats why i said nvm lol

#

ok it logs this

#

and when i click on it the welcome card is ther

#

but uh the avatar isnt showing

#

idk why

earnest phoenix
#

Yh ik my message sent very slow

hardy vector
#

oh

#

ok

quartz kindle
#

@hardy vector it seems the api doesnt support webp

#

which is the default format

#

so you need to set format to png

hardy vector
#

oh

#

how do i do that

quartz kindle
#

i showed you how

hardy vector
#

oh yea

#

lol

#

now the url sends to a proper one and tha avatar shows up but in the embed it doesnt send

#

:/

quartz kindle
#

probably because it doesnt match an image extension

#

you'd need to add it as an attachment and rename it, or use a redirect that ends with .png

hardy vector
#

how do i do that

quartz kindle
#

embed.attachFiles({attachment:urlhere,name:"myimage.png"})
embed.setImage("attachment://myimage.png")

hardy vector
#

ok

sick cloud
#

so i have todays date stamp and a time stamp in the future (ie. 12 hours away)
how do i then convert the time stamp to text (ie. 12 hours away to "tomorrow at 12am")

earnest phoenix
#

how do i log people who vote for my bot

earnest phoenix
#

how would i webscrape a site that uses cloudflare

fiery stream
#

Await

#

I guess

indigo flax
#

so uh

#

i have a warning bot

#

and my friend helped code

#

he added thi

#

``/**

  • The permissions for posting porn images.
  • @type {string[]}
    */
    const permissionsPornImageBot = config.pornImageGroups;``
#

what does that do

ripe prairie
#

just off of that, all i see is a variable being assigned to something that i have no context on

prime glacier
#
    ^
Error: Cannot find module 'dotenv'```But i had added module's dotenv
ember atlas
#

You didn’t install it, that’s what the error is saying @prime glacier

sudden geyser
#

Can you show us your package json file

ember atlas
#

^

prime glacier
#

Can you show us your package json file
@sudden geyser yeah wait

sudden geyser
#

hm, did you reload the project/made sure the dependency is actually installed

prime glacier
#

hm, did you reload the project/made sure the dependency is actually installed
@sudden geyser dependency?

sudden geyser
#

A dependency like dotenv

prime glacier
#

refresh too many times

#

A dependency like dotenv
@sudden geyser ohk

copper cradle
#

@indigo flax isn't it self explanatory?

pale vessel
#

clean up your dependencies. remove fs (built-in), ytdl-core/ytdl-core-discord (depending on which one you actually use), etc.

reef mantle
#

@prime glacier

#

Bro

#

Anyone here?

earnest phoenix
copper cradle
#

@reef mantle what do you need help with

earnest phoenix
#

i am getting this error:


com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something broke when playing the track.
        at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:43) ~[lavaplayer-1.3.38.jar!/:na]
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:103) ~[lavaplayer-1.3.38.jar!/:na]
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:349) ~[lavaplayer-1.3.38.jar!/:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]```
The bot is able to join the voice channel but is not playing music... 
More error down side : (can not send it all at once)
#
        at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.lang.NullPointerException: null
        at java.base/java.net.URI$Parser.parse(URI.java:3104) ~[na:na]
        at java.base/java.net.URI.<init>(URI.java:600) ~[na:na]
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeTrackFormat.getUrl(YoutubeTrackFormat.java:66) ~[lavaplayer-1.3.38.jar!/:na]
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeSignatureCipherManager.resolveFormatUrl(YoutubeSignatureCipherManager.java:97) ~[lavaplayer-1.3.38.jar!/:na]
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.loadBestFormatWithUrl(YoutubeAudioTrack.java:87) ~[lavaplayer-1.3.38.jar!/:na]
        at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:42) ~[lavaplayer-1.3.38.jar!/:na]
        at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:91) ~[lavaplayer-1.3.38.jar!/:na]
        ... 4 common frames omitted```
#

My java version details :

OpenJDK Runtime Environment (build 11.0.6+10-post-Debian-1bpo91)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Debian-1bpo91, mixed mode, sharing)```
#

plz someone help me ._.

#

Problem is with Lavalink

#

update lavalink

#

Mhm...
u mean lavalink.jar file?

#

yeah, check if there are any new nightly releases

#

i downloaded the recent released version

#

3..... something

#

when

#

2 days ago

#

._.

#

o

#

so.. any idea what to do?

#

it's just lavalink breaking, failing to parse a yt video so uh no idea since you aren't at fault

#

hmm

#

ok thanks

green kestrel
#

@sick cloud for something like that loader gif, they use ANSI Escape sequences

#

ANSI escape sequences are a standard for in-band signaling to control the cursor location, color, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with Esc (ASCII character 27) and '[', are embedded into the text, whic...

sick cloud
#

cool

sullen night
#

Is there anyone who can help me? I have 2 bots on the site. I want to add the bot mention as command prefix. is that possible?

sick cloud
#

what lib

sullen night
sick cloud
#

can't help you sorry

#

someone else can prob

sullen night
#

how did you do on discord.js?

#

that might help also

sick cloud
#

the idea is basically to have an array/list of prefixes, including the mention

#

then check for it

sullen night
#

is the mention is like @brittle turret ?

sick cloud
#
const prefix = prefixesArray.find(p => msg.content.startsWith(p));
if (!prefix) return;

// code...```
#

yes

#

but you need to use one with <@! and one with just <@

sullen night
#

mistyped the !

#

bot are needed right?

sick cloud
#

yeah

sullen night
#

thanks a lot

sick cloud
#

<@ is for no nick and <@! is for nick

sullen night
#

cool

sick cloud
#

so if you only used the first if your bot had a nick it wouldn't work

#

and vice versa

sullen night
#

got it

#

for using an array, if do like just instead of 'prefix', i have to do ['prefix1', 'prefix2', 'prefix3', 'prefixn']

#

right?

#

-bots @sullen night

gilded plankBOT
sinful belfry
#

keep bot commands in testing channels pls

sick cloud
#

@sullen night yea

zenith citrus
#

good day, guys! please help me. I can’t find the formula for the progress bar. upon gaining experience, the bar begins to increase.
formula
let progress = (point / tolvl) * 100
I experimented and changed the value to a larger and a smaller one, but bar still the same..

haughty night
#

@zenith citrus As it seems that the bar isnt changing it seems like you never assigned that value to the bar, like .fillRect(450, 50, progress, 25);

#

Or the value never changed

lusty quest
#

any suggestions for getting stuff like flags on arguments? i have a command that takes as 1st a number then a string with mutiple words. i want to add something like --url URL text as a flag. (javascript)

golden condor
#

@lusty quest split it into an array at --url and get the second item

lusty quest
#

ye found it out already

golden condor
#

K

weary ridge
#

@earnest phoenix Same i was getting those errors with lavalink too!!! on discord.py i guess i will switch to ffmpeg, tho lavalink's quality IS SOOO GOOD

earnest phoenix
#

._.

#

i am currently using ffmpeg but these YT API quota exceeding is just... TRASH

#

i tried to submit form for exceed quota limit 3 times but everytime it says "try again later" blah blah...

#

so planned to switch to Lavalink

weary ridge
#

hmm

modest maple
#

lavalink wont help that lmao

weary ridge
#

i never have issues with yt's api

#

also Lavalink Limits you to 6

modest maple
#

instead of getting hit with the quota you just get hit with an IP ban

white anvil
#

@sick cloud all mentions use ! now afaik

earnest phoenix
#

well, imma try it once...
a few people suggested me to use it xd

weary ridge
#

UMM

#

This is a ping command @client.command() async def ping(ctx): await ctx.send(f'Your Ping Is {round(client.latency * 1000)}ms')

#

but it gives me client ping not users

#

what do i write instead of client

modest maple
#

nothing lol

#

You have to calculate the bot's message latency manually

weary ridge
#

ohhh

modest maple
#

thats just the WS latency atm

sick cloud
#

@white anvil yeah no

#

<@> indicates a user mention, <@!> indicates a user with a nickname mention

#

top is without, bottom is with

#

both typed out using \@mention

earnest phoenix
#

you should check for both with ! and without

#

platform inconsistency being the main reason

#

android, ios and desktop discord are never consistent and every single version does something differently lol

spare iron
#

When I used and voted

@commands.Cog.listener()
async def on_dbl_vote(self, data):
    print(data)

It won't get invoked..

#

Anyone tell why?

weary ridge
#

ummm help lol

modest maple
weary ridge
#

2

modest maple
#

client has no join_voice_channel function

spare iron
#

it has connect

#

i think

#

@weary ridge

modest maple
#

🤔

spare iron
#

await channel.connect()

twin marsh
#

How do I map from a json?:
Like
This
or better for me:
Like, This

mossy vine
#

what

twin marsh
#

How do I make my bot say the json file like this:
1, 2, 3, etc
Would be easy and google doesn't really want to help me out

slender thistle
#

What do those numbers represent?

#

Keys in JSON?

twin marsh
earnest phoenix
#

what does shards mean?

steel heath
#

@twin marsh well you just have to map it: js users.map(user => `**${user}**`)

wet iron
#

can someone help me?

spare iron
#

why this thing is not working

@commands.Cog.listener()
async def on_dbl_vote(self, data):
    print(data)
wet iron
#

I get an error

#

on glitch

#

and it wont load anything

#

wont load discord.js

#

nothing

#

and it says cannot find module

earnest phoenix
#
        if (args[0] == "clan" || args[0] == "Clan") {
            for (let i = 0; i < apply.clan.length; i++) {
                let embed = new RichEmbed()
                    .setColor("#f94343")
                    .setTitle(apply.clan[i])
                message.author.send(embed);
                const filter = m => m.content.includes('discord');
                const collector = message.channel.createMessageCollector(filter, { time: 30000, max: 1});
                collector.on('collect', m => {
                    applyInfo[i] = m.content;
                });
                console.log(applyInfo[i]);
            }
        }
#

help

#

it doesnt wait until there is a message collected

summer torrent
earnest phoenix
#

using discord.js v11

#

is nasty

#

richembed

#

ew

#

hi, i got a question (did read the FAQ but didn't saw anything about it)
i've been developpinga bot that has been recently accepted, however i'm still adding features, so i'm wondering if there's any new kind of approva i have to apply to when i update the bot's code or if it's once it's in, it's in

haughty night
#

Nope

#

If its in its in

#

Iirc

radiant estuary
#

includes this permission 2147483647 administrator

earnest phoenix
#

ooh wow

#

welp thank u

chrome garden
slender thistle
#

I highly doubt it is

chrome garden
#

hmm read it in a bot's script and it seems to be firing each time a cog is loaded, probably a custom event

#

¯_(ツ)_/¯

slender thistle
#

Mhm

#

Most likely a custom cog manager does that

chrome garden
#

I want to loop through my mute list, is there an efficient way to do this without using up too many resources?

slender thistle
#

Mute list, as in?

chrome garden
#

e.g. I make a custom mute command, stores user data such as id, mute_time.
Loop would fetch this mute list, and then check if current_time >= mute_time (unmute if necessary)

#

Just wondering if there is an efficient way to do this, or is it best to just leave it in a loop

slender thistle
#

Do you store the mutes in a global dictionary?

chrome garden
#

Uh it's stored in an external database and the bot fetches it through an API, but I plan to move it into a dict not linked to the API

#

But upon API call the data is thrown into a dict yes

slender thistle
#

What is the overall way of the data storage? Like, how do you store it?

chrome garden
#

At the moment it's working through an API since it works with a site.

slender thistle
#

I mean, in the dictionary, do you use server ID as the key to then store the muted users?

chrome garden
#

Nope, bot is isolated to 1 server only it's not a public bot.

#

So it would be something like,

{
  "user_id": {
    "mute_time": 293838
  },
  ...
}
slender thistle
#

Oh, I see

chrome garden
#

There's 2 loop methods I've read a few bots, some use asyncio and some use tasks.loop()

#

Not sure which I should use from the two

earnest phoenix
#

choose the one your prefer ig

chrome garden
#

So they both do the same thing then?

slender thistle
#

At the time of writing a similar system I haven't exactly cared much about performance. I used asyncio.sleep and stored mute time in database, which I then fetched from the database once again and created a background task per each mute

chrome garden
#

Oh I see

slender thistle
#

You could probably do the same

chrome garden
#

My one just loops through a muted_dict and works from there

faint osprey
#

That seems efficient, no?

chrome garden
#

My one?

faint osprey
#

Yeah what’s wrong with it

chrome garden
#

Nothing really just was wondering if there was a better way to do it, and if I should use tasks.loop or asyncio for it

faint osprey
#

I don’t know what those are but if you’re just looping through a dictionary i think you’re method is fine

chrome garden
#

Oh one more question, I saw some people make their Cogs based in folders, would I have to change the way my Bot loads Cogs then?