#development

1 messages ยท Page 1081 of 1

digital ibex
#

what

#

ok

#

nvm

loud matrix
#

not webdev i think

digital ibex
#

how did u get that data?

#

like what url did u use

loud matrix
#

(website)/api

#

the intended gateway

digital ibex
#

then require('node-fetch')('(website)/api')

loud matrix
#

how do I get it to print the response body?

digital ibex
#
const bob = await require('node-fetch')('website/api').then((e) => e.json()).then((e) => { return e; });
console.log(bob);
``` you may need headers and body, but thats the basic template kinda thing
loud matrix
digital ibex
#

its an object

#

yes blu

#

no

#

idk what ur stuff is

quartz kindle
#

if you know how to use express, then you know how to do it

#

its simple

#

then learn a bit about express, follow some tutorials

thick gull
#
     message.reply(`Hey! Calm down! You've got ${timeLeft.toFixed(1)} more second(s) before you can use \`${command.name}\`.`);
            .then(msg => {
                    msg.delete({timeout: 5000 })
                })

at the .then "decleration or statement expected"
its probably very obvious why, but im not thinking rn, am I doing this wrong?

quartz kindle
thick gull
#

o h

#

thank you

celest schooner
#

can someone help me optmize my bot for ram

#

i have my git repo if u want it

sick cloud
#

do you use discord.js

celest schooner
#

yes

sick cloud
#

move to discord.js-light or mode to eris

#

then you're done

celest schooner
#

got it

sick cloud
#

@earnest phoenix?

#

so change homepage.html to stats.html

#

then it'll send you to it

#

that's where your files are located

#

do you even get how express works

honest perch
#

Read docs

earnest phoenix
#
const yt = require('simple-youtube-api');
bot.youtubeAPI = new yt(key);

If I call bot.youtubeAPI, is that creating new instances?

honest perch
#

Has anyone else had issues with lavalink not working with text search

#

So links work

#

But normal search does not

quaint hornet
#

my friend have a bot and he's bot have a lock command, but for bot can change the channel permissions it need a admin permission, without that permission discord says dont have permission to do that, but why if the bot already have permission to change channel permissions?

honest perch
#

It doesn't need admin perms

quaint hornet
#

without that permission it says: HTTP 403 Forbidden, {"message": "Missing Permissions", "code": 50013}

honest perch
#

Then give it the correct permissions

quaint hornet
#

thats the bot permission

sudden geyser
#

might want to hide your token @crystal socket

crystal socket
#

oh crap

sudden geyser
#

You're probably missing the colon after the function closing )

crystal socket
#

oh yeah forgot it thanks

quaint hornet
#

whats wrong with my permissions?

sudden geyser
#

It's hard to explain Discord's role hierarchy flow which may be the issue here, so (if it is), please look at this article: https://support.discord.com/hc/en-us/articles/214836687-Role-Management-101.

It could also be based around "what" you're exactly trying to change. For example, trying to change a text channel's permissions when you can't yourself (or just a plain logical error).

quaint hornet
#

its trying to change a user permission to send message

#

the hierarchy is correct

#

the bot is on top of the users who will lost that permision

dark vapor
#

not sure if this is something to do with my code

slender thistle
dark vapor
#

oh okay

lament rock
#

@dark vapor you should also reset your client's token, The first few lines of stack trace reveal it

quaint hornet
#

we discorver the problem, apperently the category have to have the change channel permission too

dark vapor
#

oh shit

#

noone saw that

lament rock
#

For requesting track info from Spotify, are you able to extract artist name and name of track without needing an auth code or do you actually need to go through an Oauth flow just to be able to get track info

digital ibex
#

if its ur token

#

@dark vapor i'd regen it since theres most likely logs which log when messages are deleted with the content of the message and like 20 people have access to it, even if they are mods they're still normal people

#

@lament rock use an api

lament rock
#

TaigaFacepalm that's what I'm trying to do. Why do you think I'm asking this info about Spotify's API

slender thistle
#

iirc I had to use OAuth flow for that

#

Don't take my word for granted as I don't remember exactly what I did last time I used Spotify's API

lament rock
#

After the initial grant, would the system be able to fully automate itself or would someone constantly have to re-grant the auth code

crystal socket
#

@earnest phoenix can you dm me your css please

#

thx

dark vapor
#

@digital ibex I regened it thanks!

slender thistle
#

After the initial grant, would the system be able to fully automate itself or would someone constantly have to re-grant the auth code
I'd suggest reading the docs on how long your token will be valid

#

Or maybe a way set it to never expire

crimson vapor
#

@earnest phoenix in your bot description, you have text as white, which is invisible, you should change that as it adds a character count to your bot description without showing anything

crystal stream
#

Good night :ะท

#

5:25

digital ibex
#

hi

#

how can I check if i get this error code? { message: 'Unknown User', code: 10013 } "10013" ?

earnest phoenix
#

how can i start create my own bot

swift void
swift void
#
const talkedRecently = new Set();
 if (talkedRecently.has(msg.author.id)) {
    msg.channel.send("You can give reputation once every hour. - " + msg.author);
} else {
        
        talkedRecently.add(msg.author.id);
        setTimeout(() => {
        
          talkedRecently.delete(msg.author.id);
        }, 7200000); 
    }
#

it doesn't send "You can give reputation...."

ancient nova
#

What was The command to check the queue

swift void
#

what queue

ancient nova
#

The bot queue

swift void
#

huh

ancient nova
#

Like to be verified

swift void
#

ah

#

-busy mods

sudden geyser
#

There is no command.

split nova
#

@swift void try a comma instead of plus

#

so
msg.channel.send("You can give reputation once every hour. - " , msg.author);

#

if that doesnt work make it a var

#
message = "You can give reputation once every hour. - " + msg.author"
msg.channel.send(message);
#

and make it a comma again

swift void
#

alright thanks

digital ibex
#

what

#

thats not how you manipulate strings...

distant plank
#

How can I get that when my bot does multiple reactions it is a message, it does it fast ?, Because it currently takes 2 seconds per reaction

low shard
#

Hi i use cubes hosting , and after 10h

#

My bot is down

#

Idk why

#

I see in console some big shit error

digital ibex
#

debug your code

low shard
#

Not error in the code

digital ibex
#

we cant do it for u

#

contact ur provider then

low shard
#

@digital ibex i dont say do it

split nova
#

@distant plank discord rate limiting , you probs cant change the speed

low shard
#

I say if you can to help me

#

?

#

What do do

#

To *

digital ibex
#

its nothing we can do unless theres someone here who works or maintains for ur provider

#

have u contacted them?

low shard
#

Yes

split nova
#

@low shard send the error

low shard
#

Its like

#

Discord gg

#

Shit error

#

I will sent it in dms

#

Ok?

split nova
#

yh ok

low shard
#

I go to my pc

digital ibex
#

have you done any debugging at all?

indigo stone
#

help my bot not here

swift void
#

your bot must be approved first

indigo stone
#

your bot must be approved first
@swift void how

#

how long

swift void
#

-busy mods

indigo stone
#

oh

#

ok

timber linden
#

I need help with this rq

#

I'm making economy

#

But as I do this

#

setVar[money;$sum[$getVar[money;$mentioned[1]];$noMentionMessage];$mentioned[1]]

#

There's a money var

#

Oops wrong server

sonic copper
#

Anyone remember what the max amount of time my bot has to wait before updating it's presence without it being considered API abuse?

wary flame
#

There are no clear api abuse limits, you should consider yourself if what you are doing would be "api abuse" or not

#

@sonic copper

#

Bottom of the page

sonic copper
#

Alrighty. Was wanting to set up an interval that updated the server count. just wanted to make sure I didn't break any rules by making it too quick

split nova
#

nah it wouldnt matter , better antispam has over 96k servers atm, it updates usually every 12 hours i think

sonic copper
#

Alrighty. Thanks for the help, yall!

wary flame
#

use a templating language

#

Personally I like ejs but handlebars should also work

low shard
#

I need good hosting for bot

#

Someone have ? Cheap. And Good

crystal socket
#

yep

low shard
#

@crystal socket what?

crystal socket
#

@low shard use galaxy gate

low shard
#

Link ?

crystal socket
#

its designed for discord

low shard
#

In dms

earnest phoenix
#

hi

delicate shore
#

hey

#

by which command can my bot

#

show name of guilds

#

it is in

#

something like this

sonic lodge
#

all guild objects have the name property

frank jackal
#

Quick question.. using discord.py what is the best way to get any of the standard emojis as an object to have the bot add as a reaction?
For example 1๏ธโƒฃ

stiff stream
#

@frank jackal i know only on js

frank jackal
#

@stiff stream what's the js way? I will seei f it helps anyway :)

stiff stream
#

ok so you want the bot to react to your message? or that the bot send something and you want him to react to him self?

#

@frank jackal

#

??????

frank jackal
#

Send something and react to itself. I can do it already but currently I have the emoji in the code.. I would rather use an id or something than actually pasting the emoji in the code

stiff stream
#

btw to paste the emoji you need \emoji

#

\๐Ÿ‘

#
        message.react("โœ…")
        message.react("โŒ")
      })
#

@frank jackal

frank jackal
#

Ok so just having the emoji directly in there is the best way then?

stiff stream
#

yeah

earnest phoenix
#

unfortunately you cannot have it dynamically lookup without a baked in map

stiff stream
#

to paste him you need to do \ before him

frank jackal
#

What do you mean by \emoji?

stiff stream
#

\๐Ÿ’ฏ

earnest phoenix
stiff stream
frank jackal
#

:one:

stiff stream
#

not like that

#

\

#

and push the emoji button

#

and choose one

frank jackal
#

@earnest phoenix thanks for the link :)

stiff stream
#

\1๏ธโƒฃ

#

but its not working with numbers

#

i guess

frank jackal
#

:one:

earnest phoenix
#

number emojis are consisted of two different characters

#

number + keycap

#

that's why escaping doesn't work

frank jackal
#

:weary:

stiff stream
#

\๐Ÿ˜ฉ

earnest phoenix
#

escaping on mobile doesn't work either

frank jackal
#

I don't understand why I need to exacpe it?

earnest phoenix
#

so you can get the unicode counterpart

stiff stream
#

^^

earnest phoenix
#

anyways you can use the map i sent you

frank jackal
#

Ok and I use the unicode to do?
I will look at the map

stiff stream
earnest phoenix
#

discord requires unicode to be sent at the create reaction endpoint

#

you cannot use colon emojis

#

exception are custom emojis

#

ron can you stop spamming emojis

#

it's annoying

stiff stream
#

lol sorry

frank jackal
#

Ok thanks. So I can escape the emoji then copy the result and paste it isn't my code to use?

#

Also appreciate the assit

open oracle
#

(With Discord js) how/can I take a post from r/ShowerThoughts?

#

like post a post from r/showerthoughts

#

when someone says a command

restive furnace
#

api

#

in short: use a thing like "node-fetch" and fetch memes from reddit and yeah.

lusty quest
#

reddit has a api. you can accessing it by adding .json at the end of the url

#

https://www.reddit.com/r/memes.json?sort=hot this as example access r/memes and sort for hot

#

when you paste this in your Browser you get a large Json file with posts. then just sort out the path in your code to display the postst

wheat saddle
#

hi

viral iris
#

is there way to show boosts level in server ?
like Boosts: 0/30 (Tier 0)

open oracle
#

ok thx everyone

lusty quest
#

i think there is a way

crystal stream
#

@lusty quest, You can ask you in dm about verification?

lusty quest
pale vessel
#

premiumSubscriptionCount, premiumTier

#

o

lusty quest
#

@crystal stream why?

crystal stream
#

Or here

sick merlin
#

Hey,
I Need A Bot That Can Automatically Purge Messages After Some Time, For Free

lusty quest
#

r/choosenbeggars

crystal stream
#

If the servers on which the bot is installed are empty, will the discord count them?

#

For verification

lusty quest
#

if you artifical do it you get flagged and need 250 Guilds. not sure what happens after this

viral iris
#

how to show boosts level in embed ?

lusty quest
#

use this to get the count and just parse it to a embed

crystal stream
#

If the servers on which the bot is installed are empty, will the discord count them?
@lusty quest

crystal stream
#

I mean to get the bot verified

lusty quest
#

its possible but idk if they check the owner of the guilds. if they do you will get rejected

crystal stream
#

Okey, thz :ะท

tight plinth
#

if you artifical do it you get flagged and need 250 Guilds. not sure what happens after this
@lusty quest no. Let's say we're after October 7th,and your bot reaches 75 servers. Normally, your bot is capped at 100 servers, but if it's an anormal growth you get capped at 250

inner quarry
#

It affects all bots right?

tight plinth
#

Yes, but not for now

fleet jungle
tight plinth
#

Wait 3+ weeks

pure lion
#

Okay I'm making a dashboard

#

But uh

#

:d

fleet jungle
tight plinth
#

Yep

pure lion
#

Does anyone know a way to send data from backed to frontend?

lime pumice
pure lion
#

Remove a .

lime pumice
#

?

#

what a?

pure lion
#

.

#

^

#

That thing

fleet jungle
#

Umm

#

I make music bot on glitch :v

pure lion
#

Please don't use glitch

#

Either host at home or buy a vps

crystal socket
#

^ dont host at home

#

just buy a vps

fleet jungle
#

My bot already on 24/7

crystal socket
#

doesn't matter

#

glitch is just bad

pure lion
#

Trivia are you py?

crystal socket
#

yes

fleet jungle
#

Me host using script

crystal socket
#

but i have other bots in js

pure lion
#

Fuck

#

Oh

#

Can you express.js?

crystal socket
#

yeah

pure lion
#

Eeee

#

Any tips?

#

Or basically how the fuck do I set up stuff

crystal socket
pure lion
#

Thanks

lime pumice
#

@pure lion r u telling me?

pure lion
#

Would that go in an index?

#

@lime pumice remove a full stop (.)

#

Haha boob funny

lime pumice
#

@pure lion in node .

#

?

pure lion
#

No

#

../

#

Remove one .

lime pumice
#

m not getting u

#

should i show my index file?

tight plinth
#

Quick question: did you write this code

lime pumice
#

yes i did

tight plinth
#

U sure?

lime pumice
#

110%

crystal socket
#

i'm pretty sure i've seen it before

tight plinth
#

If you did you'd be able to solve this error

crystal socket
#

oh yeah

#

its a public example

#

in the d.js gh

tight plinth
#

Lol

crystal socket
#

110%
@lime pumice nice

honest perch
#

Can someone who has used lavalink help me, whenever I query using text it returns not found

#

But links work

golden condor
#

Wdym

honest perch
#

So when I do !play song name it returns not found

#

But if I use a url it works fine

golden condor
#

What lib do u use

honest perch
#

Djs and erela.js

golden condor
#

I get this issue sometimes when using a different library but using shoukaku never had this issue for me for some reason

honest perch
#

Thanks, I'll try to use that lib then

golden condor
#

Np

pure lion
#

How do I send from the frontend to the backend?

earnest phoenix
#

expose an API endpoint on your backend server and hit it from frontend

#

you should obviously make it secure

#

CSRF tokens, authorization etc

sick cloud
#

i have two values, {transferred: 2785264, total: 4853128}, how do i try turn that into a % value like 50%

restive furnace
#

% 100 would work

sick cloud
#

wdym

restive furnace
#

8273727 % 100

#

for example

earnest phoenix
#

i have two values, {transferred: 2785264, total: 4853128}, how do i try turn that into a % value like 50%
@sick cloud
that's... basic maths amount/total * 100

sick cloud
#

but like if i have those two values how do i use them where

#

oh ok

earnest phoenix
#

do you not know how to calculate percentages Thonk

sick cloud
#

i don't have a use to do it much

earnest phoenix
#

neither do i but im genuinely surprised

#

that's like 3rd grade maths

pure lion
#

How can I use the oauth2 scope ID thingy to get info?

earnest phoenix
#

what

pure lion
#

Idk either

sick cloud
#

... well i'm sorry but we didn't do percentages in grade 3

#

in fact i did barely any math in early school

earnest phoenix
#

you should consider brushing up on maths

#

a few days ago you didn't know how to turn a number into a negative

pure lion
#

:o

earnest phoenix
#

anyways, dice, are you aware of how oauth works

sick cloud
#

so i'm an idiot

#

why does that matter to you

#

pro tip: it doesn't

earnest phoenix
#

what

#

i never implied that

#

i suggested you should brush up on maths since it's an essential part of being a developer in the first place

#

you're going to constantly use it

slender thistle
#

We never went through percentages in school either kek

#

Still have to Google it to this day KEKW

earnest phoenix
#

oh wow

#

epic education system 10/10

#

we covered percentages alongside fractions

sick cloud
#

i didn't end up covering fractions until a repeater course in grade 5

#

i spent like <50% of my primary school time in the classroom

pure lion
#

Cry, not at all

tight plinth
#

Ew school

earnest phoenix
#

aight im going to give you a crash course then a few resources

sick cloud
#

ok sure

earnest phoenix
#

oh not fractions, i was talking to dice for oauth

#

:p

sick cloud
#
  • o h*
#

right ok

#

oauth2 is fun

slender thistle
#

Teaching fractions outside of school mmulu

tight plinth
#

@sick cloud if you want to learn maths go to YouTube and search what you need

#

I did this for my entire school year, it worked

pure lion
#

e

#

Crash course is fun

earnest phoenix
#

anyways dice, you need to have a backend server. oauth is controlled by user decisions, the user can choose to either authorize your app or not authorize your app. there's two ways to do this, authorization code grant and implicit grant. i would personally suggest authorization code grant since it is MUCH more secure and you reduce the risks of hijacking.

tldr your user goes through the authorization screen, if they accept they get redirected to the redirect URI you set with a ?code= url parameter, you can then take that code out of the URL and exchange it for an access token (https://discord.com/developers/docs/topics/oauth2#authorization-code-grant)

the access token that gets returned is a bearer token for the user which you can use to, for example, get info about them (https://discord.com/developers/docs/resources/user#get-current-user)

pure lion
#

I already have a backend server with my website, using ejs

earnest phoenix
pure lion
#

And I have redirected to oauth2 and can see my ?code=

earnest phoenix
pure lion
#

Oooooo

#

Is that how I get data?

earnest phoenix
#

with that token you'll be able to get the data yes

#

re-read my message i explained how to

pure lion
#

Alright, thanks so much :>

#

Also unrelated, how do I res.send to update an element?

earnest phoenix
#

don't know i don't use node as my backend

pure lion
#

Oh alright

earnest phoenix
#

my forte is usually an asp.net core backend server (c#) + react frontend (ts which is compiled down to js)

pure lion
#

How do you do it in your context tho?

sick cloud
#

@pure lion once you've sent content you can't update it again unless you re-render the page, aka reload

pure lion
#

So I do 1st page that shows up, then a login button that redirects the oauth2, then second page with extra info?

earnest phoenix
#

see, i don't send any content, my frontend is react so it's statically served, content on the frontend changes based on API requests to my backend

pure lion
#

Ah got it

earnest phoenix
#

so it's different than using templating languages

pure lion
#

:sad:

earnest phoenix
#

also a big tip

#

if you're planning to launch it to the public, don't forget to implement the state parameter

slender thistle
#

How would state be generated and how exactly does one utilize it on the backend?

pure lion
#

Yeah that's a good question, what does the state Param do?

earnest phoenix
#

tldr it allows you to verify that the login is actually coming from your website and not from a foreign one (a hijacking attempt)

#

not using state exposes you to a CSRF attack

slender thistle
#

Makes sense

weary ridge
#

reeeeeeee

pure lion
#

Yeah makes sense

#

Would I need to use req anywhere?

sick cloud
#

discordjs.guide explains it well @pure lion

barren basin
#

Hello, can someone help me ? My bot have to send an embed message but it takes a long time and i don't understand why

digital ibex
#

code?

#

well i mean

#

it could be for loads of reasons thats happening

barren basin
#
var message_embed = new Discord.MessageEmbed().setColor(0x8dd4ff).setDescription(description).attachFiles([im]).setImage('attachment://'+im_name);
channel.send(message_embed);
#

I have to eat, please send me a pm i'll read it later

earnest phoenix
#

This place is better than school and stackoverflow

warped jay
#

fixed the issue with my bot

#

where do I need to tell, to unmute my bot?

earnest phoenix
warped jay
#

ok

stiff stream
#

why its not sending the name?

sinful belfry
#

lowercase U for username

#

also

#

it is message.author.username

stiff stream
#

k

#

ty

sinful belfry
#
stiff stream
#

ok

#

but

#

any ideas what i should add to this command?

wary flame
#

Can someone help me with running my nodejs discord bot on docker?

silver dust
#

Thanks

#

Fixed it

signal wagon
#

@stiff stream why not just use .setTimestamp

silver dust
#

Just made a prefix for my bot

#

didn't take me that much time

#

But node index.js was not working

#

but fixed it

stiff stream
#

thats easy

#

const PREFIX = "(the prefix)";

silver dust
#

ye

#

Needed to redownload nodejs

#

๐Ÿ˜”

violet nimbus
#

@stiff stream add user id

silver dust
#

Can someone help me with running my nodejs discord bot on docker?
@wary flame never used docker so idk

violet nimbus
#

dm me later ill give you some more ideas i need to go rn @stiff stream

#

k cya

silver dust
#

@wary flame docker has a whale logo right?

wary flame
#

Yes

silver dust
#

Hm

#

Use code prompt

stiff stream
silver dust
#

Use code prompt
@silver dust say: cd desktop

#

Then say

#

cd (your folder)

#

then say node file.js

#

file is your file's name

wary flame
#

I asked about running on docker, my bot isnt magically on docker AND docker will terminate when it has nothing to do

silver dust
#

You need a text app

#

Like visualstudio

#

Or atom

wary flame
#

If you dont know docker (wich you said) please let someone else who does know docker help me

earnest phoenix
stiff stream
#

can you send the code?

distant bramble
#

hmm i give up

wary flame
#

Code?

earnest phoenix
#

Im getting error

stiff stream
#

show me the code

distant bramble
#

@earnest phoenix full code

wary flame
#

We cant help you without the code

earnest phoenix
distant bramble
#

use haste bin and paste the lin here

stiff stream
#

@earnest phoenix make sure to not show us your token

lusty quest
#

@wary flame what did you want to do with docker?

stiff stream
#

@earnest phoenix not the error. the code

wary flame
#

Host my discord bot

earnest phoenix
#

ok

wary flame
#

@lusty quest

distant bramble
#

@earnest phoenix and not that ur code that u run the bot on

lusty quest
#

its pretty easy

wary flame
#

Can you help me

lusty quest
#

sure

distant bramble
#

okkayy my messages are super delayed

stiff stream
#

@earnest phoenix and not that ur code that u run the bot on
@distant bramble already told him

wary flame
#

I couldnt figure it out :(

lusty quest
#

did you know how to make a dockerfile?

earnest phoenix
#

Im can't see error code because my modules error

wary flame
#

Kinda

stiff stream
#

show us your full code bro @earnest phoenix

#

we cant help you if you wont

earnest phoenix
#

ok

lusty quest
#
FROM node:12
RUN mkdir -p /usr/src/bot
WORKDIR /usr/src/bot

COPY package.json /usr/src/bot
RUN npm install
COPY . /usr/src/bot

CMD [ "node", "index.js" ]
distant bramble
#

@stiff stream i know i also told at the same time but my connection is bad so it posted delayed

lusty quest
#

this is a dockerfile i use

stiff stream
#

@stiff stream i know i also told at the same time but my connection is bad so it posted delayed
@distant bramble k

lusty quest
#

pack it in the root directory of your bot and use docker compose to build the image

rocky hearth
#

how do I edit and remove a attachment (image) from a message?

wary flame
#

I did that, but I want it to connect to my local files so i dont have to rebuild every update

stiff stream
#

how do I edit and remove a attachment (image) from a message?
@rocky hearth wdym?

distant bramble
#

hmm should i use the vote webhook thing?

lusty quest
#

then add a shared volume to it

rocky hearth
#

my bot has send a message with a image as a attachment file

stiff stream
#

@rocky hearth show me the command

rocky hearth
#

how do I later remove the image from the message

stiff stream
#

@rocky hearth show me the command

wary flame
#

then add a shared volume to it
@lusty quest how do I do that? Can that be done trough docker files?

distant bramble
#

maybe u should have used hastebin

lusty quest
#

it should be

#

give me a sec

stiff stream
#

@rocky hearth dm me your command, i will help you

lusty quest
earnest phoenix
#
#

here

lusty quest
#

just make sure you edit your dockerfile to copy your bot also in there

earnest phoenix
#
#

here

#

pls help me

distant bramble
#

hmm can any 1 check his code its stuck in loading for me

earnest phoenix
#

here my error

wary flame
#

Will
VOLUME mybotpath /home/bot
Connect my local bot folder to the docker container /home/bot ?

#

And will it then update when docker container changes something and update when local files change ?

earnest phoenix
#

Im using glitch

wary flame
#

@lusty quest

earnest phoenix
#

Im will send you invite link in dm?

pure lion
#

Heyyyy

lusty quest
#

@wary flame i think (never used Volumes in a dockerfile)

earnest phoenix
#

someone is didnt helps me :(

lusty quest
#

@earnest phoenix install better sqlite 3

pure lion
#

Can someone help me with oauth2

peak drum
#

I need a bot for self promotion

pure lion
#

I'm confused about what to put in the grant_type field

#

@peak drum that's nice.

lusty quest
#

@pure lion you mean autorisation headers?

slender thistle
#

grant_type query param for OAuth

pure lion
#

Yes that

slender thistle
#

A website you use OAuth of should have a documentation mentioning all supported types

lusty quest
pure lion
#

The djs guide for oauth2 too I'm guessing but I'm not sure where to loo-

#

I'm on that page

#

I don't know what authorisation_code is

lusty quest
#

i never worked with oauth but there is it

#

your code for authentificating with the API i guess

pure lion
#

*head explodes*

lusty quest
#

it is written there

pure lion
#

Yes that is exactly where I am

#

I don't know what or how to replace

#

Oh

#

It's literally auth code

#

hurr durr

opal plank
#

isnt fetch deprecated?

#

or was it request?

delicate shore
#

How can I make my bot do this

earnest phoenix
#

@lusty quest how?

lusty quest
#

if you dont know how to install node modules did you know the basics?

digital ibex
#

its request erwin

earnest phoenix
#

or was it request?
request

opal plank
#

ah ty

solid falcon
#

How to get DBL Token?

lusty quest
#

@solid falcon get your bot approved

pure lion
#

How to log user info from oauth2?

lusty quest
#

ยฏ_(ใƒ„)_/ยฏ

solid falcon
#

@solid falcon get your bot approved
@lusty quest oh, okay

pure lion
#

How do I search for multiple scopes through the oauth?

earnest phoenix
#

You guys know what was the default property for the $os in
<client>.options.ws.properties?

digital ibex
#

wdym, @pure lion ?

pure lion
#

Not search for

#

I wanna use the guilds and the identify scopes

digital ibex
#

scope is an array

pure lion
#

a

digital ibex
#

scope: ['guilds', 'identify']

pure lion
#

Okay thanks

#

Also how do I actually get information for the user out of this?

digital ibex
#

wdym?

pure lion
#

Wait lemme log on to pc discord

#

so

#

i have the oauth2 scope set up, but i want to be able to actually access the info from the user

digital ibex
#

have u clicked authorise?

pure lion
#

yes

#

would you like to see the log?

digital ibex
#

yeah

pure lion
#
Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: Gunzip {
      _writeState: [Uint32Array],
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: true,
      allowHalfOpen: true,
      _transformState: [Object],
      _hadError: false,
      bytesWritten: 0,
      _handle: [Zlib],
      _outBuffer: <Buffer 7b 22 69 64 22 3a 20 22 35 32 38 32 32 39 37 35 33 32 35 38 32 34 36 31 34 35 22 2c 20 22 75 73 65 72 6e 61 6d 65 22 3a 20 22 44 69 63 65 28 64 69 73 ... 
16334 more bytes>,
      _outOffset: 0,
      _chunkSize: 16384,
      _defaultFlushFlag: 2,
      _finishFlushFlag: 2,
      _defaultFullFlushFlag: 3,
      _info: undefined,
      _level: -1,
      _strategy: 0,
      [Symbol(kCapture)]: false
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://discordapp.com/api/users/@me',
    status: 200,
    statusText: 'OK',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}
opal plank
#

thats a chonky buffer init

pure lion
#

ye is hyooooje

#

oh lawd its coming

opal plank
pure lion
#

seriously tho what do i do x(

opal plank
#

about?

pure lion
#

to get user/guild info

opal plank
#

cant u just slap authorization header and GET it?

pure lion
#

aaaa

#

wait ill read the docs again

opal plank
#

slap token in that chonky Auth header, send GET to /guilds/guildid

pure lion
#

its fetching /users/@me

#

already

#

the hearers are already receiving da good shit

opal plank
#

i havent done manual requests to discord's api, otherwise i'd be able to give moe help

lusty quest
#

@wary flame does it work?

opal plank
#

actually, you arent there

slender thistle
digital ibex
#

im back

opal plank
slender thistle
#

yeah I'm

#

... an idiot

opal plank
#

lmao

#

i just checked his shared server

#

i assumed most people here already be in Dapi

digital ibex
#

@pure lion log the user, not the api response

pure lion
#

I just realise I'm retarded

#

@digital ibex how?

digital ibex
#

send ur code

pure lion
#

aight

#
const express = require('express')
const app = express()
const port = 3000
const fs = require('fs')
const url = require('url')
const fetch = require('node-fetch')

let content = String(fs.readFileSync('./alebot website/index2.html'))

app.get('/', (req, res) => {

const urlObj = url.parse(req.url, true)

if (urlObj.query.code) {
    const accessCode = urlObj.query.code;
    console.log(`The access code is: ${accessCode}`);
    
    const data = {
        client_id: 'eh its kinda sensative',
        client_secret: 'nononononononononononono',
        grant_type: 'authorization_code',
        redirect_uri: 'http://localhost:3000/?',
        code: accessCode,
        scope: ['identify', 'guilds'],
    };

    fetch('https://discordapp.com/api/oauth2/token', {
    method: 'POST',
    body: new URLSearchParams(data),
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        },
    })
    .then(res => res.json())
    .then(info => fetch('https://discordapp.com/api/users/@me/guilds', {
        headers: {
            authorization: `${info.token_type} ${info.access_token}`,
        },
    }))
    .then(console.log)
    .then(console.log('aaaaaa')) //this was the retard test

}

if (urlObj.pathname === '/') {
    responseCode = 200;
    content = String(fs.readFileSync('./alebot website/index2.html'));
}

console.log(urlObj)

res.send(content)})

app.listen(port, () => console.log(`app listening at http://localhost:${port}`))
digital ibex
#
fetch('https://discordapp.com/api/oauth2/token', {
    method: 'POST',
    body: new URLSearchParams(data),
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        },
    })
    .then(res => res.json())
    .then(info => fetch('https://discordapp.com/api/users/@me/guilds', {
        headers: {
            authorization: `${info.token_type} ${info.access_token}`,
        },
    })).then((e) => console.log(e));

}``` what does it log?
pure lion
#

same things as before

opal plank
#

imagine not using breakpoints

pure lion
#

:l

digital ibex
#

i say just do this

pure lion
#

what are they for tho

opal plank
#

never again will you need console.log()

digital ibex
#

makes the code easier and more readable imo

opal plank
#

lemme grab an example

pure lion
#

the little red dots in vsc?

tight plinth
#

breakpoints? never heard of it

digital ibex
#
const userData = fetch('https://discordapp.com/api/oauth2/token', {
    method: 'POST',
    body: new URLSearchParams(data),
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        },
    });
console.log(userData);
//    .then(res => res.json())
//  .then(info => fetch('https://discordapp.com/api/users/@me/guilds', {
//        headers: {
//            authorization: `${info.token_type} ${info.access_token}`,
//        },
 //   }));```
earnest phoenix
#

Dose anyone have discord.js 11.5 code for the top.gg votes that a message is displayed after they vote saying โ€œthanks for voting ...โ€

digital ibex
#

i dont use breakpoints cuz i dont use VSC :p

opal plank
#

one sec @pure lion

crystal stream
#

Guys, please tell me how to check if the channel is NSFW?
(js)

digital ibex
#

discord.js has nothing to do with ur question

tight plinth
#

msg.channel.nsfw

opal plank
#

channel has property NSFW in it

pure lion
#

if (<channel>.nsfw)

digital ibex
#

what does it log, dice?

opal plank
pure lion
#

wait

crystal stream
#

Okey, thz u ^^

opal plank
#

instead of console.log(a)

#

you can see code in action

pure lion
#

OHHHHHH THATS SICK

opal plank
#

thats called step debugging

#

never again will you use console.log

#

unless you do

#

but still, you get the point

#

it pauses the code execution on that line you added a breakpoint so you can see values when debugging

#

just remember it only works with a debugger attached

digital ibex
#

dice u there?

pure lion
#

pending promise

#

await it?

opal plank
#

what?

wary flame
#

@wary flame does it work?
@lusty quest It's building

pure lion
#

@digital ibex how to unpend promise?

opal plank
#

means your agument is invalid

#

@earnest phoenix provide more info

digital ibex
#

just add a .then((e) => { return e; }); on the end

pure lion
#

okkk

pale vessel
#

what

#

that's redundant

digital ibex
#
const userData = fetch('https://discordapp.com/api/oauth2/token', {
    method: 'POST',
    body: new URLSearchParams(data),
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        },
    }).then((e) => { return e; });
console.log(userDate);
opal plank
#

it tells you already where the error is

#

at least post the error stack

pale vessel
#

that's not-

#

ok

digital ibex
#

?

pure lion
#

lost guess what

digital ibex
#

oh

#

mb

pure lion
#

it logs the s aaaaaaaaaaaaaaaaaaaa me thing

opal plank
#

@earnest phoenix send it already goddamit

digital ibex
#

.then((e) => e.json()).then((e) => { retyrn e; });

#

\๐Ÿ˜“

pale vessel
#

you don't need .then((e) => { return e; });, just continue your code in that .then or await it

opal plank
digital ibex
#

thats how i do it, but i didn't make my own oauth but similar

#

yeah

opal plank
#

its a fetch

#

await it

#

await your promise

#

let a = await promise
console.log(a)

#

though like i told you, no need for that with breakpoints

pure lion
#
  scope: 'identify guilds',

um

digital ibex
#

?

pure lion
#

isnt it supposed to be an array?

pale vessel
#

no

pure lion
#

okay

#
{
  access_token: 'accessy boi',
  expires_in: 604800,
  refresh_token: 'second accessy boi',
  scope: 'identify guilds',
  token_type: 'Bearer'
}
#

i gotta eat brb

digital ibex
#

i cloned a bot, i can get help with it, can i get help configuring it here?

#

its not like commands to set up ur server or anything

#

to log messages on a website

opal plank
#
 async function a() {
const b = await fetch('https://discordapp.com/api/oauth2/token', {
    method: 'POST',
    body: new URLSearchParams(data),
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        },
    })
console.log(b)
}
#

await the promise mah dude

#

or async () =>

#

also seems like an array, but i dont see it either

pure lion
#

e

green kestrel
#

@jagged pebble you did read the rules about flashing/rainbow stuff in description pages yes, before you spend time making a rainbow text anim on your bot desc page?

jagged pebble
weak rain
#
internal/modules/cjs/loader.js:1237
    throw err;
    ^

SyntaxError: E:\gen\alphastar.json: Unexpected end of JSON input
    at parse (<anonymous>)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:1234:22)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (E:\gen\index.js:4:24)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
#

whats this

scenic grotto
#
Error: Cannot find module '../build/Release/canvas.node'
Require stack:
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bindings.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\canvas.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\index.js
- C:\Users\athir\Desktop\New folder (3)\app\server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\athir\Desktop\New folder (3)\app\node_module
s\canvas\lib\bindings.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\
bindings.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\
canvas.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\index
.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\server.js'
  ]
}

``` what does this error mean?
weak rain
#

Anyone?

wary flame
#

@lusty quest It is working now on Docker, thanks a lot ๐Ÿ™‚

quartz kindle
#

@weak rain your json file is broken

#

@scenic grotto you need to rebuild the canvas module npm rebuild canvas

earnest phoenix
#

Need help why its not in the Center and why is the Animation not Playing...

.bot-name{
    text-align: center!important;
    color: #92f3fa;
    font-family: 'Homenaje', sans-serif!important;
    animation: botname 10s linear!important;
    animation-iteration-count: infinite!important;
  }
scenic grotto
#

@scenic grotto you need to rebuild the canvas module
@quartz kindle i delete the node modules and do them again?

quartz kindle
#

try npm rebuild canvas

opal plank
#

thats a sick looking design ngl

#

props for that one

#

i hope its not copied tho

earnest phoenix
#

@opal plank no i use my skretch build in a iframe

opal plank
#

iframe ruined it

scenic grotto
#

i did the rebuild then i did node and got this

$ node server
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '../build/Release/canvas.node'
Require stack:
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bindings.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\canvas.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\index.js
- C:\Users\athir\Desktop\New folder (3)\app\server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bin
dings.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\bindings.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\canvas.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\index.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\server.js'
  ]
}

honest perch
quartz kindle
#

@scenic grotto show the full logs of the rebuild command

golden condor
#

Did you have the latest one?

silver dust
#

i did the rebuild then i did node and got this

$ node server
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '../build/Release/canvas.node'
Require stack:
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bindings.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\canvas.js
- C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\index.js
- C:\Users\athir\Desktop\New folder (3)\app\server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\athir\Desktop\New folder (3)\app\node_modules\canvas\lib\bin
dings.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\bindings.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\lib\\canvas.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\node_modules\\canvas\\index.js',
    'C:\\Users\\athir\\Desktop\\New folder (3)\\app\\server.js'
  ]
}

@scenic grotto what are you trying to do rn?

golden condor
#

Beforehand

silver dust
#

Lemme see if I can help

honest perch
#

Did you have the latest one?
no lmao

scenic grotto
#

@silver dust running the bot

silver dust
#

Say

#

Node

golden condor
#

Btw uh I have made a repo which I update with the latest lavalink

scenic grotto
#

it;s more than 2,000 words

#

how could i write it?

#

or paste it

golden condor
quartz kindle
#

paste it in hastebin or any other bin

silver dust
#

Dude is it java script?

pale vessel
#

java script, yes

quartz kindle
#

jabba script

scenic grotto
quartz kindle
#

you dont have build tools installed

#

you need to install windows build tools

#

npm install -g windows-build-tools

scenic grotto
#
athir@fury MINGW64 ~/Desktop/New folder (3)/app (master)
$ npm install -g windows-build-tools

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142


quartz kindle
#

it takes a while to install

#

wait until it says "All Done"

scenic grotto
#

then i do rebuild then node server.js?

quartz kindle
#

yes

#

also, you need to install it from an administrator powershell

jagged pebble
#

how to make background

#

please help

silver dust
#

@jagged pebble wdym?

weak rain
#

@weak rain your json file is broken
@quartz kindle what should i do

jagged pebble
silver dust
#

Hm

#

Compress it

#

@quartz kindle what should i do
@weak rain copy your code then make a new one and paste it there with the same name

#

Same a s the replace

#

@jagged pebble resmi compress et

#

ร‡ok ลŸey farketmez

jagged pebble
#

tamamdฤฑr

#

birde

#

sitenin รถlรงรผsรผ

#

nedir tam รถlรงรผ bir fotoฤŸraf yerleลŸtiriyim

weak rain
#

@weak rain copy your code then make a new one and paste it there with the same name
@silver dust {
"Alphastar": [""]
}

#

its just this

jagged pebble
viral iris
#
if (message.member.hasPermission("KICK_MEMBERS")) message.channel.send("you cannot"); return
#

can any1 help ?

lusty quest
#

what is the issue?

viral iris
#

even if i have permission it says u cant

lusty quest
#

try permission.has()

earnest phoenix
#

for what?

viral iris
#

1min

jagged pebble
#

how to bot logo to circle

lusty quest
#

btw did you use d.js-light?

viral iris
#

Cannot read property 'has' of undefined

earnest phoenix
#

guys how i react like this ๐Ÿ›‘ and then the commands will deleted?

tight plinth
#

is it possible to merge 2 bots in a single team?

viral iris
#

@earnest phoenix
message.react

lusty quest
#

@viral iris sorry permissions.has

pale vessel
#

isn't that the same as hasPermission()? iirc

earnest phoenix
#

and if the member will press ๐Ÿ›‘ then the command will be deleted?

viral iris
#

still i can't

lusty quest
#

also add a ! infront of the check otherwise its true

earnest phoenix
#

OOF

pale vessel
earnest phoenix
#

what is that for?

pale vessel
#

hasPermission() uses permmisions.has()

lusty quest
#

i had some wired stuff with hasPermission() permissions.has() fixed it

silver dust
#

peki botun logosunu daire nasฤฑl yapabilirim
@jagged pebble hm bilemedim

viral iris
#
if (member.hasPermission('KICK_MEMBERS')) {
message.channel.send("u cant"); return
#

is it right ?

lusty quest
#

if (!member.hasPermission('KICK_MEMBERS')) {

earnest phoenix
#

@pale vessel wtf your profile man hentai in "seconds" ???

lusty quest
#

otherwise it will send the message if you have the permission -> ! infront

jagged pebble
#

@silver dust hallettim

silver dust
#

Tamam

jagged pebble
lusty quest
#

@earnest phoenix you can react with the bot to the reaction. you can use the MessageReactionAdd event or a Collector for looking for the reaction

earnest phoenix
#

umm...

scenic grotto
pure lion
#

Sup

#

It's me

#

I did it

#

Kinda

silver dust
#

@scenic grotto it's because you need 2 -

#

Like

#

--g

#

I think

scenic grotto
#

what is the command

lusty quest
#

@scenic grotto delete the node_modules folder and install again. helped me a few times

pure lion
#

I got the guild IDs but:

  1. How do I filter it so it doesn't display the guilds the client is not in
  2. How do I then display this info on the webpage?
opaque seal
#

How do bots choose in which channel send the bot presentation when the bot gets added to a server?

lusty quest
#

@pure lion check the guilds the User is in and only display them

#

@opaque seal you could use the SystemChannel

pure lion
#

How'd I pass in client to my app.js?

opaque seal
#

what's that @lusty quest

lusty quest
#

but this will error out if there is no system channel set

silver dust
pseudo hare
#

what's the right way to stream audio with ytdl-core? I'm currently using ytdl(url, { filter: 'audioonly', quality: 'lowest' }) but this doesn't work on some videos

opaque seal
#

what's a sytem channel

lusty quest
opaque seal
#

there is not much info on that xD

#

What does system channel mean

lusty quest
#

its a channel the Guild can use for system messages

#

usually the Join and Boost Messages are send in there from Discord

opaque seal
#

oh ok

#

thank you

lusty quest
#

there was a Wellcome Channel variable a year ago but this got removed

pure lion
#

I stuck

lusty quest
#

you get the Client from the OAuth

pure lion
#

Oh makes sense

earnest phoenix
#

\๐Ÿ›‘

opaque seal
#

What's the most convinient way to edit a message every 3 seconds and stop at the 5th time for example?

earnest phoenix
#

\๐Ÿ˜„

pure lion
#

@opaque seal a for loop

opaque seal
#

and how do you wait 3 seconds?

lusty quest
#

would not recommend every 3 seconds

pure lion
#

^

lusty quest
#

use a timeout

opaque seal
#

I need this for the presentation of the bot

#

It edits a message 5 times

lusty quest
#

dont come back here and cry your bot got ratelimited

opaque seal
#

it wont

#

3 seconds isn't too less isn't it?

lime pumice
pure lion
#

@lusty quest how'd I send any info from the backend to the frontend after getting it from oauth2?

#

@lime pumice show code

lime pumice
#

@pure lion index?

pure lion
#

Like 13

#

Line

lime pumice
#

@pure lion k

#

@pure lion saw?

tight plinth
#

files is undefined

#

make sure you know how o use fs

lime pumice
#

wdym?

#

m new to fs

#

can u tell me the fix?

tight plinth
#

learn how tyo use js and fs

pale vessel
#

nodejs and fs

pure lion
#

Flaaaaaaaz

#

Hi

quartz kindle
#

@scenic grotto the canvas module has special requirements to work on windows

#

that is because GTK is a requirement for it to work on windows

pure lion
#

Can someone help me with express, not sure how to send da shit to res after I get it from the oauth2 scope thingy

quartz kindle
#

they have an installation guide on their github that explains this

#

so you need to follow these instructions before installing canvas

delicate shore
#

how to make my bot respond

#

to dm's

#

no

#

like if you dm my bot

spice oriole
#

.

opal plank
#

it already does it

delicate shore
#

it will respond

opal plank
#

message events come from all channels

delicate shore
#

saying hi

opal plank
#

be it type text or dm

delicate shore
#

and blah. blah

#

be it type text or dm
@opal plank how

#

it doesn't

#

respond

opal plank
#

Message events contains both DM and GUILD

#

check channel type

delicate shore
#

msg.channeltype? or soemthing

#

alr i will read docs

opal plank
pure lion
#

i require assistance

#

lost, i did it

opal plank
#

i'll bonk you if you ask for APi questions

pure lion
#

but im not sure how to send the api stuff to the page

#

)/

opal plank
#

@earnest phoenix Missing Permissions

#

@pure lion ask in Dapi ffs

digital ibex
#

@pure lion what do u need?

pure lion
#

@opal plank its not an api question

opal plank
#

they are there for THAT specific reason

pure lion
#

idk how to put the stuff i got from the api onto the webpage

digital ibex
#

u can ask api questions here too shrug

opal plank
#

you got the api payload right?

delicate shore
#

msg.channel.type == "dm"

opal plank
#

you can ask it in here, but its unlikely that many would know

digital ibex
#

just like

delicate shore
#

is it like this?

#

erwin

opal plank
#

yes

#

that'll check what type it is

digital ibex
#

res.status(200).json({ response from the api });

opal plank
#

then send to author

delicate shore
#

ok thanks

#

msg.author.send?

#

then

opal plank
#

check type first

digital ibex
#

@pure lion do u mean that?

pure lion
#

i d k

#

i want to display da shit onto da website

spice oriole
#

@gleaming glen

pure lion
#

i do not know the doc shit

delicate shore
#

check type first
@opal plank

if(
msg.channel.type == "dm"){
msg.author.send("Poop")
}```
digital ibex
#

doc shit?

#

lmao

opal plank
#

idk whats the issue tbh

#

you got the response

#

just display it

pure lion
#

h o w

opal plank
#

depends what u using

pure lion
#

i cant do res.send

opal plank
#

HTML? vue? js? jquery?

pure lion
#

ejs

opal plank
#

@delicate shore cancer indentation, but yeah

delicate shore
#

ok

digital ibex
#

@pure lion res.render('ejs file', { responseFromAPI: the response u got from the api });

#

and in the ejs file

pure lion
#

okay se- why do i need a .ejs file?

digital ibex
#

u can just do <p><%- JSON.stringify(responseFromAPI) %></p> to see if it works

#

u can just like

#
app.set('bob', path.join(__dirname, 'bob'));
``` and make a folder called `bob`, in that folder, make a file with the ejs file extension, and copy `<%- JSON.stringify(responseFromAPI) %>`
#

if thats what u mean?

quartz kindle
#

if you want to send a json response you can simply res.send(response from the api)

digital ibex
#
app.get('/test', (req, res) => {
res.render('<file>', { responseFromAPI: the response u got });
});```
#

res.send is deprecated, use res.sendStatus(code, message)

quartz kindle
#

you only need ejs if you want to put the response in an html file, in a page in your website for example

pure lion
#

(node:6304) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:526:11)
at ServerResponse.header (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:771:10)
at ServerResponse.send (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:170:12)
at ServerResponse.json (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:267:15)
at ServerResponse.send (C:\Users\james\Desktop\h\node_modules\express\lib\response.js:158:21)
at C:\Users\james\Desktop\h\app.js:41:22
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:6304) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6304) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#

yeah tim that was the idea, sorry for not clarifying

digital ibex
#

code?

delicate shore
#

jesus

#

(node:6304) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

#

this much was enough

pure lion
#

lost, its just res.send

#
    fetch('https://discord.com/api/oauth2/token', {
    method: 'POST',
    body: new URLSearchParams(data),
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        },
    })
    .then((e) => e.json())
    .then(info => fetch('https://discord.com/api/users/@me/guilds', {
        headers: {
            authorization: `${info.token_type} ${info.access_token}`,
        },
    }))
    .then(e => e.json())
    .then((e) => res.send(e))
delicate shore
#

i know your real name now @pure lion

pure lion
#

whoa really?! cool!!!

delicate shore
#

James Charles

pure lion
#

im going to murder you

delicate shore
#

My real Name -> ||Never gonna give you up||

tight plinth
#

Why was I excepting that

pure lion
#

i have spoilers on auto

quartz kindle
#

thats not all the code is it?

digital ibex
#

idk why thats happening, not for my dashboard, is just put it in functions and it works, i also dont have loads of .thens. not sure why

quartz kindle
#

you have another res.something before or after the code

#

you cannot set headers after a response has been sent

#

so somewhere you're trying to modify the response when the response is already on its way

delicate shore
#

tim

#

your nitro expired?

quartz kindle
#

yes

#

it was a gift

delicate shore
#

ok

#

sad

still merlin
#

Can I have some help please, Whenever I use my userinfo command on my server my friend comes out with having bot founder role when he has the moderator role

#

The code I'm using is js .addField("Highest role", member.roles.highest)

misty sigil
#

what is member defined as

still merlin
#

first mentioned user

sudden geyser
#

is Bot Founder their highest role

still merlin
#

No

opal plank
#

isnt highest a method?

still merlin
#

there highest role is "server moderator" and its mentionable

delicate shore
#

this is not mine btw

sudden geyser
#

PG you can get yourself a tim plushie

opal plank
#

nvm its a proprety

earnest phoenix
#

@delicate shore i dont see how this is related to bot development

delicate shore
#

ok