#development

1 messages · Page 1502 of 1

craggy pine
#

Actually Tim, you helped me with something in the past. I have a question related to the css of a certain thing. Think you could assist again KEKW

earnest phoenix
#

I didn't understand the buy thing

quartz kindle
#

i hate css but i can try

misty sigil
#

i can try

craggy pine
#

sec ill get my previous message here.

earnest phoenix
#

Me too, i'm trash at css

halcyon kite
#

css is trash for me ngl

#

:/

craggy pine
#

Gotta make my page pretty kittyLove

halcyon kite
#

soooooooo what the heck is wrong with this lol

earnest phoenix
#

Now what

halcyon kite
#

same thing

#

nothing else

#

:/

#

i want this fixed so i can actually fix my brain

quartz kindle
halcyon kite
#

bc it dead

craggy pine
#

All work actually @quartz kindle

#

The main question is: When the page is loaded and by default 0 is selected, how can I add the css to it.

#

since changing the numbers to 0 and whatnot doesn't appear to work

earnest phoenix
#

Did you try making args a constant like this?:

const args = <message>.content.slice(prefix.length).trim().split(/ +/g);
halcyon kite
#

hmmmm

#

for my args in my main

craggy pine
#

ya

halcyon kite
#

</message>

#

this part wut about it tho

#

@earnest phoenix

#

problemo

#

where the heck do i put the </message>

craggy pine
#

copy pasting code isn't 100% going to work until you change it to fit your code.

halcyon kite
#

yeah

#

ik

#

but the <>

#

part

#

is weird

solemn latch
#

<message> means the type message

quartz kindle
# craggy pine ya

the original selector seems to be this .selectable svg .svg-star:hover

craggy pine
#

I see.

#

I'll give it a try real quick.

halcyon kite
#

const args = message.content.slice(prefix.length).trim().split(/ +/);
E

#

this is my check thing

#

for args

quartz kindle
#

👍

earnest phoenix
#

O wait

#

Wut

halcyon kite
#

my brain

earnest phoenix
#

Lol

halcyon kite
#

its dying in the afterlife

earnest phoenix
#

You literally wrote <message>

#

lmao

halcyon kite
#

:/

#

i did darn

earnest phoenix
#

Uh

halcyon kite
#

btw

#

im a good person my mind is speaking now send help

quartz kindle
#

usually when people say <message> or <client>, they mean <whatever name you gave to your message variable> and <whatever name you gave do your client>

earnest phoenix
#

Ya

#

Some people define client as bot

#

Or message as msg

quartz kindle
#

and some define client as shithead

earnest phoenix
#

Lmao

halcyon kite
#

msg still dont work

#

RE

craggy pine
#

shithead.shituser.getshitmessage

halcyon kite
#

bot

#

e

earnest phoenix
#

Bruh

halcyon kite
#

eeeeeeeeeeeeee

#

D: msg no work

earnest phoenix
#

You has to define it inside a client.on block

halcyon kite
#

hmm

earnest phoenix
#
client.on('message', message =>{
Some code
});
halcyon kite
#

hm

#

hm

#

but how do i define msg?

craggy pine
#

I'm going to ask 3 questions.

1: how did you learn JS
2: Are you learning JS through bots?
3: Are you following tutorials for what you're trying to do (Like YouTube ect)

because it doesn't appear you're doing any trial and error. If it doesn't work you ask here.

earnest phoenix
#

Write the message thing as msg

#

Replace message with msg

quartz kindle
#
class Shit extends Discord.Client {
  shituser(id) { return this.users.cache.get(id) }
  shitchannel(id) { return this.channels.cache.get(id) }
  shitguild(id) { return this.guilds.cache.get(id) }
  takeadump(token) { return this.login(token) }
}

const shithead = new Shit();
shithead.on("message", crap => {
  shithead.shitchannel("3428472983452342").send(crap.content)
})

shithead.takeadump("*)C*2ym30y@)*$C@)M#*$c082my3408c0823cm8@#h")
halcyon kite
earnest phoenix
#

Lmao

craggy pine
#

Not being an ass I'm genuenally curious mexShrug like do you know JS basics?

halcyon kite
#

yes i do but still my brain is dead

#

so its not helping with a dead brain

earnest phoenix
#

That's not a reason

halcyon kite
#

ik

#

its not

#

i can form a reason AHHH

earnest phoenix
#

If you know JS basics you never forgot it.

halcyon kite
#

true

#

but still i got to go do something

#

anyways

#

:/

craggy pine
#

And a lot of this is revolved around the basics for the most part which is why I asked.

quartz kindle
#

did you find any existing Content Security Policy line in your nginx configs? anywhere, not only in the reverse proxy block

halcyon kite
#

yeah ik this is basic but still

#

i have to go anyways goodbye

#

:/

craggy pine
earnest phoenix
craggy pine
#

Hope I wasn't being rude KEKW

earnest phoenix
#

Althought, some people learns JS thought discord bots...

#

Like me

#

I learned JS thought my bot

craggy pine
#

Yeah I get that. You totally can but a decent chunk of people follow a outdated bot tutorial and ask 100000 times why x code doesn't work

earnest phoenix
#

Like me PR_Pepe_Jiji

craggy pine
earnest phoenix
#

Also, i learned more fast than myself with help of some people here

quartz kindle
#

ok then lets add one

#

add_header Content-Security-Policy "img-src 'self' https://cdn.discordapp.com"; script-src 'self' 'unsafe-inline'

craggy pine
#

For sure.

earnest phoenix
#

Xd

quartz kindle
#

are you loading a script from an external site?

#

ah its inlined

#

so lets add unsafe-inline

#

edited the code

#

should probably work inside it, but i think its better outside

#

right before location /

#

then restart nginx as usual

silent cloud
#

Results is empty

#

Cannot send an empty message

quartz kindle
#

run nginx -t

#

for what reason

#

ah i mispelled

#

add_header Content-Security-Policy "img-src 'self' https://cdn.discordapp.com; script-src 'self' 'unsafe-inline'";

#

fixed

craggy pine
#

Imagine making typing mistakes.

quartz kindle
#

xd

#

what do the logs say?

#

hmm, its saying that you have a duplicate CSP header...

#

does your node.js code add any headers?

#

do you have any security package like helmet.js?

#

so remove the header from nginx and configure helmet instead

#

well that will disable it completely

#

it will work, but its less secure

#

try this

#
contentSecurityPolicy: {
    directives: {
      ...helmet.contentSecurityPolicy.getDefaultDirectives(),
      "image-src": ["'self'", "cdn.discordapp.com", "data:"],
    },
  }
#

content security policy exists to prevent the browser from loading unauthorized things

#

for example if a hacker somehow manages to inject viruses into your website, when a person opens your page, the browser will refuse to load them

#

for example in the code above its saying only allow the browser to load images from itself (same website), from discordapp, or from a data url

#

welp, then you have to add whatever is missing

earnest phoenix
lucid wharf
#

HEEEELP AAAAAAAA

#

How can i create a command where the bot create a role?=(

hoary delta
#

Has anyone here created commands for users to change the prefix of their bot?

earnest phoenix
#

you must use db to fetch the guild's bot prefix

earnest phoenix
#

To save and fetch*

lucid wharf
#

ITS LOCAL >:0

earnest phoenix
#

if you meant change prefix per user kekw, otherwise, most people here do

#

?

hoary delta
#

Seems expensive to call db to get prefix

#

every message

earnest phoenix
#

yeah, ig better cache it

lucid wharf
#

D: not know why with db?

earnest phoenix
#

Save it as a const

lucid wharf
craggy pine
lucid wharf
#

ah occcccccccc sorry

earnest phoenix
#

M

craggy pine
#

Well just by looking at that code...

#

You're never using "Guild"

misty sigil
#

also thats not how you create a role

quartz kindle
#

client.guilds.roles is not a thing either

earnest phoenix
#

Ya

#

client.guilds is for all guilds

craggy pine
earnest phoenix
earnest phoenix
lucid wharf
#

discord.js

summer torrent
#

anyone know how to customize file path thing in terminal

crimson vapor
#

which thing?

earnest phoenix
#

@lucid wharf native language, idiom.

lucid wharf
#

spanish Q_Q

crimson vapor
#

what is the endpoint to reply to a message?

crimson vapor
earnest phoenix
summer torrent
#

it is not endpoint iirc

lucid wharf
#

ORELE WEI

#

xD

earnest phoenix
summer torrent
#

just an option in message send

crimson vapor
#

do you know the option?

summer torrent
#

one sec

crimson vapor
#

oh I think I got it

summer torrent
summer torrent
#

yes that

crimson vapor
#

oh

#

nvm then

summer torrent
#

ty norizon

blissful coral
#

Sooo, I am trying to run a .exe file (valorant.exe) and I want to be able to monitor the console of the game and see when files are updated or stuff is emited. Is there a way to do this in command prompt?

#

Any ideas?

#

Event Viewer wasn't a option it can't get the app cuz it isn't a windows application

crimson vapor
#

can you just do valorant.exe in cmd?

blissful coral
#

lets see

crimson vapor
#

I assume no

blissful coral
#

@crimson vapor

crimson vapor
#

oh

#

rip

drowsy grail
#

can you launch it as a child process in node

blissful coral
#

Will I be able to view what happens?

#

Like file writes?

#

I need to monitor emitters on the game

#

Trying to back track

drowsy grail
#

uhh you would be able to read the output and you could probably listen for file writes if you know what directory to look in

blissful coral
#

I don't know

#

That is what I am trying to find with thjis

drowsy grail
#

ah

#

oh this is for macos

summer torrent
blissful coral
#

One for Windows?

blissful coral
#

This work's for windows?

drowsy grail
#

yea

#

didnt realize it worked for directories too

lyric mountain
#

You could generate a hash from the file bytes and store in a variable, then inside a loop you keep generating a hash from it, if it changes then the file has changed

quartz kindle
#

somebody just asked me about a "sync version of djs"

#

to "fix heap inefficiencies"

earnest phoenix
#

"why not working???"
"its still replying in my server sorry"

quartz kindle
#

lets fix djs by making all requests blocking

mellow kelp
#

hm yes

misty sigil
#

yes

crimson vapor
#

how do you make a sync EventEmitter tf

#

why would you want that

#

say it takes 20ms to process a command

quartz kindle
#

event emitter is sync

crimson vapor
#

I mean

#

djs

#

tho

#

ig

quartz kindle
#

its sync even in djs

crimson vapor
#

nvm then

quartz kindle
#

if you have a command that blocks the bot, it will block other events

crimson vapor
#

but I mean like message.reply() or something

quartz kindle
#

yes

crimson vapor
#

like stop the entire bot just to wait for that

quartz kindle
#

yes thats the joke

#

xD

crimson vapor
#

lol

quartz kindle
#

one way to make it:

#
let done = false;
let promise = message.reply(...).then(() => { done = true })
while(!done) {
  // do nothing
}
#

lmao

#

that would probably not even work

crystal yew
#

What would be better as a bot invite redirect link
A. Bot support server
B. Bot website

crimson vapor
#

bot website imo

quartz kindle
#

what would work tho is setting up a worker thread with a sharedArrayBuffer, and have the main process block until the value of the buffer changes

trim saddle
#

waiting for things seems hard

quartz kindle
#

and put the promise in the worker and have it change the buffer when done

#

:^)

#

wait until you attempt synchronous multithreading in node xD

crimson vapor
#

lets not

quartz kindle
#

its quite interesting tho, i have a shelved project based on it

opal plank
#

who needs threads when you can simply spawn 1087 processes to handle shit for you

crimson vapor
opal plank
#

what the fuck is that

crimson vapor
#

don't worry about it

opal plank
#

kill it before it has children

crimson vapor
#

it can't

opal plank
#

then kill whoever is responsible for that

crimson vapor
#

no thanks

#

how should I change this then?

opal plank
#

what even is that suppose to do?

quartz kindle
#

its a discord event handler lol

crimson vapor
#

emit message event as long as there is content

opal plank
#

why u making ur own handler?

crimson vapor
#

no cache

opal plank
#

also not accounting for embeds

#

nor files

crimson vapor
#

I don't use them

opal plank
#

or attachments

#

then why....?

crimson vapor
#

realistically I don't have a need for embeds

#

so just return if no content

opal plank
#

why aren you using d.js?

crimson vapor
#

no cache

#

like

#

none at all

opal plank
#

isnt that what tim has?

quartz kindle
#

making a barebones gateway for your own personal use is a very good idea

#

just a lot of work

opal plank
#

its a good experience for sure

#

but whats the goal in that snippet?

crimson vapor
#

I mean if I keep it simple it should not be that bad

#

honestly that snippet is just to show how I have message update acting as message event

opal plank
#

why you emitting the data twice?

crimson vapor
#

I am?

opal plank
crimson vapor
#

this?

opal plank
#

your message constructor already has this, why you passing the emit with this again?

crimson vapor
#

message takes shard but its private

#

so I pass message and shard

opal plank
#

but if this is the shard, why not use it in the message contructor?

crimson vapor
#

what do you mean?

opal plank
#

attach this onto your message

quartz kindle
#

i mean, nothing wrong with doing it like that

#

one is for the message constructor, the other is for the event. hes not necessariliy adding a reference to it in message

#

it keeps things separate and modular

opal plank
#
case 'MESSAGE_UPDATE': 
if(data.d.content) this.client.emit('message', new Message(data.d, this))
#

you could append this onto the message constructor

#

rather than sending a second param

quartz kindle
#

doesnt make much difference

crimson vapor
#

it would just point to the memory of the shard right?

opal plank
#

yeah

crimson vapor
#

so realistically there should be no difference except for style and preference

quartz kindle
#

yeah

#

i personally would prefer your way

#

i mean

crimson vapor
#

I choose this rather than making message.shard public because I don't want to accidentally eval my token for the most part

quartz kindle
#
client.on("message", (message,shard) => {
  // code
})
``` makes more sense than ```js
client.on("message", message => {
  message.shard
  // code
})
opal plank
#

i would go with a single param, the only reason i'd use multiple is when you are comparing two equal things, for example member updates, old and new, stuff of the sort

#

or if they are not part of it

#

having the shard reference of where the message came from makes sense

crimson vapor
#

im sending shard for all events so it should be fine

#
case 1:
case 2:
  code();
  break;
``` should work right?
vale garden
#

hi

  @staticmethod
  def user_join(access_token, userr):
   try:

    url = Oauth.discord_api_url + f"/guilds/768019392596017164/members/{userr}"

    headers = {
      "Authorization": "Bearer {}" .format(access_token)
    }

    user_object = requests.get(url = url, headers = headers)
    user_json = user_object.json()

    return user_json

i have this function
for discord oauth2
im trying to add people to a server
but im getting a {'message': '401: Unauthorized', 'code': 0} error
plz help

idk if i should really use json there
but i tried

  @staticmethod
  def user_join(access_token, userr):
   try:

    url = Oauth.discord_api_url + f"/guilds/768019392596017164/members/{userr}"

    headers = {
      "Authorization": "Bearer {}" .format(access_token)
    }

    user_object = requests.get(url = url, headers = headers)

    return user_object

as well
and that got the same error

crimson vapor
#

case 1 would do code()

quartz kindle
#

yes

opal plank
#

i would still scope, but because ou using this it might get funky

crimson vapor
#
this.client.emit('guildUpdate', data.d, oldGuild, this);``` this is my guild update emit
#

I do the raw guild, and the cached guild

#

then the shard

opal plank
#

but didnt you say theres no cache?

#

at all?

#

im confused

quartz kindle
crimson vapor
#

well

#

I cache raw guilds

#

just in case

vale garden
#

i want to add them

#

when they authorize

#

the link doesnt have the bot scope

#

but the bot does exist in the server

quartz kindle
#

you did the whole code exchange and got their token right?

vale garden
#

yea i get the access token

#

which i use in the header

#

and

#

yea

quartz kindle
#

the code you showed is for getting a member

#

not for adding one

vale garden
#

wait wha

#

i thought i would just use that url and it would work

#

what should i do instead then

quartz kindle
#

to add members you have to use PUT

#

not GET

vale garden
#

ohhh

#

oh lmao

#

so i just use the requests.put() function right

quartz kindle
#

also, from reading the docs

#

it seems you have to use your own bot token in the auth header

#

and the users access token in a json field

vale garden
#

so do i also change

#
headers = {
      "Authorization": "Bearer {}" .format(access_token)
    }
#

to

#
headers = {
      "Authorization": "Bot {}" .format(token)
    }
quartz kindle
#

yes

vale garden
#

btw could you send me a link to the docs @quartz kindle

quartz kindle
vale garden
#

kk tks

sturdy gazelle
#

discordjs, how do you cache reactions on an old message?

barren brook
#

My Embed is not working

vale garden
#

@barren brook send the code

barren brook
#

K,

#

Im just getting back into this so I dont know much, Like restarting.

#
  HelpEmbed.setTitle("Help Command")
  HelpEmbed.addField("h-help", "Help Shows a List Of Commands.")
  HelpEmbed.addField("h-ping", "Replys With Pong!")
  msg.reply("Help Is In Your DMS! :yum:")
  msg.author.send(HelpEmbed)```
Sending Double.
trim saddle
sturdy gazelle
#
  msg.reply("Help Is In Your DMS! :yum:")
  msg.author.send(HelpEmbed)```
barren brook
#

Thats weird af, Will that work

sturdy gazelle
#

ofc

trim saddle
#

you could always newline each function

sturdy gazelle
#

yeah

trim saddle
#

so it looks neater

sturdy gazelle
#
HelpEmbed =   HelpEmbed.setTitle("Help Command")
HelpEmbed =   HelpEmbed.addField("h-help", "Help Shows a List Of Commands.")
HelpEmbed =   HelpEmbed.addField("h-ping", "Replys With Pong!")```alternatively u could do this but its worse
barren brook
#

worse in what way?

sturdy gazelle
#

no reason to make all the assignments

crimson vapor
#

you don't need to redefine it

trim saddle
#

uhhh.

#

@opal plank wake up

crimson vapor
#

he is playing vsc

trim saddle
#

oh shit he lost nitro

#

no more swaying hips neon girl 😔

crimson vapor
#

yeah no more

quartz kindle
crimson vapor
#

nor does message

trim saddle
#

if you edit the content out maybe

crimson vapor
#

nah embeds make content null

trim saddle
#

you shouldn't filter that out

crimson vapor
#

I have no use for messages without it

barren brook
trim saddle
#

you're not supposed to be hosting bots on glitch

quartz kindle
crimson vapor
#

are bots against tos or are uptime robots?

barren brook
#

Is it against tos? @trim saddle

trim saddle
#

indeed

#

they banned it

crimson vapor
#

bots or uptime robots?

vale garden
#

really?

barren brook
#

Ok well what do I switch to then

vale garden
#

why

crimson vapor
#

glitch is meant to be a place for small projects

trim saddle
#

they banned bot hosting because people were misusing the platform

vale garden
#

kk

#

anyways i use repl

trim saddle
#

@quartz kindle i meant to ask

vale garden
#

which is honestly better

quartz kindle
#

blame the 5 million turkish bots on glitch

trim saddle
#

is there like a

quartz kindle
#

that have all the exact same code

crimson vapor
#

turkish bots suck

#

all 🇹🇷 everywhere

trim saddle
#

safe, not overwriting version of Object.assign()

quartz kindle
#

like, if the key exists, ignore it?

trim saddle
#

yes

quartz kindle
#

well, you could just invert the order

barren brook
#

What program do I use since I cant use glitch?

#

Im working with a buddy

trim saddle
#

well people recommend you pay for a vps

barren brook
#

VPS?

trim saddle
#

read le pins

crimson vapor
#

a dedi but not

quartz kindle
#

the right variable replaces the left variable, so if you switch them around, the existing keys will replace the keys you want to ignore and the result will be the same

opal plank
#

@trim saddle huh?

trim saddle
#

you took too long

#

go back to sleep

opal plank
#

oke

quartz kindle
#

donke

opal plank
#

monke

quartz kindle
#

stonkes

#

its 3am why am i awake

#

im out, see ya succers

craggy pine
sturdy gazelle
#

does anyone know how to cache reactions on old messages? (discordjs)

crimson vapor
#

@quartz kindle can you fetch reactions?

sturdy gazelle
#

i can see what has been reacted, but not who and i need to know who

crimson vapor
#

I thought that reactions were linked to an id

sturdy gazelle
barren brook
#

Right side

#

@sturdy gazelle

sturdy gazelle
#

what?

#

whats going on?

barren brook
#

Spamming once I test the command

sturdy gazelle
#

you do it once and it happens a lot?

craggy pine
#

Fornite to discord or are you just accidentally capturing two monitors

crimson vapor
#

2 monitors

sturdy gazelle
#

win + shift + s

barren brook
#

Yea jojo it spams it

craggy pine
#

Gotcha. I had my bot connected to fortnite using a client made for it. Was fun while it lasted KEKW too much work when it updates

crimson vapor
#

why would you do that

#

pain

sturdy gazelle
#

youd have to send ur code cuz it probs has to do with executing a command too much

craggy pine
#

Fornite verification

crimson vapor
#

oh

#

makes sense

craggy pine
#

Used to do scrim things so people wanted it mexShrug

#

so if they cheat they get their discord tag and Fortnite acc

crimson vapor
#

host or play in?

craggy pine
#

Neither

#

we made bots for it

crimson vapor
#

dev

barren brook
#
  msg.reply("Help Is In Your DMS! :yum:")
  msg.author.send(HelpEmbed)```
@sturdy gazelle
crimson vapor
craggy pine
sturdy gazelle
#

like i said the issue isnt there

crimson vapor
#

do you know the name of the server you made the bot for?

craggy pine
#

We retired it like a year ago because it's too high mainence. One update on their end can kill the entire process.

barren brook
#

Where is it? Console?

crimson vapor
#

I remember a bot requiring you to friend it

#

in order to actually do the scrim

craggy pine
#

It probably wasn't ours. Our process was like this.

#

React to embed -> Bot DMS you some fortnite related questions -> It generates a captcha code -> you dm the bot on fortnite -> it dms you on discord linking the two together

sturdy gazelle
#

if it us only sending you one dm, then the issue is in the reply, otherwise you are executing the command too much

crimson vapor
#

thats smart

barren brook
#

k

sturdy gazelle
#

are you using commando?

craggy pine
#

But as mentioned. Any updates on the games end will make us have to regenderate things and ya

crimson vapor
#

oh commando yikes

craggy pine
#

no ty.

crimson vapor
#

yeah seems like pain

#

paid well?

barren brook
#

Nah discord.js

craggy pine
#

At one point we made 800 on patreon

crimson vapor
#

oh

craggy pine
#

but since customs became a thing it yeeted our pay

sturdy gazelle
#

commando is a part of discord js but if u dunno what it is then no lol

craggy pine
#

no one really needed that feature anymore

crimson vapor
#

yeah makes sense

barren brook
#

Is commando better?

crimson vapor
#

commando is depricated

craggy pine
#

I have a video if u wana see it in action

crimson vapor
#

im good

#

seems cool

sturdy gazelle
#

eh its got more integration

craggy pine
crimson vapor
#

klasa > commando

#

and klasa stopped dev

sturdy gazelle
#

i dont use commando but im working on a bot that does

crimson vapor
#

iirc it still uses djs 11

sturdy gazelle
#

its nice to have a default command architecture but it can be a pain

#

i dont think so

barren brook
#
    .setTitle("Help Command")
    .addField("h-help", "Help Shows a List Of Commands.")
    .addField("h-ping", "Replys With Pong!");
  msg.reply("Help Is In Your DMS! :yum:");
  msg.author.send(HelpEmbed);``` Would this coding work or nah?
sturdy gazelle
#

yesh

barren brook
#

K

crimson vapor
#

the issue is not there

#

do you have a loop?

#

or something

sturdy gazelle
#

thats what i said

barren brook
#

I dont understand what a loop is.

sturdy gazelle
#

that would also be an issue

crimson vapor
#

show the entire command

barren brook
#

K wait up

#

Now the discord bot wont go online after I stopped it, Tf is happening now

terse finch
#

discord.py how do i fetch user information from a user thats no longer in a server with the bot? i have the id. how do i get the users name from that

#

using bot.fetch_user(ID) returns error code 404 user not found

barren brook
earnest phoenix
#

then the id isn't valid

barren brook
crimson vapor
barren brook
#

let HelpEmbed = new Discord.MessageEmbed()
.setTitle("Help Command")
.addField("h-help", "Help Shows a List Of Commands.")
.addField("h-ping", "Replys With Pong!");
msg.reply("Help Is In Your DMS! 😋");
msg.author.send(HelpEmbed);

#

Tried to make it look cleaner

crimson vapor
#

no, all of your code

terse finch
barren brook
#

K

terse finch
crimson vapor
terse finch
#

why not?

barren brook
#
const client = new Discord.Client();
const fs = require("fs");

client.on("ready", () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on("message", msg => {
  if (msg.content === "h-ping") {
    msg.reply("Pong!");
  }
  let HelpEmbed = new Discord.MessageEmbed()
    .setTitle("Help Command")
    .addField("h-help", "Help Shows a List Of Commands.")
    .addField("h-ping", "Replys With Pong!");
  msg.reply("Help Is In Your DMS! :yum:");
  msg.author.send(HelpEmbed);
  if (msg.content === "h-requirements") {
    let COCEmbed = new Discord.MessageEmbed();
    COCEmbed.setTitle("Requirement For Styx Clan");
    msg.author.send(COCEmbed);
  }
  const blacklistedusers = [
    "Currently Blacklisted-Ghost M033 Blacklisted until further notice",
    "TNN PLU Blacklisted until 1/10/2021",
    "Unknown"
  ];
  if (msg.content === "h-blacklistedpeople") {
    msg.author.send(blacklistedusers);
  }
});

client.login("TOKEN IS HERE");```
earnest phoenix
crimson vapor
#

they can?

terse finch
#

ive seen others do it

crimson vapor
#

thats strange

earnest phoenix
#

only members can't

crimson vapor
#

invasion of privacy I thought

terse finch
#

im just trying to figure out why its not working

crimson vapor
earnest phoenix
#

@terse finch how do you do it?

vale garden
#

hi

barren brook
#

@crimson vapor How do i stop the instances?

crimson vapor
#

not sure

#

but thats what im thinking

#

you use glitch right?

barren brook
#

yeah

earnest phoenix
#

I don't think fetch_user raises UserNotFound

terse finch
#
async def banFuck(self, ctx, member: discord.User = None, *, reason=""):
        # User, Moderator, and Server
        mod = ctx.author
        user = self.bot.fetch_user(member.id)
        server = ctx.guild.name

first the param member:discord.User fails to find the user. so ive changed it to just an int which is the id. still fails

earnest phoenix
#

you can create a function yourself,

async def convert_user(id):
    return bot.get_user(int(id)) or await bot.fetch_user(id)
#

oh wait, I'm unsure what d.py passes to that

sturdy gazelle
# terse finch ive seen others do it

if they are in the server, they will be in the cache, if they leave, they stay in the cache. if the bot restarts, the cache is cleared and only those in the server can be found

earnest phoenix
terse finch
#

so the issue was i forgot my await when i converted it to a cog, i had to rename bot.fetch_user(ID) to self.bot.fetch_user(ID) and must have accidently deleted the await

earnest phoenix
#

I mean, that still won't get the function executed if the UserConverter raises UserNotFound error, will it?

crimson vapor
#

what is that font

#

why does it look like that

earnest phoenix
#

people keep complaining it kekw

solemn latch
#

Pain.font

earnest phoenix
#

I have no clue, that's default

crimson vapor
#

not complaining

solemn latch
#

Its probably windows text smoothing disabled

crimson vapor
#

but confused

#

you use linux?

earnest phoenix
#

I do

#

use both

vale garden
#

yo im kinda dumb but

#

im adding a user to a server

#

using guilds.join

#

and i used this method

#

user_object = requests.put(url = url, headers = headers, data = {"body": access_token})

#

ik its wrong but idk how to fix it

#

plz help

#
'code': 50035, 'errors': {'_errors': [{'code': 'CONTENT_TYPE_INVALID', 'message': 'Expected "Content-Type" header to be one of {\'application/json\'}.'}]}, 'message': 'Invalid Form Body'}
#

also i got this err

solemn latch
#

Add to your headers the content type it says to use.

vale garden
#

so is the data thing fine

solemn latch
#

No idea tbh. I feel your body shouldn't be the acess token but I dont know. It would be on the docs

#

If you fix the header issue the error mentions if there are any further errors it should tell you.

earnest phoenix
#

if you use json kwarg it'll automatically set the content-type to application/json.

#

As Woo said though, ig you should replace body with access_token

vale garden
#

kk

mellow ether
#

How do u block messange with colours

lyric mountain
#

Access token in body? Lul

crimson vapor
#

lmao

haughty vortex
#

so the reason is that, the bot is responding to itself

#

@barren brook ^ that's why

crimson vapor
#

oh

#

right

vale garden
#

hi

#

i just came back

#

and looked at my code

#
 @staticmethod
  def user_join(token, access_token, userr):
   try:

    url = Oauth.discord_api_url + f"/guilds/768019392596017164/members/{userr}"
    
    headers = {
      "Authorization": "Bot {}" .format(token)
    }
    

    user_object = requests.put(url = url, headers = headers, data = {"body": access_token})
    user_json = user_object.json()

    return user_json

   except Exception as e:
     print(e) 
#

this is already in the application/json format

#

lmao

#

aaa

#

idk what the problem is

earnest phoenix
#

no?

#

I was saying json kwarg, not json method doe

#

that body is still there kekw

vale garden
#

"Authorization": "Bot {}" .format(token)

#

thats json kwarg

#

oh yea i changed it to

#

user_object = requests.put(url = url, headers = headers, data = {"access_token": access_token})

#

after that

#

lol

earnest phoenix
#

What is even kwarg lmao

mellow kelp
#

kwarg

earnest phoenix
#

I meant you should pass the payload dict to json kwarg instead of data kwarg

vale garden
#

oh bruh

#

lol

earnest phoenix
#

that way, the Content-Type will be application/json

vale garden
#

user_object = requests.put(url = url, headers = headers, json = {"access_token": access_token})

#

you mean like this

#

right

lyric mountain
vale garden
#

a

mellow kelp
#

hm yes

#

sounds about right

vale garden
#

eee

#

im getting this error now

#

Expecting value: line 1 column 1 (char 0) None

earnest phoenix
#

send line @vale garden

#

also what lang?

vale garden
#

py

#

this is the whole code

#
import requests

class Oauth(object):
  client_id = "790134964632813578"
  client_secret = client_secret_here
  scope = "identify%20guilds.join"
  redirect_uri = "https://OAuth2.phoenix76.repl.co/login"
  discord_login_url = "https://discord.com/api/oauth2/authorize?client_id={}&redirect_url={}&response_type=code&scope={}" .format(client_id, redirect_uri, scope)
  discord_token_url = "https://discord.com/api/oauth2/token",
  discord_api_url = "https://discord.com/api/v8"

  @staticmethod
  def get_access_token(code):
    payload = {
      "client_id": Oauth.client_id,
      "client_secret": Oauth.client_secret,
      "grant_type": "authorization_code",
      "code": code,
      "redirect_uri": Oauth.redirect_uri,
      "scope": Oauth.scope
    }
    
    headers = {
    "Content-Type": "application/x-www-form-urlencoded"
    }

    access_token = requests.post(url = "https://discord.com/api/oauth2/token", data = payload, headers = headers)
    json = access_token.json()
    return json.get("access_token")
    
  
  @staticmethod
  def user_join(token, access_token, userr):
   try:

    url = Oauth.discord_api_url + f"/guilds/768019392596017164/members/{userr}"
    
    headers = {
      "Authorization": "Bot {}" .format(token)
    }
    
    user_object = requests.put(url = url, headers = headers, json = {"access_token": access_token})
    user_json = user_object.json()

    return user_json

   except Exception as e:
     print(e) 
  
  @staticmethod
  def get_user_json(access_token):
    #print(access_token)
    url = Oauth.discord_api_url + "/users/@me"

    headers = {
      "Authorization": "Bearer {}" .format(access_token)
    }

    user_object = requests.get(url = url, headers = headers)
    user_json = user_object.json()

    return user_json
crystal wigeon
#

hey guys, umm how do i check if the user is premium? there's no premium property on author or in message.client.user

mellow kelp
#

you mean nitro user?

crystal wigeon
#

yeah

#

there's a buy premium on top.gg right?

haughty vortex
#

iirc you gotta get the user object

crystal wigeon
#

that

haughty vortex
#

oh

mellow kelp
#

Apparently GuildMember has a premiumSince property

#

According to a stackoverflow answer i just googled

#

so uh, you could try that

crystal wigeon
#

yeah they're saying there's a "premium" property

#

but its undefined

lyric mountain
crystal wigeon
#

so if a user is premium i wanna give extra rewards

#

how do i check for that?

lyric mountain
#

Idk how you can check if an user has premium in top.gg

mellow kelp
#

oh i thought you were talking about nitro KEKW

lyric mountain
#

They'd need to add that property to the api

#

Otherwise, you can't

crystal wigeon
#

Mmm

mellow kelp
#

yeah theres no way rn

crystal wigeon
haughty vortex
#

it's not iirc

mellow kelp
#

wait users on top.gg have a supporter property

#

maybe its that?

crystal wigeon
#

its not there on message.author

mellow kelp
#

i mean

pale vessel
#

Nope

#

I had to scrape

#

That property is like something else

mellow kelp
#

ah yes

#

if everything else fails, scraping is always the solution

pale vessel
#

if ($(".badgecase img").toArray().find(x => x.attribs.alt == "premium"))

#

Cheerio gang

trim saddle
#

bots do be having limited access to users

versed valve
#

!spam 2

earnest phoenix
#

Hmmm?

#

i think he failed horribly at making a selfbot

#

Lmao

valid temple
trim saddle
#

you just answered your own question

earnest phoenix
#

First thing:
args[0] gets the command too, so if your command is an example !help that gets the "help" string

#

I never used args[0] so i'm not experienced with that error but i know what happens....

sacred aurora
#

Why not shifting the args array on command execute

#

So the "help" will be deleted

#

Welp

valid temple
#

im not showing all my code, i did do that

earnest phoenix
#

Also, the hastebin link is empty.

valid temple
#

lol

#

thats a rip

earnest phoenix
#

Hmm?

valid temple
earnest phoenix
#

What's wrong?

valid temple
#

tryna see how to send all of the properties of one of the bigger properties, like sending all of the properties of moderation

#

ok well idk im trying to simplify it too much ik how to do that

#

how do i check if the first arg (args[0]) is equal to one of the category propertie names, but idk how to do it bcs its json which i cant use a for...of on to check the category propertie names to a string

earnest phoenix
#

First thing:
DON'T USE args[0]

#

It gets the main command

#

Also, show me where is defined args

#

Before i can suggest you something i have to see your args variable.

#

Or constant

valid temple
#

i use args[0] for everything and it works, heres variable: ```js
const args = message.content.slice(prefixes.length).trim().split(/ +/);

earnest phoenix
#

the g is missing after +/

#

regex

#

fam

valid temple
#

dawg i aint tryna be mean, thanks for tryna help, but my args works fine

pale vessel
#
const arg = "play";
Object.entries(commandsJSON).find(x => x[1].cmds.includes(arg)); // ["music", { name, ... }]```this maybe?
#

i'm not sure what you're trying to achieve really

valid temple
#

ye its hard to explain lol

#

also nice pfp

earnest phoenix
#

I suggest you to add that g

pale vessel
#

It doesn't matter

#

Split does it globally

#

You can omit the g flag

earnest phoenix
#

Oh

#

So i used g for no reason

#

lmao

pale vessel
#

Yes

earnest phoenix
#

People like me are the reason that why we don't progress as civilization

trim saddle
#

@pale vessel i have big fat lazy

earnest phoenix
#

lmao

#

I saw that message flazepe sonrojado

pale vessel
earnest phoenix
#

Gtg

#

Goodbye

sacred aurora
#

why does the tab is not working?
">>> \tBlablabla"

#

its just like gone

#

i already try manual spacing and still there's no space at the beginning of the synopsis

pale vessel
#

Discord removes more than one spaces

sacred aurora
#

hmm

#

is there any alternative?

pale vessel
#

Yes

#

hold on'

sacred aurora
#

alright

pale vessel
#

Use  

sacred aurora
#

nooice

#

its working

#

thanks again

pale vessel
#

all good bro

valid temple
sacred aurora
#

change it to lowercase first

#

eh

#

nvm

trim saddle
#

@pale vessel help me figure how to properly type my intents

pale vessel
#

intents

trim saddle
#

shush

#
interface ClientOptions {
    intents: keyof calc.wsIntentsType[]
}
``` this isn't proper
cinder patio
#

show wsIntentsType

trim saddle
#

it's just an object with a bunch of number keys

cinder patio
#

are the values also numbers

trim saddle
#

yes

cinder patio
#

why not use enums then

trim saddle
#

because, no idea

cinder patio
#
enum wsIntentsType {
  TYPE1,
  TYPE2,
  TYPE3
}

...
intents: wsIntentsType 
#

(assuming the types go from 0 - n)

trim saddle
cinder patio
#

you don't declare types

#

and there's no equal

#

see my example

#
enum wsIntentsType {
  GUILDS,
  GUILD_MEMBERS,
  ...
}
trim saddle
#

hm.

true ravine
#

Let's say I accidentally uploaded my token to my github repo (it's private tho dw) - how do I stop people being able to ever see the file that had my token in it?

earnest phoenix
#

gitignore it?

haughty vortex
#

you delete and recreate the repository

earnest phoenix
#

oh, I didn't read that right kekw

haughty vortex
#

git stores everything

#

even if it looks deleted

true ravine
#

Yeah I know it keeps it which is why I asked lul

#

I'll just recreate the repo

#

Thanks

haughty vortex
#

np

solemn leaf
#

Or refresh token

#

And just leave it there

haughty vortex
#

some bot list doesn't allow tokens to be anywhere in the bot repo

zenith terrace
#

not even in a .env file?

true ravine
#

Another question before I upload everything again

#

Currently I am using plain/raw sql queries for my database - should I switch to a more secure method before uploading, or can I just fix it before I make it public?

haughty vortex
haughty vortex
#

make sure that there's sanitation of user inputs of course

true ravine
#

Aight

#

I have a function that escapes any non-alphanumeric characters to theoretically prevent injection and I haven't had instances of it in the ~10 months the bot has been public so I'm assuming it's safe

haughty vortex
#

yeaaaaaa

#

sql databases are a bit more sensitive than you think but aight

#

it's a common misconception that user input can be "filtered"

true ravine
#

Yeah I understand that - otherwise injection attacks would never happen because basically anyone could make a function like mine

haughty vortex
#

yea

true ravine
#

I'll just keep it private for now, thanks

haughty vortex
#

alright

#

I would suggest using prepared statements instead of raw sql anyway

true ravine
#

Yeah I'm going to switch to using a rest api and in the server I'll be using something like prepared statements (or maybe something else I'm not sure yet)

haughty vortex
#

aight

summer torrent
earnest phoenix
#

How I make poll in discord

true ravine
silent cloud
#

Hey guys

#

Can somebody help me pls

#

I have blacklist command

#

It successfully adding to blacklist, but not unblacklisting

true ravine
#

Do you get any errors when you try to unblacklist?

silent cloud
#

No

#

I have this.... Only

true ravine
#

Sorry if I'm not understanding your code correctly, but on line 45 should it be this.client.user.settings.update ?

#

It looks like you are telling it to update the wrong thing

#

So it basically forgets what you told it to do with the blacklist

silent cloud
#

Hm

#

Thats settings.js file

#

In main js i have....

#

const Settings = require("./Settings.js");

true ravine
#

Ah I see

#

I'm not sure then

#

I'm not familiar with that way of doing things so you'll have to wait for someone else's answer, sorry

silent cloud
#

Kk, thx for watching

haughty vortex
#

@silent cloud does it unblacklist guilds successfully ?

silent cloud
#

No

#

Only blacklist

#

I need unblacklist too, but idk why doesnt working

haughty vortex
#

then I'm pretty sure it should be this.client.user.settings.update instead

#

either that, or you need to remove settings from wherever you use it

#

e.g. this.client.user.guildBlacklist instead of this.client.settings.guildBlacklist

silent cloud
#

Where i need to change it?

#

Line?

haughty vortex
#

wherever you use it

silent cloud
#

Oh lets see

haughty vortex
#

you're updating this.client.user but you're checking this.client.settings

#

and you're also checking this.client.user.settings below the guild (un)blacklist

#

you're checking too many things that make no sense together

silent cloud
#

Done, lets try

#

Yea

#

It working

#

@haughty vortex thx

haughty vortex
#

np

rocky hearth
#
class Parent {
  get isOfType_1() {
    return false;
  }
  get isOfType_2() {
    return false;
  }
}
class Parent_1 extends Parent {
  get isOfType_1() {
    return true;
  }
}
class Parent_2 extends Parent {
  get isOfType_2() {
    return true;
  }
}

Guys is this a good practice or I should create a boolean member?

crimson vapor
#

create something that actually does something

#

best experience imo

rustic nova
#

mfw i thought that was java

rocky hearth
haughty vortex
#

what the hell does that do

#

is what he means

crimson vapor
#

best way to learn is to practice

#

make an extention of client or smth

#

and run your bot

rocky hearth
#

I would have random instances of both the sub-parents in an array.
Then later I want to know if the instance is of what parent.

haughty vortex
#

uh

#

use instanceof

#

lmfao

cinder patio
#

^

earnest phoenix
#

hi

#

I need some help 😭

slender thistle
#

Would you like to appoint a therapy session or a development assistance?

zenith terrace
#

asking for help but not saying why

dusky sundial
#

But where's the fun in describing the problem and getting help immediately? 5Head

slender thistle
#

Because development and mental health are not coexistent

marble juniper
#

that moment when ur trying to play ur favorite game

#

but they have maintaince

#

because of an update

earnest phoenix
#

So why is this not working?

slender thistle
#

So I wonder why

earnest phoenix
#

Same LOL

slender thistle
#

Let's go through this together

earnest phoenix
#

Sorry I’m new..

slender thistle
#

Are you familiar with JavaScript?

earnest phoenix
#

A bit..

slender thistle
#

Why are you developing a Discord without basic knowledge of JS?

earnest phoenix
#

Just uh, help me

crimson vapor
slender thistle
#

If you had a slightest idea about how JSONs work

#

Also, what's the error JS is outputting

earnest phoenix
#

Nothing...

slender thistle
#

What's new, right

cinder patio
#

Don't waste your time with him

earnest phoenix
#

Bruh

slender thistle
#

Are you sure no error is being outputted and that you're not silencing them code-wise

earnest phoenix
#

Yes

slender thistle
#

Quite a confidence

earnest phoenix
slender thistle
#

Shows that it's successfully loaded

glad violet
#

Help i need help in my code js

#

i havea a music bot

earnest phoenix
#

So what’s the problem? @slender thistle

glad violet
#

leave command not working

#

it says leaved success in console but not leaving voice

#

code

#
              case 'stop':
                  var server = servers[message.guild.id];
                  if(message.guild.voice.connection){
                      for(var i = server.queue.length -1; i >=0; i--){
                          server.queue.splice(i, 1);
                 } 
               if(server.dispatcher) server.dispatcher.end();
               message.channel.send("Leaving...")
                      console.log('Leaved Succes')

                 }
                 
                 if(message.guild.connection) message.guild.voice.connection.disconnect();
              break;
             
rustic nova
#

guild.voice.connection, no?

#

On your last condition check

glad violet
#

old was VoiceConnection now it is voice.connection

#

can u fix the problem

earnest phoenix
#

Help?

rustic nova
#

@earnest phoenix learn basic js

earnest phoenix
#

And no it’s not showing any error

glad violet
earnest phoenix
crimson vapor
#

learn basic js

#

last time we are saying this

earnest phoenix
#

Then give me the fucking reason is it showing a fucking error no right? Then wtf

crimson vapor
#

then debug it

glad violet
#

i know some js coding

earnest phoenix
#

It’s just not giving a embed response @glad violet

slender thistle
#

How do you call the function itself?

#

There's no run property in the returned object when you require that file

crimson vapor
#

oh there isn't

slender thistle
#

I wonder why?

#

Maybe because they didn't set it in the module.exports part?

#

Specifically, you create a function run

#

and not attach some function as a property run

#

Applying some common knowledge from scopes and general common sense, that's not what's supposed to be done

earnest phoenix
#

Bruh, I’ve installed a package to make it work 24/7 and that’s why I have to use run rather than execute

crimson vapor
slender thistle
#

That doesn't matter in this case

sand condor
#

the name isn't the problem

earnest phoenix
#

Then what?

slender thistle
#

The problem is how you create and use (rather, not) it

#

Let me show you

earnest phoenix
#

Ye

#

Module.exports oh...

slender thistle
earnest phoenix
#

Ye

slender thistle
#

Tell me now

#

Does it work?

earnest phoenix
#

Lemme see

slender thistle
#

Don't use an interpreter

#

use your common sense and JS knowledge

#

k

#

Now, if you were to do this and keep index.js the same, what do you think really happens?

pale vessel
#

Both work shiv

#

You can define it that way

#

It will be a property called run

slender thistle
#

I'll be pissed both at myself and JS for a sec, brb

zenith terrace
#

👀

solemn leaf
#
let x = args.join("") || message.author.displayAvatarURL({ dynamic: true })

How can I make something like this work where if args is nil it makes it the avatar

zenith terrace
#

maybe shiv should take a break from this channel

crimson vapor
#

honestly I think just a break from this server

#

all the shit that takes place here

zenith terrace
#

its why I've been less active KEKW

pale vessel
#

Take a break from discord and focus on your assignments GWahreeSure

zenith terrace
#

I got all done today flaz

solemn leaf
#

.<

zenith terrace
#

>:(

pale vessel
#

Gg

zenith terrace
#

now ima go gaming

solemn leaf
#

shiv stargirl what

tribal siren
#

so i have this line

#
const bot = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });```
#

i want to add ShardingManager there

#

something like this

#
const bot = new Discord.client({ shardCount: 'auto' });```
#

how to make it so that they both get included?

molten yarrow
#

thats not how shardingManager works

pale vessel
#

That's the internal sharding

solemn leaf
tribal siren
#

oh is it

#

im just reading an idiot's guide about sharding

#

because i heard it's a serious stuff needed after passing 2000 guilds

solemn leaf
#

are you in 200 guilds

earnest phoenix
#

@slender thistle worked

molten yarrow
earnest phoenix
#

Thanks I guess..

tribal siren
#

oh ok thanks

slender thistle
#

Wonders of JS

crimson vapor
#

JS is pretty good

slender thistle
#

But sometimes doesn't make sense to me

tribal siren
#

js is noice

#

oh that's the yangire girl

solemn leaf
slender thistle
#

Yangire? I wouldn't say so but I don't mind if it is

solemn leaf
#
let x = args.join("") || message.author.displayAvatarURL({ dynamic: true })

How can I make something like this work where if args is nil it makes it the avatar

pale vessel
#

nil?

#

is this go

solemn leaf
#

no its js

pale vessel
#

What do you mean by nil?

#

Empty?