#development

1 messages · Page 654 of 1

earnest phoenix
#

^

#

It requires manual fetch if you'd ever want to use an user or member though

quartz kindle
#

what would be the simplest way to do that, aside from regular sweeping? since it doesnt offer a client option for that

earnest phoenix
#

I run a task that clears emoji, guildMember, user, channel, messages, presences (these eat SO MUCH) every 10 minutes

#

Its so good

#

I just delete the entire collections

#

Deletes everything that eats memory

#

You gotta have ur own task system to make it run though

quartz kindle
#

interesting, thanks for that

earnest phoenix
#

Np

#

It brings down memory to like 20-50mb depending on the amount your bot constantly caches

sinful lotus
#

actually on d.js master

#

its easy

#

just enable partials

#

then you can actually not cache users and members

#

¯_(ツ)_/¯

#

just do a fetch on your events if you work with those then voila

#

d.js also provide a way to do that
if (message.member.partial) await message.member.fetch()

quartz kindle
#

yes, but it doesnt have an option to automatically prevent caching in the first place, does it?

#

you can disable message caching, but not user/member/other

sinful lotus
#

oh if you want to prevent cache

#

you need to do it yourself unfortunately

quartz kindle
#

yes, that is what we are discussing, so the only thing we can do is regular sweeping

sinful lotus
#

the partials just enables us to do it easier to recache those things

#

actually I have a technique myself so that I dont need to loop on those although I don't really uncache my members

earnest phoenix
#

Im on master and i only need the cache (members/users) like once a day :/

#

Useless to store 190k users for only 5 to be used on one day

#

Lmao

sinful lotus
#

in 2 days uptime my bot only eats around 6.5gb at 2 mil user and member caches

earnest phoenix
#

In 2 days uptime my bot crashes because it reaches memory limit

#

3gb on 190k users

sinful lotus
#

its not just members and user cache you are caching on d.js

earnest phoenix
#

Where presences of the users are eating up half of it

#

Ye but users are the most eating

sinful lotus
#

in my experience d.js cache "tons" of things

earnest phoenix
#

Like holy shit

sinful lotus
#

when I say tons yes tons of it

quartz kindle
#

if you disable presence websocket events, does it prevent them to be cached as well?

earnest phoenix
#

I used heapdumps from 5s uptime vs 2 day

sinful lotus
#

I dont think so, you need to modify the lib to prevent it to cache the presence at the first place

earnest phoenix
#

And users was 79% of everything in the heapdump

sinful lotus
#

which I do

#

My d.js is forked to prevent the FF

  • Emoji Caches
  • Presence Caches
  • Message Edit cache is always 1 only
earnest phoenix
#

Hmm

sinful lotus
#

by default message edit cache is unlimited

earnest phoenix
#

I really HAVE

#

TO GET RID

sinful lotus
#

imagine editing the same message for 100 times

earnest phoenix
#

OF THE PRESENCE CACHING

sinful lotus
#

means the edit cache has 100 times message in it

#

and thats not limited tbh

quartz kindle
#

where is that cache even stored?

sinful lotus
#

message._edits

quartz kindle
#

jeez

sinful lotus
#

it can go up to 200

#

try doing experiments yourself

earnest phoenix
#

But is there a way to not sweep them, just never cache them UNLESS you ask them and get rid after

sinful lotus
#

edits or precense?

earnest phoenix
#

Like something in my bot needs presences, but thats the only thing

#

In the entire bot

#

That uses those presences

sinful lotus
#

just fork the library on where it store the presence

earnest phoenix
#

And its only when a guildmember executes that thing

sinful lotus
#

like just remove the .set() part

earnest phoenix
#

And only the guild's members presences get used

quartz kindle
#

can you extend/overwrite some classes during runtime instead of modifying the lib files?

earnest phoenix
#

but how do you fetch the presences when you need it?

sinful lotus
#

there is, Structures.extend but thats so limited

#

it doesnt allow you to change how d.js cache

#

you can just change the data cached

#

not how it caches

#

what we want is on how it caches

#

not the data cached

quartz kindle
#

cant you replace the entire extension with your own clone lul

earnest phoenix
#

Is there a way to ask the API for presences when i need them

sinful lotus
#

yes but you are replacing the "data cached"

earnest phoenix
#

If not then im stuck with auto caching of all presences..

sinful lotus
#

not where it is being set

#

thats why I run my fork and just maintain it on par with d.js master

quartz kindle
#

i see

sinful lotus
#

Structures.extend is good in something like, modifying the original message cache

#

to add your things

#

it doesnt let you modify the stores

earnest phoenix
#

Sigh im being ignored

sinful lotus
#

^I saiid you can avoid it being .set() at the first place

earnest phoenix
#

But i need the cache sometimes

#

I asked like 5 times now

#

How do you fetch them

#

When i need them

#

And theyre not cached

sinful lotus
earnest phoenix
#

So you cant ever get a user's presence if its not in the cache?

#

What the fuck is this bs

sinful lotus
#

if discord sends their presence update they will be on cache again

earnest phoenix
#

Caching 190k presences kills my bot

#

Literally

#

It uses so much memory

sinful lotus
#

What do you use presence for first?

#

there are a lot of alternatives

#

depends on what you want

earnest phoenix
#

Guild member info

sinful lotus
#

online offline playing?

earnest phoenix
#

Yep

#

And for the "mobile" or "pc" activities

sinful lotus
#

If thats the case you need to cache the presence

#

just uncache members and users to reduce ram

earnest phoenix
#

So i can format commands based on device they use

sinful lotus
#

but if I were you I would just drop presence cause its just horrible in ram

earnest phoenix
#

But im using a sweep that uncaches everything

sinful lotus
#

2 mil presence eats 2 - 4gb of ram

earnest phoenix
#

It works but i cant seem to get any of the deleted cached things back when they are gone

sinful lotus
#

before I use presence for what you are doing and Im at 10gb at 1.5mil

#

user and member caches

#

but now Im sitting at 6gb

earnest phoenix
#

Like when i fetch an user from the API it doesnt return activity

sinful lotus
#

thats almost 4gb of savings

#

presence is on more on WS I believe so

#

Discord will be sending presence when a user presence got changed or something like that

#

if you are insistent on keeping your presence

#

then you need to do a major overhaul on presence store

earnest phoenix
#

So i guess i should get rid of online, dnd statusses in my commands?

sinful lotus
#

in my opinion, that would be a better choice

#

but if you dont want

earnest phoenix
#

Meh

sinful lotus
#

as I said forking the presence store is the better solution

earnest phoenix
#

If it saves memory, i should then

sinful lotus
#

save them all in db

#

but what I cant tell about that is will your db hold out

earnest phoenix
#

Yeah no im not gonna waste my db on presences tbh

#

190k data stores on a db, changing probably every second is terrible

quartz kindle
#

cant you refactor presences into saving only the data you need? it probably saves a lot of stuff you dont need

sinful lotus
#

you can cache it on redis

#

but thats still cache

earnest phoenix
#

Unless RethinkDB is capable of storing it every second

sinful lotus
#

you can but if some user spams precense

#

then rip db

quartz kindle
#

you can flush to db on an interval

sinful lotus
#

I even dropped support for presence things updates like username profile pic etc changes

#

due to how resource taxing and blocking it is on javascript

earnest phoenix
#

Well either way, does your fork only disable presence caching and it runs on master branch when theres updates too?

#

Oh i see but i need the user's own name change whenever they change but i think fetching the user updates that?

sinful lotus
#

yes

#

you can fetch those

earnest phoenix
#

Can i use your fork maybe then

sinful lotus
#

the fork is kinda modified to the bot

earnest phoenix
#

It updates when master updates too right

#

Oh

#

Aw

sinful lotus
#

its not fit for public usage

earnest phoenix
#

Ill stay with my sweeping task then lol

#

It wipes like 20k presences every time it sweeps

sinful lotus
#

well one thing you can do is modify ._edits cache in messages

earnest phoenix
#

Along with emojis and others

quartz kindle
#

if you disable message cache, does it also disable message edits cache?

earnest phoenix
#

Meh i have a client option that gets rid of old cached messages

sinful lotus
#

it disables edits, deletes, events as well

#

it also affects the bulk delete for some reason

earnest phoenix
#

Well i mean bulkdelete contains cached messages

#

On output

sinful lotus
#

you can used the fetched messages

#

thats why its weird

#

I can fetch 100 messages manually myself but it only deletes 50 which is my max cache on messages

#

get cached for 7 days?

#

d.js default message cache is 200 per channel

#

it will be forever on 200 and replace the old messages with new ones if you dont sweep

#

for small bots thats not noticable

#

but on big bots, imagine having 1mil text channels with 200 messages cached

#

that doesnt sound so feasable

earnest phoenix
#

Mem Usage :: 61.51 MB
Uptime :: 7D, 20H, 39M
Users :: 8,898
Guilds :: 5
Channels :: 150
My bots stats (my beta bot which im testing it on, not in 220 guilds lol)
Its currently 4 minutes away from next sweep i think

sinful lotus
#

export a channel messages?

earnest phoenix
#

Actually it just swept

#

24.8MB now

twilit rapids
#

What would be the impact on RAM usage with 22k channels

sinful lotus
#

even its not on your cache as long as the messages is not deleted you can fetch them back on api via its id

#

and cache are all in ram

#

depends on your cache

#

22k channels isnt that big but the messages can

#

if its deleted and you didnt store it

#

bye bye

#

you cant fetch a deleted message

earnest phoenix
#

My bot cached 8k channels

sinful lotus
#

discord tos

#

once a message is deleted its gone from api

earnest phoenix
#

And 190k users

#

On 230 guilds

#

Along with like 2k emojis

#

A dozen of roles

#

and idk what else

sinful lotus
#

sweepers is fine if you dont use cluster sharding

earnest phoenix
#

I cant shard with 230 guilds lol

quartz kindle
#

im gonna run some tests on my bot thats in 1.2k guilds

sinful lotus
#

the performance impact on sweepers gets bigger the more guilds on a single shard

#

and you will have big problems when it goes overboard

earnest phoenix
#

My bot wont reach 1k anyways

#

Its been online for 2 years now

#

And it has 230 guilds

#

230 in 2 fucken years

opaque eagle
#

You can store messages unless the user asks to have it removed

#

But why would you need to store messages anyways? What kind of command would you need it for?

sinful lotus
#

"useless logging" is not allowed

#

like you are spying on your users

#

or selling their info

#

something like that

slender thistle
#

You can't store what is not needed and/or the user doesn't know you store basically

broken shale
#

That's why I have a rules screen before the user even uses my bot

#

They have to accept or decline

opaque eagle
#

You still can’t be logging info unless it’s so important that your app won’t work without it

slender thistle
#

Well if Discord finds out, your bot will get deleted from Discord I bet

#

And honestly I see no point in storing unnecessary data without telling the users unless you are an asshole

opaque eagle
#

2.4 End User Data. “End User Data” means all data associated with the content within the functionality enabled by the API or SDK, including but not limited to message content, message metadata, voice data and voice metadata. You acknowledge and agree that Discord and its end users, as applicable, retain all worldwide right, title and interest in and to the End User Data. If you have access to End User Data through the API or the SDK, you shall ensure that your Applications do not collect, use and/or disclose End User Data except (a) as necessary to exercise your rights under this Agreement, (b) in accordance with Discord’s Privacy Policy. If you have access to End User Data through the SDK, you additionally agree to get express permission from the End Users.

You shall not sell, license or otherwise commercialize any End User Data. You may not use End User Data to target End Users for marketing or advertising purposes. You may not disclose End User Data to any ad network, data broker or other advertising or monetization related service.

You shall delete all End User Data upon Discord’s or the End User’s request and within seven (7) days following the End User’s termination of the End User’s account. You may only retain chat logs as necessary for the operation of your Applications. Discord’s offering of an API or SDK that allows you to reproduce or display End User message content is not an express or implied license to such content from Discord.

hollow saddle
#

tfw you copy part of the discord api’s tos

opaque eagle
#

Yes

slender thistle
#

Because when you link it, barely anybody will honestly read it

hollow saddle
#

Yes

opaque eagle
#

Hey I find it fun to read legal documents

hollow saddle
#

And when you copy a whole section and paste it to a channel, it’s very hard to miss zoomeyes

#

I find it boring

#

And painful

#

But you do you

sinful lotus
#

One should not create a bot when they dont even read Legal

#

you will get lawsuited for that

#

can you pay the lawsuit

hollow saddle
#

Pff

#

Lawsuit

sinful lotus
#

they got a bot deleted from sending loli stuff

#

dont think they wont

earnest phoenix
#

I’m using the code:
dbl.webhook.on('ready', hook => {
console.log(Webhook online! http://${hook.hostname}:${hook.port}${hook.path});
});
dbl.webhook.on('vote', vote => {
console.log(O membro com o ID ${vote.user} votou em mim ;w;!);
});

And every time i’will start my bot, i have the error:
dbl.webhook.on('ready', hook => {
^
TypeError: Cannot read property 'on' of undefined

#

lol

sinful lotus
#

dbl.webhook is undefined

earnest phoenix
#

But its the code of the API page

#

const dbl = require('dbl-api')

#

I think its that

sinful lotus
#

yes but reading it saves you a fortune

#

if you are not responsible on little things

earnest phoenix
#

I have that @earnest phoenix

sinful lotus
#

I cant see you responsible on big things

earnest phoenix
#

hmm

#

@earnest phoenix dont put the code in a event

sinful lotus
#

what is your code even

#

you just sent the dbl.webhook

#

that dont give me anything

earnest phoenix
#

I didn’t

sinful lotus
#

you need to know what is yes and no

#

nsfw channel exist for those although somethin that is illegal is red area

#

ask the bot dev

#

probably they are lazy

#

At the first place why even require Administrator, I would question the bot developer's code in this

earnest phoenix
#

Anyone can help me ?

sinful lotus
#

try posting the whole code

#

instead of that part only

#

.on of undefined means dbl.weebhook is undefined

#

I would look on how dbl.webhook is defined if I were you

earnest phoenix
#

What is the Webhook password?

quartz kindle
#

is it a good idea to enable ws compression?

earnest phoenix
#

@earnest phoenix a random password

#

You can put "test123" or idk

#

@earnest phoenix and the url?

#

http://serverip/dblwebhook

broken shale
#

@slender thistle I only store data like user ID and user name, command times ran to log possible cheating/macros/transfering to another alt

slender thistle
#

Should be fine then

earnest phoenix
#

@earnest phoenix needs to have something on the page?

#

??

#

@earnest phoenix can i use glitch to host that page?

#

Yes

#

And at /dblwebhook

#

I need to write something on the page?

#

@earnest phoenix ^

#

No pls stop ping me every time

#

Ok

#

Sorry

earnest phoenix
#

lmao no

quartz goblet
#

help

quartz kindle
#

did you install it through the "add package" button?

broken shale
#

does glitch give you a ip for where your bot is hosted on

west spoke
#

Yes

west spoke
#

?

indigo geyser
#
m = 0
while True:
	f = input('Write Anything')
	m = (m+100)
	if f == '/money':
		print (m)
    else:
    	print('+100')
```
```Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>                        start(fakepyfile,mainpyfile)                              File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start                           exec(open(mainpyfile).read(),  __main__.__dict__)         File "<string>", line 7                                       else:                                                           ^                                                   IndentationError: unindent does not match any outer indentation level                                                   [Program finished]```  i think this is a Pydroid problem right?
slender thistle
#

You used an unnecessary space somewhere

#

or used a tab instead of space

west spoke
#

m = 0
while True:
f = input('Write Anything')
m = (m+100)
if f == '/money':
print (m)
else:
print('+100')

#

@indigo geyser

earnest phoenix
#

who codes in python

west spoke
#

a lot of people here

#

Python is the #5 (2 according to other research) most used language

earnest phoenix
#

lazy i already have a bot

lone wraith
#

What approach do you guys use to keep track of command usage on your bots (count for how many times each command is getting used)

mossy vine
#

i dont keep track, but a database would work fine for that purpose, since its just incrementing a value

indigo geyser
#

@west spoke already try it

#

I try to restart the phone

lone wraith
#

@mossy vine Yeah, thought there might be a different approach that I haven't thought of

#

Thanks

west spoke
#

@indigo geyser tip 1: dont use pydroid

#

Its picky with indents

indigo geyser
#

Don't use it

west spoke
#

Whatever line it says it has a error on, backspace the beginning of the command to the previous line and press enter

indigo geyser
#

Ok

#

Thanks

earnest phoenix
#

were would i put this message.content.split("#=help",1)[1]

#

in this

#

for x in range():
await message.channel.send("")

west spoke
#

*my code, hes using my help command as a base

earnest phoenix
#

idk what a base is

west spoke
#

But idk what you are trying to do exactly

earnest phoenix
#

im trying make it so when u type !hello the bot ask you want you want to type then it types that

west spoke
#

That's a wait for message event

#

I thought you were wanting !hello <text>

earnest phoenix
#

so what do i do

slender thistle
#
for x in range(20):
    await channel.send("something")

I would suggest against that

earnest phoenix
#

im not going put it in this server

slender thistle
#

This server or not, you can still get ratelimited unless you are sure it doesn't hit it or put delay inbetween the iterations

west spoke
#

^

#

I'd only say one

abstract crow
#

Does anyone know how to use modules for commands?

earnest phoenix
#

which library

abstract crow
#

Sorry DJS

west sand
#

Guys i use this javascript var channel = message.channel channel.overwritePermissions(channel.guild.defaultRole, { VIEW_CHANNEL: true }, { SEND_MESSAGES: true } );

#

but it does only do VIEW_CHANNEL

abstract crow
#

I think it should be { VIEW_CHANNEL: true, SEND_MESSAGES: true }

amber fractal
#

yeah, you have 2 objects

abstract crow
#

I may be wrong though

amber fractal
#

the second one is ignored because the method only has 1 parameter

west sand
#

@abstract crow i think i have tried that but it didn't work

amber fractal
#

it's just ignoring the second one

west sand
#

how can i fix it ?

abstract crow
#
.overwritePermissions(guild.member {
    'VIEW_CHANNEL': true 
    'SEND_MESSAGES': true 
    'READ_MESSAGE_HISTORY': true
})
#

Base it off of that

amber fractal
abstract crow
#

So change some things around

amber fractal
#

only 1 object

abstract crow
#

Wait I was actually right for once 🤣

#

So yeah try , { perm1: value, perm2: value })

west sand
#

ok thanks i'll try it

stray garnet
#

how to let the bot check that an channel has nsfw turned on?

west spoke
#

Lang?

abstract crow
#

For DJS ^

west spoke
#

For python async I have a work-around

stray garnet
#

d.js @west spoke

west spoke
#

Ah

#

See link avove

abstract crow
#

if(message.channel.nsfw) {}

#

It will be a boolean

#

true or false

stray garnet
#

ok

obtuse wind
#

Hey guys, I have a question, my userinfo command keeps having an error pop-up it says "cannot send an empty message"
I use node.js / discord.js

#

can anyone help me?

west spoke
#

It's a empty message

#

embed=infoembed?

#

I dont think you can just send the string

obtuse wind
#

I'm not sure if I follow, the message is supposed to send the embed

mossy vine
#

no need for that neko

#

its a richembed

#

it does have quite a few typos tho

#

the error seems to be originating from your index.js file

#

and that does not look like an index.js file

#

wait nvm

#

that was snekfetch

obtuse wind
#

should I do a try catch then?

mossy vine
#

try logging infoEmbed

obtuse wind
#

k

#

still nothing

mossy vine
#

so it logs nothing?

#

thats the problem

obtuse wind
#

I just logged I tried it with the try catch first

#

it looks like the "nickname" is undefined

mossy vine
#

yes

#

you are using Nickname instead of nickname

obtuse wind
#

oh

#

joined this server "user.joinedAt" was removed cause that was undefined as well

mossy vine
#

i reccommend you read the docs

#
obtuse wind
#

I have docs opened already

#

4 tabs to be exact lol

topaz fjord
#

what d.js version

#

also try message.channel.send({ embed: infoEmbed })

#

@obtuse wind

obtuse wind
#

ok

#

idk what version I should check though

topaz fjord
#

what version do you have installed

#

it'll show up in package.json

hollow saddle
#

Or you can use npm ls discord.js

obtuse wind
#

11.5.1

#

is the current version

topaz fjord
#

did the thing work

obtuse wind
#

my npm version is 6.9.0

topaz fjord
#

ok

obtuse wind
#

it works thanks 👍

topaz fjord
#

np

hollow saddle
#

Yeah because in order to not have an object and send an embed, the variable needs to be named embed

topaz fjord
#

^

hollow saddle
#

Since message.channel.send(embed) is just a shortcut to message.channel.send({ embed: embed })

obtuse wind
#

do you think I should do message.channel.send({embed: embeds}) for all my commands?

topaz fjord
#

Only if it's an embed use that

obtuse wind
#

k

#

Also 1 more question, why doesn't my clear/prune command send an error message saying that the message is over 14 days old?

hollow saddle
#

Did you code it to do so

#

Cause I’m not sure if bulkDelete does that automatically

lusty dew
#
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/discordjs/discord.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Aj\AppData\Roaming\npm-cache\_logs\2019-07-13T20_02_19_301Z-debug.log```
#

I keep getting this error

#

But I never have gotten it before when trying to install discord.js master

hollow saddle
#

You need git for discord.js master

#

Do you have git installed?

topaz fjord
#

use the https link

peak quail
#

with node . >log-File.txt 2>error-File.txt i can run my bot logs (errors) in a file but on the normal logs how can i log the normale console.logs in my console ?

topaz fjord
#

use a process manager to actually run it

vagrant bison
#

In which location should the vps server be located?

earnest phoenix
#

wherever you want

#

if your bot is mostly used by users in EU place it in EU

vagrant bison
#

I do not think vps should be closer to the discord API.

earnest phoenix
#

discord servers*

#

discord has servers all around the world

#

so it doesn't really matter

vagrant bison
#

Voice servers have, and api is only one

earnest phoenix
#

if you host the bot in the US you're going to have a small difference between usage in US and EU, isn't anything significant though

inner jewel
#

the discord api is fully hosted in US east

#

other places have only voice servers

vagrant bison
#

+1

#

@inner jewel

#

so where bots should be hosted, what location?

amber fractal
#

I host mine as close as I can to discord servers

inner jewel
#

if you want low rest/ws ping, us east

vagrant bison
#

I'm sorry for ping

inner jewel
#

if you want low voice ping to a specific region, in that region

earnest phoenix
#

@inner jewel so VPS located in Poland should be good?

inner jewel
#

wrong continent

#

it'll work, but if you want low ws/rest pings, you need to be in US east, not europe east

vagrant bison
#

AHHAHAA

#

+1

#

+1

#

thanks

earnest phoenix
#

chodzi o mały ping

#

a my pewnie mamy z 50/60

#

wiec wiesz

#

no one can understand you

#

speak english

lusty dew
#

@hollow saddle I didn't have git installed when I first downloaded it

#

But I'll try

#

Thanks

vagrant bison
#

@earnest phoenix eh nie

#

discrd api jest w US east wiec komunikacja miedzy tym serwerem a srwerem jest dłuższa

#

na polskie ping wynosi okolo 200ms

#

albo 150ms

#

dla europy zachodniej 120ms

rotund canopy
#

I have a question if anyone can Dm and help me

#

This nickname is... sigh

hollow saddle
#

Why limit yourself to only one person helping you when you can have multiple in a channel

rotund canopy
#

That’s fair

indigo geyser
#

@rotund canopy, OP tell you ask here your question If it's a Code Question

rotund canopy
#

It is

#

I’ve set up almost all of my bot on my own but there’s one feature I’m having trouble with. I need a way for a bot to send a picture and then for people to guess what that picture is (having the bot recognize they guessed right).

#

I haven’t found anyone able to help me yet

#

So it’s appreciated if u can help

hollow saddle
#

You could set up an array and inside it, use objects for the pictures url and correct answer and go from there

#

And then await messages and if the message equals the answer, it’s correct

#

I’m speaking in terms of discord.js since I’m only experiencing in that

fair flare
#

Lol

rotund canopy
#

I can do most of tht. Thanks

indigo geyser
#

This is with Python (not all of this is correct, but the concept is this) ```python
@client.event
async def on_message(message):
if message.content == '$random':
emb = discord.Embed(title='Guess The Image')
emb.set_image(url=your link image here)
await message.channel.send(content=None, embed=emb)
if message.content == 'correct answer':
await message.channel.send('correct')
else:
await message.channel.send('Nope')

rotund canopy
#

Oh thank you

indigo geyser
#

Np

#

not all of this is correct

rotund canopy
#

Ik

slender thistle
#

Like no args for on_message

indigo geyser
#

Sorry

#

Fixed

slender thistle
#

Specifying content isn't necessary but explicit > implicit ig

opaque eagle
#

I guess that conversation ended but I had to look up "Poland" to know where it was

#

RIP my history teachers

indigo geyser
#

Haha

spiral pasture
#

hi

brazen quartz
#

Not 100% sure if this the right channel, but off-topic is insane atm so seemed better here lol

#

I am trying to get a small team of BETA testers to test my new bot, I really want to make sure its as good as can be, if you'd like to help out and test my bot, DM and I'll link you to a form 😃

hollow saddle
#

What kind of bot is it

brazen quartz
#

RPG style loot em up bot, I don't wanna give away too much and thats the best way to describe it I think lol

#

@hollow saddle

hollow saddle
#

Ah I see

opaque eagle
#

I'm trying to push code to a GitLab repository that's under a group that I don't own, but I'm a dev in the group... ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://gitlab.com/groupname/reponame.git'

sinful lotus
slim heart
#

@opaque eagle iirc gitlab “developer” only can submit PRs. Only managers can push straight to it and accept prs

inner jewel
#
jshell> var e = Executors.newCachedThreadPool()
e ==> java.util.concurrent.ThreadPoolExecutor@26a1ab54[ ...  = 0, completed tasks = 0]

jshell> CompletableFuture.supplyAsync(() -> "some async value", e)
$4 ==> java.util.concurrent.CompletableFuture@2b71fc7e[Not completed]

jshell> $4.join()
$5 ==> "some async value"```
#

@sinful lotus

sinful lotus
#

@inner jewel supplyAsync?

inner jewel
#

yes

#

remember to pass the thread pool as the second argument

sinful lotus
#

so that wraps the threadpool to CompletableFuture hence not block my code?

gloomy estuary
#

guys one help

#

how to host in heroku

earnest phoenix
#

you dont

gloomy estuary
#

y

earnest phoenix
#

heroku is not made for bot hosting

gloomy estuary
#

oh but it can be

#

then

#

which is for free

sinful lotus
#

why you want a bot if there is tons of bots already tho

ember atlas
#

My friend loves calum Scott so I’m trying to send this embed for them, why do I get an unexpected or invalid token?

`!e const discord = require(“discord.js”)

const calum = new discord.RichEmbed();
.setTitle(“Calum is hot”)
.setDescription(“Matt loves calum more than he does his jull”)
.setImage(“https://cdn.discordapp.com/attachments/598700186125991936/599831998537924608/image0.png”)
.setColor(“RANDOM”)
message.channel.send(calum)`

opaque eagle
#

Get rid of the ; after new discord.RichEmbed()

ember atlas
#

Same thing

slim heart
#

Use proper quotes

#

You’re using the iPhone “”

#

I believe right?

#

I’d suggest either making ur eval command auto replace them (there’s variants for single quotes too) or using the proper quotes, by holding down the “ button until it pops up the variation menu and just letting go should give you the proper quote "

bright spear
#

or use gboard

valid frigate
#

oh actually, you get invalid token since if that's your eval command, you are requiring discord without defining the client, logging it in, etc.

#

if your eval command sends back the output directly you could just eval the richembed without having to call message.channel.send

slim heart
#

@valid frigate no wrong, invalid token means invalid character which would be “

valid frigate
#

ohh i thought it meant invalid discord token

#

lmfao

slim heart
#

He also doesn’t even use client but

near igloo
#

HELLO

#

CAN I GAT A HELP FROM THE DEVELOPERS?

#

IS ANY DEVELOAPERS CAN HELP ME?

twilit rapids
#

YES JUST SEND YOUR QUESTIONS AND WE WILL TRY TO HELP YOU

near igloo
#

I HAVE MAKED A HTML REGISTRATION FORM AND I WANNA INPUT A PICTURE HIW WILL I INPUT A PICTURE

slender thistle
#

Calm down on the caps lock

near igloo
#

<img src="image.jpg"> command is not working

spring ember
#

@near igloo you need an upload input

#

<input type="file" />

near igloo
#

<input type="file" />? OK THX THEN

#

I HAVE ANOTHER QUESTION

#

CAN I ASK IT?

slender thistle
#

CALM DOWN WITH THE CAPS LOCK, AGAIN
AND YES, JUST ASK YOUR QUESTION. YOU AREN'T HELPING ANYONE BY ASKING IF YOU CAN ASK A QUESTION

near igloo
#

CALM DOWN WITH THE CAPS LOCK, AGAIN
AND YES, JUST ASK YOUR QUESTION. YOU AREN'T HELPING ANYONE BY ASKING IF YOU CAN ASK A QUESTION

#

CAPS +BOLD

covert turtleBOT
#

By asking if you can ask a question, you have already asked a question so simply just ask the actual question. State exactly what the problem is so someone can help you as soon as possible.

sinful lotus
#

Last warning

#

Don't caps lock

copper crystal
#

All shards are online and the bot is responding in one server but not another. What could be the reason?

near igloo
#

how can i public my html project so any 1 can see it

sinful lotus
#

@copper crystal check your ws status

#

if ws is fine

#

probably your code is blocked of some sort

peak quail
#

when somone spam a command
is that also api abuse ?

sinful lotus
#

more like they are abusing your bot

lusty dew
#

TypeError: (intermediate value).setTitle(...).setDescritpion is not a function I keep getting this error .

#

Oh wait

#

Just noticed what is wrong

gloomy estuary
#

How to mention user in py @bot.commands

#

Anyone please

#

Please

tulip wave
#

Anyone know what the rate limits on webhooks are? (Discord webhooks if anyone needs any clarification)

hallow olive
#

Anyone know how to also do @frank blaze help but also keep the /help command?

#

for people who dont know the prefix

slender thistle
#

@gloomy estuary which user exactly

#

Mention for prefix? What library?

hallow olive
#

anyone?

#

i code on glitch.com btw

#

(if that changes anything lol)

slender thistle
#

Read my last message LolWhat

hallow olive
#

oof

#

k

#

wdym by what library ??

mossy vine
#

why library are you using

hallow olive
#

discord.js

mossy vine
#

how are you checking for prefix right now

hallow olive
#

wdym GWbruhGalaxyThink

twilit rapids
#

@tulip wave 30 msg per min

hallow olive
#

i want it to be @frank blaze help but also for ppl who know the prefix to be /help

gloomy estuary
mossy vine
#

yes

#

how are you checking for the prefix

#

you likely have an if statement with something like message.content.startsWith

slender thistle
#

I'm asking you "which user you want to mention", not "what do you use for your commands"

hallow olive
#

so i add that somewhere or smth GWbruhGalaxyThink

#

dang im stupid lmfao

mossy vine
#

wha

#

no

hallow olive
#

in all the commands i just add `:usage:"/example",

mossy vine
#

what command handler are you using

hallow olive
#

where do i check that

mossy vine
#

do you have a message event anywhere

hallow olive
#

wait lemme check

#

events file
message
ready

#

message.js

#

?

mossy vine
#

can you send the contents of the message.js file

hallow olive
#

in dms or here

mossy vine
#

here

#

just make sure you dont send any sensitive info

tulip wave
#

@twilit rapids thx

mossy vine
#

like tokens or passwords

hallow olive
#

ill sent that on dms to be more safe tbh

sinful lotus
#

@tulip wave its sent on headers

tulip wave
#

Oh yeahhhh never checked them

hallow olive
#

who knows how i could make my bot count this server aswell and his playing thing to then be 50k ?

#

dont mind the playing thing just how i aalso count this server

bright spear
#

what

late hill
elfin iron
#

I need a little help :/. I am trying to add this to my git repo. But it wouldn't show up? It just looks blank like I didn't add anything.


(https://discordbots.org/bot/598431937035763713)```
mossy vine
#

i dont think you can put a link in a link title

eternal tangle
#

hello, i have a possibly easy problem here

#

using discord.js i'm trying to split a message's rows in an array of strings

#

like so

#
    let text = message.content

    text.split('n/')
#

but it doesn't actually split it into rows

slender thistle
#

New line is \n MegaThonk

eternal tangle
#

hmmm

#

i'm trying to see what happens with

console.log(text.length)

for(let i = 0; i < text.length; i++){
    console.log(text[i])
}
#

but the result still is in individual letters even with \n

#
7
a
s
d

a
s
d
#

when i write asd asd

hybrid ruin
#

Correct me if I misunderstood something, but you're currently printing every character in the string without checking for line breaks or anything

#

You want it to print "asd" "asd", right?

eternal tangle
#

yes

uneven rover
#

message.content.split(/ +/g);

eternal tangle
#

so am i doing just

#

the console logging wrong and it actually does what it's supposed to

turbid gale
#

When doing text.split("\n") you need to set a new variable or use text

eternal tangle
#

as in let text = message.content.split('/n')

turbid gale
#

yes but \n not /n

eternal tangle
#

yes frick

hybrid ruin
#

It's okay, you'll get used to it ;P

eternal tangle
#

oof

earnest phoenix
#

Hello, for my question I'll make an example: the bot asks me for an iD of a random user on discord and he answers me with his nickname and his tag of the genre username#0000. How do I get the bot to give me the username#0000 format but not the mention?

eternal tangle
#

still not good with let text = message.content.split('\n')

turbid gale
#

I mean if you're typing asd asd there's no new line

hybrid ruin
#

@earnest phoenix In Java, I'd simply do member.getUser().getName() + "#" + member.getUser().getDiscriminator()

earnest phoenix
#

in javascript ?

eternal tangle
#

it works now

#

flipping hell

turbid gale
#

getDiscriminator*

uneven rover
#

<>.user.tag

earnest phoenix
#

@uneven rover thx

hybrid ruin
#

Thanks Shea GWowoHehe

turbid gale
#

or you could use User#getAsTag either works

eternal tangle
#

thankss guyss

hybrid ruin
uneven rover
#

or member.tag actually depends on how you define member

#

and what lib youre using...

earnest phoenix
#

I do this and isn't work

#

t/eval let id = "546968486606536706"

message.channel.send(${id.user.tag})

uneven rover
#

oh discord.js?

turbid gale
#

That would be a string

earnest phoenix
#

yeah

weary lark
#

because of lol

#

probs

uneven rover
#

you can define member by client.users.get(id);

weary lark
#

then do .send

turbid gale
#

String doesn't have a property of user

weary lark
#

wait im dumb

turbid gale
#

You'd want to use discord.js to find the user by id, it'll have a function for that somewhere

earnest phoenix
#

but if the user is not in one of the bot's servers

turbid gale
#

If the user is not in the server, discord has a request you can make to find them which discord.js will have implemented somewhere

weary lark
#

/eval var id = client.users.get("546968486606536706");
message.channel.send(id.user.tag);

#

try that maybe

earnest phoenix
#

ok

weary lark
#

if it doesnt work, try removing user from id.user.tag

#

and if that doesnt work then replace id.user.tag to id.username + "#" + id.discriminator

hollow saddle
#

id.username and id.discriminator are not properties of id

#

id is a string

earnest phoenix
#

@weary lark

#
t/eval const client = bot
let id = "546968486606536706" 
let memberid = client.users.get(`${id}`)

message.channel.send(id.user.tag)```

TypeError: Cannot read property 'tag' of undefined```

hollow saddle
#

Yeah cause it’s a string

weary lark
#

okay

earnest phoenix
#

okkk

weary lark
#

wait

#

hold up a sec

earnest phoenix
#

I think

hollow saddle
#

Just get the member by doing message.guild.members.get(“id” or client.user.get(“id”)

#

Then use .id

#

Or .tag

weary lark
#

you should already be getting the client

#

in the eval

#

without requiring it

#

so what are you trying to get exactly @earnest phoenix?

#

the discriminator (4 numbers after username), the username (username) or both?

earnest phoenix
#

I try to retrieve a user's user's nickname and tag via their ID without going through the mention

weary lark
#

okay

uneven rover
#

try javascript t/eval let id = message.author.id; let memberid = bot.users.get(id) message.channel.send(memberid.tag)

weary lark
#

oh feck nickname

hollow saddle
#

^

#

Yes

#

That would work

weary lark
#

yeah that'll work

#

im sorry for being here lmao

hybrid ruin
#

XD

hollow saddle
#

Lmao

earnest phoenix
#

@uneven rover you'r best

hybrid ruin
#

Poor Pie just wants to help

earnest phoenix
#

thx u

weary lark
#

ima just focus on working on my website now lol

hybrid ruin
#

Best of luck

#

Better show us progress sooner or later

weary lark
#

will do

earnest phoenix
#

@weary lark

#
let id = args.join(" ")
let userid = id
let memberid = bot.users.get(userid);

            .addField("⛔ Utilisateur gban :", memberid.tag)```
opal terrace
#

anyone know any good random image apis

weary lark
#

i dont sadly

opal terrace
#

ok

earnest phoenix
#

@weary lark check my code up please

#

the bot cannot read tag

weary lark
#

ur using discord.js right?

earnest phoenix
#

yes

weary lark
#

ok

earnest phoenix
#

I just warn on The args ID join the bot doesn't have it in its list of users, I try with client?

weary lark
#

replace bot with client maybe?

#

unless client = bot already

earnest phoenix
#

yeah @weary lark

#

bot = client

weary lark
#

im so confused rn, idk why, ill give it to someone else lol

#

sorry but i cant help you with that one

quartz kindle
#

Did you console.log those values to see if they are correct?

earnest phoenix
#

the console say me Cannot read property 'tag' of undefined @quartz kindle

uneven rover
#

try console.log(args)

solid hull
#

i want learn to code but i don't know what for a program is good for a newcomer

#

php storm or something like taht, i dont know

hybrid ruin
#

Visual studio code

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

weary lark
#

^

mossy vine
#

literally any code editor

#

what you use comes down to preference

hybrid ruin
#

It's all a preference, but knowing how visual studio code works is a good thing

#

Yeah

sage bobcat
#

One message removed from a suspended account.

weary lark
#

same

sage bobcat
#

One message removed from a suspended account.

weary lark
#

word (wait you can code in that?), notepad, notepad++, atom (but can be buggy/laggy), vsc + theres a lot more out there lol but yeah

sage bobcat
#

One message removed from a suspended account.

weary lark
#

i went from notepad to notepad++ to atom and now vsc

solid hull
#

And what kind of programming language should i start? or what programming language did you start with?

hybrid ruin
#

Python or javascript

#

Perhaps js

weary lark
#

^

sage bobcat
#

One message removed from a suspended account.

solid hull
#

okay 😄

sage bobcat
#

One message removed from a suspended account.

weary lark
#

i started with js

slender thistle
#

Depends tbh

#

Whichever one you like

weary lark
#

then went to html, css, and now kinda learning/not learning python

slender thistle
#

Python and JavaScript are labeled simple programming languages

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

hollow saddle
#

I started with html and css

sage bobcat
#

One message removed from a suspended account.

hybrid ruin
hollow saddle
#

But yeah I’d start with js

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

solid hull
#

i am a german person, i don't understand all what you write, but some programm languages i hear befor

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hybrid ruin
sage bobcat
#

One message removed from a suspended account.

hybrid ruin
solid hull
#

a friend say to me it's important to learn first the grounding and than the many programm languages, i think you hear i'm really newcomer 😅

sage bobcat
#

One message removed from a suspended account.

hybrid ruin
#

Yeah that's fine

solid hull
#

😅

hybrid ruin
#

Once you know the base of js for example, understanding the base of other programming languages will become easier

broken shale
#

I started out knowing nothing lmao and I started JS, the community is helpful and overtime you'll get the hang of it

hybrid ruin
#

It's pretty much the same, just in a different syntax

#

There's obviously more than that to it, but you get the idea

solid hull
#

okay, thanks guys for the much help
😅 🙃

sage bobcat
#

One message removed from a suspended account.

solid hull
#

👌

onyx summit
#

so I wanted to use jwt to create auth tokens for my api.
but how can I revoke tokens?

#

save every generated token in a db and deleting them when revoked?

earnest phoenix
#

So I'm trying to make my code randomly select four lines from words.txt and combine them, all separated by dashes
I got the random word part working, but I'm struggling on getting four words
I thought about making an vector and pushback the vector, like in C++
This is the code
https://throwbin.io/uWGXk4m
Ping me if you can help

#

it isn't exactly a bot question, but whatever, there are lots of devs here

quartz kindle
#

Is that node/javascript?

slim heart
#

“C++”

quartz kindle
#

You dont need an http request to open a local file

slim heart
#

Wait no nvrm

quartz kindle
#

Oh youre working on a website, not node

#

Also, your funcions are creating an infinite loop

#

Combine calls wordgen and wordgen calls combine

near igloo
#

!DOCKTYPE>
<html>
<head>
<title> Creating fOrms </title>
</head>
<body bgcolor="lightblue"><center>
<form>
<h1>Online registration Form </h1>
<b>First Name :</b>\t<input type="text" name="first_name" size="25"><br><br>
<b>Last Name :</b><input type="text" name="last_name" size="25"><br><br>
<b>Age :</b><input type="text" name="age" size="25"><br><br>
<b>Phone-NO :</b><input type="text" name="phonenumber" size="25"><br><br>
<b>E-mail :</b><input type="text" name="email" size="25"><br><br>
<b>Password :</b><input type="text" name="password" maxlength="10"><br><br>
<b>Date of Birth :</b>
<select name="moths">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select><br><br>

#

<b>Years :</b>
<select name="years">
<option value="1">1999</option>
<option value="2">2000</option>
<option value="3">2001</option>
<option value="4">2002</option>
<option value="5">2003</option>
<option value="6">2004</option>
<option value="7">2005</option>
<option value="8">2006</option>
<option value="9">2007</option>
<option value="10">2008</option>
<option value="11">2009</option>
<option value="12">2010</option>
<option value="13">2011</option>
<option value="14">2012</option>
<option value="15">2013</option>
<option value="16">2014</option>
<option value="17">2015</option>
<option value="18">2016</option>
<option value="19">2017</option>
<option value="20">2018</option>
<option value="21">2019</option>
</select><br><br>

#

<b>Dates :</b>
<select name="dates">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select><br><br>

hybrid ruin
weary lark
#

^

slim heart
#

also explain what you’re doing, what’s wrong, etc

weary lark
#

first thing i see: !DOCKTYPE>

hybrid ruin
#

doctype

#

It should start with <!DOCTYPE html> @near igloo

#

Other than that, what's the issue?

near igloo
#

PieToday at 19:17
first thing i see: !DOCKTYPE> REPLY=>could not select the bracket

slim heart
#

Still not dock and you didn’t supply a type

near igloo
#

OKOK

#

THX

#

is it ok?

#

i wanna insert a picture

#

and how do i make footer menue

#

hwlloooooooooo????

earnest phoenix
#

i think you should learn html right from the beginning

near igloo
earnest phoenix
#

Is that notepad

weary lark
#

yummy

near igloo
#

yup

opaque eagle
#

LOL

#

That's cute

near igloo
#

?

onyx summit
#

maybe learn the very basics of general coding shrug

weary lark
#

yeah

slim heart
#

Bug

#

Html is like the easiest code to format why

opaque eagle
#

And for an online registration form you'll need to know PHP too

topaz fjord
#

HTML is coding spongerino

slim heart
#

“Code”

mossy vine
#

you dont need php

earnest phoenix
#

well you're clearly new to programming, If you want to learn HTML from the beginning I suggest w3schools. Also get an IDE while you're at it

opaque eagle
#

Plus 2, if all you need is some basic info, why not use smth like a Google Form instead?

slim heart
#

Cuz people feel sPeCiAl when they say they made it themself

near igloo
slim heart
#

Ok a slight upgrade

opaque eagle
#

Even cuter but whatever

slim heart
#

Still need formatting and a better ide

near igloo
#

i started coding on notepad++

earnest phoenix
#

@slim heart I don't think that's the problem here.

slim heart
#

Ok cool you’re not gonna end there

earnest phoenix
#

@near igloo try w3 schools

weary lark
#

google search issues

earnest phoenix
#

it's good for basic HTML

near igloo
#

ok...

weary lark
#

do your own research and learn new things

topaz fjord
#

Or just find an online course

weary lark
#

and yeah w3 schools is amazing

topaz fjord
#

You won't get anywhere if you keep asking questions without trying

near igloo
#

who can give me a link for downloading css

weary lark
#

you dont download css

hybrid ruin
#

You don't download css, you create css

weary lark
#

^

hybrid ruin
earnest phoenix
#

Again, w3 schools

#

yeah

near igloo
#

tiana i dont need w3 school i just wanna download css

hybrid ruin
#

You can't download css

earnest phoenix
#

possibly a troll

hybrid ruin
#

You have to code it just like your html file

near igloo
#

y?

weary lark
#

Because you have to

mossy vine
#

@earnest phoenix not everyone new to coding is a troll

earnest phoenix
#

they're ignoring what they've been told to do for the second time

hybrid ruin
#

Perhaps he doesn't understand the concept of it yet, no sweat

earnest phoenix
#

and continue using their point despite it being debunked by two people

solid hull
#

And what is easy to program or what should I program first?
an app or a discord bot... idk

topaz fjord
#
  1. Learn a programming language
  2. Practice the programming language
  3. Pick which one your interested
  4. Code
dusty oxide
#

Hello world

solid hull
#

hi

topaz fjord
#

Although with apps its a bit different

#

If you're talking about mobile ones

#

There are certain langs

solid hull
#

yeah mobile

lofty hamlet
#

Hi

#

I have a problmem

#
  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/oauth2/token?grant_type=authorization_code&code=${code}&redirect_uri=${redirect}`,
    {
      method: 'POST',
      headers: {
        Authorization: `Basic ${creds}`,
      },
    });
  const json = await response.json();
  fetch('https://discordapp.com/api/oauth2/token', {
    method: 'POST',
    body: json,
  })
    .then(res => res.json())
    .then(info => request({
      url: 'https//discordapp.com/api/users/@me',
      method: "GET",
      headers: {
        authorization: `${info.token_type} ${info.access_token}`,
      },
    }), function (error, response, body) {
      if (!error)
        console.log(body);
    })
    .then(console.log);
  res.redirect(`/?token=${json.access_token}`);```
#

Does not work :/

#

Invalid URI "https//discordapp.com/api/users/@me"

topaz fjord
#

Android: Java, Kotlin, Dart, React Native
iOS: Dart, Object C, Swift, React Native

#

Those are the langs for mobile

mossy vine
#

dart for android as well

#

flutter

topaz fjord
#

I put it cyber

mossy vine
#

oh

#

im blind

#

thx

dusty oxide
#

Lol

solid hull
#

but can i program an mobile app on the PC ? or i have to code on the mobile when i want a mobile app?

lofty hamlet
#

Who can help me plz ?

topaz fjord
#

@solid hull you can program a mobile app from a pc

opaque eagle
#

You pretty much have to program a mobile app on pc

mossy vine
#

^

solid hull
#

okay, 👌

opaque eagle
earnest phoenix
#

@lofty hamlet where does the error occur

lofty hamlet
#

@earnest phoenix no does he work so with my code how i can take the id of user ? :

#
  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/oauth2/token?grant_type=authorization_code&code=${code}&redirect_uri=${redirect}`,
    {
      method: 'POST',
      headers: {
        Authorization: `Basic ${creds}`,
      },
    });
  const json = await response.json();
  fetch('https://discordapp.com/api/oauth2/token', {
    method: 'POST',
    body: json,
  })
    .then(res => res.json())
    .then(info => fetch('https://discordapp.com/api/users/@me', {
      headers: {
        authorization: `${info.token_type} ${info.access_token}`,
      },
    }))
    .then(function (data) {
console.log(data.id)
    });
  res.redirect(`/?token=${json.access_token}`);
}));```
earnest phoenix
#

what did you just ask

lofty hamlet
#

I want take the id of user

earnest phoenix
#

/users/@me returns a user object

lofty hamlet
#

Yeah but i d'ont have the user idd when i console.log this

earnest phoenix
#

because it's returned in json

lofty hamlet
#

I have for example a lot of infors

#

Where is the id of user 🤔

weary lark
#

oh geez

earnest phoenix
#

you still don't parse the data in json

#

look at the request above

topaz fjord
#

log the body

lofty hamlet
#

🤔

#

Body is :

#
  access_token: 'XXXX',
  scope: 'identify',
  token_type: 'Bearer',
  expires_in: XXXX,
  refresh_token: 'XXXX'
}
#

@topaz fjord

pulsar mango
#

Hello, how can I reinvite my bot on this server :-?

slender thistle
#

Ask one moderator

pulsar mango
#

uhm, you are a moderator, right :?

slender thistle
#

Judging by my roles, I think mmulu

pulsar mango
#

so..

#

can not you invite my bot? :x

#

please

mossy vine
#

i have used nginx as a reverse proxy several times now, but this time its giving me the apache2 default page on / and nginx 404 on any other paths

#

it works fine with ip:port

slender thistle
#

@pulsar mango 👌

stray garnet
#

How to do an Command that replies with an Random answer in an Embed?

west spoke
#

Choose a random thing from a array

stray garnet
#

Ok

weary lark
#

example:

const poop = ["lol", "no u", "etc"];
message.channel.send(`${poop[~~(Math.random() * poop.length)]}`);
#

lol

stray garnet
#

and how to do it in an embed?

weary lark
#

you're using discord.js?

stray garnet
#

yes

weary lark
#

gud

#

RichEmbed Example:

const poop = ["lol", "no u", "etc"];
const random = new Discord.RichEmbed()
.addField('Randomizer', `${poop[~~(Math.random() * poop.length)]}`)
message.channel.send({embed: random});
stray garnet
#

ok

#

thx

mossy vine
#

i dont think ~~ is valid js

weary lark
#

lol

#

@stray garnet

inner jewel
#

~~X is basically Math.floor but limited to 32 bits

#

~ is the bitwise not operator

#

running it twice yields the original value back, but js converts numbers to 32 bit integers (and truncates decimals) before applying that operator

mossy vine
#

wow

stray garnet
hybrid ruin
#

Totally fine

#

Completely normal

weary lark
#

thats fine

stray garnet
#

ok i hope so

earnest phoenix
#

Sorry for intrerupting, but can this be turned into an async function cuz the await can only be used as such, and my brain couldn't come to a logical solution```
if(!muterole) {
try{
muterole = await message.guild.createRole({
name: "flex taped",
color: "#514f48",
permissions: []
})

soft cove
stray garnet
#

@earnest phoenix Deutsch?

amber fractal
#

@soft cove if they dont have the command I dont think you can

#

oh wait

#

let me see

soft cove
#

who is "they"

earnest phoenix
#

@stray garnet nope

amber fractal
#

A bot

#

but that shows me as wrong

stray garnet
#

@earnest phoenix rly?

earnest phoenix
#

what do you mean? I'm seeking for an advice

soft cove
hybrid ruin
#

When the bot comes online, you want to log that somewhere. Then upon command, compare that time to now and you'll have your uptime

#

Obv. reset when it goes offline and such

soft cove
#

Im not going to log hundreds of bots at a time

#

i want it to be in a command where it checks it on the spot

hybrid ruin
#

Might be another solution somewhere, can't think of one as of now

west spoke
#

@waxen meteor version?

hybrid ruin
#

@waxen meteor There's a Member#isBot function I believe

#

Either Member or User#isBot

west spoke
#

Nope

#

There isnt not in dpy

hybrid ruin
#

There isn't?

waxen meteor
#

I'm using the rewrite version

hybrid ruin
#

I thought there was, my bad

waxen meteor
#

With discord.ext.commands

hybrid ruin
west spoke
#
#normal code
if message.author.bot:
                  return```
topaz fjord
#

You only need the second part

west spoke
#

Replace message with whatever handler you use

slender thistle
#

Or just return if message.author.bot is True

west spoke
#

Ah ok turtle

waxen meteor
#

So I'll need to put that in each command class?

west spoke
#

No

#

I dont think you do

topaz fjord
#

It's useless to have if not

hybrid ruin
#

Honestly, yes you do

#

Unless you have a "global" way of checking it before each command

#

Depending on how you handle your commands, that is

soft cove
#

so i asked around and the only way to do that is to check when the bot goes online, then store that in a db and then when it goes offline reset the value

amber fractal
#

uh

west spoke
amber fractal
#

at the top of your message event

west spoke
#

O I did it wrong

#

Welp

hybrid ruin
#

If you have a function which handles the base of each command class, you can put it in there

amber fractal
#

that's the global place before commands

hybrid ruin
#

@soft cove That's what I told you

amber fractal
#

Almost, if not, everyone has a message event mmLol because that's where you put a command handler

waxen meteor
#

Well, I have Discord.py's built-in command handling function, so would I have to go in and edit the library itself?

hybrid ruin
#

True true

slender thistle
#

How are you doing your commands

#

commands extension or on_message?

waxen meteor
#

Commands extension

slender thistle
#

If you didn't override on_message, your bot will default other bots by default

#

And if you did override it, well, you just need a if message.author.bot: return in the very beginning of it and that's it

waxen meteor
#

I didn't override anything

slender thistle
#

You want your bot to ignore other bots, right? Am I following the topic here?

waxen meteor
#

Yes

#

With the commands

slender thistle
#

Eh you're good

waxen meteor
#

I ran the help command from another bot and my bot responded to it