#development

1 messages ยท Page 1499 of 1

earnest phoenix
#

imma do like mee6

opal plank
#

then why....?

gusty quest
#

ok?

old cliff
#

Hes just showing what he coded in 38 secs

old latch
opal plank
earnest phoenix
#

๐Ÿ—ฟ Good luck on "becoming better than MEE6 i guess"

old cliff
#

I made a better bot than mee5 already

gusty quest
#

can anyone help me ๐Ÿ˜›

earnest phoenix
#

bruh

#

Which is something everyone can do

#

with what

old latch
gusty quest
#
embed.thumbnail.url: Not a well formed URL.``` my code: ```.setThumbnail(`https://vacefron.nl/api/ejected?name=${message.author.username}&impostor=true&crewmate=red`)```
cinder patio
#

Is this your alt @old cliff

gusty quest
#

this

old cliff
#

My alt is named Clyde

cinder patio
#

how did you know they coded this in 30 something seconds they literally only showed the code

old cliff
#

And its not in here

old latch
gusty quest
#

?

old latch
#

these are the docs ;)

gusty quest
#

ik how to set thumnail

old latch
#

ah

#

then?

earnest phoenix
#

The URL you provided as a parameter to that method is invalid

opal plank
#

its ebcause of the name

#

it probably has space

earnest phoenix
#

you need to URL encode the username as it might turn the URL invalid

#

^^

opal plank
#

you need to URIEnconde()

#

encodeURI()

gusty quest
#

oh okay

opal plank
#

to make it valid

earnest phoenix
#

encodeURIComponent

opal plank
#

same shit

#

you get the point

earnest phoenix
#

<Wait wtf is the difference again>

old cliff
#

Use canvas

earnest phoenix
#

What

opal plank
#

urs is technically the right one

#

but both should work just fine

pale vessel
#

no

gusty quest
opal plank
#

np

earnest phoenix
#

noice

#

URIEncode...

opal plank
earnest phoenix
opal plank
#

today we learned

earnest phoenix
#

๐Ÿ—ฟ

old cliff
#

Nothing

fossil canyon
#

i have problems with it! after o2auth auth i get in my url this data code=PSIfVb40fayRxIJGbLUnFeopE3c*** how to get identify from it?

earnest phoenix
digital ibex
#

hi, my dumb brain isnt working again for some reason

#

does anyone know why when i do await lost.createMessage(guild.logs.dashboard.channel, 'hi', { title: 'hi' }); nothing happens?

#

im an idiot nvm me

crimson vapor
#

don't strikethrough it if you actually need help

digital ibex
#

i dont need help anymore

crimson vapor
#

ok

fossil canyon
earnest phoenix
#

huh?

pale vessel
#

code stop works amandathink

fossil canyon
earnest phoenix
#

what is that language

#

oh my fucking god

#

you just copypasted it from the doc site

#

๐Ÿ™„

opal plank
#

did he paste python in js?

earnest phoenix
#

yes

#

also

opal plank
#

LMAO

earnest phoenix
quartz kindle
#

Lol

past needle
#

I can't find the rules that specifies that we can't make a command public containing a discord bot's server informations :O

#

i know we shouldn't do it but i don't find it :-:

earnest phoenix
#

shouldn't have expected anything from a person with a novaskins avatar

fossil canyon
#

and where i can find this code in js?

earnest phoenix
#

you don't

#

just implement it yourself

#

the example is there as a guideline to tell you what you're supposed to do

#

hence example

#

Can I give my bot Admin Permission?

#

Bot gives Missing Perms err when channel is private

#

Any views or suggestions?

solemn latch
#

handle errors properly

umbral zealot
#

If your bot hasn't been given rights to view a private channel, then it's not meant to see this channel.

#

You should probably just ignore channels the bot doesn't have perms to.

lusty quest
earnest phoenix
#

I already gave all required permissions

#

But when user makes a channel private and changes permission

#

Any how sometimes bot gives in one channel Missing Perm err but works fine in another channel

lusty quest
#

just handle the errors properly

#

if you dont have permissions ignore the channel

earnest phoenix
lusty quest
#

either role or Read/Write permissions

earnest phoenix
#

I used Embed in almost every command

earnest phoenix
solemn latch
#

handling errors isnt just handling after, its handling before as well.
You should be checking if you have send perms, embed perms and any other perms before doing it too.

earnest phoenix
solemn latch
#

you can check your own perms.

lusty quest
#

just check if you have read permissions and if you have write permissions (write is probably the one that errors out, without read you wont trigger any command)

solemn latch
#

which should be all you need

earnest phoenix
#

If channel doesn't has perms I dm user

solemn latch
#

you already expressed send messages isnt the only perm you use.

lusty quest
#

what if the user disabled DMs?

solemn latch
#

you also need embed links to send embeds(which you almost always do)

earnest phoenix
lusty quest
#

lol so probably after 1 day

earnest phoenix
#

I checked all perms even before executing commands. They work fine and give response too

#

But this channel permission is creating issue

gilded olive
#

Imo discord permissions are the worst to deal with

earnest phoenix
#

With Administrator Permission bot gives Zero e rr

solemn latch
#

not all users will give your bot admin

earnest phoenix
#

Hm

solemn latch
#

i remove admin on every bot i add to personal severs

#

since its uneeded

lusty quest
#

just require Admin permissions is like Using Java in a stupid way.

earnest phoenix
#

if this is your guild just take use of discord's view as role feature and view your guild with your bot's roles

#

you'll quickly find where you messed up permissions

#

I'll redesign command handler again. With Better permission handling.

gilded olive
#

should I include send_messages and read_messages in required permissions 5Head

lusty quest
#

there are people who will mess it up if you dont

solemn latch
#

just send message imo

gilded olive
#

Like @commands.bot_has_guild_permissions(send_messages=True, read_messages=True) but that may just be a waste

solemn latch
#

since you wont get the command if you dont have readmessage

earnest phoenix
#

^

lusty quest
#

one thing ive learned is, design your stuff that even a Donkey can use it. if you dont babysit every step someone somehow at some point will fuck it up.

gilded olive
#

Realized

fossil canyon
#

can someone translate code to js? i trying it and still not works! API_ENDPOINT = 'https://discord.com/api/v6'
CLIENT_ID = '332269999912132097'
CLIENT_SECRET = '937it3ow87i4ery69876wqire'
REDIRECT_URI = 'https://nicememe.website'

def exchange_code(code):
data = {
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'authorization_code',
'code': code,
'redirect_uri': REDIRECT_URI,
'scope': 'identify email connections'
}
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
r = requests.post('%s/oauth2/token' % API_ENDPOINT, data=data, headers=headers)
r.raise_for_status()
return r.json()

earnest phoenix
#

๐Ÿ˜‚

mellow kelp
earnest phoenix
#

lol

mellow kelp
#

that's just python

fossil canyon
#

i need it in js

umbral zealot
lusty quest
#

that looks like a mix of TS,JS and Py

umbral zealot
#

you were told what to use

earnest phoenix
#

they took the sample from the docs and want to directly translate it 1:1 instead of thinking and solving it themselves

fossil canyon
umbral zealot
#

it's passport with passport-discord for an express server

earnest phoenix
#

wait till they realize that python and node have completely different packages

solemn latch
#

believe it or not, different programming languages cant be "translated" like that.

lusty quest
#

wait until they try to run js stuff with py

earnest phoenix
#

it's actually quite possible

umbral zealot
#

Wait until they realise programming cannot be done by relying on copy/pasting for the entire time.

lusty quest
#

i know but not out of the box

earnest phoenix
#

Never solve queries of people who copy paste

mellow kelp
#

aight imma head out

earnest phoenix
#

lmfao

shrewd creek
#

is there a way to fetch the list of users using my bot??

mellow kelp
#

i think you need the guild members intent

shrewd creek
#

yea

lusty quest
#

just the amount of users or the user object?

shrewd creek
#

like all my bot users

#

what ever i can

umbral zealot
#

What do you need them for

#

specifically

shrewd creek
#

i thoght it woud be cool

umbral zealot
#

To just have a list of users? To do what with it?

opal plank
#

you just want a count?

shrewd creek
#

yea

opal plank
#

or an ACTUAL list of names?

#

if its just count you dont need intents

#

guild comes shipped with the memberCount with it

shrewd creek
#

yea

opal plank
#

so just run an aggregator function on all guilds

#

(idk which language you coding in)

shrewd creek
#

@bot.command(name='servername', help='only vissible to devs')
@commands.is_owner()
async def servers(ctx):
await ctx.send(bot.guilds)

umbral zealot
#

ckient.guilds.cache.reduce((acc, g) => acc + g.memberCount, 0);

#

Awww you're python

shrewd creek
#

i ran this it worked

umbral zealot
#

oh well

opal plank
#

it py

#

hmmm im not sure BUT

#

i think for is valid py syuntax

#

try this

placid iron
#

No

earnest phoenix
#

that isn't fetching

opal plank
#

async def servers(ctx):
users = 0;

placid iron
#

That is cache dependant

earnest phoenix
#

^

#

it also probably isn't very smart to cache every member of every guild

placid iron
#

sum([g.member_count for g in bot.guilds])

gilded olive
#

g.members

opal plank
#

async def servers(ctx):
users = 0;
for x in bot.guilds:
users = users + x.members
break

await ctx.send(users)

solemn latch
#

g.members is also cache

opal plank
#

that SHOULD work?

placid iron
#

@shrewd creek read what I said

solemn latch
#

sum is probably better

opal plank
#

actually

#

NO

placid iron
#

@opal plank that is also cache dependant and also members is a list

opal plank
#
async def servers(ctx):
   users = 0
 for x in bot.guilds:
   users = users + x.member_count
break

await ctx.send(users)
#

this i think is valid

placid iron
#

Also in python we have list comprehension which is pog

gilded olive
#

List comprehension is goated

placid iron
#

@opal plank I already gave the best answer

opal plank
#

or that

#

idk python though

#

๐Ÿคทโ€โ™‚๏ธ

placid iron
#

Why the break

#

Also indentation

opal plank
#

for works in break no?

placid iron
opal plank
#

yeah, just i wrote that by hand

#

not gonna bother typing indentation by hand, use ur IDE

#

another reason i hate py, indentation

shrewd creek
earnest phoenix
placid iron
#
@bot.commamd()
async def userCount(ctx):
    users = 0
    for g in bot.guilds:
        users = users + g.member_count

    await ctx.send(users)โ€Š```
#

@earnest phoenix bruhmoment

opal plank
#

wait, that actually worked?

mellow kelp
#

i think functools has a reduce method

gilded olive
#

Isnt that inside the for loop

earnest phoenix
#

Why are you sending inside loop lmao

gilded olive
#

Yea

mellow kelp
#

you could also use lambda with it

placid iron
#

@opal plank bruh

mellow kelp
#

ig

gilded olive
#

That would send a lot of times

opal plank
#

LMAO

#

i know python

placid iron
#

Lmao

gilded olive
#

Move it outisde the loop

opal plank
#

aparently

mellow kelp
#

ah yes

sudden geyser
#

Rovi's answer is probably the best

sum([g.member_count for g in bot.guilds])

placid iron
#

@earnest phoenix mobile moment

mellow kelp
#

learning python by solving python questions

opal plank
#

@slender thistle hahahaha git rekt scrub, i know python and heres the proof

solemn latch
#

when do your python classes start erwin, need a good teacher pogey

placid iron
#

Python has +=

#

Could've used that too

sudden geyser
#

at least we don't have ++

mellow kelp
#

wait python doesnt have ++?

earnest phoenix
#

No

sudden geyser
#

no

mellow kelp
#

o

opal plank
#

clearly im in a position to do it

placid iron
#

They Py lib not working tho

earnest phoenix
#

Why is there random break doe kekw

placid iron
#

@earnest phoenix I asked too lol

sudden geyser
#

Teal doesn't suit you Erwin

opal plank
#

doesnt break stop for loops statements?

placid iron
#

Yes

opal plank
#

for x in thing:
something
else
blac
multiple lines
break

gilded olive
placid iron
#

No

opal plank
#

that should be run one very iteration no?

placid iron
#

You use crash if you want to break out of it

#

Break

earnest phoenix
#

Else block would be executed if for doesn't break or return

placid iron
#

@shrewd creek no don't use that one

gilded olive
#

tho len(bot.users) would work fine christmaspop

opal plank
placid iron
#

sum([g.member_count for g in bot.guilds]) this literally works

#

@opal plank indentation

opal plank
#

ik

placid iron
opal plank
#

i explained before

stark abyss
#

is js break and py break different?

earnest phoenix
#

sum(g.member_count for g in bot.guilds)

opal plank
#

i NOT writing py indentation by hand

#

use your IDE for that

mellow kelp
#

pain

opal plank
#

surely py has some linter or some shit

earnest phoenix
#

Pep

opal plank
#

i hate forced indentation

earnest phoenix
#

Or flake

sudden geyser
#

break in Python and JS are the same.

gilded olive
#

pep8 PauseChamp

sudden geyser
#

But loops are a bit different in Python

mellow kelp
#

pycharm harasses you for separating two pieces of code with 1 line instead of 2 KEKW

placid iron
#

I mean after 5 years of python I just indent things correctly anyway

opal plank
#

im not writing indentation by hand

#

sorry to give it to you

placid iron
#

Lazy

opal plank
#

specially when i hate py

#

i DONT EVEN CODE IN PY FFS

placid iron
#

Don't code it then look

sudden geyser
#

You'll get used to indentation. You already indent all your code by 2-4 blocks

earnest phoenix
#

1 tab โŒ
4 spaces โœ…

placid iron
#

Lol

mellow kelp
#

angery

earnest phoenix
#

Kekw

placid iron
#

Space gang

earnest phoenix
#

Pain

sudden geyser
#

Magic ```py
for x in range(5):
print(f"x: {x}")
else:
print("Yeah")

mellow kelp
#

tabs gang

earnest phoenix
#

Wtf what?

placid iron
#

For else

sudden geyser
#

try running it

mellow kelp
#

hm yes

#

for/else loop

opal plank
#

big yikes, i'll go hide in my TS cozy troll cave while yall praising forced indentation

#

bye

stuck pike
#

My bot hitted 11000 members lol

sudden geyser
#

Indentation as a scope isn't that bad Erwin

stuck pike
#

Users*

opal plank
#

it is

#

its forced indentation

#

fuck that

sudden geyser
#

can you explain why it's bad

#

or is it just preference

placid iron
#

I don't praise it, it's just not bad. And it's a good thing to do anyway

shrewd creek
opal plank
#

it is PRECISELY becuase it doesnt give you preference

#

its FORCED

earnest phoenix
#

yo guys

#

i have a dumb question

opal plank
sudden geyser
#

What, do you write with mixed 2-3-4 indentation for every block? omegalul

placid iron
#

Dude, why you so mad

opal plank
#

thats the one thing i hate

sudden geyser
#

Forced is not always bad.

placid iron
#

You don't even code python

opal plank
#

i don thate python, i have indentation in python

earnest phoenix
#

i have something like this i want the link to only be on "click me" how can i do that

stuck pike
#

I m just checking and testing rn

sudden geyser
#

You could omit braces in all your JS code but you won't do that since it looks ugly

mellow kelp
#

@earnest phoenix lib?

earnest phoenix
#

ight

mellow kelp
#

thats the title

opal plank
#

actually

stuck pike
#

@earnest phoenix js orpy?

opal plank
#

yeah if its title its different

mellow kelp
#

for the title you have to set the embed url

placid iron
#

Title don't have

#

Markdown

opal plank
#

you need to set url

stuck pike
#

Yea

earnest phoenix
#

Ok

#

Hold on

opal plank
#

back to screeching

#

anyway

#

forced indentation

#

fuck that

earnest phoenix
stuck pike
#

Lawl

opal plank
#

if i dont want indentation, let me fucking run my code without indentation

earnest phoenix
#

(for the record that's not actually py)

mellow kelp
#

fibonacci indentation has joined the chat

stuck pike
#

I never used python rather than making a hello world

placid iron
#

I think you can have negative indentation in python lol

mellow kelp
#

whoa

placid iron
#

Not tried myself but I saw it somewhere

earnest phoenix
sudden geyser
#

x to doubt

opal plank
#

it doesnt give you the option

#

its always forced

#

how many spaces u use is up to you

mellow kelp
#

good luck minifying python

placid iron
#

jQuery trash tho

opal plank
#

but its the lack of option that i hate

sudden geyser
#

Erwin I assume you're joking so I don't think it's worth arguing

opal plank
#

im not

gilded olive
#

Then use a lamdba, but that isnt wise

#

Hold ip

opal plank
#

i dont like the way python indentation is forced

sudden geyser
#

oh well that's sad

gilded olive
#

Theres a one line bot made in py

opal plank
#

period

gilded olive
#

Brb

mellow kelp
#

lambda is cool tho

placid iron
#

Yeah

#

Lambda epic

mellow kelp
#

bad thing is i cant use multiple statements

placid iron
#

Wdym

gilded olive
#

Beautiful

mellow kelp
#

and vscode KEEPS CHANGING MY LAMBDA TO FUNCTIONS WHY

earnest phoenix
#

wait how would i put it in .setDescription?

placid iron
#

Bruh

earnest phoenix
#

i keep gettings errors

#

its annoying

restive furnace
earnest phoenix
#

I don't know what to say hashflushed

opal plank
#

see? i wanna write like that

#

fuck indentation

placid iron
#

That is python

opal plank
#

ik

placid iron
earnest phoenix
#

do you want to lambda and chill ๐Ÿ˜ณ ๐Ÿ‘‰ ๐Ÿ‘ˆ

#

read the docs for delete

shrewd creek
#

*bot.guilds gets me the name and no of ppl in all servers in which my bot is in

mellow kelp
#

delete doesn't take a number as parameter

opal plank
#

bot.guilds*

#

i think

earnest phoenix
#

Bot doesn't even have guild kekw

opal plank
#

actually

shrewd creek
#

so techinically bots.guilds.members should get me names ryt

earnest phoenix
#

Yes Erwin

opal plank
#

why the fuck am i even helping for py? i dont know py

earnest phoenix
opal plank
#

i should shut up when i dont know about something

fiery escarp
#

@earnest phoenix whatโ€™s the error lol

earnest phoenix
sudden geyser
#

that's not an error

placid iron
sudden geyser
#

that's some code

earnest phoenix
#

sec

#

PROBLEMS

#

a list object doesn't have members attribute

#

I MET

shrewd creek
earnest phoenix
runic lantern
earnest phoenix
#

What are you trying to do

#

ok gg

#

its fixed

#

im dumb

runic lantern
#

cool

shrewd creek
#

if thats somtin possble

fiery escarp
#

Youโ€™ll need the guild members intent for that if you donโ€™t have it turned on

earnest phoenix
#

[i.name for i in bot.get_all_members()]

#

Or [a.name for i in bot.guilds for a in i.members]

#

Kekw

placid iron
runic lantern
#

you need to have the timeout as {timeout: 5000} (i think, you'll have to check up on the docs)

earnest phoenix
#

that's still cache reliant, no?

placid iron
#

Yeah

earnest phoenix
placid iron
#

The only way to do what he wants is to first chunk all guilds and stuff like bruh. Why do you want to do this

earnest phoenix
#

have you tried reading the error

#

and what does the error say

#

Don't use get_all_members unless you need the guild object kekw

#

and why do you think that is

#

did you get it

#

lmfao

digital kiln
#

yes omg

shrewd creek
# placid iron Or [m.name for m in bot.users]

@bot.command(name='infoserver', help='only vissible to devs')
@commands.is_owner()
async def infoserver(ctx):
await ctx.send(bot.guilds)

how do i put it like this

sry if i am being annoying its my first bot

earnest phoenix
#

Kekw just send it literally

placid iron
#

ctx.bot tho

earnest phoenix
#

because send is a promise

#

bot is still defined I'm sure

#

you need to resolve it by either awaiting or using promise then pattern

placid iron
#

Yeah but I like ctx.bot more

gilded olive
placid iron
#

Feels secure and also makes it easier to copy paste to any command

gilded olive
#

thats what you want right

shrewd creek
#

@bot.command(name='infoserver', help='only vissible to devs')
@commands.is_owner()
async def infoserver(ctx):
await ctx.send [m.name for m in bot.users]

like this??

gilded olive
#

What

placid iron
#

You need brackets

earnest phoenix
#

Well that's indeed easier to port to cogs

gilded olive
#

([])

solemn latch
#

erwin we need you, theres a py question KEKW

placid iron
#

Also I'm sure that soon if not now, that will fail because the string representation will be over 2000 characters

gilded olive
#

Hence why you use jishaku

earnest phoenix
#

hastebin it mmLol

#

''.join(i.name for i in bot.users)[:2000] KEKW

placid iron
#

@gilded olive I just truncate my evals lol

earnest phoenix
#

i just throw big responses from eval in a hastebin and then send the link of the hastebin instead

#

Why use jishaku when you can paginate yourself weirdsip

placid iron
gilded olive
#

Everything at your fingertips from one line of code

pale vessel
earnest phoenix
#

because you put it in the title

mellow kelp
#

field titles can't have that

earnest phoenix
#

Or field name

#

how can i fix

shrewd creek
#

@earnest phoenix

earnest phoenix
#

users aren't in cache then

#

enable server members intent

#

that still won't get you all users

#

only the cached ones

gilded olive
#

are intents enbled in your code as well

#

intents = discord.Intents.default()

#

intents.members = True

#

and pass intents=intents into your bot constructor

shrewd creek
#

noe i nver used this lines of code

gilded olive
#

I see

earnest phoenix
#

@earnest phoenix how do i fix mine

#

Pass the hyperlink as field value instead

earnest phoenix
gilded olive
#

?

earnest phoenix
#

nothing

#

how

#

const Discord = require('discord.js')
const client = new Discord.Client()
const fs = require('fs')
const { prefix } = require('./config.json')

client.commands = new Discord.Collection()

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'))
for(const file of commandFiles)
{
const command = require(./commands/${file})

client.commands.set(command.name, command)

}
console.log('index.js ready!')

client.on('message', message => {
if(message.author.bot) return;
if(message.content.indexOf(prefix) !== 0) return;

const args = message.content.slice(prefix.length).trim().split(/ +/g)
const command = args.shift().toLocaleLowerCase()

if(command === 'kick')
{
    client.commands.get('kick').execute(message, args)
}

})

#

@earnest phoenix

#

I searching mods of my disc bot

#

Dm me

#

Pass it as second argument, the first could be zws or something

#

stop using short form pwease LOL

#

zws??

#

Hello help me Please I'm re-describing my bot to make it more welcoming and I use it <th></th>and I would jump odes line I know it's <hr>or <br>but when I try it doesn't work

#

Zero width space

#

ok

#

Who wants

#

:D

#

.-._.-.

#

.---_---.

lusty quest
#

if you would read the rules you would know self advertising is not allowed.

earnest phoenix
#

.________.

lusty quest
#

also recruiting

earnest phoenix
#

nobody cares about your shitty bot

#

Hmmm for my problem help me Please.-.

earnest phoenix
#

you want the table to enter a new line?

#

Ah.*.

gilded olive
#

cry too ruthless

earnest phoenix
#

Nan, I want to make a space I don't want it to be all sticky

#

add margins

#

Margins.-.

#

?

misty sigil
#

margin property in css

#

iirc

earnest phoenix
#

Ah okey thanks

misty sigil
#

Iโ€™m shit at css and even I know that

shrewd creek
#

sum([g.member_count for g in bot.guilds]) this works

[m.name for m in bot.users] but this dosnt it displays mine and the bots name

earnest phoenix
#

dude my stuff is not working

earnest phoenix
#

as to why they're different; member_count is a property returned by discord and does not rely on cache

misty sigil
#

users does

shrewd creek
#

oh

earnest phoenix
#

you have to do the comparison for every id

misty sigil
#

or else itโ€™s just if (comparison || true || true || true || true)

earnest phoenix
#

^, right now you're telling if channel id is this OR this string is valid OR this string is valid OR this string is valid OR ...

misty sigil
#

or you could make a custom function

earnest phoenix
#

another way is also chucking the ids into an array and then calling includes on the array

misty sigil
#

that does that ^

sterile lantern
#

let allowed = ['id 1', 'id 2']
if channel.id includes allowed etc

#

basically like dat

misty sigil
#

yea

sterile lantern
#

except it isnt real code kinda

misty sigil
#

wait wouldnโ€™t it be if allowed includes channel.id

sterile lantern
#

o

#

yea

earnest phoenix
#

uhm, what do i do if the token to my bot isn't regenerating?

sudden geyser
#

Are you regenerating the token from the Bot tab and not the client secret?

earnest phoenix
#

?

#

Hold up

sudden geyser
#

Developer Portal > My Applications > (Your Bot) > Bot > Token > Regenerate

earnest phoenix
#

thats what i did

#

It's not regenerating and both my bots are offline-

sudden geyser
#

When you hit the Regenerate button does it say "A new token was generated!" above.

earnest phoenix
#

Yes

pure lion
#

you need to put the new token into your bot's config

sudden geyser
#

and you're replacing the old token with the new one afterwards

earnest phoenix
#

I tried that, i tried it like 5 times it's still offline

pure lion
#

h

earnest phoenix
#

The token isn't regenerating ;-;

sudden geyser
#

I'd ask you to record a video of you regenerating the token, but they're meant to be private.

earnest phoenix
#

Yeah-

#

I also dk how to rec on laptp

#

laptop*

#

just look at the token

mellow kelp
#

its regenerating

earnest phoenix
#

it is?

mellow kelp
#

yeah

earnest phoenix
#

oh shit nvm

mellow kelp
#

look at the last letters

earnest phoenix
#

lemme try it again, with a diff one-

#

istmfg if it don't work i will cry

#

WHY DOES KAGANE HATE ME

dire obsidian
#

Hey ummm

#

Someone know about apache server?

eternal osprey
#

hey guys

#

i had some issues

umbral skiff
mellow kelp
#

discord rpc

#

there are some libs for that

umbral skiff
#

how?

drifting wedge
#

someone explain to me how the js fetch works?

cinder patio
#

It makes a HTTP request to a URL you provide

drifting wedge
#

and its async since the js is client side?

eternal osprey
#
 if (message.content.startsWith(prefix + "setprofile")){
      const args1 = message.content.slice(prefix.length).slice(4).trim().split(' ');
      const list = client.guilds.cache.get("734123033782124575"); //change this to your own server id. > right click your server inco > copy-id!
      fs.appendFileSync("./server.txt", member.user.username + " " + args2.join("\n")); 
      const exampleEmbed4 = new Discord.MessageEmbed()
      .setColor('RANDOM')
      .setAuthor('Server Moderator')
      .setFooter("Command created for your community!")
      .setDescription("The current server name: " + z)
      .setThumbnail("https://media.giphy.com/media/phJ6eMRFYI6CQ/giphy.gif")
      message.channel.send(exampleEmbed4);
      
     ```why is this returning: "member not defined".
drifting wedge
#

and how would i get the response

cinder patio
drifting wedge
#

o ok

earnest phoenix
#

Hello i need help with my bots

drifting wedge
#

like if the url responds/returns like a {code: 200} or a {code: whatever} i can get that?

earnest phoenix
#

is an radio bot 24h/24 and somes times he stop playing with this errors

cinder patio
#

of course you can

drifting wedge
#

no download file

#

pls

#

just hastebin it

earnest phoenix
#

okay

#

wait

drifting wedge
#

uhh how would i get it?

#

let resp = fetch()?

cinder patio
#
const res = await fetch("...");
res.status; // status code
res.json() // Promise which resolves into a JS object
drifting wedge
#

uhh how do i set the status? i would return it in a dict form?

#

like a {code: success} | {code: fail}

cinder patio
#

um... you make the request, you don't send the status

drifting wedge
#

the js makes the request with fetch

#

and the link/url

#

the url returns {code: ok} or {code: fail}

#

how do i get that?

#

or i can return it as the code too

#

like the actual status code

cinder patio
#

yeah look at the snippet I sent you

drifting wedge
#

mhm

#

alr ty

#

this gets the actual status?

cinder patio
#

If the response returns the JSON {code: ok}, you have to do

const json = await res.json();
json.ok```
drifting wedge
#

like the http code?

cinder patio
#

res.status gets the http code

drifting wedge
#

ok ty

cinder patio
#

Don't listen to more than 11 events of the same time... I think the error message is clear

earnest phoenix
#

how can i fix that ?

crimson vapor
#

it says

earnest phoenix
#

because i have already set max listeeners 99999

crimson vapor
#

increase the max

#

what are you listening to more than 11 times?

earnest phoenix
#

(i use shard)

cinder patio
#

why do you need more than 11 listeners

earnest phoenix
#

is a radio bot 24h/24

crimson vapor
#

yeah but what do you need so many listeners for?

earnest phoenix
#

with sharding system without problem without shard

crimson vapor
#

also how did you increase the max?

#

it should be Client.setMaxListeners()

earnest phoenix
#

i will see

#

you

#

wait

cinder patio
#

If you need more than 11 listeners you should rethink your implementation

earnest phoenix
#

in ShardResume

#

but @crimson vapor why without shard i don't have any pb

#

and with shard i need to increase the max listeners

crimson vapor
#

yikes

#

whats this

earnest phoenix
#

my shardresume event

cinder patio
earnest phoenix
#

and when a shardresume a setMaxListeners to 9999999999999

earnest phoenix
#

that for set the max listeners

crimson vapor
#
  1. move that above
#
  1. this is kinda shitty and a waste of memory
#

youre creating a new listener every what 10 seconds

#

thats a memory leak kinda

earnest phoenix
#

so how i need to do ?

crimson vapor
#

im not sure why your code is like this, so idk

#

but if you want to get rid of the error, move the ee.setMaxListeners(9999) just under const ee =

pale vessel
#

million no

cinder patio
#

You listen to the "error" event for every guild you have EVERY TIME A SHARD RESUMES. And you don't do anything inside the event

crimson vapor
#

that wouldn't work?

pale vessel
#

no you're supposed to tell them to not use setMaxListeners()

crimson vapor
#

then tell them to fix their code first

#

its all in a setInterval

earnest phoenix
#

yes it's all in a setinterval

crimson vapor
#

you're literally making a memory leak

cinder patio
#

he's creating the event emitter too... so the only one who can emit the event he's listening to is him

solemn leaf
#

Any way to make raw bytes into an image without creating the image

#

just sending to discord

earnest phoenix
#

...send the bytes

#

if i don't set the MaxListeners in the Interval can be good ?

solemn leaf
#

So like raw

earnest phoenix
#

if you're thinking of raw as in RAW the format

#

i don't think discord displays RAW

solemn leaf
#

"{'type': 'Buffer', 'data': [137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0

#

this is what I got rn

earnest phoenix
#

and that tells me absolutely nothing

shrewd creek
#

@bot.command(name='botusers', help='only vissible to devs')
@commands.is_owner()
async def botusers(ctx):
await ctx.send ([m.name for m in bot.users] )

we told you what's the issue
as to why they're different; member_count is a property returned by discord and does not rely on cache

isthere any work around to get the data??

solemn leaf
#

Can I turn image.data into a message

#

holding the image

earnest phoenix
#

what are you doing

eternal osprey
#

hey

solemn leaf
#

Im asking to turn the images bytes into an image I can send to discord without having to create it on hdd

eternal osprey
#
  if (message.content.startsWith(prefix + "setprofile")){
      let member = message.author
      const args2 = message.content.slice(prefix.length).slice(10).trim().split(' ');
      const list = client.guilds.cache.get("734123033782124575"); //change this to your own server id. > right click your server inco > copy-id!
      fs.appendFileSync("./members.txt", message.author.username + " " + args2 + "\n"); 
    
      message.channel.send("**Your profile has been set!**");
      
     
      ```
pale vessel
#

Upload the buffer

eternal osprey
#

why is my args showing , after each word

pale vessel
#

because you aren't joining it

eternal osprey
#

so .join("")

pale vessel
#

so it turns into array.toString()

#

.join(" ") i guess

earnest phoenix
solemn leaf
#

I tried to send image.buffer

pale vessel
#

Wait, you're splitting and joining it back

eternal osprey
pale vessel
#

Just remove .split(' ');

eternal osprey
#

i didn't even see that

#

thanks

pale vessel
cinder patio
earnest phoenix
#

The fires at them @pale vessel

#

Fries*

solemn leaf
#

message.channel.send({files: [image.Buffer]});

cinder patio
#

and, did you get any errors

solemn leaf
#

Cannot read property 'pipe' of undefined

cinder patio
#

and image.Buffer is "{'type': 'Buffer', 'data': [137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0 ...

solemn leaf
#

<Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 03 20 00 00 02 58 08 06 00 00 00 9a 76 82 70 00 00 00 01 73 52 47 42 00 ae ce 1c e9 00 00 20 00 ... 25443 more bytes>

#

that is image

cinder patio
#

so image is a Buffer object?

solemn leaf
#

wait

#

no

earnest phoenix
solemn leaf
#

image prints image is the buffer

cinder patio
solemn leaf
#

image is the buffer

#

lol

earnest phoenix
solemn leaf
#

image.Buffer isnt a thing

cinder patio
#

try message.channel.send({files: [image]});

solemn leaf
#

I did

#

it sent it

#

thanks

eternal osprey
#
if (message.content.startsWith(prefix + "profile")){
      allItems = fs
      .readFileSync("./members.txt", "utf8")
      .split("\n")
      .map((x) => x.split(/ +/));
      console.log(allItems)
        let filtered = allItems.filter((x) => x[0] === message.author.username);
        let final = filtered.map((x) => x[1]).join("\n");
      const exampleEmbed4 = new Discord.MessageEmbed()
      .setColor('RANDOM')
      .setAuthor('Server Moderator')
      .setFooter("Command created for your community!")
      .setDescription("**Your set user description: **" + final)
      .setThumbnail("https://media.giphy.com/media/phJ6eMRFYI6CQ/giphy.gif")
      message.channel.send(exampleEmbed4);
      ```one  quick question. As you see this command would get the first item in the array, but what if someone inputs a whole sentence?
#

how would i actually take all the arrays of that user

heavy anchor
earnest phoenix
#

how ?

eternal osprey
heavy anchor
earnest phoenix
#

@heavy anchor thx

eternal osprey
heavy anchor
#

Idk Iโ€™ve known it an RPC

cinder patio
#

use join

eternal osprey
#
let final = filtered.map((x) => x).join("\n");```
#

already joinin it

opal plank
#

huh

earnest phoenix
#

RPC is not rich presence

opal plank
#

why you mapping it?

eternal osprey
#
 if (message.content.startsWith(prefix + "profile")){
      allItems = fs
      .readFileSync("./members.txt", "utf8")
      .split("\n")
      .map((x) => x.split(/ +/));
      console.log(allItems)
        let filtered = allItems.filter((x) => x[0] === message.author.username);
        let final = filtered.map((x) => x[1]).join("\n");
      const exampleEmbed4 = new Discord.MessageEmbed()
      .setColor('RANDOM')
      .setAuthor('Server Moderator')
      .setFooter("Command created for your community!")
      .setDescription("**Your set user description: **" + final)
      .setThumbnail("https://media.giphy.com/media/phJ6eMRFYI6CQ/giphy.gif")
      message.channel.send(exampleEmbed4);
      ```
earnest phoenix
#

RPC is an old deprecated communication protocol discord used for games back in 2017

eternal osprey
#

i am mapping it to actually control what is set by which user

opal plank
#

no, THAT has a reason

#

this doesnt

#

map(x => x) makes no sense

eternal osprey
#

I know i had deleted it accidentally

opal plank
#

it returns the same thing

eternal osprey
#

i know

#

you basically have the same output

opal plank
#

cxorrect

earnest phoenix
#

yes

#

game SDK

eternal osprey
#

anyways, the x[1] returns the first array outside of the member.username

opal plank
#

thats why i mentioned

eternal osprey
#

how do i take all the arrays?

#

if applicable

heavy anchor
#

Ah well thatโ€™s the package I used to make one a while back but maybe itโ€™s changed since I made one.

eternal osprey
opal plank
#

idkd if RPC is decomissioned or deprecated

#

it might work but it might not be a good idea to use that

#

@earnest phoenix read what me and cry sent in chat,

eternal osprey
opal plank
#

i do not, you'd have to check with the ddevs server

eternal osprey
opal plank
#

discord developers

earnest phoenix
opal plank
#

if you want to use it, its better to check on the Game SDK

#

not RPC, since it might not work anymore

earnest phoenix
#

ok

#

i need to Download it right

#

1.3 Go damn what

opal plank
#

did you... read what i sent....?

undone rose
#

Anybody here know why my bots are staying up and reconnecting successfully for a day or two before running into this error and staying offline?
Are you guys like, just not handling the 'connection reset by peer' error and letting pm2 restart your bots or something
Just wondering what other people here are doing bc I'm on latest eris ver and it happens on all my bots on all hardware, Windows and Ubuntu https://cdn.tanners.space/rLt3

#

Is it finally time to move back to discord.js or something

dusky marsh
#

Just use pm2 like u said to restart the process

#

it should do it by default

crimson vapor
undone rose
undone rose
#

It was the return in the for loop and then there was another bug later in the code

crimson vapor
#

oh

#

lol

undone rose
#

yeeee we're just doing stability testing now bc this keeps happening

crimson vapor
#

eris

#

ive never used eris

earnest phoenix
#

data vl = require('vl')
data conf = require('conf')

vl.args('info(require'v')') {
then do {
v(=)c
};
} else {
conf.new('info')
}

data confirm = confirm(action)

execute.vl('type' => ".exe")

#

making adiscord bot

undone rose
#

I only use it bc d.js was p crap for large bots 3-4 years ago

earnest phoenix
#

with my programming languager

undone rose
#

but I'm wondering now if it's losing it's base/support

crimson vapor
#

maybe

dusky marsh
crimson vapor
#

djs is still shit with memory managment

dusky marsh
#

after it errors

crimson vapor
#

caching everything

undone rose
#

until it doesn't

#

so I have to end up restarting manually

dusky marsh
#

hm

undone rose
#

My code is p simple if you want to look at it

#

It's a small bot

crimson vapor
#

json db

#

ytho

#

lol

dusky marsh
#

this doesnt really sound like a code problem unless ur logging in too many times and getting ur token reset or something

crimson vapor
#

its Eris

dusky marsh
#

oh, idk Eris, it could be a lib error then but /shrug

undone rose
#

json db is fine for this because it's only holding info for a single guild

#

and it won't be holding a lot

crimson vapor
#

ok

undone rose
#

yeye, that shareX thingo I made also uses it

#

haven't had an issue w it yet and it's db is much larger

#

I only use it for these small and portable things

crimson vapor
#

yeah I understand

undone rose
#

lmao

dusky marsh
#

i wonder if json transaction speeds are considerably slower than sqlite queries to argue against even that haha

#

lmao

#

crude errors require crude solutions

undone rose
#

lol maybe but it's fine, I mostly started using the json db because 1. the code is braindead simple, and 2. you don't have to install anything or run any kind of database server. Just npm install lowdb and it works ez as that. Having it has made doing the support for my ShareX software really easy bc literally nobody has an issue with configuring the database or it failing on them

earnest phoenix
#

data vl = require('vl')
data conf = require('conf')

vl.args('info(require'v')') {
then do {
v(=)c
};
} else {
conf.new('info')
}

data confirm = confirm(action)

execute.vl('type' => ".exe")
if(vl-execute < vl-stop) create New folder(
folder.name = log.txt: write{
'log'
} else {
log.destroy()=vl
} then[stop]
);
const start = 'ยฟ'

start.vl() => else {
write(vl) or {
on(vl) => do('x');
}
}

conf.login{
token(
"your token"
);
};
command('npm vl') return;<else>
x=command{
type=x
};stop<wait;

#

doing a discord bot with your language moment

#

OMFG

#

THE BOT STARTS

#

:O

terse silo
#

hello how can i know if my bot is added?

slender thistle
opal plank
#

yo

earnest phoenix
#

nice

opal plank
#

have i shown u the graphs?

slender thistle
#

nein, what graphs?

opal plank
#

dms

jolly heath
#

What does botCallbackURL mean

ionic dawn
jolly heath
ionic dawn
#

earlier this morning a user said they weren't

restive furnace
#

they are IIRC

earnest phoenix
#

they are

#

why wouldnt they be lmfao

#

unless your source is a discord employee/discord themselves/proficient user

#

they're probably bullshitting

opal plank
#

i sure hope its fine cuz one of my bots does just that

#

out off a 31k pool of emotes

boreal pewter
#

can anyone real quick give me the fastest easiest way to report number of servers for discord.py

earnest phoenix
#

who's the owner of this server. I can't remember
I just collect the emotes

#

I love emotes

#

I'm an emote hunter

sudden geyser
jolly heath
earnest phoenix
#

english only

boreal pewter
#

i mean if there is a ready made smtin to send it to top.gg

earnest phoenix
hasty mulch
earnest phoenix
#

import?

boreal pewter
earnest phoenix
#

you need an instance of a TextChannel

#

then you can call that

hasty mulch
earnest phoenix
#

so... just call that method on it

hasty mulch
#

I already am though?

earnest phoenix
#

??????????????????????

sudden geyser
#

Then why do you want to import it

hasty mulch
#

Cause I had to download it when I downloaded d.py

earnest phoenix
#

wh a t

sudden geyser
#

That doesn't make sense.

hasty mulch
#

Thatโ€™s what I saw with other people

#

Then again, I havenโ€™t seen those people in the d.py server for a while...

sudden geyser
#

That's just confusing. What I assume you want to do is call .trigger_typing() on a TextChannel instance.

#

Yet you say you are.

#

So what's the issue here.

#

Download doesn't make sense in this context.

drifting wedge
#

is there any big issues here? ```js
function edit_bio() {
let bio = document.getElementById("bio").value;
let id = document.getElementById("id2").value;
let edit = fetch(https://domain.com/api/profile/edit/${bio}/${id}/);

let resp = edit.status;

if (resp === 200) {
    document.getElementById("status").innerHTML = "Worked"
}

if (resp === 401) {
    document.getElementById("status").innerHTML = "Nope"
}

}```

#
@app.route("/api/profile/edit/<bio>/<id>/")
@requires_authorization
def api_profile_edit(bio, id):
    user = discord.fetch_user()
    if user.id == id:
        collection5.update_one({"_id": id}, {"$set":{"bio":bio}}, upsert=True)
        return("200 - ok", 200)
    else:
        return("401 - unauthorized", 401)```
sudden geyser
#

You forgot to await fetch

drifting wedge
#

oh

#

lemme add that

#

sry lmao new to js here

#

how does await work?

#

wat does it do?

sudden geyser
#

You await a Promise. fetch(...) return a Promise. So, await fetch(...). The function you're using it in must be an async function as well.

See https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await

drifting wedge
#

uhh i have a question right

#

this is the "route"

#
@app.route("/api/profile/edit/<bio>/<id>/")
@requires_authorization
def api_profile_edit(bio, id):
    user = discord.fetch_user()
    if user.id == id:
        collection5.update_one({"_id": id}, {"$set":{"bio":bio}}, upsert=True)
        return("200 - ok", 200)
    else:
        return("401 - unauthorized", 401)```
#

it requires auth

#

the user in the page is already authed

#

but is the fetch basically the same as the user?

#

cuz its not working

silver lintel
#

How do i generate a server invite link to a server in DJs?

peak cosmos
errant perch
#

how do i convert .json to quick.db

misty sigil
#

you dont

errant perch
#

k

earnest phoenix
#

grab all values from your json file, transfer them to quickdb

#

in your code

earnest phoenix
#

discord sends it whenever it feels like it

stark abyss
#

me knowing that I will never get the cool dev badge again PepeCryHands

peak cosmos
#

@earnest phoenix what do you mean

earnest phoenix
#

...exactly what i said

#

you're not granted to receive a member object in the reaction add/remove payloads

peak cosmos
#

so how do i change it so i can

earnest phoenix
#

in fact, reaction remove payload does not send a member object at all, only ids

peak cosmos
earnest phoenix
#

idk i don't do python nor do i understand your code architechture

peak cosmos
#

is there a place where i can learn a better way of doing it

halcyon kite
#

Hi

errant perch
#
let prefixes = JSON.parse(fs.readFileSync("./data/guildConf.json", "utf8"));
var prefixkeys = Object.keys(prefixes)

for (var i = 0; i < prefixkeys.length; i++) {
  var keyed = prefixkeys[i]
  var pfx = prefixes[keyed].prefix
  console.log(pfx)
  db.set(`prefix_${keyed}`, pfx)
}``` this seemed to work well. hopefully this will help someone else
halcyon kite
#

Wut it do lol

errant perch
#

convert json to quick.db

halcyon kite
#

Ok

peak cosmos
earnest phoenix
#

the way you're doing it right now, at least to me, seems correct

#

it's just that you're not granted to receive a member object

#

try fetching the member instead, if there's a guild id present

peak cosmos
#

@earnest phoenix so in the guild = payload.guild_id i change that bit

#

what would i change it to though

earnest phoenix
#

Use get_guild method, then fetch the member

#

Or get it from the cache first actually

peak cosmos
#

i'm new to this so i wouldn't know how to

earnest phoenix
#

You already got the guild object, even though it's pretty redundant by using discord.utils.find, you can get the member using guild.get_member(id), the id is from the payload

peak cosmos
earnest phoenix
#

The issue is in remove one tbh

peak cosmos
#

?

#

remove one

earnest phoenix
#

on_raw_remove

peak cosmos
earnest phoenix
#

Well, I've told you what to do, so

peak cosmos
#

i dont understand :/ tho

earnest phoenix
#

Are you new to python

peak cosmos
#

this sort of python yes

#

i mean i say this sort i havent used python in years

earnest phoenix
#

Told ya the problem isn't in the add one, but in the remove one

peak cosmos
#

i did the same to that one tho

earnest phoenix
#

id isn't defined, use the one from the payload

#

Have you taken a look at the link I sent

#

Well id is defined, but it's built-in function

solemn leaf
#

Im using a npm called youtube-dl Im playing the video as it downloads I think and the video will randomly stop playing before the video is over can I get some help

connection.play(youtubedl(v.url, ['-x', '--audio-format', 'mp3'])).on("finish", function () {
   connection.disconnect();
})
peak cosmos
haughty vortex
summer torrent
twin pendant
#

why should i not use json as a database

sudden geyser
#

No readme file, -5 points.

#

Using JavaScript, -5 points

haughty vortex
#

I'm not planning on having a readme for a while

#

not until it's pretty stable

#

also, I like JS because it's easy to make DI-friendly stuff in

sudden geyser
#

the js part was a joke

haughty vortex
#

I know it was a joke

#

but I'm never too careful about it

earnest phoenix
#

js doesn't follow DI at all

haughty vortex
#

anyway, the main discord client is at src/lib/services/discord-service.js, with the command handler being at src/lib/services/command-service.js and a test command being at src/lib/services/test-command-service.js

haughty vortex
earnest phoenix
#

i mean sure, i do it in my project too

haughty vortex
#

I don't think that there's any languages that have DI as a forerunner

earnest phoenix
#

but the implementation is the same across a variety of languages

haughty vortex
#

it's similar yea

#

c# is not built for DI

#

.NET is built for DI

earnest phoenix
#

huh

haughty vortex
#

the .NET framework was built with DI in mind, C# is just a language

sudden geyser
#

What is DI anyway

haughty vortex
#

dependency injection