#development

1 messages · Page 1886 of 1

nocturne comet
#

Hey if anyone needs testers pop me a ping

boreal iron
#

Try to send application/json within the header

#

As content type of course

#

That’s why I told you to define a header

#

You have to tell the endpoint which content type you wanna receive as it’s capable of returning different types

#

node-fetch and browser fetch isn't the same thing apperantly

Ouch 🤦‍♂️

#

Send the content type as header or make things god damn complicated and convert the buffer to a string

#

some_bufferino.toString("utf-8")

simple stump
#

How do I set a channel name? Is it channel.setName?

sterile lantern
#

yes for discord.js

spark flint
#

How do i use the Cpanel API with python lmao

#

i hope someone else can help me here

boreal iron
#

Your browser isn’t doing anything else like nodejs other than converting the buffer into a human readable string

spark flint
#

anyone here good at html lmao

#

a text box next to the text

eternal osprey
#
 let database = JSON.parse(fs.readFileSync("./database.json", "utf8"));
  for (const key in database){
    if (message.channel.id == key && message.attachments.size > 0){
        let d = [...message.attachments]
        console.log(d)
        let m = d[0][1].attachment
        console.log(m)
        let g = await client.channels.cache.get(database[key].output[0]);
        setTimeout(() => {
          g.send(m)
        }, 10000);
       
     
    
    }
  }```does anyone know why this code is sending the formats really strange on android?
#

it's sending like this on pc and iphone

#

but on android it's only showing 1 image and then the bott's name again

#

how's that possible and can i fix that?

lyric mountain
eternal osprey
blissful coral
#

seems discord sided not you

lyric mountain
#

that's a discord thing, not something you can solve through code

#

also try to migrate to an actual database

#

will save u headaches later

stray seal
#
                    member.send('Here is a transcript of your ticket, please click the link below to view the transcript', embed); 

Code is on top, error on bottom. What do i do? I am bad at reading errors lol

(node:87) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
    at /home/runner/Ticket-Bot/commands/ticket/close.js:40:13
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:87) 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:87) [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.
blissful coral
#

member is undefined.

lyric mountain
#

can you even send a message to a member object?

blissful coral
#

yes

#

It'll send it to the user obj I think

#

If not its member.user.send

#

But member isn't defined so the function isn't the problem

stray seal
#

How do i fix?

blissful coral
#

Define member

stray seal
#

There is none.

#

It is whoever closes the ticket

blissful coral
#

That's why you define it

#

Well what are you defining member as

stray seal
#

The one who opened the ticket

blissful coral
#

what do you define it as

#

exactly

#

show code

stray seal
#

Ping

blissful coral
#

?

lyric mountain
#

Pong! 23ms

verbal meadow
blissful coral
#

No

#

They are attempting to send a dm

#

reply doesn't exist on user

#

nor on member

stray seal
#

No i am not.

blissful coral
#

Are you sending in a channel?

#

Then why are you doing GuildMember#send()?

stray seal
#

I am trying to make it where if you do t!close it closes the ticket.

stray seal
#

It don't delete unless you run t!delete

blissful coral
#

Then TextChannel#send()?

#

Don't do member#send() if its meant for a channel

verbal meadow
blissful coral
#

I am aware

stray seal
#

I don't care if it sends anything, the ticket is not closing.

blissful coral
#

Show the code

#

You need to do TextChannel#send() not GuildMember#send() @stray seal

#

In this case your doing undefined#send() which doesn't exist in any case KEKW

stray seal
blissful coral
#

Why are you looking for a member via a ticket ID

verbal meadow
blissful coral
#

Stop please

stray seal
#

???

#

What?

blissful coral
#

Not you

stray seal
#

I used a YT video my friend sent. The YouTuber posted the code on G-Hub to help people see the code, so they can see what they missed, since he has low quality PC. I am IRL friends with him, so i got to watch him make it.

#

He don't have discord last time i talked to him.

blissful coral
#

I suggest learning how to use javascript before making a discord bot

stray seal
#

I never had this error on any other bots.,

lyric mountain
#

they are VERY different languages

stray seal
#

I call JS Java lol

#

BUT, still having issues.

lyric mountain
#

you shouldn't tho

#

also, saying "I never had this error before" is not a valid complaint

#

you need to define member, that's a very basic stuff

stray seal
stray seal
#

But now it is not.

lyric mountain
#

if the code is the same, then it wasn't working earlier

stray seal
#

It was though.

lyric mountain
#

well, if you say so...

stray seal
#

Can someone help me fix this lol

#

How do i defind a member?

blissful coral
#

Like I already told you, learn javascript before you make a discord bot

blissful coral
slender wagon
blissful coral
wheat mesa
#

html discord bot

slender gulch
#
<script>fetch('https://discord.com/api/v9/...')</script>
``` ![kekw](https://cdn.discordapp.com/emojis/885719221407973417.webp?size=128 "kekw")
lyric mountain
#

V12...💀

#

U can't return inside promises btw, but u can await and extract whatever u return to the promise

#

Yet v12 is already deprecated

#

Unmaintained libs are dangerous to keep using

#

The later u change, the more work it'll take

#

Except it'll not stay up to date with discord api

#

Honestly it's a miracle that's keeping v11 alive

#

I bet message intent will finally pull the plug

quartz kindle
#

receiving a channelCreate/channelUpdate for stage channels crashes djs v11

errant flax
#

how do i download a database from mongodb?

#

since i wanna transfer it to another cluster

lament rock
#

api v6 is already supposed to be unavailable, but for whatever reason, it can still work. djs v11 is still on api v6

lyric mountain
#

I mean, that's how you do with SQL databases

lament rock
#

Literally divine intervention

errant flax
lyric mountain
#

Literally that, backup the database

#

Search how you backup a mongo database, that'll be how you download it

#

After that just restore it on the desired server

earnest phoenix
#
  if(button.id === "ye"){
     
    let jokes = new MessageEmbed()
    .setTitle("Jokey Bot Help Menu | Jokes")
    .setColor("RANDOM")
    .setDescription("**PREFIX**: `j! or mention`!")
    jokes.addField('`j!dadjoke`\n `j!joke`\n `j!mamajoke` \n `j!schooljoke`\n `j!teenjoke` \n `j!meme`','\u200B')
    jokes.setFooter(`© Made by Dayln#3129`)



     let button = new MessageButton()
  .setStyle('url')
  .setURL('https://discord.com/oauth2/authorize?client_id=882255845147160607&scope=bot&permissions=858927048') 
  .setLabel('Invite me!'); 

  let button3 = new MessageButton()
  .setStyle('url')
  .setURL('https://discord.gg/TeyAEhjXuD') 
  .setLabel('Support');  

    let button2 = new MessageButton()
  .setStyle('url')
  .setURL('https://daylnbot-2.daylncode.repl.co/') 
  .setLabel('Website');  

let button4 = new MessageButton()
.setStyle('red')
.setLabel('⬅️')
.setID('home');

let button8 = new MessageButton()
  .setStyle('green')
  .setLabel('➡️') 
  .setID('nfsw'); 

let row = new MessageActionRow()
  .addComponents(button, button2, button3, button8, button4);

  
  button.message.edit(jokes, row)
  }
#

that all the code

wheat mesa
#

button.message is undefined

#

probably because there's no message property on a MessageButton object

west agate
#

how do i check if my bot has a certain permission?

rose warren
#

Lib?

earnest phoenix
#

it 13*

#
const { client } = require('discord.js')
const user = require('discord.js')

module.exports = {
  name: "hidden",
  cooldown: 10,
  description: ("TEST"),
  execute(message) {
    message.author.send('Hello! Please Redeem your prize here! ||https://jokeybot.daylncode.repl.co/hidenredeem.html || :check:')
    message.reply('You got mail :e_mail:')
message.client.channels.cache.get('891558944496046091').send('@gritty ibex i have sent a rick roll using **Hidden Command** HEHE')

client.users.cache.fetch('673011572225998856', false).then((user) => {
 user.send('Hello!');
});
      
  }
};



pale vessel
#
  1. That's not how you import client, use message.client
  2. It's users.fetch, it's not a cache operation
cinder birch
#

ohhh

pale vessel
#

Get rid of those imports, they're invalid and don't do whatever you think they do

cinder birch
#

can i also ask off topic queries over here?

errant flax
#

how do i make something happen in nodejs?
like i want the a variable to be 10 (just an example) at the rate of 0.0001% chance of happening when i run the code

slow ibex
#

From what line?

errant flax
#

discord.js version?

#

the type is now GUILD_TEXT

#

iirc

pale vessel
#

Check if member.presence exists before accessing member.presence.status as it's nullable since v13

#

member.presence?.status === "online"

small tangle
#

Actually what happens in the case presence is null with ? ? It doesnt try to access status and executes the next line?

pale vessel
#

It treats member.presence?.status as undefined and it won't pass

small tangle
#

But dont crash? So it would just evaluates the compare to undefined === online which is false?

pale vessel
#

Yep

small tangle
#

I see nice peepoHappy

#

Thx

errant flax
#

quick question how do i make my npm package compatible with ts?

regal creek
#

so im going around having fun and learning about machine learning and tensorflow. But when i try to use the tensorflowjs converter i get an python error message saying "no module named tools"

#

any ideas?

pale vessel
errant flax
#

example?

#

like what the package.json would look like

#

use this instead: member.presence?.status

pale vessel
errant flax
pale vessel
#

It'll also return undefined instead of null with how optional chaining works

errant flax
#

ah

errant flax
pale vessel
errant flax
#

is that a yes or no

pale vessel
#

You want your module to work with TypeScript, what do you do?

#

You learn TS!

#

Annotations are easy to pick up, you're fine haha

#

Have a look at the examples

molten flint
#

Hey somoene know how to fix ticket.js THE problem is when ticket creator close ticket i get error and bot shut down

earnest phoenix
#

youll need presence intent

#

yes

#

and youll need to enable it in dev portal too

#

if you didnt

slow ibex
#

So.. ok
Oftentimes i get this Error when trying to play a song through ytdl-core

MinigetError: input stream: Status code: 403
    at ClientRequest.<anonymous> (C:\Users\Administrator\Desktop\Discord Bots\DJ Strawdong\node_modules\miniget\dist\index.js:210:27)
    at Object.onceWrapper (events.js:520:26)
    at ClientRequest.emit (events.js:400:28)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:647:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:515:22)
    at TLSSocket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at TLSSocket.Readable.push (internal/streams/readable.js:204:10) {
    statusCode: 403
}
#

When this happens the Bot hangs in an Limbo on that guild.

sharp wing
#

Yo guys with this command i want the Bot to DM me but it isnt working


module.exports = {
    name:'say',
    description:"say what the user says",
    execute(message, args){
     
        if(message.member.roles.cache.has('782908342548299778')) {
        const messageSent = message.content.slice(5).trim()
        if(message.author.bot) return;
       user.send('content');
        message.delete()
    }
} 
}
#

like if i run the say command it says stuff in the server, same way i want the bot to dm me it and not say it in the server
dm me or dm the person i mentioned

errant flax
#

how do i run a ts file using terminal

split hazel
#

but does for some reason leak like 100mb memory initially

errant flax
#

what does that do

split hazel
#

well if you didn't know what it did why would I send it to you

errant flax
split hazel
#

oh boy

split hazel
#

it means it uses a bit more memory (ram) than javascript when it starts

errant flax
#

ah

cinder patio
#

you can also add a script in your package.json which automatically tanspiles and runs your code...

#
"run": "tsc && node ."
errant flax
#

im just using repl.it bc laptop slow af

split hazel
#

I don't think repl lets you install things globally

errant flax
#

so like terminal commands for packages dont work?

errant flax
split hazel
#

yes

#

I don't know there might be some hack for it if anyone knows @quartz kindle does

errant flax
split hazel
#

he's a repl it nerd to an uncomfortable extent

errant flax
#

to this*

split hazel
#

Yes

errant flax
#

the only way u can run some cmds in terminal is that the repl needs to be running

#

for like custom ones

#

afaik

split hazel
#

though you might be able to find some typescript project template running

earnest phoenix
errant flax
earnest phoenix
#

npx <command here>

errant flax
#

ah

#

yo it works

#

but why do i get an error

#

i thought any valid js is valid ts

#

its running in a loop

#

fixed it

errant flax
errant flax
eternal osprey
#

hey how do i check if a user's account is over 3 weeks created and isn't a bot?

eternal osprey
#

js

spark flint
#

i know how to do it in python

eternal osprey
#

djs

spark flint
#

ah

#

wait until someone who knows djs to arrive lmao

eternal osprey
#

alrighty np!

boreal iron
errant flax
earnest phoenix
split hazel
#

claim is exaggerated

#

you have to set a couple compiler flags for it to work

errant flax
#

i got an error in ts

#

i just wanted to console log a string

quartz kindle
#

running ts-node in repl.it is better done using a local ts-node that runs inside the code

#

You can require ts-node and register the loader for future requires by using require('ts-node').register({ /* options */ }). You can also use file shortcuts - node -r ts-node/register or node -r ts-node/register/transpile-only - depending on your preferences.

Note: If you need to use advanced node.js CLI arguments (e.g. --inspect), use them with node -r ts-node/register instead of the ts-node CLI.

#

you can check this example

sharp wing
#
                                                            const user = client.users.cache.get('832933395998048306');user.send('Birthdays come around every year, but friends like you can only be found once in a lifetime.I really love how you be sooo nice to people no matter how rude they are to you.You barely even express anger and always spread postivity!\n\nWishing you a fabulous birthday! Hope you had a good day so far and enjoy the rest of the day too :DeadpoolHeart:');}
                                                            if(command === 'doge'){
                                                                const user = client.users.cache.get('832933395998048306');user.send('https://www.homemade-gifts-made-easy.com/image-files/xhappy-birthday-images-cute-bear-600x600.jpg.pagespeed.ic.5JWTK6-7RI.jpg');}```
this command works when i use my id but not when i use my friend's ID

i want the bot to dm my friend
boreal iron
#

lmao that gif, Tim

#

glad you deleted the embed KEKW

quartz kindle
#

xD

quartz kindle
#

the user gets cached once the bot sees it after it starts

#

for example when it reads a message from that user

split hazel
#

its eri

sharp wing
boreal iron
#

Fetch the user instead

high crown
#

My code is taking a lot of time to run

#

Like literally a lot of time

#

What to do of high ping?

#

Are u typing or my internet is gone

#

?

grim aspen
#

What is your hosting service?

high crown
rocky hearth
#
// for ts, I have a type like 
type TP = {
  a: any,
  b?: any
}

// now I want make a MagicUtility Generic which transforms each required field to `string` and optionals to `number`
// for example
type AfterMagic = MagicUtility<TP>
// AfterMagic should be of this type =>
/*
{
  a: string
  b: number
}
*/

I hope its clear.

grim aspen
high crown
grim aspen
#

It is a package that let’s you run code 24/7 with a vpn

high crown
#

Ohhh

#

I'll check it on Google

#

Thanks for help

grim aspen
#

It works better than uptime robot

high crown
#

Oh

#

Noice

#

I'm checking it rn

split hazel
#

to fix high ping you need to remove virus

earnest phoenix
#

?? what

#

in the fk is this

pale vessel
#

AbortController is in Node 16+

earnest phoenix
#

ill stick to cs

pale vessel
#

Good choice

cinder patio
errant flax
#

dont understand the qouted part

quartz kindle
#

check the example i sent

errant flax
#

like

require("ts-node").register({...})
#

do i do this in a .js file

raw gust
#

hey Is anyone here using mongodb?

errant flax
#

and whats /* options */

errant flax
quartz kindle
errant flax
#

whats the options thing?

quartz kindle
#

probably the same options tsconfig does

errant flax
#

idk tsconfig or anything abt ts

quartz kindle
#

then why are you using ts lol

errant flax
#

i just started learning it

quartz kindle
#

then learn tsconfig

errant flax
#

k

quartz kindle
#

they are not required tho, you can just run defaults

errant flax
#

but why is it having an error tho

#

i just did
console.log("hello world")

#

then this came up

quartz kindle
#

did you try what i showed you?

errant flax
#

wait the register part?

quartz kindle
#

everything

errant flax
#

ah not yet misosface

quartz kindle
#

package.json main -> js file
js file -> require ts-node register
js file -> require ts file
ts file -> your code

cinder patio
# rocky hearth ```ts // for ts, I have a type like type TP = { a: any, b?: any } // now I...

The only way I can think of to do it is like this:


type TP = {
  a: number,
  b?: number
}

type Magic<T> = {
    [key in keyof T]-?: undefined extends T[key] ? number : string;
}

type AfterMagic = Magic<TP>;

const a: AfterMagic = {
    a: "A",
    b: 4
}

BUT the properties of TP cannot be any, because any could be undefined so there is no way to check if a property is optional or not.

#

you could really make the properties any type except any or unknown, and it'll work

errant flax
quartz kindle
#

yes

errant flax
#

oh it works

#

without ts-node

#

:kekw:

#

is this ts or node version?

quartz kindle
#

node

errant flax
quartz kindle
#

do you have all the dependencies

errant flax
#

I've just required the file btw without ts-node

quartz kindle
#

why dont you just...

errant flax
#

the thing is im making my npm package be supported for ts

quartz kindle
#

you dont need ts to make it work in ts

errant flax
#

so what do i do then

quartz kindle
#

all a js lib needs to work in ts is to have a .d.ts file

errant flax
#

and then iara_huh_hmm

quartz kindle
#

and then it works

#

lol

#

the .d.ts file contains the exports and declarations in ts format

#

example

#
// index.js
exports.myfunction = function(a, b) { return a + b; }

// index.d.ts
export myfunction(a: number, b: number): number
errant flax
#

but how do i code thag

#

that*

#

is there any way to compile it easily iara_huh_hmm

hybrid cargo
#

Create a file named index.d.ts

quartz kindle
#

if you're writing your lib in js there is no compiling

#

unless you want to write the entire lib in ts

errant flax
hybrid cargo
hybrid cargo
#

Yeah

errant flax
#

imma learn ts first

#

but i do wanna know how i can test it

quartz kindle
#

test it on your own pc

#

with typescript/tsc

feral aspen
#

How's everyone's day, going?

cinder patio
old cliff
#

should I add READ_MESSAGE_HISTORY as required perm?

hybrid cargo
#

I mean what are you doing to cause this error?

boreal iron
#

Imagine copy and paste your own code and send an ephemeral message to somebody via. DM.

old cliff
quartz kindle
#

read message history is required for a bunch of weird things, so i usually just keep it on

hybrid cargo
#

Changing failIfNotExists to false would solve that issue

hybrid cargo
earnest phoenix
#

can i make this less ugly

solemn latch
#

🤔 ive never used an empty slice before, what would an empty slice even do?

nocturne comet
#

Hey quick question is replit a good place for coding discord bots

earnest phoenix
#

nah, it splits the args and gets the [0]'s lengths ;d

solemn latch
#

you dont need to slice() though

boreal iron
#

Just split your content and take the 2nd item of the array as command.

#
const something = message.content.trim().split(/ +/g);

// !prefix command Woo is ugly

// something[0] -> probably your prefix
// something[1] -> probably your command
solemn latch
#

heck ive been called out

boreal iron
pale vessel
#

U can use \s+ to support other whitespaces and omit the g flag since split is already global

boreal iron
#

Hmm good note

earnest phoenix
#

wth happened to djs

small tangle
#

Its evolving. Backwards.

#

No fr its evolving which is normal that parts are getting deprecated

earnest phoenix
#

i did

#

but some intent shit is not working

#

follow the migration guide

#

nvm figured it out

#

tnx

crystal wigeon
#

its there a way to add timeout on messages that wait to get edited?

#

like my function that calls msg.edit() errors out sometimes saying "discord api error unknown message" thought it's a timeout issue where i can ask djs to wait for some more time before erroring out

cinder patio
#

and typescript will automatically generate declaration files for you

#

oh nvm

lament stump
earnest phoenix
#

I have a little question, how can i get all id object in this log :

{
    id: "0001"
},
{
    id: "0002"
}```
#

I know how to do the basics but I have a blackout

boreal iron
#

Looping through the objects or map them which will throw all items into an array

lament stump
#

^

earnest phoenix
#

oh yeah thx !!

quick salmon
#

in discord.py, does anyone know of a good way to suppress members in a voice chat and only that voice chat, but that also doesn't require them to have to leave then rejoin?

#

I tried muting but it becomes a massive faff to try and unmute them again when they leave

earnest phoenix
#

💀

quick salmon
#

wonder why

quick salmon
earnest phoenix
quick salmon
#

I might have a bad workaround

#

but if it ain't broke don't fix it

earnest phoenix
#

maybe

ancient nova
#

how do you get the msg/message thing if you don't wanna use an event?
currently I have

client.on("message/messageCreate", (msg) => {
    if (msg.guild.id != GuildID) return;
})
``` but I want to do it somehow without the need to use an onMessageEvent, so I can just do msg.guild.id with msg being something like const msg = ... and so on, is it possible?
solemn latch
#

how do you plan on knowing what the message is, or that it exists?

#

like whats the goal here?

ancient nova
#

if I have the guild ID how do I get the msg component?

boreal iron
#

Why do you need the message object if you input command in the CLI?

solemn latch
#

^ realistically you dont need it, unless you want to use the exact same functions for each command
then i guess you could generate one if you really wanted to.

ancient nova
#

for example to check for this "if (msg.guild.id != GuildID) return;" and I can't do it without the msg component

boreal iron
#

Also if you send a message via. your application it will return a promise with the message object

ancient nova
#

client.on("message/messageCreate", (msg) => {
if (msg.content = prefixhello) return msg.channel.send(hi);
})

#

so like I have this

solemn latch
#

ideally, you wouldnt use the same properties on cli ran commands.

ancient nova
#

but when I do "prefixhello" inside the console it still works

boreal iron
#

I don’t get why you need to use the message event if you wanna send commands as CLI input.

ancient nova
#

I use readline for getting the input inside command console

boreal iron
#

You can not use a discord event to manage your CLI inputs

ancient nova
#

well that sucks

boreal iron
#

That wouldn’t make any sense at all

wheat mesa
#

Why is it client.on(“message/messageCreate”

#

Is that valid?

boreal iron
#

You will have to write the code yourself dealing with your input, verify it, etc.

ancient nova
#

for example I'd have

rl.question('Listening', (answer) => {
    if (answer == `${prefix}help`) {
       const msg = getchannelbyid(id)fromguild(id);
       msg.channel.send(helpinfohere);
    }
}
``` can something like this really not be done?
solemn latch
#

if you run a command in cli, what channel do you want it to send the response to? 🤔
how would you program that, unless you always sent it to a specific channel.

#

then at that point, why not just run the command in that channel

ancient nova
boreal iron
#

If you run a command in a discord channel all associated data like the message, channel etc. will be send to you via. Discord

If you manage your commands via a CLI you have to specify anything
The channel you wanna send the stuff in, probably the guild, too etc.

It has to be an interface between djs (or the API in general) and your inputs

solemn latch
#

so your commands in cli will look like

prefixcommand channelid guildid authorid args
?

ancient nova
ancient nova
#

I just want it for eval commands and some other stuff to make my life easier

boreal iron
ancient nova
#

not by name but rather by ID though

solemn latch
#

yeah, its possible, but youd need to write a ton of code yourself.

boreal iron
#

Searching the cache or using the filter method

ancient nova
#
client.guilds.cache.filter(guild => guild.id == GuildID).then(guild=>guild.name);
#

like this?

boreal iron
#

client.guilds.cache.filter((guild) => guild.id === your_input)

ancient nova
boreal iron
#

What’s the benefit of creating an environment that can deal with CLI commands to send them to your application?

solemn latch
#

Personally, I'd just try and use dj's method for creating/adding data, with your own event.

#

just be aware, you may cause yourself some errors if you dont handle this properly.

ancient nova
boreal iron
#

I would understand creating an executable listening to arguments you pass but a whole environment permanently listening for commands you input into the console being an interface between it and your djs (app) is horribly much work for like no benefit.

#

Sending your commands in a private Discord server is easier.

slow ibex
#

So uuh..
What can i do against this thing?
When this happens my whole bot gets unresponsive for the Guild

[MV] 이달의 소녀/ 희진, 현진, 하슬 (LOONA/HeeJin, HyunJin, HaSeul) "The Carol" is playing now
MinigetError: input stream: Status code: 403
at ClientRequest.<anonymous> (C:\Users\Administrator\Desktop\Discord Bots\DJ Strawdong\node_modules\miniget\dist\index.js:210:27)
at Object.onceWrapper (events.js:520:26)
at ClientRequest.emit (events.js:400:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:290:12)
at readableAddChunk (internal/streams/readable.js:265:9)
at TLSSocket.Readable.push (internal/streams/readable.js:204:10) { statusCode: 403 }   
boreal iron
#

Well 403 is forbidden
Just handle the error and skip playing it

solemn latch
slow ibex
#

Its multiple errors.. sometime its 403, sometime 404, sometime 410

ancient nova
#

I filtered out the guild got it's components

#

now I can do guild and filter out the channel I want to message and boom

#

2 lines of code for everything

boreal iron
#

Hmm took a look meanwhile into the built in features of nodejs to read console input but it still looks like too much work to verify the complexity of being able to use different commands and their parameters

#

You’re simply building a command handler for console inputs which does the same the command handler in your application dealing with commands (in guilds for example) does

#

Which seems to be double the amount of work to do

#

But of course that’s your decision not mine

boreal iron
earnest phoenix
#

Multiple errors 😬

boreal iron
#

Following the RFC 403 is not an authentication error, but 401 is.
Also if the connection is "broken" the issuer wouldn’t return a valid status code or a response in general.

earnest phoenix
solemn latch
#

isnt there a status code for if the client breaks the connection?
for some reason 🤔

#

I think its more used internally to the webserver though

boreal iron
#

I think so

slow ibex
#

idk whats happening there.

boreal iron
#

401 is

#

(Unauthorized)

slow ibex
#

Maybe a thing that YT/Google is saying "No"

earnest phoenix
slow ibex
#
//.on("error", error => console.error(error));
.on("error", (error) => {
  onsole.log(`An error occured!: ${error}`);
  serverQueue.connection.dispatcher.end();
})

I tried it with that. Hopefully that works

boreal iron
#

The ressource is not available for the reason you receive or not receive.
Can’t be because it doesn’t exist, your user agent isn’t allowed to access it etc.

ancient nova
#

so I have an array with my command names, I want to check if the command I type is in there, if it is execute the code if it is not give an error that a command isn't in the array, how could I do that?

boreal iron
boreal iron
#

You may wanna transform it to lower case or upper case whatever you like

#

Whatever your array looks like of course

solemn latch
boreal iron
#

According to the RFC it isn’t
403 is a simple ACCESS DENIED

#

for reasons

slow ibex
boreal iron
#

Discussion over!
403 on any answer

slow ibex
#

This happens everytime when i try to manually skip after that 403/404/410 error

solemn latch
ancient nova
earnest phoenix
#

yeah but say you send correct data but 1 thing is incorrect, it could return 403 instead of 401

boreal iron
earnest phoenix
#

na i cant explain it well

boreal iron
#

It seems like you don’t get the difference between authentication and simply the fact you’re not allowed to view a resource

slow ibex
solemn latch
#

we need 402, missing authentication
401 = authentication provided but isnt valid
402 not provided
403 permission denied.

401 kinda handles both. not provided and non valid.

#

but i guess with 401 it is supposed to provide the reason in the statustext

earnest phoenix
slow ibex
#

and..
What abbout Epipe events?

boreal iron
#

A request the client does which isn’t valid will always be 400 (bad requests) BEFORE checking the validity and for example return 403 for you don’t have access even if your request is build correctly

slow ibex
boreal iron
solemn latch
boreal iron
#

If an authorization is required, no it should return a 401 before

slow ibex
#

Are you guys/girls/(what ever gender you are) really beefing around HTTP Statuscodes?

boreal iron
lament stump
#

How to check if an array of objects contains a string in JavaScript without knowing the place of the object? (like there could be more elements, but with different orders)

Like I want to access "stardust":

inventory: [{name: "Cookie", amount: 2}, {name: "Stardust", amount: 1}]

I tried: inventory.includes("Stardust") which does not work

earnest phoenix
slow ibex
#

Use 413 for everything. End of discussion /s

boreal iron
earnest phoenix
#

see

boreal iron
#

That’s up to your webserver and how you set it up

slow ibex
#

And then there are APIs that return a 404 via 200 status code

earnest phoenix
slow ibex
#

ytdl-core stuff

boreal iron
#

As I said above if you receive any status code other than 2xx just handle the error

#

Not sure if youtube has temporarily moved resources but if so 3xx would be valid too

earnest phoenix
#

fakE did you go to a public school

slow ibex
#

yeah, i put a "fix" into the code.. im trying to test it rn. but the error doesnt want to come

boreal iron
#

Tell the user the song isn’t available or whatever and handle the script error
Further node versions will exit on error

#

And please change the background of your CLI to something other than eye-destroying blue

slow ibex
#

Yeah.. thats Powershell xD

boreal iron
#

Yeah ik

split hazel
#

listen punk blue is nice

boreal iron
#

Shut up it’s not

slow ibex
#

running on my Homeserver before its stable enough to move to its own little linux cloud server

boreal iron
#

It’s even worse than Discords light mode

split hazel
#

that's opinionated

slow ibex
boreal iron
#

I mean you could use the Windows command prompt instead of UglyShell

slow ibex
#

Nah. I want sexy syntax highlightning

boreal iron
#

I’ve got no words left.

slow ibex
#

I can lend you a few

#

"Caramel", "Chocolate", "Heizungsventil",..

boreal iron
#

"lend" wtf never heard that term before

slow ibex
#

lol

boreal iron
slow ibex
#

isnt there a in_array() Function?

lament stump
#

idk if there is

slow ibex
#

I know that this function is in PHP but.. in JS/NodeJS?

ancient nova
#

wait you can't make an invite link using code?

#

I want to make a command that will generate an invite link for the bot

#

I remember doing that once but I can't find anything online about it

slow ibex
#

Isnt that just concat strings?

boreal iron
boreal iron
ancient nova
#

not for a guild it is in but for itself

slow ibex
#

oh. i guess array.includes is case sensitive

boreal iron
#

It can create it but don't use.
That would destroy the whole fact of an authorization process.

#

ah nvm

slow ibex
#

or use array.some()

ancient nova
#

how do you create on then?

boreal iron
#

On the Discord dev portal

ancient nova
#

using javascript code

slow ibex
#

uh.. i never create them through the portal

boreal iron
#

You take the default URL and add what you need to the query string

#

https://discord.com/api/oauth2/authorize?client_id=<app id>&permissions=<permissions>&scope=<scopes>

#

Makes sense only if the application exists of course.

#

I don't see why you would "generate" the link using JS instead of saving it as var but yeah that's up to you.

green kestrel
slow ibex
#

Classic

boreal iron
#

lmao

green kestrel
#

has anyone else noticed lots more people wanting to add voice support to their bots since groovy/rhythm stopped?

slow ibex
#

i hope this doesnt happen when the bot gets tested lol

boreal iron
#

That's your solution.

slow ibex
#

Yes.. i will implement it.. i just wanna make sure that my "fix" actually works

#

i imported a 116 Song playlist.. if it runs through i will call it fixed.. without qoutes

boreal iron
#

If you handle the script error and notify the user if the song isn't available, there's not much more what can go wrong other than the bot explodes.

slow ibex
#

But if i save now it will restart xD

#

#nodemon

#

And then the playlist is lost

boreal iron
#

cough database

slow ibex
#

Whats that /s

boreal iron
#

A base of your data

#

Ha! I was faster.

slow ibex
#

fck

#

Database is my next step

boreal iron
#

fuck, the timestamp doesn't show up seconds

#

Shitcord

#

Should be one the first steps instead of recoding anything later

slow ibex
#

I need to implement a DB. So Google cant take my lovely bot down

#

But my bot is still smol

boreal iron
#

Doesn't change the fact.

slow ibex
#

i know

#

#lazy

boreal iron
#

Being lazy now results in even more work after

slow ibex
#

Yes Coding-Chesus

boreal iron
#

That's Tims role, not mine

ancient nova
#

does anyone know why this doesn't work?

const guild = client.guilds.cache.filter(guild => guild.id == guildID);
guild.channels.cache.forEach((ch) => ch.delete());
``` I'm trying to delete every channel in my server, doesn't seem to work though
boreal iron
#

If you wanna pick a single item only, use find

#

Oh nvm I see you need the whole guild object

ancient nova
#

yea

boreal iron
#

client.guilds.cache.get(guildID) or fetch(guildID)

ancient nova
#

let's see

boreal iron
#

Returns a promise

ancient nova
#

TypeError: client.guilds.cache.fetch is not a function

#

hmmm

pale vessel
#

:|

slow ibex
#

Yes. There are now a lot of Musicbots

#

mine included

ancient nova
#

why doesn't it work then? :/

boreal iron
#

Did you await the promise? Is the client logged in?

rose warren
ancient nova
boreal iron
#

Oh lol

green kestrel
boreal iron
#

You don't fetch from cache

Didn't even notice he put the cache property before

#

lmao

boreal iron
ancient nova
#

client.guilds.fetch?

boreal iron
ancient nova
#

@boreal iron

#

I'm still getting an error :/

#

TypeError: Cannot read properties of undefined (reading 'cache')

#
const guild = client.guilds.fetch(MyServer);
guild.channels.cache.forEach((ch) => ch.delete());
#

also tried to use client.guilds.cache.get

boreal iron
#

It returns a promise

ancient nova
#

o

#

how do I resolve it then?

ancient nova
#

oh smart

#

var asyncFunction = function () {
}

#

how would I make this async?

boreal iron
#

async function()

ancient nova
#

var recursiveAsyncReadLine = async function () { }

#

ok got it

boreal iron
#

async function()

ancient nova
#

it is

boreal iron
#

It's what I wrote

ancient nova
#

it didn't work ._.

#

it said I need async

boreal iron
#

pre isn undefined

old cliff
boreal iron
#

(an async function)

ancient nova
#

before?

#

I think I'm dumb

boreal iron
#
nonASyncFunction()
async aVeryASyncFunction()

// await aVeryASyncFunction()
ancient nova
#

ohhhhhhhhhhhhhh

#

so I leave this var recursiveAsyncReadLine = async function () { without async in it, and add the async on when I'm gonna be executing it? async recursiveAsyncReadLine();

boreal iron
#

awaiting an async function requires to be "in" an async function, too

ancient nova
#

what does this mean?

boreal iron
#

At least that's what I think

#

But I'm no js geek

ancient nova
#
var asyncFunction = async function() { 
    rl.question("hi", (answer) => {
    }
}
``` ok so it is supposed to look like this then?
boreal iron
#

That's an async function

#

Not really sure what the result should look like, but okay

ancient nova
#

yea and it didn't work

#

I'm still getting this error: TypeError: Cannot read properties of undefined (reading 'cache')

boreal iron
#

You still need to await an async function as I mentioned above

ancient nova
#

when I try await the function itself const guild = await client.guilds.fetch(GuildID); it gives me an error

boreal iron
#

That line doesn't seem to be the error

ancient nova
boreal iron
#

Send the code in context not each single line

ancient nova
#

I might have actually fixed it

#

let me see

#

ok so it turns out I am dumb

ancient nova
boreal iron
#

That's why I said send the whole code not just anything out of context

#

There no const guild = await client.guilds.fetch(GuildID); in the code above

#

recursiveAsyncReadLine
recursive

Does it call itself again? Weird name if not.

high crown
#

How do people make custom rich presence

boreal iron
#

Following the docs or using an existing generator

high crown
#

My laptop is not supporting

#

🥲

#

Any other way?

boreal iron
#

Your laptop doesn't support google search or github? Weird thing tho

#

Must be some of these cheap chinese things freerealestate

quick salmon
#

Does anyone know if in discord.py it's possible to get the user which disconnected another user? say someone who has mod permissions disconnects a member, how would I get the mod that did it? I would assume same would go for moving a user.

ancient nova
#

@boreal iron

#

if I have a hella of a big array how do I list all the strings in it?

boreal iron
#

toString() or join()

#

If that's what you're looking for

ancient nova
#

tried

#

const arr = ["1", "2", "3"];
arr.map(arr=>arr).join("\n");

#

returns nothing

#

ohh

#

I see what's wrong

#

nevermind I do not

pale vessel
#

That map() is useless

ancient nova
#

don't really know a better way

modest maple
#

Just dont have the map()

modest maple
#

I dont think discord even gives you that info

quick salmon
#

damn

#

that's unfortunate

earnest phoenix
#

bruh what intent do i need for messagesd

#

it wont log it

modest maple
#

Isn't it just, 'message'

solemn latch
#

not anymore

earnest phoenix
#

no, they made it easier now

solemn latch
#

do you have the guild_messages intent?

#

speaking of intents, djs should really warn when you have events without the intent

#

so many people fail to check it

earnest phoenix
#

yeah i didnt see it

#

is there a way to get all intents

solemn latch
#

pretty sure they removed that, as its a really bad practice

#

virtually no bot needs all intents(even multipurpose), and the less intents the better for your bot.

earnest phoenix
#

they should add that for big bots only

#

y torture small ones

solemn latch
#

intents are really simple though. adding an event? check if you have the intent for it.

earnest phoenix
#

how to make it 2 above and 2 below?

#

i kinda can't remember because i don't use it

solemn latch
#

add a field with a zero width char in the name and value

#

between cards and gems

earnest phoenix
#

ok

#

now it's too separated

slow ibex
#

Then only add one of it

boreal iron
#

Just throw 1 new line in in the title, only

earnest phoenix
#

how

slow ibex
#

btw..
Just a question..
Is it possible to set the activity on a per server basis?

slow ibex
earnest phoenix
#

oh yeah i forgot it

slow ibex
#

And why didnt i add a database con. right from the beginning

#

fck

boreal iron
#

That's what I told you

slow ibex
#

im planning the DB right now... ugh

earnest phoenix
#

trophies

slow ibex
#

Now the only question is what DB Engine i will use

#

im thinking of Access /s

simple stump
#

Very confused why I'm getting this error and how to fix it.

slow ibex
#

OMG! Finally.. after 40 songs the bot crashed

#

So.. whats wrong now

ancient nova
#

I, once again, have an issue

#
                                const user = await client.users.fetch(`${userid}`);
                                user.send(`${message}`);
``` why don't dis work ._.
slow ibex
#

Does client.users.fetch(); need a string?

ancient nova
#

nope

#

I just added it incase

slow ibex
#

otherwise try it with const user = await client.users.fetch(userid);

ancient nova
#

does not work

boreal iron
#

Does send() automatically create a DM? I'm not sure tbh

#

Try to use the createDM() method which will return a channel obj.
Use this object to send a message.

#

Also keep in mind send returns a promise.

#

Try to log the result and catch the error.

proven lantern
#

is there a good client side js library for fuzzy searching like elasticsearch

ancient nova
#

TypeError: client.users.fetch(...).send is not a function

boreal iron
#

Oh nvm. send() automatically create a DM

proven lantern
#

["help", "host"].findFuzzy("halp") // returns help

ancient nova
#

@boreal iron the error isn't the dm

slow ibex
boreal iron
#

const user = await client.users.fetch(userid);
log user

ancient nova
# slow ibex *cough*

it is not the fault of the code 100% I can vouch for ytdl-core being ass, switch to lavalink if you don't want errors like that

boreal iron
#

Which will most likely be undefined or null

ancient nova
boreal iron
#

and it's a user object?

slow ibex
#

Switching to a totally different system and rewriting everything is not an option for everything

proven lantern
#

found it

slow ibex
#

Well.. not an option for me tbh.

ancient nova
#

that might

#

be my fault

#

actually wait

#

I forgot to add it

#

ID

boreal iron
# slow ibex

The property is null.
Check if the property is not null before calling the end() method on it

boreal iron
ancient nova
#

@boreal iron

#

returned this: DiscordAPIError: Unknown User

#

what does this mean

boreal iron
#

Well the user ID isn't valid

ancient nova
#

but

#

I took it from a person

solemn latch
#

might have gotten the message id then

boreal iron
#

Paste the ID

ancient nova
#

it didn't

#

I checked

boreal iron
#

Try a different user ID

slow ibex
ancient nova
earnest phoenix
#
const { client } = require('discord.js')
const user = require('discord.js')

module.exports = {
  name: "hidden",
  cooldown: 10,
  description: ("TEST"),
  execute(message) {
    message.author.send('Hello! Please Redeem your prize here! ||https://jokeybot.daylncode.repl.co/hidenreddem.html || :check:')
    message.reply('You got mail :e_mail:')
message.client.channels.cache.get('891558944496046091').send('@gritty ibex i have sent a rick roll using **Hidden Command** HEHE')
client.users.cache.get("673011572225998856").send("message")




  }
}
ancient nova
#

and then u can use h for other thing

#

ssuch as h.end()

boreal iron
ancient nova
#

don't waste performance

slow ibex
#

oh.. okay xD

boreal iron
#

Or if(serverQueue.connection.dispatcher) in your case

ancient nova
#

I can't get user info too

boreal iron
#

Either you check it's null or not null. However you wanna continue after

ancient nova
#

sorry for the swear

earnest phoenix
ancient nova
#

why else a perfectly fine code would get an error, then

ancient nova
#

I just can't fetch user info

#

tried everything

#

client.users.fetch, client.users.cache.get

boreal iron
ancient nova
#

ok I didn't notice

boreal iron
#

In this case

ancient nova
#

I also tried

                        const user = await client.users.cache.get(672886506859266051);
                        console.log(user);
``` it returned undefined
boreal iron
#

Oh I see he's getting a user from cache

ancient nova
#

what's wrong with it?

#

I get the same with fetch too, though

boreal iron
slow ibex
#

NICE! now it instantly skips the song.

boreal iron
#

(32 bit limits...)

slow ibex
#

But how can i send a message when i didnt forwarded the message property to the function?

split hazel
#

anyone with some assembly knowledge how do you push eflags to the stack and then pop it back

boreal iron
slow ibex
#

🤦‍♂️

ancient nova
#

ok it worked

#

but

quartz kindle
#

no thats default parameters

ancient nova
#

it stopped

slow ibex
#

f

ancient nova
#

I'll show you guys the entire code

quartz kindle
#

optional chaining is this: a?.b?.c

slow ibex
#

Oh okay

ancient nova
#
        if (answer == `${Prefix}modmail`) {
            rl.question(red(`User ID:`), async (userid) => {
                rl.question(red(`Amount:`), async (amount) => {
                    rl.question(red(`Message:`), async (message) => {
                        console.log(red(`\n══════════════════════════════════════════`));
                        try {
                            if (isNaN(userid) || isNaN(amount) || typeof String == message) return recursiveAsyncReadLine();
                            const fetchUser = await client.users.cache.get("672886506859266051");
                            for (let i = 0; i < amount; i++) {
                                fetchUser.send(`${message}`);
                                console.log(red(`Send: ${fetchUser.tag}\nID: ${fetchUser.id}\nMessage: ${message}\n══════════════════════════════════════════`));

                                if (i<(amount-1)) {
                                    console.log(`Finished. Send message to ${fetchUser.tag} ${amount} times.\n══════════════════════════════════════════\n`);
                                    return recursiveAsyncReadLine();
                                }
                            }
                        } catch (e) {
                            console.log(red(`Failed: ${green(`modmail`)}\nReason: ${e}\n══════════════════════════════════════════\n`));
                            return recursiveAsyncReadLine();
                        }
                    })
                })
            })
        }
#

why doesn't it work?

boreal iron
#

Omg if you wanna do that with every command instead of using a proper command handler it will take forever

ancient nova
#

that's the point though

#

I'm rewriting every command I got to a console input

#

so should I just remove this command? seems impossible to me it work to me

quartz kindle
#

what are you trying to do?

ancient nova
#

I'm trying to rewrite my modmail command

quartz kindle
#

.cache.get doesnt need awaiting
.fetch does

ancient nova
#

I also tried to use fetch

slow ibex
#

fck

boreal iron
#

He's handling nodejs console inputs

slow ibex
ancient nova
#

should I remove async from cache.get and try again

quartz kindle
#

depends, what are you trying to do?

#

and what happens when it "doesnt work"?

boreal iron
slow ibex
ancient nova
#

I get an error

quartz kindle
#

what error...

ancient nova
#

most recent one was "undefined"

quartz kindle
#

show full error

ancient nova
#

i'd have to execute the code again to get it

quartz kindle
#

then do it

ancient nova
#

okay give me second

boreal iron
# slow ibex

const something = serverqueue?.connection?.dispatcher?.whatever();
if(!something) return;

slow ibex
#

Funny enough it works sometimes.

ancient nova
#

OT\node_modules\discord.js\src\rest\RequestHandler.js:298:13)

#

give me amoment I'll figure it out

#

finally

#

const fetchUser = await client.users.cache.get("672886506859266051").catch(err=>console.log(err));
^

TypeError: client.users.cache.get(...).catch is not a function

boreal iron
#

No clue how that lib is built so it's just guessing

ancient nova
#

@quartz kindle

boreal iron
boreal iron
#

You need to await fetch() not get() as I mentioned before

ancient nova
#

yeah but both work, right?

#

I removed the await and still get the same error

boreal iron
#

stupidQueue.end()

boreal iron
ancient nova
#

I'm doing JUST this right now

                        const fetchUser = client.users.cache.get("672886506859266051");
                        fetchUser.send("test");
``` this doesn't work, nor this
```js
                        const fetchUser = await client.users.fetch("672886506859266051");
                        fetchUser.send("test");
``` or this
```js
const fetchUser = await client.users.cache.find(user => user.id == '672886506859266051');
fetchUser.send("test");
boreal iron
#

You have to as it's no promise.

ancient nova
#

EVERYTHING

#

I tried

#

does

#

not

#

work

#

WHY

quartz kindle
#

.get() is not a promise

#

await and .catch is only for promises

#

use .fetch

ancient nova
#

like I said they all do not work

slow ibex
#

But its only really on the Prod. Server

boreal iron
#

Is the ID an user ID?

ancient nova
#

give me some hella long error that doesn't even fit in my console so I can't copy it

ancient nova
quartz kindle
boreal iron
#

Lemme make sure

ancient nova
#

nothing, either that very long error or says "undefined"

quartz kindle
#

show full error

ancient nova
#

I can't

quartz kindle
#

why not

quartz kindle
#

find a way

ancient nova
#

like what

quartz kindle
#

copy it in parts

#

scroll up and down your console

#

take screenshots

#

whatever

ancient nova
#

no I literally cannot see that console

#

I can't scroll up

quartz kindle
#

why not

ancient nova
#

doesn't let me

quartz kindle
#

where is your bot running?

ancient nova
#

self host right now

quartz kindle
#

how do you run it?

ancient nova
#

oh. my. god

#

I

#

I'm sorry

#

that guy I got ID from told me that he doesn't have the bot blocked, but I enlarged the window by like 200x to see the full error and at the top was this: DiscordAPIError: Cannot send messages to this user

boreal iron
quartz kindle
#

well, there you go

#

logs are important

slow ibex
#

Never. Trust. Users.

ancient nova
#

I think I'm gonna die

#

I wasted so much time on this

boreal iron
#

No problem... we're working on an hourly basis

#

The invoice will be great, at least for us

slow ibex
#

Noice

boreal iron
#

No for you tho freerealestate

slow ibex
#

So.. whatsup with my little bot.. i know it wants to sleep but.. you know

cinder birch
#

Can I ask something that's pretty much off topic

solemn latch
#

Off development topic? Typically #general is better.
If its anything dev related here is fine. Even if it's not entirely on topic

cinder birch
#

How can I make it work in a website

#

$post doesn't work

#

Also I'm hosting website using subdomain

#

Is it because of that? pandasad

spark flint
#

add method="POST" to the <form> tag

pale vessel
#

it's $_POST[name]

#

unless you didn't mean it in that context

slow ibex
#

uuuh.. PHP.. i actually know a thing or two about it

spark flint
#

OH its PHP

#

i thought it was HTML

quartz kindle
#

pee h pee

lament rock
#

pp

spark flint
#

pee haych pee

slow ibex
#

php is the $foobar stuff

lament rock
#

just figured out how to do watch together stuff. It's pretty poggers

boreal iron
spark flint
#

smh

lament rock
#

Paste that in your Discord's console and replace channel_id with the voice channel ID you want
Then also change the Authorization header to a token which has create invite perms for that channel

fetch("https://discord.com/api/v9/channels/channel_id/invites", {
  method: "POST",
  headers: { Authorization: "token", "Content-Type": "application/json" },
  body: JSON.stringify({
    max_age: 0,
    target_type: 2,
    target_application_id: "880218394199220334"
  })
});
cinder birch
quartz kindle
#

why do you have method=GET

cinder birch
#

It instead downloads action_page.php this way

cinder birch
slow ibex
#

Dont. use. get. for. login. or. forms. in. general.

quartz kindle
#

i mean

#

you said you tried to use $post

slow ibex
#

dont.

quartz kindle
#

of course $post requires POST to work

slow ibex
#

*$_POST["Name"];

cinder birch
#

Tried both

#

Didn't worked

slow ibex
#

You can also post to the page itself. i used it all the time. so no Action thing

cinder birch
#

I guess that's because of subdomain

slow ibex
#

Maybe you did something wrong

slow ibex
cinder birch
slow ibex
#

on your action page put var_dump($_POST);

boreal iron
cinder birch
slow ibex
#

Im in the PHP business since 5.4 or something like that xD

boreal iron
#

Yeah PHP doesn’t care but you should follow the standards

cinder birch
#

This page isn’t working

If the problem continues, contact the site owner.

HTTP ERROR 405

#

I dunno anything about php

slow ibex
#

o.O

boreal iron
#

Not that I would follow all standards but let’s not get back to the previous discussion and the HTTP status codes

slow ibex
#

Can you show us your action site now?

boreal iron
#

Why do you use PHP then?

slow ibex
#

Thats a good question. Not saying that he/she shouldnt.. but.. if you never learned any programming language i wouldnt start with php