#development

1 messages · Page 1876 of 1

green kestrel
#

becase we all want a bot to fit in 6 megs of ram yeah lol

earnest phoenix
#

And if i add it i can enable this

narrow sun
#

member.activity requires presence intents

#

add a cmd which tracks member statuses or activities

#

why do u need to enable it tho

earnest phoenix
#

@narrow sun

#

When this intent didnt enabled

narrow sun
#

aah usernames

#

u dont need presence intent

earnest phoenix
#

I need

narrow sun
#

member intent it is

earnest phoenix
#

If i dont why this doesnt work

narrow sun
#

huh

#

no

earnest phoenix
narrow sun
#

did u enable the member intents

earnest phoenix
#

Yes

#

It working when i enabled presence intent

narrow sun
#

bruh

#

Member Intent¶

#

Whether you want to track user updates such as usernames, avatars, discriminators, etc.

earnest phoenix
#

Lemme tell you again
Member intents = ✅
Presence intents = ❌

My code include

client.user.username

when the intents
Presence = ✅
Members = ✅

NO ERROR

but if

presence = ❌

cannot read property of name undefined

narrow sun
#

hmmmmm

#

🤔

#

if u want it so bad just add a tiny cmd which includes member.activity or member.status

#

user=discord.Member

#

user.activities[0].name

earnest phoenix
#

My problem discord doesnt lemme activate this intent

umbral onyx
#

random noob question, has the discord api implemented already a gif api or would i have to implement a specific api myself to my bot? Im using c# so i need proper c# documentation. ive seen the giphydotnet one but it may be outdated.

quartz kindle
#

no, discord does not offer third party apis

#

you have to use your own

stable eagle
#

Is it ok if a bot is hosted in NY and the database server in Frankfurt?

modest maple
#

well yes

#

but that is

#

not the most optimal thing in the world

#

especially if you're doing alot of DB queries

earnest phoenix
#

don't most databases have replica sets in different regions

woeful pike
#

yes but multiregion replication isn't as simple as picking a random replica to read from

urban slate
#

guys how do i know what permissions the bot is missing?

lyric mountain
#

manage channels or message

#

you hid the whole path, so I can't know for sure

urban slate
#

for banning a user or kicking are those perms required?

earnest phoenix
#

Yes

lyric mountain
#

then ban or kick perms

urban slate
lyric mountain
#

if you knew WHERE it happened why didn't u just check those 2?

earnest phoenix
#

Note that you have to check if the user has a role above you too

urban slate
#

no cause thats not my server lol

urban slate
feral aspen
#
const { Permissions } = require("discord.js");

if (!message.channel.permissionsFor(message.guild.me).has([Permissions.FLAGS.VIEW_CHANNEL, Permissions.FLAGS.SEND_MESSAGES, Permissions.FLAGS.EMBED_LINKS])) return;
lyric mountain
urban slate
#

read it carefully

lyric mountain
#

where as in "where in the code"

urban slate
#

oh

#

no i dont know where it happened in the code

earnest phoenix
#

Jeez (nuts) djs permission checking is so much better now

lyric mountain
#

if it happened in ban/kick command it obviously is missing ban/kick perms

lyric mountain
#

goddamn

urban slate
urban slate
#

it says in the console log

feral aspen
urban slate
quartz kindle
#

the path can tell you which request exactly it failed at

#

there is no reason to hide the path

lyric mountain
#

that's what I was talking about

#

if you knew it errored during kick -> bot is missing kick perms

urban slate
#

no but it has a condition check for those perms

lyric mountain
#

then it is hierarchy error

urban slate
#

then further in code it checks the perms

quartz kindle
#

checking for perms is not enough

#

you have to check if your bot's role is above them as well

urban slate
#

wait can kick members be a different permission for specific channel?

quartz kindle
#

since you cant kick members with a higher role

urban slate
lyric mountain
#

debugging is no guessing game
E - happened during kick
S1 - bot has no perm
S2 - bot is below the target

#

you just make a checklist and eliminate options

lyric mountain
#

e = error
s1 = solution 1
s2 = solution 2

quartz kindle
#

also, member objects have a kickable property which you can check

urban slate
quartz kindle
#

if(!member.kickable) return

lyric mountain
urban slate
#

nice

#

thanks for that

#

is their a same property for ban?

urban slate
quartz kindle
urban slate
#

thnxx

#

just to be sure this should also work right?

#

!message.member.kickable

#

for the event messageCreate

#

instead of just member.kickable

#

i did check with the docs

#

@quartz kindle

solemn latch
#

message does have the member property

urban slate
#

it do

solemn latch
#

just note, message.member is the person who sent it

urban slate
#

yes

#

ik

modest maple
#

@worthy cloud bro

#

so cool bro

#

@woeful pike Since you're a moddum now

#

zoomeyes You better do the mod tings

woeful pike
#

I gotchu homie

modest maple
#

Proud

tulip ledge
#

anyone good at physics? I thin k I fucked up my gravety formula

#
    forceX = 0
    forceY = 0
    for planet in planets:
      distance = get_distance((player.get_position()[0] + 25, player.get_position()[1] + 35), (planet.get_position()[0] + (planet.get_radius() / 2), planet.get_position()[1] + (planet.get_radius() / 2)))
      # Planet.radius * 0.05 is planets mass
      forceX += (planet.get_radius() * 0.05 * (planet.get_position()[0] + (planet.get_radius() / 2) - player.get_position()[0] + 25)) / distance
      forceY += (planet.get_radius() * 0.05 * (planet.get_position()[1] + (planet.get_radius() / 2) - player.get_position()[1] + + 35)) / distance

    delta_time = (frame_time_in_seconds / 1000) * 60
    player.set_velocity(player.velocity_x + forceX * delta_time, player.velocity_y + forceY * delta_time)
    player.update(delta_time)
#

the player seems to be orbitting relative to the edge of the planet instead of the center

lyric mountain
#

eh, wtf

urban slate
urban slate
lyric mountain
#

y are u dividing by 2

tulip ledge
#

create a vector to move the player into a direction based on the gravitational strengths of the planets

tulip ledge
lyric mountain
#

also, save commonly acessed values in variables

tulip ledge
#

Yeah I prob should

lyric mountain
#

pX = planet.get_position()[0]
pY = planet.get_position()[1]

urban slate
#

This was kinda hard to read ngl

tulip ledge
modest maple
#

also ngl I cant remember much of my gravity physics classes but

urban slate
modest maple
#

I dont think thats how you work out acceleration due to gravity

urban slate
#

And + 35

lyric mountain
#

player.get_position()[1] + + 35

#

not 35

tulip ledge
urban slate
tulip ledge
urban slate
#

Fg = GM1M2/r^2

tulip ledge
#

that's 3d tho

#

this is 2d

modest maple
#

yes and that translates to a acceleration due to gravity

urban slate
tulip ledge
#

and yes it is acceleration

lyric mountain
#

ok so, let's first start sanitizing that so we can understand better the code

#

vigint make a player.get_center_pos()

#

so we can reduce that code

tulip ledge
#

I know it's not the best implementation it's my first time making this so ye

#

ok

lyric mountain
#

player center should be height / 2 and width / 2

#

no hardcoded values

tulip ledge
#

See

#

thats the thing

#

I don't have a height or width

lyric mountain
#

how did u get 35?

tulip ledge
#

I just know how big the player model is

#

its 70 / 2

lyric mountain
#

player model is fixed at 70?

tulip ledge
#

yes

#

50x70

lyric mountain
#

then u have the dimensions

urban slate
#

Yea

tulip ledge
#

yes

lyric mountain
#

(frame_time_in_seconds / 1000) * 60
frame_time_in_seconds / 60_000

#

btw, why divide seconds by 1000?

tulip ledge
#

because it's deltatime

#

for it u need the milliseconds

#

and times it by the fps

lyric mountain
#

then u multiply by 1000

tulip ledge
#

oh

lyric mountain
#

seconds to millis is s * 1000

tulip ledge
#

fuck I'm brainless

lyric mountain
#

lul

tulip ledge
#

alright so now the player is not on screen anymore

lyric mountain
#

we'll get there

#

show the current code after those changes

tulip ledge
#
# In the player class
  def get_center_pos(self):
    return [self.get_position()[0] + 25, self.get_position()[1] + 35]

# In the game loop
    forceX = 0
    forceY = 0
    for planet in planets:
      distance = get_distance((player.get_center_pos()[0], player.get_center_pos()[1]), (planet.get_position()[0] + planet.get_radius(), planet.get_position()[1] + planet.get_radius()))
      forceX += (planet.get_radius() * 0.05 * (planet.get_position()[0] + (planet.get_radius() / 2) - player.get_position()[0] + 25)) / distance*distance
      forceY += (planet.get_radius() * 0.05 * (planet.get_position()[1] + (planet.get_radius() / 2) - player.get_position()[1] + 35)) / distance*distance

    delta_time = (frame_time_in_seconds * 1000) * 60
    player.set_velocity(player.velocity_x + forceX * delta_time, player.velocity_y + forceY * delta_time)
    player.update(delta_time)
lyric mountain
#

u don't need parens in delta time formula btw, and can be multiplied by 60_000 directly

#

ok, let's see distance

tulip ledge
#
def get_distance(obj1, obj2):
  return sqrt((obj2[0] - obj1[0]) * (obj2[0] - obj1[0]) + (obj2[1] - obj1[1]) * (obj2[1] - obj1[1]))
#

why the _ in 60_000?

lyric mountain
#

_ can be used in values to separate thousands

#

it has no actual effect other than aesthetics

tulip ledge
#

wait

#

I just realised

#

wait nvm

lyric mountain
#

save planet coordinates to variables so you don't access it everytime

tulip ledge
#

right

lyric mountain
#

wait, ur getting the bottom right coordinate of the planet

tulip ledge
#

am I ?

lyric mountain
#

pX + radius = right
pY + radius = bottom

tulip ledge
#

oh

lyric mountain
#

or are the planet coordinates focused on top left?

tulip ledge
#

yes

#

top left

lyric mountain
#

ah then it's fine

#

make a get_planet_center_pos too so you can grab it easily

tulip ledge
#

Now we have this:

    forceX = 0
    forceY = 0
    for planet in planets:

      distance = get_distance(player.get_center_pos(), planet.get_center_pos())
      forceX += (planet.get_radius() * 0.05 * (planet.get_center_pos()[0] - player.get_center_pos()[0])) / distance*distance
      forceY += (planet.get_radius() * 0.05 * (planet.get_center_pos()[1] - player.get_center_pos()[1])) / distance*distance

    delta_time = frame_time_in_seconds * 60_000
    player.set_velocity(player.velocity_x + forceX * delta_time, player.velocity_y + forceY * delta_time)
    player.update(delta_time)
lyric mountain
#

what does 0.05 represents?

tulip ledge
#

the radius * 0.05 is just what I do to get a mass

#

so the bigger the planet is

#

the heavier it is

lyric mountain
#

save it to a variable too

#

like mass = planet.get_radius() * 0.05

tulip ledge
#

also

#

I think

#

it's fixed

lyric mountain
#

really?

tulip ledge
#

yeah$

#

it's working

#

it's going around the planet now

#

idk what fixed it

lyric mountain
#

nice

tulip ledge
#

indeed

lyric mountain
#

sometimes reducing the code solves weird issues

tulip ledge
#

I noticed

lyric mountain
#

was probably something regarding planet center or get_distance args

tulip ledge
#

probably

lyric mountain
#

a bit too late, but what type of game is that?

#

space sim?

tulip ledge
#

no

#

I am finally getting coding in school but I'm already ahead of my class (not that good at python tho but still far ahead of my class) and my teacher just gave me the task to make a puzzle game, and some time ago I saw a video of some guy who made a puzzle game where you have to navigate a space guy through space by placing planets

#

that's what I'm making

lyric mountain
#

sounds like a cool concept

#

you should try porting it to mobile

tulip ledge
#

its written in python tho

#

is it possible

#

to port it to mobile?

lyric mountain
#

maybe

#

oh pygame also

tulip ledge
#

I don't have an android device

#

yeah I'm using pygame

lyric mountain
lyric mountain
blissful coral
#

How do I make - red and + green in markdown again?

#

I forgot the code for it

lyric mountain
#

diff

blissful coral
#

ty'

lyric mountain
#

yw

#

you could also try unity, it does run in c# but shouldn't be that hard to port

tulip ledge
#

sure why not

#

I've always wanted to learn unity and c#

lyric mountain
#

all you'll need is to draw ur assets and make a shitton of levels with varying challenges

#

I'd say ur concept is good enough to be on par with candy crush or angry birds

tulip ledge
#

well

#

it's not mine

#

someone else made it

#

for a game jam

#

i think

#

I'm just recreating it in python

lyric mountain
#

but use the "place planets" idea and make something unique

tulip ledge
#

Like what

#

a platformer?

lyric mountain
#

idk, I was thinking abt something where you gotta move the player to the exit (a ship for example) while dodging hazards

tulip ledge
#

that is kinda what he made

lyric mountain
#

that by placing planets or other objects to change its path

#

oh

#

nvm then

#

but still, make it just for the sake of making

tulip ledge
#

I will

lyric mountain
#

you said you wanted to learn unity, use it as practice

tulip ledge
#

another question tho

#

the character seems to be moving like it should but it kinda just goes straight to the planet

#

instead of "curving"

lyric mountain
#

gravity is the inverse square of distance

tulip ledge
#

so, now in english pls? 🙂

lyric mountain
#

nvm, noticed the / dist * dist

#

is it just falling to the planet?

#

maybe the planets are too small to properly apply real gravity falloff

tulip ledge
#

it is going in an elliptic way "around" the center of the planet

#

but it's like

#

really small

#

like the width

#

is really small

lyric mountain
#

try changing the mass modifier

tulip ledge
#

that changes the speed

#

of how fast he goes around

#

not the width

lyric mountain
#

usually the arc is defined by the angle of attack

tulip ledge
#

yeah, keep in mind I'm still a 15 yo student

#

I don't understand anything of that sentence x)

#

I have a feeling it has to do with the velocity

#

uhuh definitly

lyric mountain
#

angle of attack is the angle between the player's direction and the planet

tulip ledge
#

I just put the standard velocity values back to y 0 x 0 so he doesn't start with movement

lyric mountain
#

like, lemme find a gif for that

tulip ledge
#

and he just goes straight at the planet

lyric mountain
#

it should start moving from anywhere in the screen

#

gravity is never 0

tulip ledge
#

wdym?

#

it does start moving from anywhere

#

it's just that it moves straight at it

#

and I want it to curve too

#

if you get what I mean

#

like a meteor

#

entering space's orbit

lyric mountain
#

like, let's say you have a bowling ball in one corner of the universe and you are on the other corner

tulip ledge
#

it curves

lyric mountain
#

nothing else exists, only you 2

#

eventually, the ball will reach you

tulip ledge
#

mhm

#

Well

#

I know why

lyric mountain
#

that because, even though you are extremely away, gravity will still affect you and the ball

tulip ledge
#

I just have to give the character a starting x velocity

#

now it's going around the planet

lyric mountain
#

ye, that'll solve it

tulip ledge
#

alright time to make the placing of planets

#

: )

lyric mountain
#

if you want stable orbit u just need to find out the planet's escape velocity and stay below it

tulip ledge
#

that shouldn't be a problem

#

I just tested out with the biggest planet

lyric mountain
#

found it

tulip ledge
#

it stays in the orbit

lyric mountain
#

blue is a ship, black is a planet

tulip ledge
#

that's interesting

lyric mountain
#

note how depending on angle it'll be affected differently

tulip ledge
#

yeah

novel snow
#

Yeh, But how'd I loop it?

lyric mountain
#

orbital mechanics is fascinating, you'll be amazed on how interesting it is once you go down the rabbit hole

#

for instance, do try KSP if you're interested

quartz kindle
#

someone said obital mechanics? o_O

lyric mountain
#

yes tim, kaboom

quartz kindle
#

ooo awesome

zenith terrace
#

Tim no explosives for you

tulip ledge
lyric mountain
#

ye

#

they'll release a 2nd game next year, so you can hop on the hype train if you like it

blissful coral
#

looks cool ngl

opaque seal
flat copper
#

how can I decrease the size of background-image?

blissful coral
#

width and height properties

flat copper
#

position

#

?

lyric mountain
eternal osprey
#

is there an invite event? in v11 djs

solemn latch
#

not that im aware of

eternal osprey
#

hmmm. How would i ever check and log if a user invited someone then?

#

i've seen it in many bots, there must be some sort of event or way to check that

lament rock
#

If your client has perms for audit log events, you'd have to listen for that and check the type

lyric mountain
#

whichever invite get the value increased is the invite used

proven lantern
#

Has someone made a tool that turns slash command configs into documentation?

solemn latch
#

not that im aware of

split bane
#

const keepAlive = require("./server");
keepAlive();

#

What I’m supposed to put into the index

#

While using express

solemn latch
#

depends on whats in ./server

split bane
#

const express = require('express');
const server = express();

function keepAlive(){

server.get("*", function(req, res, next){
res.end('baldy')
});

server.listen(3000, ()=>{console.log("Server is Ready!")});
}

module.exports = keepAlive

blissful coral
#

Anyone in here who has knowledge of the interactions API endpoints and how to use them without a library? I am trying to respond to a button press and seem to be doing something wrong.

proven lantern
#

i use the interactions api endpoint without a library, but i've never made a button

blissful coral
#

I have the button made and the message sent, I just need to respond when someone clicks it though.

proven lantern
#

are you getting the event? it looks like a button click should call the INTERACTIONS ENDPOINT URL

blissful coral
#

Well I am using discord-rose

#

But the lib doesn't handle buttons

proven lantern
blissful coral
#

So I am listening to the INTERACTION_CREATE event

#

And its the raw data from the API

proven lantern
blissful coral
#

How can I do it with gateway?

#

Do I just need to pass auth headers or?

proven lantern
#

im not sure about doing it with gateway.

#

i think you cant

blissful coral
#

I think it said you can

proven lantern
#

docs seem to say it sends an interaction. is there such a thing as a gateway interaction?

proven lantern
blissful coral
proven lantern
#

bot token

blissful coral
#

ok

#

Getting 400 bad request?

proven lantern
#

any of the content missing required fields?

blissful coral
#

I only send back content and the type

#

Which is all I need to?

proven lantern
#

headers are in the body

blissful coral
#

Oh

#

Shit

proven lantern
#

i thought content was the body for a sec

blissful coral
#

LOL

#

Same thing

proven lantern
#

oh yeah, i always use embeds in my code

#

content needs to be a string

blissful coral
#

@proven lantern anything else I could try?

#

I think I see the problem

proven lantern
#

is the string empty?

blissful coral
#

No

#

It isn't

#

Idk what is going on tbh

proven lantern
blissful coral
#

404

#

oh wait

#

/webhooks

#

Nope, bad request again

proven lantern
#

try removing type:4

#

maybe

blissful coral
#

Nope

proven lantern
#

are you doing an ACK response first?

blissful coral
#

Docs said you didn't have to if using gateway?

proven lantern
#

oh yeah

shy turret
#

wtf is the point of the folder locales in electron

proven lantern
#

probably for localization files

blissful coral
#

kek

proven lantern
#

is the string less than 2000 characters>?

blissful coral
#

Yes

#

Maybe because I am using v9?

proven lantern
#

i am using v9

#

this.worker.user.id is the application/bot id?

blissful coral
#

yes

proven lantern
proven lantern
#

wtf

blissful coral
#

Invalid form body

proven lantern
#

oh, is the JSON.stringify needed?

blissful coral
#

Yup

#

For node-fetch atleast

proven lantern
#

try type:5

boreal iron
#

Make sure the header doesn’t require JSON as content type

blissful coral
#

Wdym

proven lantern
#

nm

#

i think the type field is needed in the body

blissful coral
#

didn't do anything

proven lantern
#

we removed it earlier

blissful coral
#

Found the raw error

boreal iron
#

I mean you might need to set the correct content type for the request to application/json

proven lantern
#

lol

blissful coral
#

damn thats annoying

proven lantern
#

good ol' fetch

blissful coral
#

Yeah'

proven lantern
#

axios has a nice api

#

return await axios.patch(`https://discord.com/api/v9/webhooks/${application_id}/${token}/messages/@original`, data, { headers: { Authorization: `Bot ${discordTokens[application_id]}` } });

blissful coral
#

Now we are getting somewhere

boreal iron
blissful coral
#

Yeah thanks

proven lantern
#

i think you had it right originally

#

type:6

#

type:5 is just an ACK

blissful coral
#

Nah same thing when I do that too

boreal iron
#

An endpoint is not supposed to expect an image if you send an .exe file you know

proven lantern
#

type 7?

blissful coral
#

Still unknown

boreal iron
blissful coral
proven lantern
#

maybe the original url you used

blissful coral
#

/interactions/id /token/callback

boreal iron
#

Do you reply within 4s?

proven lantern
#

hi

blissful coral
#

Doesn't matter for a gateway connection

proven lantern
#

PATCH/webhooks/{application.id}/{interaction.token}/messages/@original ?

boreal iron
#

I’m sure I read somewhere the interaction webhooks are available for 4 s only until they’re invalid

blissful coral
#

Ok

boreal iron
#

Maybe I didn’t read well, who knows

blissful coral
#

15m

#

its 4s if you don't send a ACK back when using webhooks

#

With gateway its fine

proven lantern
#

nice!

blissful coral
#

???

proven lantern
#

getting close

blissful coral
#

Yeah

#

How is it empty doe

boreal iron
#

You’re probably missing a property

#

The question is which one

blissful coral
proven lantern
#

you can either use content or embeds

#

so it should be happy

blissful coral
#

I am using content

#

Yeah

#

Do I need to put it inside data: { }

#

LMAO

proven lantern
#

i can see things

blissful coral
#

Well

#

I found the problem

#

It was that it was not inside a data tag

proven lantern
#

i cant believe i missed that too

boreal iron
#

At least you figured it out

proven lantern
#

it was right there

blissful coral
#

Awesome

#

Working now

#

Thanks!

proven lantern
#

congrats!

blissful coral
#

I had to make all my interaction handling from scratch due to the lack of a interaction handler apart from slash commands in the lib I am using

#

Just had to figure out how KEKW

proven lantern
#

i didn't even know it was possible to handle interactions through the gateway

chilly sparrow
#

anyone have any idea what is causing this issue??? I havent changed any of my code and suddenly its been erroring out everytime it tries to send a message

proven lantern
#

maybe an issue with the bot token?

chilly sparrow
#

thing is its working in my own guild, but when others try and use commands it throws that

proven lantern
#

maybe those other guilds didnt give the bot permissions

astral lava
#

hi

chilly sparrow
#

wait I just noticed discord added a bunch more permissions on the dev portal

#

now I need to manually select "send messages"

astral lava
#

that's dumb

earnest temple
#

How can i make when the bot sends message to delete it for example in 2minutes

#

I forgot the code name

lyric mountain
#

The code name is javascript

#

Maybe java, c#, ruby, lisp, scratch, f#, ts, etc

chilly sparrow
#

discord.scratch lib when?

lyric mountain
#

You bet, it exists

#

There's a hack that allow doing http requests in scratch

jaunty ore
#

why are so many bots banned?

pallid jungle
#
2021-09-15T01:13:50.976047+00:00 app[Worker.1]:       throw new DiscordAPIError(data, res.status, request);
2021-09-15T01:13:50.976048+00:00 app[Worker.1]:             ^
2021-09-15T01:13:50.976048+00:00 app[Worker.1]: 
2021-09-15T01:13:50.976049+00:00 app[Worker.1]: DiscordAPIError: Unknown Message
2021-09-15T01:13:50.976050+00:00 app[Worker.1]:     at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:298:13)
2021-09-15T01:13:50.976050+00:00 app[Worker.1]:     at runMicrotasks (<anonymous>)
2021-09-15T01:13:50.976050+00:00 app[Worker.1]:     at processTicksAndRejections (node:internal/process/task_queues:96:5)
2021-09-15T01:13:50.976051+00:00 app[Worker.1]:     at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
2021-09-15T01:13:50.976051+00:00 app[Worker.1]:     at async MessageManager.delete (/app/node_modules/discord.js/src/managers/MessageManager.js:205:5)
2021-09-15T01:13:50.976051+00:00 app[Worker.1]:     at async Message.delete (/app/node_modules/discord.js/src/structures/Message.js:709:5) {
2021-09-15T01:13:50.976052+00:00 app[Worker.1]:   method: 'delete',
2021-09-15T01:13:50.976052+00:00 app[Worker.1]:   path: '/channels/887506152936583198/messages/887506454754496542',
2021-09-15T01:13:50.976052+00:00 app[Worker.1]:   code: 10008,
2021-09-15T01:13:50.976053+00:00 app[Worker.1]:   httpStatus: 404,
2021-09-15T01:13:50.976053+00:00 app[Worker.1]:   requestData: { json: undefined, files: [] }
2021-09-15T01:13:50.976053+00:00 app[Worker.1]: }
uneven fulcrum
#

does anyone use patreon for their bot premium perks

#

if so can u explain to me how u did it

#

like webhooks etc

lyric mountain
#

Because people don't pay attention when making stuff

#

Resulting in half-assed bots

jaunty ore
#

any discord bots?

earnest phoenix
urban slate
#

guys if i wanted to use template literals for a string for example: `This is a string which includes ${something}` but inside that string i also want to do formatting for example: `This is a string which includes ${something} and `something in code block``

#

how do i do this?

#

cause that gives me an error rn

#

so it should look something like this: `This is a string which includes ${something} and code block stuff`

#

wait

#

i just solved my own problem

#

nice

wheat mesa
#

just escape the `

crude sable
#

Hello
I need some help with coding a bot using node.js
i coded the bot but i want to make a welcome message like when the bot joins a server it will put that message
I am unable to do that
Can anyone pls help me to do that?

crude sable
earnest phoenix
lament rock
#

The bot will inherit the <@&264445053596991498> role permissions and it'd be up to server administration to properly setup their permissions

#

<@&264445053596991498> is <@&guildID> btw

lyric mountain
#

Why everyone with double @?

#

@round cove

round cove
#

Thanks

#

is discor dnot banning?

#

Hello?

lyric mountain
#

Idk, I'm still seeing it but the #general one got deleted

round cove
#

IT WONT

#

Oh

lyric mountain
#

Maybe discord ratelimited itself KEKW

round cove
#

Just needed to manually delete I guess

pale vessel
valid frigate
#

if i were to remove a role from a user when they don't have said role, what kind of error code would that warrant

#

or would discord say nah its all good

pale vessel
#

unless the role is higher/equal to the bot's highest role (even if the target member doesn't have it)

valid frigate
#

yeah that makes sense

#

ok thanks bruhzepe

worthy ivy
#

this dosnt work, even tried console logging member but nothing

compact cedar
compact cedar
#

I don't remember if I have to activate an intent on the developer panel, I'm off the pc now

#

I'll see if I can execute the command on the cell phone

earnest phoenix
worthy ivy
earnest phoenix
#

Yes

worthy ivy
#

these are my intents lol

#

i swear discord man

#

whats the intent anyway

earnest phoenix
#

There's the guild members intent which you enable in your code and on your bot page

earnest phoenix
#

No

#

On your bots page there is an option to enable the guild members privileged intent enable it and then go to ur code and add the guild members intent

compact cedar
earnest phoenix
#

Also if you're using v13

#

Enable the channel partial if you're messing with dms

#

You need it enabled if it's the bots first time dming the user

worthy ivy
#

what

#

is this correct?

earnest phoenix
#

Yes but you also need to enable it on the bot dev portal on discord

compact cedar
# worthy ivy what

Google translator is so good that it translated your text as "If this is the first time they attack the user"

#

The one above aaaa

earnest phoenix
#

If you are sending dms you also need the channel partial if you're using v13 that is

earnest phoenix
#

Yes

#

So for dms direct messages intent and channel partial

#

And it should all work

worthy ivy
#

DIRECT_MESSAGES and the CHANNEL partial?

#

this is correct?

earnest phoenix
#

Seems right to me

#

Try it and see

urban slate
#

what are partials?

earnest phoenix
#

Honestly

#

I don't even remember

#

Iirc they are just objects that aren't full

drifting shell
#

does anyone know how to make a table with just a pure number, no scale of up/down on grafana?

earnest phoenix
#

So you can have a dm object that may not have all the data it should

#

Or smth idk

#

Discordjs confuses me

earnest phoenix
urban slate
#

oh

earnest phoenix
#

It's basically just means it can be incomplete

urban slate
#

ohhhh k

#

thnx mate

earnest phoenix
#

Np

old cliff
#

Can someone explain why this is happening?
The voice state isn't updating

#

I have the GUILD_VOICE_STATE intent

#

I dragged it

earnest phoenix
#

try running the command again

#

might be skill/cache issue

old cliff
earnest phoenix
#

skill issue then

old cliff
#

fk off

#

🥲

#

anyone knows why this is happening?

hybrid cargo
#

Could be caching issue

#

I think one of my friends got the same issue on eris too like a couple of months back

#

But idk how he solved it tho

old cliff
#

hmm

#

I am getting the voiceStateUpdate but the cache isnt updating

#

cache isn't updating :/

hollow loom
#

how to delete slash commands

hollow loom
#
const 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.data.name, command);
}

set of undefined

#
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with bot latency.'),
    async execute(interaction) {
        await interaction.reply({ content: `Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ws.ping)}ms`, ephemeral: true});
    },
};
cinder patio
#

Anyone have any experience using the google docs API? I'm trying to write some text to a document, this is my request:

        await this.docs.documents.batchUpdate({
            documentId: id,
            requestBody: {
                requests: [
  { insertText: { text: 'Wow! So epic!\n', location: { index: 1 } } },
  {
    updateTextStyle: {
      range: { startIndex: 1, endIndex: 14 },
      textStyle: {
        foregroundColor: { color: { rgbColor: { blue: 89, green: 18, red: 92 } } },
        bold: true
      },
      fields: '*'
    }
  },
  { insertText: { text: 'Hello World\n\n', location: { index: 1 } } },
  {
    updateTextStyle: {
      range: { startIndex: 1, endIndex: 13 },
      textStyle: {
        foregroundColor: { color: { rgbColor: { blue: 82, green: 235, red: 52 } } }
      },
      fields: '*'
    }
  }
]
            }
        });

but I'm getting Error: Internal error encountered.. When I remove the updateTextStyle objects everything works fine, so the error is somewhere in there, but I dunno where!

flat copper
#
const Discord = require('discord.js');
const {Intents} = require("discord.js")
const client = new Discord.Client({
  intents: [
				Intents.FLAGS.GUILDS,
				Intents.FLAGS.GUILD_MEMBERS,
				Intents.FLAGS.GUILD_MESSAGES,
				Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
				Intents.FLAGS.GUILD_VOICE_STATES,
				Intents.FLAGS.DIRECT_MESSAGES
			],
});

const { setup } = require("./index")

setup({
	client: client,
	prefix: '!!',
	commands: [
		{
			name: 'hlo',
			reply: 'Hloooooo!',
			type: 'reply'
		},
		{
			name: 'boo',
			reply: 'booo!'
		}
	],
	triggers: [
		{
			name: 'hlo',
			answer: 'Hloooo',
			type: 'reply'
		}
	],
	wlcm_channel: '863395716318625822',
	leaveChannel: '',
	wlcm_embedType: true,
	wlcm_embed: {
		color: 0x0099ff,
		title: 'Welcome!',
		url: '',
		author: {
			name: 'Welcome to {guildName}',
			icon_url: "{avatarDynamic}"
		},
		description: '{user}',
		thumbnail: {
			url: '{avatarDynamic}'
		},
		image: {
			url: '{avatarDynamic}'
		},
		timestamp: new Date(),
		footer: {
			text: 'welcome {user}',
			icon_url: "{guildIcon}"
		}
	},
	wlcm_msg: 'Hlo {user}',
	leave_embedType: true,
	leave_embed: {
		title: 'byeeee {username}'
	},
	leave_msg: 'byeeeee {username}'
});
client.on('ready', () => {
	console.log('hlo ' + client.user.username);
});

client.login(' ');
earnest phoenix
#

because google sheets is better

cinder patio
#

yeah

earnest phoenix
#

w h a t

azure lake
#

Hello i Forgot how to code status to bot can someone help me with that im using node.js

#

im using Replit

civic scroll
#

@earnest phoenix when people posting their whole 2k line source code and find a problem

#

i think they meant client presence

azure lake
#

im using replit for coding

civic scroll
#

vscode + ts

#

but yeah what's the problem

azure lake
azure lake
#

pls

civic scroll
#

<Client>#setActivity -> text status
<Client>#setPresence -> online / dnd / ...

urban slate
#

(client.user.setActivity("status", {type: 'WATCHING'}))

#

thats how i have it

#

like its a a bit different but this is the thing that does the actual stuff ig

#

i dont remember much

#

@azure lake

hollow loom
#

set of undefined

civic scroll
#

what

#

what error

#

pardon

urban slate
#

no like can u send the screen shot of error

civic scroll
#

ah

hollow loom
civic scroll
#

commands property doesn't exist on client

spark flint
civic scroll
civic scroll
#

use typescript, you won't bump into this heck

hollow loom
#

i have this doe

urban slate
civic scroll
hollow loom
#

ty

civic scroll
#

add this line before the fs#readdirSync

#

man forgot to assign props

hollow loom
#

k it works

civic scroll
#

it should

#

also split up code

#

if you import as a whole, you are basically patch up a bunch of code you don't use thus slowing it down

#

but small scale whatever

earnest phoenix
#

what happens if you say ur mom to xiuh's daughter

cinder patio
#

google docs API: I'm trying to create a table and insert text inside the table's cells in one API call. I've read online that the row index offset is 5 and the column index offset is 2, but I'm getting the error: Invalid requests[5].insertText: The insertion index must be inside the bounds of an existing paragraph. You can still create new paragraphs by inserting newlines.

This is the code which inserts the rows and cols text:

        let ind = 0;
        for (const row of rows) {
            // row index offset
            ind += 5;
            for (const col of row) { 
                // col is an array with an insertText object and an optional updateTextStyle object
                col[0].insertText.location.index = ind;
                if (col[1]) {
                    col[1].updateTextStyle.range.startIndex = ind;
                    col[1].updateTextStyle.range.endIndex += ind;
                }
                obj.push(...col);
                // text length + column index offset
                ind += col[0].insertText.text.length + 2;
            }
        }

And this is what the final requests object:

[
  { insertTable: { rows: 3, columns: 3, location: { index: 1 } } },
  { insertText: { text: 'Name', location: { index: 5 } } },
  { insertText: { text: 'Role', location: { index: 11 } } },
  { insertText: { text: 'Targets', location: { index: 17 } } },
  { insertText: { text: 'Google', location: { index: 31 } } },
  { insertText: { text: 'Sheriff', location: { index: 39 } } },
  { insertText: { text: 'None', location: { index: 48 } } },
  { insertText: { text: 'Sal', location: { index: 59 } } },
  { insertText: { text: 'Goon', location: { index: 64 } } },
  { insertText: { text: 'Google', location: { index: 70 } } },
  // There is more but the error is happening at the "Sheriff"
modest kettle
#

How do I make the vote detection system on top.gg?

earnest phoenix
old cliff
#

how much time does it usually take for a guild to be available to send a message after the guildCreate event?

hybrid cargo
quartz kindle
#

^

#

you dont even need to login to the gateway to send messages

lyric mountain
#

aaaand we have a fourth

old cliff
#

geez

slender wagon
#

so um i am working on a array list on vsc and i am using a theme

#

when i get past 1003 or smthn character the text of the array list loses color

#

is that normal or?

lyric mountain
#

why u have 1003 characters in an array list?

#

actually, why is it hardcoded?

slender wagon
#

it's hashtags

#

an array*

#

not array list

#

my bad

#

setting in different categories of hashtags and making a randomiser

lyric mountain
#

is the whole array a single string?

slender wagon
#

no?

quartz kindle
#

vsc auto-disables syntax highlighting on very large files

#

idk if you can configure the threshold somewhere

#

but usually "very large files" are like millions of lines

lyric mountain
#

what else is in that array?

#

maybe vsc also disables syntax highlighting for very long strings

slender wagon
#

yup i think that's the case

#

cuz i just ran the code and it is working perfectly

#

a single string would be if the array only had one ' '

#

right?

lyric mountain
#

no

#

well, yeah maybe, show an example

slender wagon
#

so basically

lyric mountain
#

['abcd']

slender wagon
#

i got four of those ['L','O','L']

#

so not a single string

#

right?

lyric mountain
#

ye

slender wagon
#

i wouldn't use an array if it was a single string lmao

lyric mountain
#

but why do you have such a long string in an array?

slender wagon
#

it's instagram hashtags

lyric mountain
#

1003 chars worth of hashtags?

slender wagon
#

it picks only one

#

yeah i want different hashtags on all the posts

lyric mountain
#

wouldn't it be better if you had 1 hashtag per array element?

solemn latch
#

If it works it works 🤷‍♂️

slender wagon
#

1 post can have 30 hashtags

#

so it wouldn't be worht it

#

worth it

delicate shore
#

How to remove this from github pages??

lyric mountain
#

I mean, you could just grab 30 random elements

delicate shore
#

the ./porftolio part

lyric mountain
#

that way you'd have 30 randomized hashtags

#

instead of 4 presets

slender wagon
#

no no

#

those are packs of hashtags i took from somewhere

#

and combined help alot

lyric mountain
#

ok then

slender wagon
#

thx

lyric mountain
quartz kindle
#

you should be able to can

lyric mountain
#

but take that with a grain of salt, it's been ages since I used ghpages

#

didn't u write the source code?

slender wagon
#

😂

quartz kindle
#

yes

delicate shore
#

it's no where there

lyric mountain
#

inspect element -> find class -> visibility: hidden

urban slate
lyric mountain
#

add the css to ur source code

urban slate
#

what are some more examples of api abuse?

lyric mountain
urban slate
#

thnx

grim aspen
quartz kindle
#

remember when discord introduced the 1 hour ban on 10k invalid requests?

quartz kindle
#

they said some bot was doing 300k invalid requests per hour for no reason

urban slate
#

lol

urban slate
#

also whats rate limit?

lyric mountain
#

read the link I sent, that's the official api tos

urban slate
lyric mountain
#

it is

grim aspen
lyric mountain
#

that's called terms of service

#

aka "what you can do and what you can't"

urban slate
lyric mountain
urban slate
#

so the bot rate limits the users?

lyric mountain
#

ratelimit is how frequently you can do something

grim aspen
#

from discord tos: you've tried a specific action on Discord too many times, without much of an interval between attempts.

#

so you would get limited on the amount of messages/requests your bot can send through api

lyric mountain
#

not only messages

#

everything you do on discord has a specific ratelimit

grim aspen
#

basically

urban slate
#

ohh

#

also can someone explain me this?

#

can you like not advertise your brand?

#

or the bot owners website?

grim aspen
#

so basically for a brand you can't put a brand logo as your bot's pfp

#

considered trademark infridgement

lyric mountain
#

basically by using the api you don't get rights to use discord brand nor they get rights to use yours

urban slate
#

ohhhhhhhhhhhhh

#

got it

lyric mountain
#

you can put a logo on your pfp, you just cant use discord or any other branding as if you owned it

#

except if you get explicit permission to do so

grim aspen
#

i thought it wasn't allowed

lyric mountain
#

it is, you just can't do so without permission

urban slate
lyric mountain
#

like, using youtube branding without them allowing

grim aspen
#

skullbite's bot was given a cease and desist for using spotify logo and having the name spotify

lyric mountain
#

they probably didn't allow it

urban slate
#

well that would have been obvious

#

is this why groovy got shut down?

lyric mountain
#

pirating

urban slate
#

ahhhh

#

yea technically

lyric mountain
#

or "unauthorized content sharing/reproduction" to be specific

grim aspen
#

youtube started cease and desisting discord bots basically due to what kuu said

urban slate
#

but

#

what will the other music bots use now?

#

like they wont go for youtube

lyric mountain
#

until they get caught, exist

urban slate
#

hmmm

lyric mountain
#

there's nothing you can do against it, the devs are the wrongdoing party

urban slate
#

yea

grim aspen
#

there's nothing really to be done, once every bot is taken down for youtube policies. game over

urban slate
#

thats sad

grim aspen
#

well i mean every bot that uses youtube

urban slate
#

not being able to listen to music with me mates

#

i cant type

#

you guys got any tips to get my bot into more servers?

#

i legit dont know what else i can do

#

i have already added it to multiple server lists

grim aspen
#

i believe there is an auctions

urban slate
#

hmm yea

grim aspen
lyric mountain
#

have your users like it and they'll eventually advertise for you

urban slate
#

yeaaaa

#

well i will just hope for the best then lol

lyric mountain
#

@round cove sixth

dreamy blaze
#

Is the server search still under development on the website?

lyric mountain
#

no, it's just buggy until they finish migration

dreamy blaze
#

ok, so voting will push servers to the top for searches again soon?

lyric mountain
#

kinda, the sorting is not 100% voting

#

it also includes relevance to the search query and popularity

dreamy blaze
#

we have apex in the tags, short desc., long desc and about 40 votes and we used to be page 1 before migration, but now we don't seem to exist in searches?same for rocket league and other tags we have

feral aspen
#

How can I handle this?

let lookup = await dictionary.find(a);
if (!lookup) return console.log("An error has occured while trying to search for this word.");
#

If it errored in the .find(), I can't handle it since it just crashes.

pale vessel
#

await dictionary.find(a).catch(() => null);

urban slate
feral aspen
#

Ah.. woops.

#

My bad.. it worked. 👍

feral aspen
lyric mountain
#

searching is not working as it's supposed to be currently

dreamy blaze
#

oki dokie, ty for the heads up

feral aspen
#
let lookup = await dictionary.find(a).catch(() => null);
if (!lookup) return console.log("\nThe word you entered is invalid.");
else console.log(`\nThe search system was able to find results for the inputted word, "${a}".\n`); // Return a message stating that it has found results for the word.

lookup.then((res) => {
    console.log(JSON.stringify(res, null, 4));
}, (err) => console.log(err));
#

There are times whereas .then() is not a function.

quartz kindle
#

if you use await, then you cant use .then at the same time

feral aspen
#

Oh, really?

quartz kindle
#

unless you make a copy

feral aspen
#

Ah.. just stringifying a return value so, for sure. 👍

quartz kindle
#

.find returns a promise, so you can do promise.then

#

but if you await it, its not a promise anymore

feral aspen
#

Ohh.. alright.

#

Yeah.. I'll remove the await temporarily just to see the entire object value then get it back.

#

.. or redefine a variable using the find method without the await then add then.

#

Edit: Solved.

feral aspen
#

Anyone knows some npm that searches for the antonym of a word since all the ones I found online are not working.

spark flint
feral aspen
#

That's synonyms. 👀

#

Let me check..

spark flint
#

It has the "antonym" tag

feral aspen
#

Oh.. let me perform the search method, then.

feral aspen
#

An empty array was returned. 👀

spark flint
#

Ah

#

Lemme try find another

feral aspen
#

There is no other one, though.

spark flint
#

Uses thesaurus.com to look up synonyms and, if available, antonyms.

feral aspen
#

thesaurus-com also does the same, and some other guy forked it and called it thesaurus-dom.

#

Same design.. tf.

#

Empty Arrays.

wooden kindle
#

does any1 know the API for the tweet command in discord.js so u can create a tweet then it comes out as embed

quartz kindle
split hazel
#

lmao

#

a spare utility function in djs which lets you tweet

feral aspen
#

God dammit.

wooden kindle
#

this thing

rose warren
#

twitcord.js

pale vessel
quartz kindle
#

dafuq lmao

feral aspen
#

Tf

pale vessel
#

that was a joke

#

there is no such thing

#

Sorry :|

quartz kindle
#

its just an empty page xD

feral aspen
#

You just ruined his hype. 😂

split hazel
#

tim trolled successfully

quartz kindle
#

i knew it was a joke

#

but i had to confirm

rose warren
#

Tim be like "wait did I forget to put this in my Discord lib?" 👀

quartz kindle
#

ew no

pale vessel
#

Tfw the lib is so bloated it seemed possible at first /s

feral aspen
#

Anyone knows some type of antonym npm or something...

#

All the ones I found are returning empty arrays.

spark flint
#

that means there is no available acronym

feral aspen
#

Not ancronym, antonym.

lyric mountain
#

is there really an antonym lib?

feral aspen
#

I never found one.. 😦

lyric mountain
#

thought so, it's not something logically doable

#

unless you manually define antonyms for everything like dictionaries do

feral aspen
#

YIKES.

solemn latch
#

might be more helpful to log the status code

wooden kindle
#

@solemn latch please change ur name

solemn latch
#

👍

lunar lance
#

how do i fix this?

lyric mountain
#

error is probably not happening there

#

show the whole stacktrace

lunar lance
#

whats that?

lyric mountain
#

the full error message

lunar lance
lyric mountain
#

you need to supply a role into add_roles instead of the id

lunar lance
#

and what would that look like?

#

just the name of the role?

lyric mountain
#

no, the role object

#

you need to fetch it

lunar lance
#

?

#

oh

#

how do i do that

lyric mountain
lunar lance
#

(sorry for the constant questions i am new to python)

#

alr ty

lyric mountain
#

btw, iirc discord.py is abandonware, keep that in mind

lunar lance
lyric mountain
#

abandoned library

lunar lance
#

oh so not up to date?

lyric mountain
#

means it'll no longer stay updated to api changes

#

author gave up on it

lunar lance
#

ah ok

#

so like this?

feral aspen
#

What npm can I use to read from https://api.dictionaryapi.dev/api/v2/entries/en/happy. Aka.. god dammit finally found one.

solemn latch
#

you can just use the default https module

feral aspen
#

How does that work? I want to convert it to an object I can use.

solemn latch
lyric mountain
#

ye, it returns a json like any other api

feral aspen
#

Alright.. it logged it now, but as a string. 👀

#
const https = require('https');
https.get(`https://api.dictionaryapi.dev/api/v2/entries/en/${a}`, (response) => {
    let data = '';
    response.on('data', (chunk) => {
        data += chunk;
    });
    response.on('end', () => {
        console.log(data);
    });
});
lyric mountain
#

parse it

#

JSON.parse(data)

feral aspen
#

SyntaxError: Unexpected end of JSON input

#
let lol = JSON.parse(data);
console.log(lol);
lyric mountain
#

put the string here

#

see if the json has something missing

feral aspen
#

Valid Json

lyric mountain
#

hm

#

you tried the string stored in data right?

feral aspen
#

Hm.. I tried an online npm playground, same error.

feral aspen
lyric mountain
#

console.log(data)

#

then put that in jsonlint

feral aspen
#

That's what I did...

lunar lance
feral aspen
#
const https = require('https');

https.get(`https://api.dictionaryapi.dev/api/v2/entries/en/${a}`, (response) => {
    let data = '';
    response.on('data', (chunk) => {
        data += chunk;
    });

    response.on('end', () => {
        console.log(data);
    });

    let lol = JSON.parse(data);
    console.log(lol);
});

Using data in the console.log(data), I added to that website the output, it gave an error.

#

Let me try again.

lyric mountain
lyric mountain
#

you need to put inside 'end' event

lunar lance
#

it just did this

lyric mountain
#

else it'll try to parse an empty string

lyric mountain
#

don't just copypaste stuff you see online

lunar lance
#

what is define guild

feral aspen
#

Ayy.. it worked. 👍

lyric mountain
lyric mountain
#

you lack some fundamental knowledge that'll be required to properly make a bot

solemn latch
#

op

lunar lance
#

i just wanna make a bot too

lyric mountain
#

but you can't just skip steps

lunar lance
#

wdym

lyric mountain
#

ik making bots is fun and all, but you're putting the wagon in front of the horse

drifting wedge