#development

1 messages · Page 1908 of 1

earnest phoenix
#

thats where the problem is

coral sigil
#

It is not the problem

#

but i think you should use the bot's id for the checking

earnest phoenix
#

if the command started with prefix or not

boreal iron
#

Why do you over complicate things…

earnest phoenix
#

is that not what i did here

coral sigil
#

so you should check the messge.content.startsWith for '<@${your_bot's_id}>' then it'll always work no matter the username

#

Yea like fake said

boreal iron
#

But the client user tag will always work, too as the bot is in the guild in the moment receiving the event

coral sigil
#

true

#

client,user,tag is easier somehow i think

boreal iron
#

Doesn’t actually matter what you use

coral sigil
#

can you get the id too easily? is it client.id

boreal iron
coral sigil
#

okay

earnest phoenix
boreal iron
#

Gimme a sec to clarify it

earnest phoenix
#

take your time

boreal iron
#

There you go

#

Errr wtf

#

New try

#

That’s it

coral sigil
#
if (!message.content.startsWith(`<@!${client.user.id}>`) || !message.content.startsWith(PREFIX)) return
coral sigil
boreal iron
#

It is indeed

#

Can’t remember that shit, too

coral sigil
#

Yep

#

And the timestamp formatting is right under it, perfect

earnest phoenix
#

I tried both

#

with ! and without it

coral sigil
#

I''ll test it too

#

sorry my mistake

#

if you check if they are not true you should use &&

#

like this if (!message.content.startsWith(`<@!${client.user.id}>`) && !message.content.startsWith(PREFIX)) return

#

Now it will return if those both are false

earnest phoenix
#

shouldn't we use the or operator

boreal iron
#

No

coral sigil
#

Yea if you check if they are true

earnest phoenix
#

oh alright

boreal iron
#

Not or not is logical nonsense

coral sigil
#

I like to do it like that so the code wont be full of recursive ifs :D

earnest phoenix
#

WAIT

#

BOTH OF THEM STOPPED WORKING

coral sigil
#

:D

#

On my end it works

earnest phoenix
#

isn't && the AND operator

coral sigil
#

yes

earnest phoenix
#

I still don't get this

coral sigil
#

so if those both are false, return

#

if the message doesnt start with mention AND it doesnt start with prefix, return

earnest phoenix
#

OH WAIT

#

RIGHT

#

I GET ITT NOW

coral sigil
#

Nice!

boreal iron
#

Think in boolean lol

coral sigil
#

think in binary ;)

boreal iron
#

if( FALSE and FALSE ) error

#

false or false will always error

#

If both conditions aren’t false

#

In your case both prefixes can’t be used at the same thing

earnest phoenix
#

still the same thing

#

mention doesnt work prefix works

coral sigil
#

what do you have

earnest phoenix
#
client.on("messageCreate", (message) => {
    if(!message.content.startsWith(PREFIX)) return;
    if(message.cleanContent.startsWith(`<@${CLIENT_ID}>`) && message.cleanContent.startsWith(PREFIX)) return;
    const args=message.cleanContent.slice(PREFIX.length).trim().split(/ +/);
    const command=args.shift().toLowerCase();
    if(!client.commands.has(command)) return "CommandNotFoundError";
    try {
        client.commands.get(command).execute(client, message, args)
    } catch (error) {
        message.reply(`There was an error executing that command.`)
    }
});
pale vessel
#

It's <@!

#

Check for both <@ and <@!

coral sigil
#

yep

pale vessel
#

<@! is used when a member has a nick

earnest phoenix
#

alright

boreal iron
#

Dude

coral sigil
#

and you can remove if(!message.content.startsWith(PREFIX)) return;

boreal iron
#

Your prefix check on top

earnest phoenix
#

wait i forgot abt that one

#

okay removed that

#

still the same

coral sigil
#

u have the <@! ?

#

you dont have the ! at the front

#

...

boreal iron
#

Where did u define the client_id?

#

And why?

coral sigil
#

please copy this line to your code```if (!message.content.startsWith(<@!${client.user.id}>) && !message.content.startsWith(PREFIX)) return````

earnest phoenix
boreal iron
#

I know what is but why did you define a var?

coral sigil
#

you get the id from client.user.id you dont need to do your own CLIENT_ID

earnest phoenix
#

oh wait

#

right oh god i forgot

coral sigil
#

but that line works

earnest phoenix
#

still the same

#
client.on("messageCreate", (message) => {
    if (!message.content.startsWith(`<@!${client.user.id}>`) && !message.content.startsWith(PREFIX)) return
    const args=message.cleanContent.slice(PREFIX.length).trim().split(/ +/);
    const command=args.shift().toLowerCase();
    if(!client.commands.has(command)) return "CommandNotFoundError";
    try {
        client.commands.get(command).execute(client, message, args)
    } catch (error) {
        message.reply(`There was an error executing that command.`)
    }
});
#

here s the code

azure lark
#

dose anyone know how i can store data inside an array with mongo db?

earnest phoenix
#

okay okay

#

doing that rn

boreal iron
#

As one format is for members with and other without nicknames

coral sigil
#

oh

#

I didn't know that

boreal iron
#

User or User (nickname)

coral sigil
#

Oh sry

boreal iron
#

Yee don’t worry

coral sigil
#

But the code will now think the bot's username is the command, the parsing has to be changed

#

Or the parsing has to be different when the bot is mentioned I mean

boreal iron
#

The mention will show its nickname instead of the application name

#

If one is set

earnest phoenix
#

still not working

azure lark
#

dose anyone know how i can store data inside an array with mongo db?

boreal iron
coral sigil
#

What do you mean it is not working?

boreal iron
#

Even if that’s nonsense but try it freerealestate

earnest phoenix
#

still not working

boreal iron
#

Just show code once more, please

coral sigil
#

well this is working on my end: ```
if (
!message.content.startsWith(<@!${client.user.id}>) &&
!message.content.startsWith(<@${client.user.id}>) &&
!message.content.startsWith(PREFIX)
)
return;

#

But that has to be changed later...

earnest phoenix
#
if (!message.content.startsWith(`${client.user.tag}`) && !message.content.startsWith(PREFIX) && !message.content.startsWith(`<@${client.user.id}>`)) return```
#

my if statement

coral sigil
#

it is wrong

boreal iron
#

You’re missing the message format

coral sigil
#

the first should read: !message.content.startsWith(`<@!${client.user.id}>`)

boreal iron
#

At least if that didn’t work we now know his bot has a nickname

coral sigil
#

It will work

boreal iron
#

That’s the reason the original check with user only didn’t work

coral sigil
#

True

boreal iron
earnest phoenix
#

im dying

#

i tried printing in the console what .cleanContent prints and it only prints User Name and tried checking for it but it still doesnt work

boreal iron
#

I don’t see any use case for that property other than logging stuff

#

Or cross posts without mentions

earnest phoenix
#

i dont know what you mean

signal estuary
#

How can I make subcommands for a slash command?

const data = [
        {
            name: 'tag',
            description: 'create a tag',
            options: [{
                
            }

            ]
        }
]
await client.guilds.cache.get(guildId)?.commands.set(data)

I want to have tag create, tag edit, tag remove, etc

boreal iron
#
    options:
    [
        {
            name: "subcmd1",
            description: "Sub command 1 description",
            type: "SUB_COMMAND",
            options:
            [
                {
                    name: "channel",
                    description: "Select a channel for example.",
                    type: "CHANNEL"
                }
            ]
        },
        ...
     ]
#

Where sub command options are parameters (if you need them).

#

To understand nesting

signal estuary
high crown
#

I'm trying to use animated emojis in my bot but it is not working

#

setDescription

#

Anyone

brittle oyster
#

is it a animated emoji

high crown
#

It is working when I write simple text but it is not working with this code

high crown
brittle oyster
#

hmm

spark flint
#

Its not an embed erro

#

its an emoji error

high crown
high crown
#

😐

spark flint
#

is the bot in the server with that emoji?

high crown
#

Yes

spark flint
#

hmm

high crown
#

The emoji is form that server itself

brittle oyster
#

are u sure you have the correct id

spark flint
#

try pasting that emoji code

#

the <a:ID>

high crown
#

Wait

#

<​a:hay_fire1:901817890355965973>

#

here it is

spark flint
#

paste that in the server

#

not here

#

<​a:hay_fire1:901817890355965973>

high crown
#

ok

spark flint
#

try typing \:emoji:

#

but replace emoji with the emoji name

high crown
#

Ok

#

Aaaaah

#

I've tried doing it

spark flint
#

not a valid emoji then

high crown
opaque acorn
#

What library do you recommend for greater speed in my music bot?

high crown
#

Waao text

spark flint
#

what language first

lament stump
#

you need to actually get the emoji afaik

opaque acorn
#

js

spark flint
opaque acorn
#

ok

#

thx

high crown
hybrid cargo
#

Phantom you cannot get Ids using the method mentioned above on mobile

#

You need to be on PC

#

And the ID you are using is probably the message ID

high crown
lament stump
#

You can also get the emoji from the client's cache with the id

high crown
#

So how to get the emoji I'd?

hybrid cargo
#

Then type \:hay_fire1: and send it in the channel. It will automatically be sent as the ID in the channel, after that copy paste that ID

cerulean anchor
#

does discord bot maker host your bots for free?

hybrid cargo
hybrid cargo
spark flint
cerulean anchor
spark flint
#

yeah

hybrid cargo
spark flint
#

you have to host it yourself

high crown
#

Oh

#

Thanks a lot

#

U really recorded a video for me ❤️

hybrid cargo
#

You can also just copy and paste the same string in the chat box to get animated emojis if u dont have nitro

high crown
#

Oh

#

Thanks

#

/:bolbcatban:

#

oop

#

:bolbcatban:

#

it is not coming for me

cerulean anchor
#

Also, is dbm discontinued?

high crown
#

:blobcatban:

#

see

#

it comes for a second only

#

and then goes

spark flint
#

@earnest phoenix

coral sigil
high crown
#

\:emojiName: was not working for me so after cussing my fate I did this....will it work?

#

yes it worked

#

thanks a lot guys

coral sigil
#

Nice job!

boreal iron
livid lichen
#

Does anyone know how I could find the error using process?

earnest phoenix
#

send the full error and fix the bug then

old latch
#

looks like your message is too long

#

since it says something about "2000 or fewer"

earnest phoenix
#

If I have if elif and else then if I want to add another like cooldown cmd then how can I add 4th

old latch
#

err what

earnest phoenix
#

Hm wdym

old latch
#

can you send like a code snippet?

earnest phoenix
#

Hm

old latch
#

I don't understand your question

earnest phoenix
#

I have shut down my pc

#

Ok wait lemme tell

old latch
#

so you want to expand your if else chain?

earnest phoenix
#

Ya

old latch
#

you're using python right?

earnest phoenix
#

Like I have already used if elif and else

earnest phoenix
old latch
#

you can put as many "elif"s as you want

#

they just have to be before the else

earnest phoenix
#

Oo

old latch
#

this is very basic python tho

earnest phoenix
#

Ok

#

Ty @old latch

#

Forgot 😂

old latch
#

you should probably first have a solid understanding of python

earnest phoenix
#

Ok ty

old latch
#

:D

earnest phoenix
#

is there a thing like jishaku in discord.js

#

like they have it in d.py

spark flint
#

apparently so

earnest phoenix
#

has anyone seen a package that actually fulfils all requirements for npm package explorer

signal estuary
#
CommandInteraction {
  type: 'APPLICATION_COMMAND',
  id: '901858432888496149',
  applicationId: '894599461735661578',
  channelId: '893918781628370984',
  guildId: '893491180820643860',
  user: User {
   ...
  },
  member: GuildMember {
    guild: Guild {
      ..
    },
    joinedTimestamp: 1633098756770,
    premiumSinceTimestamp: 1633358046458,
    deleted: false,
    nickname: null,
    pending: false,
    _roles: [
      ..
    ],
    user: User {
     ..
    }
  },
  version: 1,
  commandId: '901818245852586015',
  commandName: 'tag',
  deferred: false,
  replied: false,
  ephemeral: null,
  webhook: InteractionWebhook { id: '894599461735661578' },
  options: CommandInteractionOptionResolver {
    _group: null,
    _subcommand: 'create',
    _hoistedOptions: []
  }
}

So like:

switch(interaction.subCommand) {
case 'firstSub:
..
break
case 'secondSub:
break
...
earnest phoenix
boreal iron
#

Looping through the options, for example

earnest phoenix
#

I'm glad I use detritus

boreal iron
#
for(const option of interaction.options.data)
{
  if(option.name === "create")
  {
    ...
  }
}
wheat mesa
boreal iron
#

Shhh Erwins

earnest phoenix
#

Djs interactions look way more complex and hard

wheat mesa
#

cus djs is shit

#

detritus just handles all this garbage for you

earnest phoenix
wheat mesa
#

rest client

earnest phoenix
earnest phoenix
#

Wrong reply

earnest phoenix
boreal iron
#

Actually not, but also yes

#

If you understood how it’s built and how to access it it’s easy not to say logical

cinder patio
#

Are we hating on languages we don't know bloblul

boreal iron
#

But it’s somehow less user friendly

quartz kindle
#

all libs suck

#

raw api best

cinder patio
#

imagine if everyone had to write their own rest API wrapper

#

there would be a dozen bots around

quartz kindle
#

a dozen very efficient and well written bots

boreal iron
#

Would automatically sort out most of the shit

quartz kindle
#

instead of thousands of shit bots

boreal iron
#

Aye

earnest phoenix
#

He's not being rude, he's speaking the truth

boreal iron
#

no more Indian bot scammers

earnest phoenix
earnest phoenix
earnest phoenix
modest maple
#

example -> Most of the Discord.py forks with all sorts of monkey patching

boreal iron
#

Good I create a backup of my PHP framework okeh

earnest phoenix
#

So efficient

wheat mesa
#

outdated humor

earnest phoenix
#

Just stole from dankmemer

earnest phoenix
earnest phoenix
lament rock
#

You need to install ffmpeg

#

and it needs to be in your PATH

earnest phoenix
lament rock
#

ffprobe probably won't be necessary and is just warning you that one or the other is supported but none is installed

next crown
#

Hi

#

Is there anyone that can help me with my unban comand

reef stump
#

@rare mist

#

hi dud

#

Can Review My Bot 😁

boreal iron
#

As they told you a few times already, be patient.

#

Saw you asking many times already, dude

earnest phoenix
#

There is a server always kicking my bot without getting it back

#

And code is true but all things showing undefined

boreal iron
#

In your event check if the guild is available.

#

That's a property in djs13

#

if(!guild.available) return;

earnest phoenix
#

Hmmm

#

And my bot started to slow restart after this server showed up

#

It's happening again

boreal iron
#

As I said might be an unavailable server for whatever reason.

coral sigil
next crown
coral sigil
#

What's the error?

next crown
#

Couldn't resolve the user ID to unban

coral sigil
#

Okay, could you then show the code?

next crown
#

Ofc

#
const Discord = require('discord.js');

module.exports = {
    name: 'unban',
    description: "Ovo je _ping komanda.",
    async execute(message, args) {

        if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send('You can\'t use that!')
        if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send('I don\'t have the permissions.')

        const member = message.mentions.members.first();

        let memberTarget = 
        message.mentions.members.first() ||
        message.guild.members.cache.get(args[0]);

        if(!args[0]) return message.channel.send('Please specify a user');
       
        let reason = args.slice(1).join(" ");

        if(!reason) reason = 'Unspecified';

        message.guild.members.unban(memberTarget)

        message.channel.send("uspelo");


    }
} 
coral sigil
#

How do you execute that command? What is the first argument?

boreal iron
#

Well the member isn't cached anymore if you ban it off the server after a bot restart.

next crown
#

I am using discord.js version 12.5.0

boreal iron
#

You have to fetch the user object as he's not a member anymore.

next crown
#

Command should work like =unban members id

coral sigil
#

So you paste the user id to the command and dont mention it?

next crown
#

Yes

coral sigil
#

If so, fakes answer works

boreal iron
coral sigil
#

Yep

#

I think it should be an id

next crown
#

U can't metion banned person

boreal iron
#

message.mentions.members.first() OR message.guild.members.cache.get(args[0]);

next crown
#

I have both of that

boreal iron
#

You can always mention an user ID

#

Even if it's not part of a server.

next crown
#

U can't I tryed

boreal iron
#

BUT instead, as I already said, you need to fetch the user, not getting it from the cache

next crown
#

U can just paste id

coral sigil
#

Where do you fetch it? message.guild.members.fetch()?

coral sigil
boreal iron
#

It's only cached until the app restarts

next crown
#

Where do I fetch it and how?

coral sigil
#

Yea where do you fetch it, I dont think it resolves if you do message.guild.members.fetch()

boreal iron
#

client.users.fetch(args[0], false, true)

#

yeah...

#

typos are always present

coral sigil
#

np

boreal iron
#

Keep in mind that's a promise

next crown
coral sigil
#

You put it where you need to get the user

#

you need to await it or do .then

#

Could it work like this

const Discord = require('discord.js');

module.exports = {
    name: 'unban',
    description: "Ovo je _ping komanda.",
    async execute(message, args) {

        if(!message.member.hasPermission("BAN_MEMBERS")) 
          return message.channel.send('You can\'t use that!')
        if(!message.guild.me.hasPermission("BAN_MEMBERS")) 
          return message.channel.send('I don\'t have the permissions.')

        const member = message.mentions.members.first();

        if(!args[0]) return message.channel.send('Please specify a user');

        let memberTarget = 
          message.mentions.members.first() ||
          await client.users.fetch(args[0]);

        let reason = args.slice(1).join(" ");

        if(!reason) reason = 'Unspecified';

        message.guild.members.unban(memberTarget)

        message.channel.send("uspelo");
    }
} 
#

But you need to get the client to this event

#

So you need to change the event handler you have

#

To pass through the client

#

Would it be easier to remove the user from the guild's bans

#

you only need the user id to do that

#

not the whole user

boreal iron
#
        ...

        if(!args[0]) return message.channel.send('Please specify a user');

        const memberTarget = await (message.mentions.members.length) ? message.mentions.members.first() : client.users.fetch(args[0], false, true);

        if(!memberTarget) return // error couldn't fetch user

        message.guild.members.unban(memberTarget);
coral sigil
#

do guild.bans.remove(userId)

boreal iron
#

Hmm it's up to you.

coral sigil
#

Wouldn't it be easier

boreal iron
#

Using guild.bans.remove() seems to be easier, yeah

#

As the promise returns an error if the entered user resolvable is invalid or not banned.

coral sigil
#

Yea just what I was about to say

boreal iron
#

Don't need to fetch the user using that method.

wheat mesa
#

Has anyone had issues with using the discord-rpc package on npm? I can get my RPC to work perfectly fine when I run it on my own computer, but when I try to run it on my VPS, I get ```
Error: Could not connect
at Socket.onerror (/home/opc/wafflebot-detritus/node_modules/discord-rpc/src/transports/ipc.js:32:16)
at Object.onceWrapper (events.js:520:26)
at Socket.emit (events.js:400:28)
at Socket.emit (domain.js:470:12)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21)

#

Anyone know any solutions to this?

#

Nevermind

#

Turns out that's just not a capability of discord's rpc

coral sigil
#

Nice job figuring it out though

wheat mesa
#

Took some research, I'll just have to take a different approach to this

boreal iron
#

lol somehow experienced this shit myself, too

#

The interaction I received through the event did expire before I could defer it

coral sigil
#

How is that even possible :D

boreal iron
#

The script has no logged delay

#

Must be a Discord issue then

coral sigil
#

okay

boreal iron
#

Almost happened 2 times close to each other

split hazel
#

must be a cache issue

boreal iron
#

Hmm couldn’t figure it out so fast

#

Would need to debug a few more examples

earnest phoenix
#

Does top.gg accept bots that onlt use slash commands

coral sigil
#

Yes

earnest phoenix
coral sigil
#

Yep

earnest phoenix
#

Oh okay

earnest phoenix
coral sigil
#

Why not

earnest phoenix
#

Yay

digital lotus
#

Hey so I’m running into problems with node js it keeps making my bot unresponsive after 16 hours

earnest phoenix
#

Hello, how can I resolve this error? Is another way to check bot permission?

coral sigil
#

the message guild can be null, so typescript complains about it. Because you can send messages in DMs, then there wouldn't be message.guild

#

You need to either check if its null above or do message.guild?.me...

earnest phoenix
#

Ok, thanks

split hazel
#

welcome to typescript

#

this is why i stopped using it

#

it slows down my productivity

earnest phoenix
#

but i don't know why i still have this error..

split hazel
#

kind of defeats the purpose of js

earnest phoenix
#

i check bot permission

#

in my server bot have permission

coral sigil
#

Are you trying to register slash commands?

earnest phoenix
#

no, i try to make change nickname command

coral sigil
#

Oh, that just looked like it errored at the start so i thought you were registering

earnest phoenix
#
import { GuildMember, Permissions } from "discord.js";
import { ICommand } from "wokcommands";

export default {
    category: 'Moderating',
    description: 'Change Nickname',
    minArgs: 2,
    permissions: ['CHANGE_NICKNAME'],
    expectedArgs: '<users> <nickname>',

    callback: async ({  message, args, interaction }) => {
        let nickname = args.join(" ");
        const target = message ? message.mentions.members?.first() : interaction.options.getMember('user') as GuildMember
        if(!target) return `You need to tag someone to change him nickname.`
        if(message?.guild?.me?.permissions.has(Permissions.FLAGS.CHANGE_NICKNAME, true)) {
            target.setNickname(nickname)
        }
    }
} as ICommand
#

this is my code

coral sigil
#

hmm

#

Are you sure the error came from that?

earnest phoenix
#

I think so... when i trigger the command error appear

coral sigil
#

Makes sense

#

Is the change nickname permission for changing others' nicknames

#

Or is it only for changing your own

#

That could be it

boreal iron
#

Nope his own

coral sigil
#

Yea so it still doesn't have permission if you only check for CHANGE_NICKNAME

earnest phoenix
#

hmmm

boreal iron
coral sigil
#

Yea that is what you should check for

earnest phoenix
#

in my server i already have check it

boreal iron
#

Nope

earnest phoenix
#

on bot role

coral sigil
#

The role position matters

boreal iron
#

Do you wanna change the nickname of others or only the bot?

coral sigil
#

If you are trying to change someones nick that is above the bot's role, you cant

earnest phoenix
#

change the nickname of others

earnest phoenix
boreal iron
#

Yeah then it’s MANAGE_NICKNAMES

coral sigil
earnest phoenix
#

yes

coral sigil
#

And this "member" does not have any other roles above the bot role?

earnest phoenix
#

no

coral sigil
#

Could you send the updated code that still makes the error?

earnest phoenix
#

Look, i try to check if my verification it work, and it work. but when i put target.setNickname(), he say's dosen't have permission

#

....

earnest phoenix
#
import { GuildMember, Permissions } from "discord.js";
import { ICommand } from "wokcommands";

export default {
    category: 'Moderating',
    description: 'Change Nickname',
    minArgs: 2,
    permissions: ['CHANGE_NICKNAME', 'MANAGE_NICKNAMES'],
    expectedArgs: '<users> <nickname>',

    callback: async ({  message, args, interaction }) => {
        let nickname = args.join(" ");
        const target = message ? message.mentions.members?.first() : interaction.options.getMember('user') as GuildMember
        if(!target) return `You need to tag someone to change him nickname.`
        if(message?.guild?.me?.permissions.has(Permissions.FLAGS.MANAGE_NICKNAMES, true)) {
            target.setNickname(nickname)
        }
    }
} as ICommand
coral sigil
#

I think you need to do it like this: ```
if(message?.guild?.me?.permissions?.has("MANAGE_NICKNAMES")) {
target.setNickname(nickname)
}

(you don't have to pass the true as the second argument because it's default value is true)
boreal iron
#

You need the null coalescing operator only on the guild property

#

me property can’t be null

#

As well as permissions

coral sigil
#

Like that?

boreal iron
#

It can only be an empty array if you haven’t any permission

coral sigil
#

Well it'll complain :D

boreal iron
#

Not if you use it on the guild property

#

Only

coral sigil
#

Only on guild?

boreal iron
#

Yes

earnest phoenix
#

and if i remove on message error is back

coral sigil
#

I think it has to be on every if the one on the left has it

earnest phoenix
boreal iron
#

TypeScript shit…

#

Well nvm then

coral sigil
#

It actually does not make sense

boreal iron
#

Yeah

#

As I explained above

earnest phoenix
#

I think I'll move to javascript, it's nonsense with this typescript :)))

boreal iron
#

Well that’s up to you

#

But it will not fix your permission issue

coral sigil
#

Well I would say it is really good that you can see errors before you run the application

wheat mesa
#

pretty sure it's the .me causing it

#

since .me is a Member object

coral sigil
#

guild can also be null

wheat mesa
#

Yes

boreal iron
#

guild yes, me not wtf

earnest phoenix
#

but if i remove .me another error's appear

coral sigil
#

Yea it has a problem

wheat mesa
#

🤦‍♂️

boreal iron
#

Like on his screenshot permissions would be the issue

coral sigil
#

it doesnt get that you are trying to get a guild member

#

it onyl thinks that is a member object

wheat mesa
#

message.guild.me is a Member object of the bot

coral sigil
wheat mesa
coral sigil
#

and then you can check it's permissions

boreal iron
earnest phoenix
#

oh

boreal iron
#

That’s what I feel watching that useless TS error

coral sigil
#
(message?.guild?.me as GuildMember)?.permissions.has("MANAGE_NICKNAMES");
boreal iron
#

Oh my ugly god

coral sigil
#

Almost forgot the ? :D

boreal iron
#

Never thought I would say this, but thanks for I’m using JS

coral sigil
#

That was not fun to troubleshoot when I first got it...

#

The error msg is not that clear

#

Remember to import GuildMember from discord.js

earnest phoenix
#

thanks

coral sigil
#

Did you get it working?

wheat mesa
coral sigil
#

Yea I started to think that aswell after you posted the screenshot, it shows that .me can only be GuildMember

hidden lily
#

whats the best way to do time based events for your bots ? like if I want my bot to send something 25 min from now. Do I just use setInterval (NodeJS)?

wheat mesa
#

Oh you know what it is

#

It should be message.guild!.me.blahblahblah

coral sigil
#

But if someone sends a DM it crashes

#

Because then the message doesn't have a guild

wheat mesa
#

Ah yea

#

this is the witchery that I use const perms = payload.guild!.me?.permissionsIn((payload.message as any)?.channel)!;

#

But that's detritus

coral sigil
#

That looks worse than djs :D

boreal iron
wheat mesa
hidden lily
#

ok, good, I'm doing something right

wheat mesa
#

nothing is worse than djs

coral sigil
#

hmm

boreal iron
#

Well TS is but before that python

coral sigil
#

Why is python bad

hidden lily
#

do most of you guys use TS for bot development? I'm just using good old fashioned JS

boreal iron
proven lantern
#

TS is for people that dont want to learn JS

boreal iron
#

You’re a Texan, you don’t count

wheat mesa
coral sigil
proven lantern
#

lets see what the creator of JSON has to say about TS

#

timestamped

hidden lily
#

but thats a later BlackDoom problem, current BlackDoom doesn't even have a verified bot yet

proven lantern
#

lowest value bugs found by type system. type system causes bugs

#

when you take a full accounting of types, they are just not worth it

coral sigil
#

That json guy is right

proven lantern
hidden lily
#

my personal opinion is that Web was not made for Strong Typing

#

any time you try to shoe horn something into something that isn't accepting it is when you make unnecessary complexity

boreal iron
#

Might also be an idea to spread your workload into multiple threads later on

#

If you somehow notice a slowdown

earnest phoenix
#

The deno team stopped using typescript for their (internal) code even though deno is supposed to support typescript

#

It was too much brainfuck for them

hidden lily
#

yea thats also a good idea, I'm running everything from home now (I have my own server stack on a gigabit symmetrical network) but I think I would run seperate containers for my server with a load balancer instead of seperating out the threads

cinder patio
#

And yet it's written in rust... one of the more brainfucky languages out there.

earnest phoenix
#

All I like about typescript is the intellisense

split hazel
#

same

#

i dont like the aggressive and petty type errors/warnings

#

it will refuse to compile if you forget to do one thing

cinder patio
#

actually it still compiles if you have errors

split hazel
#

not for me

cinder patio
#

maybe you just haven't noticed it?

hidden lily
#

but intellisense with typescript gives you a false sense of security IMO

split hazel
#

nope

#

it just completely halts

cinder patio
#

well if it's a syntax error then yeah

#

but if it's related to types then it should still compile

split hazel
#

yeah types

#

it doesnt compile

#

i usually clear my dist folder too so it would be difficult to not notice

#

and besides the errors would be too annoying to just ignore

#

i used to go along with the flow of "ts is cool" but not anymore

#

slows me down too much

#

intellisense is cool though

proven lantern
#

you can get intellisense from jsdocs

split hazel
#

annoying to do

hidden lily
#

another newbie question: If you make any changes to your bot, does it need to get approved again

split hazel
#

/*
*

  • {number} number
    */ is very unintuitive
#

in a library sure

earnest phoenix
#

there are editors that rename typescript as awesome intellisense powered by ai

earnest phoenix
#

¯\_(ツ)_/¯

split hazel
#

and i do like strongly typed languages but trying to add strong and strict typing to a language that wasnt designed to be like that just makes it hard to use sometimes

hidden lily
#

yea, ai is one of those words that gets thrown around loosely

digital lotus
#

Has anyone else had an issue with node js just randomly taking your bot offline??

split hazel
#

the devil is downloading

earnest phoenix
split hazel
#

i got used to it quickly

earnest phoenix
split hazel
#

i mostly use c++ nowadays

earnest phoenix
#

Replit or heroku?

digital lotus
#

I have no host

hidden lily
#

yea I was gonna say host issues normally break stuff

digital lotus
#

I run everyone myself

hidden lily
#

even memory errors

earnest phoenix
#

Well then you turned off the bot or killed the process

digital lotus
#

No I didn’t it would work before I go to bed but when I wake up the bot is offline it didn’t throw any errors just went offline

split hazel
#

what being an alpha male looks like:

digital lotus
#

I even have a batch to auto restart the bot upon error

digital lotus
proven lantern
#

all this stuff

earnest phoenix
#

cry debate about it

is children a render prop in react

digital lotus
earnest phoenix
#

Hi

#

Help me

split hazel
#

help me help you

#

breaks out into a song

earnest phoenix
#

See

#

All you're doing is changing the way the prop content is displayed

#

Isn't that what a render prop is supposed to do?

proven lantern
#

the render component is still handling the render, it's just passing it to the other component

native walrus
# proven lantern

you can just do <div className={classNames(styled.root, className)} />

earnest phoenix
#

what classnames do

native walrus
#

nicely formats conditional classes

#

css modules is a pain though. So verbose for very little real benefit

proven lantern
native walrus
#

you can still do that with the next argument

#
classNames(staticClass, {
  [dynamic]: condition
})
proven lantern
#

2 parameters?

#

no thank you

#

max 1 parameter

native walrus
#

uhh ok if you like writing unnecessary objects

proven lantern
#

i've done that in other places

#

but mixing is bad

native walrus
#

I don't see why that would be the case

#

classNames itself is pretty bad imo

proven lantern
#

i use it whenever i need to change class names based off the state

#

that's old code

#

i use @media selectors now

woeful pike
#

idk chakra does a lot of these out the box and it's not verbose like this

woeful pike
proven lantern
#

i was using material-ui

proven lantern
#

they give these functions

woeful pike
proven lantern
#

but regular css is better

#

more control

earnest phoenix
#

I tried Bulma for a while and I love it for static websites

woeful pike
#

bulma is ok but I end up fighting the framework more than actually using it

earnest phoenix
#

Chakra's good for dynamic stuff and accessibilty

proven lantern
#

i dont see the point of a css library when you just end up customizing their default components anyways

earnest phoenix
woeful pike
#

right, chakra doesn't have much of an opinion on your design. And you can turn it all off very easily in places where it does

#

for me it's a css preprocessor than a framework with built in styles

earnest phoenix
#

Chakra uses emotion and they say it makes your website sorta slow

woeful pike
#

yeah it is a little chunky

earnest phoenix
#

chonky

woeful pike
#

they also don't support using the smaller version of framer-motion

#

which makes me a bit upset

#

but the developer experience is so good that it's worth it

earnest phoenix
#

Center component

woeful pike
#

I don't hate my life doing designs with chakra

earnest phoenix
#

Saves a lot of headaches

woeful pike
#

Stack components take care of RTL too

proven lantern
#

is a css library going to make that any easier?

earnest phoenix
#

OwO what's that

#

Also put an epilepsy warning

proven lantern
#

regular css

earnest phoenix
#

also we're talking about chakra which is more about accessibility

inland pelican
#

Sa

earnest phoenix
#

d

#

bruh

#

@gilded plank sus

azure lark
#

how do i format this so i can put multiple lines on the web page?
res.status(200).json({"line_one": "Im line one", "line_two": "Im line two"})

azure lark
#

making an api, its a express server and idk how to format the json so it is like:

"line_two": "im line two"```
spark flint
#

you don't need it outputted on multiple lines tho

#

it works just the same

azure lark
#

yes but its so people can read

#

its gonna say all endpoints and stuff

coral sigil
#

I don't think you can get it to multiple lines if you are only outputting json

#

It depends on the browser how it'll show it to them

#

Most browsers just dump the raw json so it will be on one line until the end of the screen

azure lark
coral sigil
#

Maybe you dont give them json? Give them html with line breaks or something like that

azure lark
#

hm ok

#

so just a render a html file that has it all on?

coral sigil
#

Yeah, but i'll look into that real quick

#

that link

azure lark
#

ok

coral sigil
#

They are using <pre>

#

That's how they show it just like they want to

azure lark
#

ah ok

#

in the json??

coral sigil
#

I'm sorry im wrong actually :D

opaque seal
#

Is it normal that I get '***' as project ID?

That section of the workflow is

# Push the Docker image to Google Container Registry
    - name: Publish
      run: |-
        docker push "gcr.io/${{ secrets.GKE_PROJECT }}/$IMAGE:$GITHUB_SHA"
#

Or is it just to hide the secret

#

in the output

#

(github actions)

coral sigil
#

Yea I think they hide it

opaque seal
#

ok

coral sigil
azure lark
#

chrome

boreal iron
#

That doesn’t depend on the browser

#

You can return the raw string formatted

coral sigil
#

But is it still a json response?

boreal iron
#

Which is still a regular JSON response

#

Yes

coral sigil
#

Oh

opaque seal
#

But it's just a json

coral sigil
#

Please explain it so Char can do it too

opaque seal
#

Firefox is formatting it

boreal iron
#

Just google JSON pretty print for JS

#

Im sure there’s a similar way doing it like with PHP

opaque seal
#

PHP pepowot

boreal iron
#

Aye

#

Pretty-printing is implemented natively in JSON.stringify(). The third argument enables pretty printing and sets the spacing to use:

var str = JSON.stringify(obj, null, 2); // spacing level = 2

#

There you go

boreal iron
#

You should be able to view the raw data as well in Firefox

azure lark
#

do i have to do something to display it on an express server or something??

boreal iron
#

Looks like a wrong content type

azure lark
#

eh

coral sigil
#

What does your code look like?

azure lark
#



const text = {
  "Test": ["Test", "Test2"]
}
// serialize JSON object
const str = JSON.stringify(text, null, 4);

// print JSON string
console.log(str);


  res.status(200).json(str)
})```
boreal iron
#

Content type application/json

#

Does it set that automatically?

coral sigil
#

Well it would make sense to do that automatically since res.json is used

boreal iron
#

Dunno express

azure lark
#

ye it dose im pretty sure

boreal iron
#

That TS error didn’t make sense, too

coral sigil
#

:D

boreal iron
#

Sense and nonsense are close to each other

coral sigil
#

especially in this lang

boreal iron
#

Well I can’t check it on mobile

#

You have to do it on your own

#

curl url -v

coral sigil
#

I think you need to app.use(expres.json())

#

But that is usually used on the server when you expect json, not when you are responding with json

opaque seal
boreal iron
#

In this case the content type must be wrong or \n would be parsed as new line

coral sigil
#

I read about it, I think JSON.stringify() puts the \n things there

boreal iron
#

If it has the right content type it will be printed fancy as raw data but still be regular JSON data

#

Doing that myself, too on my API

azure lark
#

should i just send a html file

coral sigil
#

I'll test it

#

testing is faster than reading the stackoverflow

boreal iron
#

The screenshot I sent is pretty printing

pale vessel
coral sigil
#

So its stringifying two times and thats what happens

azure lark
#

so do i just type the json how i want it

boreal iron
#

Just don’t use json() as method on res

coral sigil
#

Then the type might be wrong

boreal iron
#

If you wanna have pretty printing

coral sigil
#

content type

boreal iron
#

Yes that’s what I’m saying for 5 min now

#

Set the content type to application/json

#

Manually

#

res.header()?!

#

Whatever idk express

pale vessel
coral sigil
#

and it has been also confirmed that res.json sets the correct content type

pale vessel
azure lark
#

?

coral sigil
#

res.json sets the correct content type, you dont have to do that manually.

azure lark
#

oh ok

#

so its just:



const str = {
  "Test": "Hi",
  "Test2": "hi"
}


  res.status(200).json(str)
})```
?
coral sigil
azure lark
#

how

coral sigil
#

For example like this app.set("json spaces", " ")

#

That would use 2 space indenting

#

Do that outside the app.get

pale vessel
#

you could also just put 2 as value and it'll use 2 spaces

#

or "\t" if you want it to use tabs

coral sigil
#

However you like

azure lark
fair axle
#

How can I delete a slash commands in discord.js v13?

boreal iron
#

Get its ID and send a delete request

#

client.application.commands.delete()

#

(if it’s a global command)

#

delete() takes the command ID as argument or the command resolvable

digital lotus
earnest phoenix
earnest phoenix
#

My bot ideas are totally cringe
You people are gonna laugh
It’s a restaurant economy bot

#

My bot replies with h when someone says h and it's in 75+ servers

marble juniper
#

more useful than mine

#

lol

earnest phoenix
marble juniper
#

totally really

#

*real

earnest phoenix
#

Cool

finite oracle
#

Anyone know about adding a custom background image on the bot page? I'm adding the imgur link but it says only jpeg and png are accepted even though it is...

north mural
#

Hey I got a question if anyone can help

wheat mesa
short pilot
#

This should work for voting right? pepe_thinking do i need to authorize

import topgg

@client.event
async def on_dbl_vote(data):
    bob = data["username"] + data["discriminator"]
    if bob in daily_limit:
        daily_limit[bob][0] += 1
        daily_limit[bob][1] += 1
    else:
        daily_limit[bob] = [4, 4]
    limit_file = open("daily_limit.json", "w")
    json.dump(daily_limit, limit_file)
    limit_file.close()
    print(time() + " - " + bob + " - voted, daily_limit updated")```
earnest phoenix
#

please stop using a json file for a database 🙏 🙏 🙏

short pilot
earnest phoenix
#

Lol

flat copper
#

i have an issue that when i restart my bot its automatically emitting guildCreate or guildDelete events

short pilot
# earnest phoenix Lol

I'm assuming my code should theoretically work then, apart from being massively inefficient?

earnest phoenix
#

I don't do python so just try it and see if it works

short pilot
#

im guessing i need to add this with my bot token?

bot.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
await bot.topgg_webhook.run(5000)```
#

how do i vote again to test it?

boreal iron
# flat copper

That’s not an issue, those event are happening while your bot is offline or they are keep happening because of an unavailable guild.

rustic nova
#

just have it ignore that event when guild is undefined on that event

boreal iron
#

You should always check if a guild is available, in any event if you’re dealing with a guild

earnest phoenix
#

I think you already told him that before

boreal iron
#

if(!guild.available) return;

#

I think so

boreal iron
earnest phoenix
#

!guild.available && return

#

are you allowed to use return in an operator

boreal iron
#

In that case it would be a condition

#

The operator is &&

short pilot
#

mmmkay my code still does absolutely nothing when someone votes

#

client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "my bot token")
client.topgg_webhook.run(5000)

@client.event
async def on_dbl_vote(data):
    # doesn't run```
#

pls help

sterile brook
#

Imagine not using json objects in json db

earnest phoenix
#

my non techy friend really thinks mongodb is a json database

split hazel
#

i mean is he wrong

#

he's already learning fast

woeful pike
#

yeah 99% of people on discord use mongodb because they think it's a json datatabase they can use without getting yelled at

earnest phoenix
#

Imagine converting sql stuff to json so you can actually use it

#

afaik it's supposed to stink really hard

#

am i simping for mongodb

hybrid cargo
woeful pike
#

we're having a really really difficult time migrating the shitty mongodb database for topgg to postgres because there's no data validation and every once in a while we get a field on a record that should be a boolean like approved for bots that is a string for no reason

#

you can't make assumptions on the data you're working with because there's no data integrity

#

a language that doesn't check types passing random shit into a database that doesn't check types. What could possibly go wrong

#

the only reason i can see myself using mongodb is if I'm building something rly quick that needs a little bit of persistence. And I only do that because of mongodb atlas, not because mongodb is actually good

earnest phoenix
#

easy is better than efficient

#

and mongoose exists

#

you can't hate on react for not having state management built-in because they know the community can make one better

woeful pike
#

mongoose is one of the worst ORMs I've ever used

#

you can do validation at the application layer but you still don't have integrity. You can't safely do migration between schemas because the database doesn't have info on what the schema looks like in the first place lmao. Also there's basically no tooling for migrations to begin with

#

mongodb people just like to pretend they don't have a schema for some reason

#

honestly mongodb is an L you take for scalability, not a tool that makes your life easier. And it's not even necessarily good at that either

woeful pike
earnest phoenix
#

I just use mongodb bc of the free offered atlas

sterile brook
#

Tru

lyric mountain
#

normal externally hosted dbs work just as fine

sterile brook
lyric mountain
#

ye

#

still technically an external db

marble juniper
#

just use supabase

#

it provides a postgres instance for free

#

lol

#

but with a 500 mb limit but I personally don't store that much anyways

#

for bots that aren't on a giant scale that store server settings its perfect

woeful pike
#

supabase is good

#

the 500mb limit is the same as the mongodb atlas limit

marble juniper
#

also you can self host it as well

#

using docker

woeful pike
#

you might as well just setup a proper database if you're gonna go down that route

marble juniper
#

ig

azure lark
#

how do i set the body of a website to an image

earnest phoenix
earnest phoenix
azure lark
#

no, like how discord do it. so you can pate the url: https://cdn.discordapp.com/attachments/895400729978736670/902188027642773534/discordblue.png and it will display the image and you can use it in embeds and stuff

earnest phoenix
#

oh

#

opengraph

wheat mesa
#

That image?

azure lark
#

no

earnest phoenix
#

If you want to do embeds on your website:

  1. Send a request to that link and check the content type header
    If it's an image (res.headers['content-type'].test(/^image\//))
  2. Put an <img> under the message with the src set to the url
earnest phoenix
azure lark
#

yes

earnest phoenix
#

set the background image of the body element with css

azure lark
#

so the link is the image,
so in an embed i could do;
.setImage("https://cdn.discordapp.com/attachments/895400729978736670/902188027642773534/discordblue.png")

earnest phoenix
#

umm
why don't you just open the image link

#

your browser will already display it in full size

azure lark
#

no, im making an api and i want it to display an image like that, thats just an example.

earnest phoenix
#

anyways

#some-element {
    background-image: url("some url");
}
#

that's the css you need for it

earnest phoenix
azure lark
#

raw image data

earnest phoenix
#

your browser already shows it as full size

coral sigil
#

@spark flint You can force a cache refresh on chrome with ctrl + shift + R i think

spark flint
#

ah ok

cold meteor
#

Apologies quick question:
Im new to Javascript, and currently trying to work with coding a website in it.

My issue is the following

I have this code on my website

        <script type="text/javascript">
        let progress = document.getElementById('progressbar');
        let totalHeight = document.body.scrollHeight - window.innerHeight;
        window.onscroll = function(){
            let progressHeight = (window.pageYOffset / totalHeight) * 100;
            progress.style.height = progressHeight + "%";
        }
        </script>

When moved to the javascript.js file, the code doesnt work anymore, im confused as to why.
any help would be appreciated

<script type="text/javascript" src="main/js/javascript.js" ></script>

This is the link i did to the javascript file.

earnest phoenix
azure lark
#

is there a way that i can turn a canvas image into a link

lyric mountain
#

no, but u can save it as a file and serve it like any other file

#

or just upload to discord

azure lark
#

its not for a bot, its for a web server

cinder patio
#

You can convert it to buffer and then convert that buffer to base64

pale vessel
#

add the image to a canvas and use canvas.toDataURL()

#

it's basically base64

shadow frigate
#

I'm looking to use UptimeRobot to keep track of the status of my discord bot, I already use it for my webserver, but how would display the status of my discord bot instead?

boreal iron
#

Well your bot needs to continuously answer requests to make it possible to check if it’s alive or not.

#

I guess the easiest way is to listen to HTTP requests and answer them with a 200 status code

#

If the bot is down it doesn’t answer anymore which will be noticed as down time

#

But I’ve got no clue if your service supports that.
That’s something you will have to find out

shadow frigate
#

@boreal iron Issue is, i'm already doing that for my webserver

#

I don't want to have to create another web server in the code of my bot

#

Since it already has one

boreal iron
#

If so what prevents you from sending requests to it, if it already exists?

earnest phoenix
#

It doesnt fetch server Informations just checking if its available

shadow frigate
#

Which does not account for my discord bot

boreal iron
#

If the webserver code is part of your bot, it also means the bot's running.

marble juniper
shadow frigate
#

Running the webserver and bot separately

boreal iron
#

I don't want to have to create another web server in the code of my bot

#

You need to respond to requests in any way.

#

Looking on your services website there isn’t much more available to use in your case

#

Also why shouldn’t a simple and lightweight webserver be a problem?

#

Define a specific port for it and configure your firewall that only uptime robot can access it

#

Therefore no spam and/or performance issues will appear

vivid fulcrum
#

you can also tunnel it w ngrok or cloudflare tunnel

azure lark
#

how do i make an express endpoint that i can do /magik/<user id> and it will distort the user with the id said in the url's profile pic and then return that image so someone could send it in an embed,
i already have the part where it finds all the info about the user using the id and gets their profile pic.

lyric mountain
#

just a heads up, that's bound to fail

#

discord hates urls that return different results each time it's accessed

azure lark
#

ohh

lyric mountain
#

so, like, if the user changes avatar and retry it'll still show the old avatar

azure lark
#

even after a long wait?

vivid fulcrum
#

no

#

i don't remember what the cache expiry is

#

however

#

you can append a cache buster to the url, forcing the discord to recache the image from the url

azure lark
#

should i just do /magik?<image url>?

lyric mountain
#

ye

#

that'll do to make discord not cache it

azure lark
#

okay, either way, how do i do that lol

lyric mountain
#

just grab the param and return a blob

#

like

#

?id=123456789 means param id will have value 123456789

#

grab the user avatar using that id

#

then set response header content-type to image/jpg (or whatever format u want) and put the modified image bytes into the body

#

it'll result into something like this

#

except with a different image obv

#

in this example, I use two params (anime and name)

azure lark
#

im just not sure how i would change the image and then send it back

lyric mountain
#

THAT'S a whole new issue

azure lark
#

ah. my bad

lyric mountain
#

you'll want to use canvas for that probably

#

give it a search on how to process images using it

azure lark
#

okay

lyric mountain
#

it can range from incredibly easy to overwhelmingly hard

#

depending on your goal

azure lark
#

i know a lil bit of canvas, its mainly getting the image from it and then sending as the response

earnest phoenix
# marble juniper

Nice,sadly i can't find any integration for my actual projects.Since i need the changestream functionality,which mongodb has.

dapper jasper
#

So I'm trying to make a slash command I have this code but I don't know what to do with it:

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

const data = new SlashCommandBuilder()
.setName('log')
.setDescription('logs some info.')
.addStringOption(option => option.setName('input').setDescription('Enter a string'))
.addIntegerOption(option => option.setName('int').setDescription('Enter an integer'))
.addNumberOption(option => option.setName('num').setDescription('Enter a number'))
.addBooleanOption(option => option.setName('choice').setDescription('Select a boolean'))
.addUserOption(option => option.setName('target').setDescription('Select a user'))
.addChannelOption(option => option.setName('destination').setDescription('Select a channel'))
.addRoleOption(option => option.setName('muted').setDescription('Select a role'))
.addMentionableOption(option => option.setName('mentionable').setDescription('Mention something'));
#

then:

client.on('interactionCreate', async interaction => {
    if (!interaction.isCommand()) return;

    const string = interaction.options.getString('input');
    const integer = interaction.options.getInteger('int');
    const number = interaction.options.getNumber('num');
    const boolean = interaction.options.getBoolean('choice');
    const user = interaction.options.getUser('target');
    const member = interaction.options.getMember('target');
    const channel = interaction.options.getChannel('destination');
    const role = interaction.options.getRole('muted');
    const mentionable = interaction.options.getMentionable('mentionable');
    
    console.log([string, integer, boolean, user, member, channel, role, mentionable]);
});
#

But I'm almost certain I'm missing a step because it doesn't show up

pale vessel
#

You have to actually post the slash command as a guild or global command

earnest phoenix
#

Post slash command with options

#

client.application.commands.create({ name, description, options });

dapper jasper
earnest phoenix
#

Idk i am caching guild and than creating commands

#

But if it works yes its true

earnest phoenix
#

Need to see your code

dapper jasper
# earnest phoenix Need to see your code
client.once('ready', () => {
const data = new SlashCommandBuilder()
.setName('log')
.setDescription('logs some info.')
.addStringOption(option => option.setName('input').setDescription('Enter a string'))
.addIntegerOption(option => option.setName('int').setDescription('Enter an integer'))
.addNumberOption(option => option.setName('num').setDescription('Enter a number'))
.addBooleanOption(option => option.setName('choice').setDescription('Select a boolean'))
.addUserOption(option => option.setName('target').setDescription('Select a user'))
.addChannelOption(option => option.setName('destination').setDescription('Select a channel'))
.addRoleOption(option => option.setName('muted').setDescription('Select a role'))
.addMentionableOption(option => option.setName('mentionable').setDescription('Mention something'));
console.log(client.application.commands.create(data));
console.log('Ready!');
});
earnest phoenix
#

Hmm

#

What about adding options on command file

dapper jasper
dapper jasper
earnest phoenix
#
module.exports = {
    "name": "join-channel",
    "type": 1,
    "description": "Sends auto Mesage when someone joined.",
    "options": [
        {
            "name": "options",
            "description": "What you want to do?",
            "type": 3,
            "required": true,
            "choices": [
                {
                    "name": "Set",
                    "value": "set"
                },
                {
                    "name": "Reset",
                    "value": "reset"
                }
            ]
        },
        {
            "name": "channel",
            "description": "Choose a channel",
            "type": 7,
            "required": false,
            "channelTypes": ['GUILD_TEXT'],
        },
    ],
    async run(client, i, lang, options)
earnest phoenix
#

and

const commands = fs.readdirSync(`./commands/${dir}/`).filter(file => file.endsWith(".js")).forEach(async cmd => {
    let file = require(`./commands/${dir}/${cmd}`);

let name = file.name
let desc = file.description
let options = file.options

commands.crete ({name: name, description: desc, options: options})
dapper jasper
#

@earnest phoenix now I'm confused

earnest phoenix
#

Why

dapper jasper
earnest phoenix
#

Dont you try to add options?

dapper jasper
# dapper jasper So I'm trying to make a slash command I have this code but I don't know what to ...

gives me the json:

{
  "name": "log",
  "description": "logs some info.",
  "options": [
    {
      "type": 3,
      "name": "input",
      "description": "Enter a string",
      "required": false
    },
    {
      "type": 4,
      "name": "int",
      "description": "Enter an integer",
      "required": false
    },
    {
      "type": 10,
      "name": "num",
      "description": "Enter a number",
      "required": false
    },
    {
      "type": 5,
      "name": "choice",
      "description": "Select a boolean",
      "required": false
    },
    {
      "type": 6,
      "name": "target",
      "description": "Select a user",
      "required": false
    },
    {
      "type": 7,
      "name": "destination",
      "description": "Select a channel",
      "required": false
    },
    {
      "type": 8,
      "name": "muted",
      "description": "Select a role",
      "required": false
    },
    {
      "type": 9,
      "name": "mentionable",
      "description": "Mention something",
      "required": false
    }
  ]
}