#development

1 messages Β· Page 1844 of 1

boreal iron
#

Damn I like those ephemeral messages to "suppress" command errors caused by the user

#

Much less spam in a channel the bot is used

#

Hopefully nested commands will or sub-command groups will not show up in the future before entering it's main group command

sacred aurora
#

which one is better bind or arrow function

odd stratus
#

=> is more commonly used nowadays, I prefer it more

sacred aurora
#

its for controller class in an api

sacred aurora
#

i'll just use arrow function then

rose warren
sacred aurora
#

aye thanks

boreal iron
rose warren
#

Yeah that's definitely pog

sterile thicket
#

I am sending a message: js message.reply()Then I am catching an error js .catch(error=>{})But now what I want is, if there is no error in sending the reply, I want to send another message. How do I do that?

rose warren
#

I like keeping channels clean

boreal iron
#

Yeah I have to say I really like that shit... even if I always refuse to get in touch with the latest "technology"

#

I somehow always have to... (at the end)

lyric mountain
#

in the end, everything evolves to crab anyway

boreal iron
#

Well comparing 10-15 y ago to now, yes, you're right.

sterile thicket
#

:c help

#

I noob

boreal iron
#

That's already written down the Discord dev docs

#

Just need to wait until it arrives

#

There we go:

#

Currently, subcommands and subcommand groups all appear at the top level in the command explorer. This may change in the future to include them as nested autocomplete options.

sterile thicket
#

I am sending a message: js message.reply()Then I am catching an error js .catch(error=>{})But now what I want is, if there is no error in sending the reply, I want to send another message. How do I do that?

boreal iron
#

Use .then(...go on...) or await the reply and check it's result

#

Does anybody has the Discord permissions list (in the accurate order)?

#

(as flags)

eternal osprey
#
fs.readFile('codes.txt', {encoding: 'utf-8'}, function(err, data) {
    if (err) throw error;

    let dataArray = data.split('\n');
    console.log(args1[0][2])
    const searchKeyword = `${args1[0][2]}`; 
    let lastIndex = -1; 
    for (let index=0; index<dataArray.length; index++) {
        if (dataArray[index].includes(searchKeyword)) { 
            lastIndex = index;
console.log("Yup it's in there!")
            break; 
          }
    }
    dataArray.splice(lastIndex, 1); 
    const updatedData = dataArray.join('\n');
    fs.writeFile('codes.txt', updatedData, (err) => {
        if (err) throw err;
        console.log ('Successfully updated the file data');
    });``` Hey, why is it console.logging eventhough args1[0][2] is not in the txt file?
#

for example: !test again heyhey

#

heyhey is nott in tthe txt file but it is still removing the last line from tthe txt file?

digital ibex
#

er, im a bit confused. I am making an api request to https://discord.com/api/v9/webhooks/875789465308770346/aW50ZXJhY3Rpb246ODc1Nzg5NDY1MzA4NzcwMzQ2OmE2UjE3QURhVE5xYkowbkQ2R3d4QVpqd2ticWdCdFZXOVBJWThwTVBCeWpNN1g3alByaTNpbTN0am5oTWVGclZUMG1nMk43cUVBcnQ0ejlqR0RsUHM2M1ZxU2d0M3RybHdmSG9WV3BKeWY5dVNuUlc1T2NXNlRBQjZmemhBYjg5/messages/@original

#

with the body { content: 'hi' } and my bots message is not editing for some reason

#

im getting this error btw

#

Error: connect ECONNREFUSED 127.0.0.1:80 with axios

low bone
#

@original? what is that

#

didn't the api says /messages/message_id

#

and this message must be sent by same webhook

pale vessel
#

It refers to the original response

low bone
pale vessel
#

It is

#

It's in docs lol

low bone
#

didn't see it, it will be helpful

low bone
low bone
digital ibex
#

? no, its by axios

long crow
#

how does the axios setup look like?

digital ibex
#

i sent the url im sending the request to

#
        return await this.RequestManager.request(
            'PATCH',
            `${this.RequestManager.constants.BASEURL}${this.endpoints.EDIT_SLASH_COMMAND_RESPONSE(
                applicationID,
                interactionToken
            )}`,
            { content: params.content }
        );```
#

and thats

#
        const options = {
            method,
            url,
            headers: {
                Authorization: `Bot ${this.client.token}`,
                'Content-Type': 'application/json'
            },
            data
        };

        return await axios(options);```
low bone
pale vessel
#

😐

low bone
#

it almost look same syntax as webhook
id/token/messages..

pale vessel
#

And interactions are webhooks

low bone
#

yea it's under same path

pale vessel
#

The way you PATCH an interaction response is the same way as you would do on a webhook for example

pale vessel
digital ibex
#

yeah, i have

sterile thicket
#

How do I check the result whether it gave an error or not, if I await the message.reply?

digital ibex
low bone
#

that's url?

pale vessel
#

I blame Axios

#

I'm a fetch guy so

digital ibex
#

fetch is annoying some times

low bone
#

that's relative url.. probably he thinks u meant localhost

long crow
#

have you set up the baseURL for axios?

digital ibex
#

yes

#

Oh, wait thats the wrong console.log

pale vessel
#

Axios makes stuff confusing

digital ibex
#

i found the issue, im dumb :/

long crow
#

which is?

digital ibex
#

typo

#

:/

feral aspen
#

Hey..

#

I'd like to ask what do we mostly do with interactionCreate.

#

I'm confused honestly, I don't find it a purpose. (Talking about normal commands, not slash.)

digital ibex
#

nothing

cinder patio
#

it's emitted when a user clicks a button... or uses a select menu... or a context menu

digital ibex
#

it doesnt do anything for normal commands

cinder patio
#

definitely not nothing

digital ibex
#

he said normal commands, not slash

cinder patio
#

normal messages can have interactions too

feral aspen
#

I mean I can use it to do something if someone clicked a button.

#

.. but a real purpose.. I don't find any examples.

cinder patio
#

normal messages can have buttons, select menus and context menus

boreal iron
#

That's a real purpose, lol

digital ibex
#

oh yeah, true i forgot there are other components

feral aspen
boreal iron
#

But you can't interact with them

vivid fulcrum
#

technically you can

cinder patio
#

the event is the only way to tell if a button has been clicked

feral aspen
#

Oh.. damn.

vivid fulcrum
#

via HTTP

#

but that's dumb if you already have the bot running over the gateway

feral aspen
#

I can't seem to find any documentation how to setup the interactionCreate event. 😐

cinder patio
#

you really don't need to use that event if you're using discord.js

low bone
#

the methods and properties of interaction that was provided in that event

feral aspen
#

Alright.. I have this command.

const row = new MessageActionRow()
.addComponents(
    new MessageButton()
    .setCustomId('random')
    .setLabel('primary')
    .setStyle('PRIMARY')
);  

message.channel.send({ content: 'Hello World.', components: [row] });
#

How can I make it whereas (only for this command).. if someone clicked the button.. it would, for example, reply to the user with a message.

#

I know for a fact that interactionCreate does this but they do it for all buttons in general.

low bone
#

ex:

client.on("interactionCreate",interaction=>{
  if(!interaction.isButton())  return;
  console.log(`button with id ${interaction.id} was clicked by ${interaction.user.username}`)
})
pale vessel
#

Check the button ID

#

You set it to random

feral aspen
#

I got so confused.

#

Documentation is even more confusing.

#

I created the button.. and I created the event.

earnest phoenix
#

Does anyone know how to make a command in python that shows the number of servers the bot is in?

#

The response will be: I am in {guilds} servers.

pale vessel
#

len(client.guilds) I guess

earnest phoenix
#

Hmm ok

feral aspen
#

Alright.. I've done it.

#

.. now how can I make it do something once done?

pale vessel
#

Do something once done?

feral aspen
pale vessel
#

What do you want to do? Respond to the interaction?

feral aspen
#

Basically if the button was clicked, reply with a message.

proper bolt
#

easier way than the client.on("interactionCreate"

earnest phoenix
#

djs has support for slash commands now?

brave garnet
#

eee. quick question - is searching for things (like users, messages, channels) api abooz? in programming, not using ofc

earnest phoenix
#

why will it be

feral aspen
earnest phoenix
#

you're searching through your own cache

pale vessel
#

Command?

feral aspen
#

Should I make a new parameter named as interaction?

feral aspen
pale vessel
brave garnet
feral aspen
#

I don't want the reply to be for all the buttons.. only for one specific command. Like a command when its button is clicked, it does this, another button does something different.

proper bolt
#

yes thats what customID is for

#

and you can also check the message id of the interaction

feral aspen
#

How..

#

One moment.

#
const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js");
const { black } = require("../../other/texts/colors.json");

module.exports = {
    config: { ... },
    run: async (bot, message, args) => {

        const row = new MessageActionRow()
        .addComponents(
            new MessageButton()
            .setCustomId('test')
            .setLabel('primary')
            .setStyle('PRIMARY')
        );

        message.channel.send({ content: 'Hello World.', components: [row] });
    },
};
pale vessel
#

Ah

#

You could pass an additional parameter called interaction

feral aspen
#

That's done.

brave garnet
#

ehhh, ill ask my questions someone another

pale vessel
#

So ```js
if (interaction) {
// handle

return;

}

... // command code```

#

Or create a folder with interaction handles

feral aspen
pale vessel
#

Are you using v12?

feral aspen
#

No.. V13.

low bone
pale vessel
#

interaction is the interaction

#

It has the reply method?

low bone
#

interaction.reply("MESSAGE")

pale vessel
#

You don't have to use client.api anymore, they have a class and event for interactions now

#

What part is confusing? RaidenThink

feral aspen
#
TypeError: interaction.reply is not a function
    at Object.run (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\src\commands\owner\customcommand.js:30:21)
    at module.exports (C:\Users\Mohammad Hajjiri\Desktop\Rewrite\src\events\guild\messageCreate.js:45:27)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
#

What I'm trying to do is make two buttons in a message in a command, if button a is clicked, it does something else if button b is clicked, it does something else.

#

Also, not sure why the error above showed...

low bone
#

.<

#

the event is not inside the command itself

boreal iron
#

Does anybody has the Discord permissions list (in the accurate order, regarding the hierarchy)?

potent olive
pale vessel
#

Accurate order? What do you mean?

low bone
feral aspen
#
module.exports = async (bot, interaction) => {
    if (!interaction.isButton()) return;
    console.log(`A button with an ID of ${interaction.id} was clicked by ${interaction.user.username}.`);
};
potent olive
boreal iron
low bone
#

in ur command , remove interaction.reply

pale vessel
# potent olive ...

You shouldn't invite a shitty bot that runs 2 instances in the first place

#

It's a private bot

pale vessel
#

Only ADMINISTRATOR is special

feral aspen
pale vessel
low bone
#

yea, use if or just redirect it back to the message command

potent olive
pale vessel
#
if (interaction.isButton() && interaction.customId === "random") require(...).run(..., interaction);```
boreal iron
pale vessel
#

Something like that

boreal iron
#

alright, ty

feral aspen
brave garnet
#

hi?

feral aspen
#

Fetching for messages and channels are not abusable..

#

.. but what are the reasons behind this?

brave garnet
#

iterating through also?

feral aspen
brave garnet
feral aspen
#

Ah.. not sure what that is. :( (no reactions πŸ˜‚ )

brave garnet
feral aspen
#

Not sure..

brave garnet
#

like if you say
$grep -c test
will print all the channels containing "test" in name or smth..

feral aspen
#

The channels are like cached.. so it's like finding channels.

brave garnet
#

? i thought api aboooz

#

high

feral aspen
#

.. or like looping through all the channels in a guild that has a channel named as "test".

brave garnet
#

second more =p

feral aspen
#

What?

brave garnet
#

or no... generally as i said to find dofferent types of data in discord and show output in embed or smth....

#

abooz or noot?

feral aspen
#

I don't think so.

brave garnet
#

y know. i wanna be sure. i dont wanna be banned as a dev =p

#

especially that bot is public on topgg =p

#

β€’~β€’

feral aspen
brave garnet
#

k

restive furnace
#

yes it is

#

you need to cache

brave garnet
#

thk. grep goes byebye

feral aspen
#
if (!message.channel.permissionsFor(message.guild.me).has([Permissions.FLAGS.VIEW_CHANNEL, Permissions.FLAGS.SEND_MESSAGES, Permissions.FLAGS.EMBED_LINKS])) return;
#

How is Permissions not defined?

brave garnet
#

idk. maybe ur cAPSlOCK?

feral aspen
#

Nope?

lament rock
feral aspen
lament rock
#

You don't

#

const Discord = require("discord.js")
const { Permissions } = Discord
// is the same as
const Permissions = Discord.Permissions

unless you're dealing with low level memory references in which case they aren't the same

feral aspen
#

Ah..

#

This is.. oh god.

#

Thank you. πŸ‘

#

Oh god.

#

I should click the link.. πŸ‘

#

Yoo Luca.

#

@solemn latch

#

New user to ban. πŸ˜„

last tapir
#

hey

#

how do you get the owner tostringed?

#

the guild owner

#

i cant seem to get the owner

lament rock
#

if you don't have the owner in the cache, you need to access the guild.owner_id or guild.ownerID or guild.ownerId and fetch the user from the API

last tapir
#

how

lament rock
#

Discord sends the owner ID for each guild. Look at your library's docs and look for guild owner ID or something similar

last tapir
#

then?

#

<guild>.ownerId then?

lament rock
#

fetch the user

#

if you're using djs, client.users.fetch(id)

last tapir
#

πŸ‘

feral aspen
#

Hey.. I've never been so confused.
I have this code.

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

In some commands, it checks, and in some commands, it errors TypeError: Cannot read property 'has' of undefined

#

What? πŸ˜‚

pale vessel
#

@last tapir you can also use await guild.fetchOwner();

feral aspen
feral aspen
#

Update, for some reason, this is only happening in one category.

#

Update.. I don't know what the fk I did.. for some reason.. the bot is checking another code that has .has and if that .has has an error.. it errors the first .has word in the first sentence, if that makes sense.

#

Its solved.. but not sure how. πŸ€·β€β™‚οΈ

analog jolt
#

adding someone to bot team later on wont show them on creator list on the website?

rose warren
#

It will eventually on the new site.

signal estuary
#

I have now a login button with the identify scope for a bot.

<button><a href="https://discord.com/api/oauth2/authorize?client_id=872968216169812009&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Findex.html&response_type=code&scope=identify"></a>Log in</button>

Now I want to get data from the user. The redirect url is the main page.
How do I get data from the user?

signal estuary
hot brook
#

when I try to vote for a bot I click log in, and then I click authorize, and then what happens next is I go back to the log in page

#

brehh

lament rock
signal estuary
#

I followed this docs exactly:
https://discordjs.guide/oauth2/#implicit-grant-flow

But this isnt working. When authorizing the user with the bot I get back to the page, it still shows just "Hoi" without the username and discriminator as it should. The config.json is also empty:

    "clientId": "",
    "clientSecret": "",

All I get is a weird code in the url bar:

http://localhost:53134/?code=ZfaVki5XQl2h9M3B5GmQm3qoddFGTV

Can someone help me?
I used this exaclty this code:
https://github.com/discordjs/guide/tree/main/code-samples/oauth/simple-oauth-webserver

earnest phoenix
#

I can't remember if implicit grant flow gives you a code as well since i've never really used that flow before

low bone
earnest phoenix
#

Thought so

low bone
signal estuary
low bone
signal estuary
low bone
#

can u console log query?

stark trench
pale vessel
signal estuary
#

Bruh why is that a discord embed

pale vessel
#

Because it leads to the OAuth page

low bone
#

localhost:xxx is not same as localhost:xxx/

low bone
errant flax
#

a

long crow
#

b

#

I dont how many commits I try to make the posts appear. lmao

sudden geyser
#

html is hard

#

but hey it looks nice

long crow
#

well, yeah quite some time seeking the template

sudden geyser
#

I thought it was raw instead of a template :(

long crow
#

if it raw, I be dad already

vivid fulcrum
#

it feels like i'm reading a blog

#

you might wanna look into something else

long crow
#

nah too much fluff, sore to the eyes

boreal iron
#

The easier the better, aye

lethal trout
#

https://sourceb.in/0P6ykA8VP3

if (typeof data !== 'string') throw new error(errorMessage);
                                        ^

RangeError [EMBED_DESCRIPTION]: MessageEmbed description must be a string.```

It works in v12 though
i changed it to v13 but idk if there is more
earnest phoenix
#

You will have to join it

lethal trout
#

it works in v12

earnest phoenix
#

Yes

lethal trout
#

i am learning v13

earnest phoenix
#

Actually no

lethal trout
#

so i need help

long crow
earnest phoenix
#

Anyway

#

v13 requires the description to be a string

#

as stated

lethal trout
long crow
#

What you need is to read the guide

earnest phoenix
#

an array !== string

#

so you have to join the array

lethal trout
#

how?

earnest phoenix
#

...

lethal trout
#

pls?

earnest phoenix
#

by using .join("\n") (\n is an example)

#

you can join it with anything really

long crow
#

lolzer

#

What you need is really just understanding guide

#

Or basic javascript even

earnest phoenix
#

and understanding error messages

#

They are pretty self explanatory if it says it must be a string then don't give it an array

lunar cove
#

So this is really a beginner question but I have developed some basic bots but I don't know how do devs make bots public. Like what I did was for my guild , how can I make it customizable for each guild ?
I tried googling but couldn't find answer , can someone tell me how it's done ?

PS : Also which database framework is good among MongoDB, SQL and SQLlite for discord bots ?

pale vessel
#

Those are fine, just pick your favorite/something that you find interesting

lunar cove
#

ok thanks

errant flax
#

how hard is making a sharded bot vvGFXRT_flushedspin

pale vessel
#

as easy as adding an extra parameter

errant flax
#

how does sharding works anyways vvGFXRT_flushedspin

summer torrent
#

creating new process for each shard

errant flax
#

that doesn't make things clearer

pale vessel
#

do you know what a process is

errant flax
#

no.. misosface

summer torrent
#

why do you have cringe emojis in your messages

#

anyways

pale vessel
#

when you do node . or anything similar, it creates a new process of node

#

sharding is similar

#

it spawns multiple processes based on the number of shards you provide

#

each shard handles different guilds

errant flax
#

so basically a shard is like clones of a bot?

summer torrent
#

yes

pale vessel
#

yes

summer torrent
#

when shard is offline, bot will be offline in that shard's guilds

errant flax
#

so that means guild a can have an "online bot" and guild b can have an "offline bot"?

summer torrent
#

did you wonder that why big bots has status pages?

pale vessel
#

if both are on different shards, yyes

errant flax
#

What would happen if i return in a setInterval

cinder patio
#

nothing

errant flax
#

would it stop it or..?

cinder patio
#

it won't stop the interval

sly finch
#

hmm

#

im a bot developer πŸ™‚

narrow cradle
#

Hey may I have the invite to discord developer server?

narrow cradle
#

Thx

waxen bough
#

how do i augment process declaration in typescript

cinder patio
lunar cove
pale vessel
#

Same one

brave garnet
#

can i have a question not related to bot developing? (just other dev things)

cinder patio
#

yes

brave garnet
#

someone know how to convert python to js?

#

(it contains some imports btw)

cinder patio
#

why do you want to do this

#

if you know both languages you can just rewrite it yourself

brazen gate
#

why i cant create .env file

cinder patio
#

If the python code uses external libs, even if you find a converter it won't work as expected cause JS doesn't have the exact same libraries and APIs

cinder patio
eternal osprey
#

hey, why does this little snippet work when i input: !redeem test code123, eventhough there is not even a code123 in the codes.txt:

if(args1[0][1] == 'spotify'){
  message.delete()
  fs.readFile('codes.txt', {encoding: 'utf-8'}, function(err, data) {
    if (err) throw error;

    let dataArray = data.split('\n');
    console.log(args1[0][2])
    const searchKeyword = `${args1[0][2]}`; 
    console.log(dataArray)
    const index = dataArray.indexOf(`${searchKeyword}`);
  if (index > -1) {
 dataArray.splice(index, 1);
 let newLinks = dataArray.join('\n')
  fs.writeFileSync('./codes.txt', newLinks);
  }else{return message.channel.send("Not a valid key!")}```
#

it is not sendingg the not a valid key error

cinder patio
#

console log searchKeyword to see what it is

eternal osprey
#

sure

cinder patio
#

oh wait you already do it

#

so what is it

eternal osprey
#

basically everything i put after !redeem spotify.

#

thisisthevariable

#

!redeem spotify code1

#

etc etc

cinder patio
#

And dataArray?

eternal osprey
cinder patio
#

Console log dataArray[index] right after you declare index

brazen gate
eternal osprey
#

sure!

eternal osprey
#

and it deleted it from the original file, which is good

#

but if i would use a key that is not in tthe file:

#

UREKA!

#

now i can check if it's undefined and return it

brave garnet
eternal osprey
#
if(args1[0][1] == 'spotify'){
  message.delete()
  fs.readFile('codes.txt', {encoding: 'utf-8'}, function(err, data) {
    if (err) throw error;

    let dataArray = data.split('\n');
    const searchKeyword = `${args1[0][2]}`; 
    console.log(dataArray)
    const index = dataArray.indexOf(`${searchKeyword}`);
    if(dataArray[index] == undefined){
      return message.channel.send("Not a valid key!")
    }
  if (index > -1) {
 dataArray.splice(index, 1);
 let newLinks = dataArray.join('\n')
  fs.writeFileSync('./codes.txt', newLinks);
  }
  

  ```strange!
#

It first says that the key has been claimed

#

and then sends: the key is not valid?

solar cave
#
    async def help(self, ctx: commands.context,command : str):```
if i give command arg it doesn't sending anything even i have provided if statements
signal estuary
opaque seal
#

I have this inside a div to create a greyish background but I don't understand why it doesn't take the full window size

<div v-if="createPopup || editPopup || deletePopup" class="fixed z-10 w-screen h-screen bg-black opacity-70"></div>
earnest phoenix
#

what the heck are those css classes

opaque seal
earnest phoenix
#

i dont know tailwindcss

#

i like my code pure

opaque seal
earnest phoenix
#

anyways to make it cover the whole screen you should use 100vh for height and 100vw for width

#

also what's the point of a grey background if it covers the whole screen

opaque seal
#

just added inset-0 works now

opaque seal
earnest phoenix
#

They wont be able to see anything else if the popup takes the whole screen

earnest phoenix
#

what element is supposed to take the whole screen

opaque seal
#

nothing

#

the gray background wasn't taking the full space in the container

earnest phoenix
#

as i said

opaque seal
#

cause it had some insets

acoustic reef
#

is the guild_ids required?

@slash.slash(
  name="ping",
  description="Pong!",
  guild_ids=[]
)
async def _ping(ctx:SlashContext):
    await ctx.send("Pong!")
summer torrent
#

if you want to make it guild-only, yes

earnest phoenix
#

message.guild.emojis.cache.forEach(a => a.delete());

#

Why not working

shadow frigate
#

Anyone know the rate limits for this discord API endpoint?
https://discord.com/api/channels/:channel_id/messages

modest maple
#

they're not locked in place limits

#

check headers

tulip ledge
hollow depot
#

hi, i need to deploy an express application to a specific domain name, i'm new to express and online i didnt find anything helpful, can anyone help me?

solemn latch
quartz kindle
#

welp, looks like slash commands are not the only option anymore

restive furnace
#

how

rose warren
#

Wdym

restive furnace
#

what happened

rose warren
#

@mentions?

quartz kindle
#

Yes, bots will continue to receive message content (and embeds, attachments, and components) for DMs and messages in which they are mentioned.

rose warren
#

Yeah

quartz kindle
#

basically, make your bot mention your prefix

#

and youre good

rose warren
#

Yup

tulip ledge
#

But how do message collectors work then?

quartz kindle
#

you have to mention the bot every time

#

:^)

tulip ledge
#

;-;

rose warren
#

That's not practical

#

Slash is still the better option

quartz kindle
#

or you can use dms

#

you can create a message collector in dms

rose warren
#

I hate it when bots send stuff in DMs

quartz kindle
#

so do i

#

but its an option

rose warren
#

Bad UX

quartz kindle
#

also now we get to keep our eval commands

#

which is good

#

although having to maintain a websocket connection for them would suck

#

i'd still prefer private slash commands

near stratus
# hollow depot hi, i need to deploy an express application to a specific domain name, i'm new t...

put something like this

server {listen 80;
listen [::]:80;
root /var/www/<your domain.com>/html;
index index.html index.htm index.nginx-debian.html
server_name yourdomain.com www.yourdomain.com;
location / {
        proxy_pass http://localhost:8083;#whatever port your app run
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

at /etc/nginx/sites-available/domain.com
Then run
Then run ```bash
sudo ln -s /etc/nginx/sites-available/domain.fuck /etc/nginx/sites-enabled/domain.fuck

Then restart nginx with
```bash
sudo service nginx restart
rose warren
quartz kindle
#

yeah

hollow depot
quartz kindle
#

if possible, i want to move my bot out of the websocket entirely

rose warren
#

Same

near stratus
long crow
#

Hi Tim

quartz kindle
#

just waiting for them to support attachments

#

my interaction server lib is pretty much ready

hollow depot
quartz kindle
near stratus
long crow
#

it an alien language

hollow depot
quartz kindle
#

what hosting service?

near stratus
hollow depot
hollow depot
near stratus
rose warren
long crow
#

Not even motivated to even start

quartz kindle
quartz kindle
rose warren
quartz kindle
#

will put it on github soon

rose warren
rocky hearth
#

Ihv a ts object, i want to extract all the optional fields and make a new type. How do I do that?

cinder patio
#

type it out like a normal person

rocky hearth
#

There is alot. I want to make a utility type For that

cinder patio
#

Are all the properties optional or just some?

rocky hearth
#

Just some

cinder patio
#

And in the new type they would be required? Or still optional?

rocky hearth
#

I want to exclude the required fields

#

Still optional

pallid jungle
#
2021-08-14T13:07:18.410153+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
2021-08-14T13:07:18.410165+00:00 app[Worker.1]:     at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
2021-08-14T13:07:18.410166+00:00 app[Worker.1]:     at runMicrotasks (<anonymous>)
2021-08-14T13:07:18.410166+00:00 app[Worker.1]:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-08-14T13:07:18.410185+00:00 app[Worker.1]:     at async RequestHandler.push (/app/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
2021-08-14T13:07:18.410186+00:00 app[Worker.1]:     at async Object.module.exports.run (/app/commands/embeds/help.js:131:17)
2021-08-14T13:07:18.410186+00:00 app[Worker.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2021-08-14T13:07:18.410243+00:00 app[Worker.1]: (node:4) 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)
2021-08-14T13:07:18.410328+00:00 app[Worker.1]: (node:4) [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.
#
Client.on("message", async (message) => {
    if(!message.member.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS", "USE_EXTERNAL_EMOJIS"])) return;
})
cinder patio
# rocky hearth Still optional

Then use Optional. It makes all fields optional. AFAIK there is no way to extract all the optional fields from a interface and create a new type with them

#

Optional does what you want it to, but It'll make the required fields optional too instead of removing them

#

but there's no other way

tired panther
rocky hearth
#

Its called Partial though!

quartz kindle
#

just make 2 interfaces and intersect them?

pallid jungle
cinder patio
#

Oh yeh Partial not Optional

quartz kindle
#

also you have to take channel permissions into account

pallid jungle
cinder patio
#

if the required properties are only a few

earnest phoenix
#

Does top.gg pass reference url,when somebody votes or is it possible?

cinder patio
#

but using intersections is also an option

quartz kindle
#

where is the rest?

pallid jungle
#

Shouldn't it be fore all commands ?

quartz kindle
#

yes, but you didnt show the commands code, and its important to know where it is. is it inside the same client.on("message") or is it inside another client.on("message")?

rocky hearth
#

Ok πŸ‘

pallid jungle
#

They are not in the index.js

quartz kindle
#

let me explain

earnest phoenix
#

how are you using the command file

#

that's what tim is asking

pallid jungle
quartz kindle
#

do you have this? js client.on("message", () => { // permissions here // commands here }) or this? ```js
client.on("message", () => {
// permissions here
})
client.on("message", () => {
// commands here
})

pallid jungle
#

No

quartz kindle
#

im asking because you showed this

pallid jungle
quartz kindle
#

still doesnt answer my question

#

show your index.js then

pallid jungle
quartz kindle
#

you are not understanding the question, show your index.js file

pallid jungle
#
// connecting to discord
const Discord = require('discord.js')

// connect us to the config.json file
const config = require('./config.json');

// create a new Discord Client 
const Client = new Discord.Client({disableEveryone: true, partials: ['MESSAGE', 'REACTION']});

require('discord-buttons')(Client);

// we make a new system for the cmds
Client.commands = new Discord.Collection();

// require the fs module
const fs = require('fs');

const fetch = require('node-fetch')

const prefix = ('w!');

// it creates a new function for our aliases
Client.aliases = new Discord.Collection();

const map = new Map();

const snipes = new Discord.Collection()

const mongodb = require('./mongo')()

// it creates a new function for our aliases
Client.aliases = new Discord.Collection();

// it creates a new function for our cooldowns
const cooldown = new Set();

const userSchema = require("./schema/user-schema")

const Levels = require("discord-xp");

const canvacord = require("canvacord");

const { MessageEmbed } = require("discord.js");
var moment = require('moment')

Client.on("message", async (message) => {
    if(!message.member.guild.me.hasPermission(["SEND_MESSAGES", "EMBED_LINKS", "USE_EXTERNAL_EMOJIS"])) return;
})

With handler ?

quartz kindle
#

yes

pallid jungle
#
fs.readdirSync('./commands/').forEach(dir => {

    //in the cmds folder, we gonna check for the category
    fs.readdir(`./commands/${dir}`, (err, files) => {

        // console log err (catch err)
        if (err) throw err;

         // checking if the files ends with .js if its a javascript file
        var jsFiles = files.filter(f => f.split(".").pop() === "js");

         // if there is no cmds in the file it will return
        if (jsFiles.length <= 0) {
          console.log("Can't find any commands!");
          return;
        }

        
        jsFiles.forEach(file => {

            // console the loaded cmds 
            var fileGet = require(`./commands/${dir}/${file}`);
            console.log(`File ${file} was loaded`)

            // gonna let the cmds run
            try {
                Client.commands.set(fileGet.help.name, fileGet);

                // it search in the cmds folder if there is any aliases
                fileGet.help.aliases.forEach(alias => {
                    Client.aliases.set(alias, fileGet.help.name);
                })

            } catch (err) {
              // catch err in console  
                return console.log(err);
            }
        });
    });
});
quartz kindle
#

do you have an event handler?

pallid jungle
quartz kindle
#

i need to see all your Client.on()

pallid jungle
#
Client.on("ready", async () => {
    console.log(`πŸ€– ${Client.user.username} is Online!`)
    function randomStatus() {
    let status = ["πŸ€– Wolfy Bot", "πŸ€– w!help", "πŸ€– Poob Beep"]
    let rstatus = Math.floor(Math.random() * status.length);

    Client.user.setActivity(status[rstatus], {type: "PLAYING"});
    }; setInterval(randomStatus, 5000)
})
#

Other logs codes

#

I can't send them

quartz kindle
#

how many Client.on("message") do you have?

pallid jungle
#

9

quartz kindle
#

show them

pallid jungle
#

Come private

#

wait

earnest phoenix
#

literally just remove the private part before sending

pallid jungle
#

Check your dm @quartz kindle

cinder patio
#

nobody's gonna steal your code

#

lmao

pallid jungle
#

;\

modest maple
#

the general rule of thumb: You're asking for help in this server, your code doesnt work, no one is gonna steal it mmLol

pallid jungle
earnest phoenix
#

Because it is too bad to steal

cinder patio
#

you also have 9 message event listeners

quartz kindle
#

when discord sends you a message

earnest phoenix
#

it has no content

quartz kindle
#

it sends it to ALL your client.on("message") at the same time

#

it does not send it to one, then another

#

they do not affect each other

#

so your permission checking from one client.on("message") does not affect the code in another client.on("message")

pallid jungle
#

oh

#

So what should i do

earnest phoenix
#

unless you create a function* to call the next message event handler when needed

#

Β―\_(ツ)_/Β―

quartz kindle
#

add permission checking to all your client.on("message")

pallid jungle
#

& how to make it affect the commands file

quartz kindle
#

or put all your code in 1 client.on("message")

pallid jungle
#

ok

cinder patio
#

do the second one plz

pallid jungle
quartz kindle
#

yes you can

pallid jungle
#

I will try

#

@quartz kindle thank you

earnest phoenix
#

.info

old latch
#

tim I envy your patience

#

xD

earnest phoenix
#
 let button = new MessageActionRow()
        .addComponents(
            new MessageButton()
                .setCustomId(`Hasnoid`)
                .setLabel('Share:')
                .setStyle('PRIMARY')
                .setDisabled(true))
        .addComponents(            
            new MessageButton()
                .setCustomId(`pool_${user}`)
                .setLabel('1')
                .setStyle('SUCCESS'))
        .addComponents(
            new MessageButton()
                .setCustomId(`pool_${user}`)
                .setLabel('3')
                .setStyle('SECONDARY'))
        .addComponents(
            new MessageButton()
                .setCustomId(`pool_${user}`)
                .setLabel('9')
                .setStyle('DANGER'));
message.channel.send({embeds:[exampleEmbed],components:[button]});

is something wrong here

old latch
#

I don't think so...

#

are you getting errors or why are you asking?

earnest phoenix
#
DiscordAPIError: Invalid Form Body
components[0].components[2].custom_id: Component custom id was already specified
components[0].components[3].custom_id: Component custom id was already specified
old latch
#

await the .send() method

#

oh

#

ahh yes you have to have different ids for all buttons

earnest phoenix
#

okay makes sense mmLol

old latch
#

πŸ‘

sick fable
#

Nonetype has no attribute 'request'

#
import requests
import discord
from discord.ext import commands
import time
import random
import asyncio

client = commands.Bot(command_prefix = "$$")
client.remove_command('help')

@client.event
async def on_ready():
	print(f"Successfully logged into {client.user.name}")
	

async def generate_meme():
	
	#Fetching the given api and sorting out stuff
	api_url = "http://meme-api.herokuapp.com/gimme"
	fetch = requests.request("GET", api_url)
	res = fetch.json()
	title = res['title']
	subreddit = res['subreddit']
	image = res['url']
	upvotes = res['ups']
	author = res['author']
	link = res['postLink']
	prev = res['preview']
	preview = random.choice(prev)
	
	#Setting up the embed
	embed = discord.Embed(color = discord.Colour.blue())
	embed.set_author(name = title, url = f"{link}")
	embed.add_field(name = "**β€’Subreddit:**", value = f"_r/{subreddit}_", inline = False)
	embed.add_field(name = "**β€’Upvotes:**", value = f"_{upvotes}_", inline = False)
	embed.add_field(name = "**β€’Author:**", value = f"_{author}_", inline = False)
	embed.add_field(name = "**β€’Preview:**", value = f"[Click me](prev)", inline = False)
	embed.set_image(url = image)
	
	#Sending the embed to the given channel
	channel = await client.fetch_channel("873035924936753192")
	await channel.send(embed=embed)
	asyncio.sleep(5.0)
	
client.loop.create_task(generate_meme())
client.run()
#

Here's the code

valid frigate
#

I've been curious what happens if you register two handlers for the same event like message create

#

Does it run both at the same time or just the last one

quartz kindle
#

both at the same time

valid frigate
sick fable
#

Help

#

😭😭😭

valid frigate
#

Wonder how that would affect global variables

#

Or anything that gets modified by both functions

quartz kindle
#

in a single threaded language like js, the first callback will run first

#

at least while the code is synchronous

quartz kindle
quartz kindle
#

add this to your code print requests.__file__

#

what does it log?

quartz hill
#

I have an asynchronous function. I am using settimeout. There is a request inside the function. When there is an error, I cannot catch it with try catch, how should I fix it?

async function f() {

request({url:url,json:true},function(err,response,body){
if(response.statusCode===200){
//somethings doing
}else{
var msgE = new Discord.MessageEmbed();
return msg.channel.send(msgE.setFooter("Error"));
}
});
}
setTimeout(f, 1500');

quartz kindle
#
function f() { // does not need to be async if it returns a promise
  return new Promise((resolve, reject) => {
    request(..., (err, res, body) => {
      ...
      resolve(body) // or reject(err)
    })
  });
}
quartz hill
#

if any error how catch ?

quartz kindle
#

f().catch()

quartz hill
#

ooh thx

quartz kindle
#

or try { await f() } catch() {}

quartz hill
#

but with settimeout possible ?

quartz kindle
#

setTimeout(() => f().catch(e => ...))

quartz hill
#

thx so much

quartz kindle
#

also, if you want to return from inside the promise, use resolve instead of return

#

for example resolve(msg.channel.send())

quartz hill
#

thx

quiet pawn
#
<!DOCTYPE html>

<script>
  var DinoNuggyCount = 0;
  </script>

<html>
  <head>
    <title>Dino Nuggys</title>
  </head>

  <body>
    <a href=# onclick="add()">
      <img scr="img/dinonuggy.jpeg" alt="Dino Nuggy">
      </a>
    <br><br>
    you got:
    <input type="text" id="text" disabled style= text-align:center>
    <script>
      function add() {
        DinoNuggyCount = DinoNuggyCount + 1
        document.getElementById('text').value = DinoNuggyCount;
        document.title = DinoNuggyCount + "DinoNuggyCount";
      }
      </script>
  </body>

</html>
#

the image wont show on the page and i have no idea why

earnest phoenix
#

Are you using a webserver like express

quiet pawn
quiet pawn
#

i use repl to test stuff

quartz kindle
#

first

#

you have scr instead of src

earnest phoenix
#

also yea

quiet pawn
quiet pawn
earnest phoenix
#

tim notices the little things smh

quiet pawn
#

im just having a brain fart

#

ty tim

solemn latch
quartz kindle
#

πŸ‘

quiet pawn
#

swag

#

now to finish it up

earnest phoenix
#

I need to learn to actually read code instead of skimming for a problem

charred wyvern
#

Hello

#

I was wondering of anyone knows how many votes we need to make some money?

quiet pawn
#

101

#

if you are talking about vote creds

charred wyvern
#

pk

#

ok

#

Thanks

#

Is it a month?

#

or like in general

quartz kindle
#

you earn credits, not money

#

you can only spend them on ads, you cannot convert it to actual money

hexed sedge
#

If you were earning money, p sure top.gg would be deadish

earnest phoenix
#

unless you are tim and cheat the system

quartz kindle
#

i wish

#

lmao

hexed sedge
#

Cant you sell the ads to others?

earnest phoenix
#

doubt

quartz kindle
#

no idea

feral aspen
#

Hey.. in slash commands, I heard there are two types, global and local? What's the difference?

quartz kindle
#

local = guild only

earnest phoenix
#

top.gg wouldn't allow others to make money on their behalf

quartz kindle
#

aka each guild has different commands

#

global = same commands in all guilds

earnest phoenix
#

also global commands take 1 hour to load

#

so

feral aspen
#

Every tutorial in YouTube is showing local commands... πŸ‘€

quartz kindle
#

show code

modest maple
#

you just dont give a guild id

earnest phoenix
#

You simply don't give a guild id

feral aspen
#

Ah.

earnest phoenix
#

If you are using d.js that is

quartz kindle
#

if you're using client.application.commands, just dont give it an id

earnest phoenix
#

idk how any other lang does it

quartz kindle
#

otherwise if you're using guild.commands, use client.application.commands instead

feral aspen
#

I'm still trying to setup slash commands in my current folder.

#

I have normal commands right now that uses prefixes and the message create event, I'm trying to figure out how to transition them.

quartz kindle
#

discord should eventually create a command manager dashboard

feral aspen
#

.. so I'm currently following up a tutorial since I'm legit, LOST.

quartz kindle
#

while there isnt one, someone already made one on github, you can try using that

feral aspen
#
const { readdirSync } = require("fs");

module.exports = async bot => {
    const load = dirs => {
        const commands = readdirSync(`./src/commands/${dirs}/`).filter(d => d.endsWith('.js'));
        const commandArray = []; //

        for (let file of commands) {
            const pull = require(`../commands/${dirs}/${file}`);
            bot.commands.set(pull.config.name, pull);
            if (pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name));

            commandsArray.push(pull); //
            bot.on("ready", () => { //
                bot.guilds.cache.get("...").commands.set(commandArray); //
            }) //
        };
    };

    ["bughunting", "economy", "fun", "image", "information", "management", "music", "owner", "partnership", "settings", "social", "utility"].forEach(x => load(x));
};
#

This is the code in my command handler.

#

The codes that has a // after it are the codes the tutorial told me to add for the slash commands.

#

Ah..

#

Yes.. no I know.. it takes some time for it to actually update.. alright.. I'll use locally for some time then.

torn sundial
#

local commands are instant
global commands take to a maximum of an hour to propagate (ive gotten them within 5-10 minutes though)

feral aspen
#

God.. that name.

#

Thanks!! .. but if I don't want to transfer all the commands I have in my folder to slash commands.. should I make a new collection?

signal estuary
#

I have here a web server from the official djs guide:

const fetch = require('node-fetch');
const express = require('express');
const { clientId, clientSecret, port } = require('./config.json');
const fs = require('fs');
const app = express();

app.get('/', async ({ query }, response) => {
    const { code } = query;

    if (code) {
        try {
            const oauthResult = await fetch('https://discord.com/api/oauth2/token', {
                method: 'POST',
                body: new URLSearchParams({
                    client_id: clientId,
                    client_secret: clientSecret,
                    code,
                    grant_type: 'authorization_code',
                    redirect_uri: `http://localhost:${port}`,
                    scope: 'identify',
                }),
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                },
            });

            const oauthData = await oauthResult.json();

            const userResult = await fetch('https://discord.com/api/users/@me', {
                headers: {
                    authorization: `${oauthData.token_type} ${oauthData.access_token}`,
                },
            });

            console.log(await userResult.json());
        } catch (error) {
            // NOTE: An unauthorized token will not throw an error;
            // it will return a 401 Unauthorized response in the try block above
            console.error(error);
        }
    }

    return response.sendFile('index.html', { root: '.' });
});

app.listen(port, () => console.log(`App listening at http://localhost:${port}`));

But the server doesnt load any script files or css files linked in the html file. How can I made him to load them?

solemn latch
crimson kindle
#

hello

#

can anyone help?

#

@bot.event async def on_guild_add(ctx): adrian = bot.get_user(811965393781653595) await ctx.send_adrian(f"Added to {ctx.guild.name}")

#

it wont work

earnest phoenix
crimson kindle
#

and what to do?

earnest phoenix
#

era what happen to your pfp

late grotto
#

era HACKED?1!!?!?

earnest phoenix
# crimson kindle and what to do?

I believe you are looking for the on_guild_join event. Furthermore, the event takes in the guild parameter representing a discord.Guild object

crimson kindle
#

@earnest phoenix help

#

e

quartz kindle
#

ctx is already a guild

earnest phoenix
#

Because ctx is the guild

crimson kindle
#

ok

#

thx

earnest phoenix
#

put guild

#

like

#
@bot.event
async def on_guild_join(guild):
earnest phoenix
crimson kindle
earnest phoenix
#

May cause confusion though

#

tell me if that works @crimson kindle

earnest phoenix
#

no

crimson kindle
earnest phoenix
#

look

#

no, pass guild as the only parameter

#

furthermore that is invalid syntax

crimson kindle
#

ok

earnest phoenix
#

@earnest phoenix Lets not spoon feed developers.

#

oh sorry

crimson kindle
#

"ctx its not defined"

earnest phoenix
crimson kindle
#

ok

earnest phoenix
#

cuz u changed ctx to guild

earnest phoenix
#

Not ctx

#

yep

#

Furthermore as future reference, it is fairly unique for an event to take ctx as a parameter, there are but a handful which do.

crimson kindle
#

lemme test

crimson kindle
#

@bot.event
async def on_guild_join(guild):
adrian = bot.get_user(811965393781653595)
await adrian.send(f"Added to {guild.guild.name}")

earnest phoenix
crimson kindle
earnest phoenix
#

discord.Guild has no attribute to guild.

earnest phoenix
crimson kindle
#

ok

earnest phoenix
#

@earnest phoenix

#

scam link

crimson kindle
# earnest phoenix scam link

@bot.event
async def on_guild_join(guild):
adrian = bot.get_user(811965393781653595)
await adrian.send(f"Added to {.guild.name}")

#

now the not didnt send the message

sterile thicket
#

I didn't get that yet

crimson kindle
#

@earnest phoenix just the guy send scam link

sterile thicket
#

I am sending a message: js message.reply()Then I am catching an error js .catch(error=>{})But now what I want is, if there is no error in sending the reply, I want to send another message. How do I do that?

earnest phoenix
#

and make sure that the bot already has a mutuals with u

earnest phoenix
crimson kindle
#

thx so muck for helping

#

its working

earnest phoenix
#

Ok

earnest phoenix
crimson kindle
#

Yea

main trench
#

Is it normal for v13 d.js to have a error bypass a catch function?

pale vessel
main trench
#

It's giving me the error instead of sending a embed I have for errors

I'm working on eval

pale vessel
main trench
#

Interesting

#

Guess they changed that

pale vessel
#

Nop

#

Always been the same

main trench
#

Weird since the way I'm doing it now always worked

#

Until I updated to v13

crimson kindle
#

There are fails here?
'@bot.command()
async def sl(ctx):
user = await bot.get_user(811965393781653595)
await user.send("Servers connected to:")
for guild in bot.guilds:
await user.send("guild.name")'

main trench
#
try {
      //success embed

    } catch (e) {
        
     //error embed
    }

how my code is setup for refrence

quartz kindle
#

try catch only works on promises if they are awaited

main trench
#

never experienced that before

#

weird

quartz kindle
#

its always been like that

#

since promises were invented

sterile thicket
pale vessel
#

Do whatever on success()

sterile thicket
#

.then(() => success(message.reply(`Sent!`)))

pale vessel
#

Without the success() part

sterile thicket
#

lol

#

ok let me try

pale vessel
#

Sorry lol

sterile thicket
#

I thought it is a function

pale vessel
#

I'm bad at explaining

sterile thicket
#

lmao

#

thanks that worked well

hexed sedge
pulsar kettle
#

alguien me puede ayudar con un problema del js

main trench
#

Got it working

#

Basically the code that's doing the actual evaluation had to be in the try function

#

Nothing await related

heavy wren
pulsar kettle
heavy wren
#

No creo que haga falta el inglΓ©s

#

pero bueno

pulsar kettle
#

que bueno que hablas espaΓ±ol

#

medio se

heavy wren
heavy wren
# pulsar kettle si

ΒΏAlgΓΊn error? ΒΏQuΓ© acciΓ³n hicistΓ© antes de que sucediera este error?

rose warren
#

English only here please! You can speak other languages in #general-int πŸ˜‰

heavy wren
pulsar kettle
#

oki

rose warren
#

Gracias ! dog_Like

hollow depot
#

this is unrelated to bot developing, but still coding so ill ask here

i am familiar with node.js, but i never used js in html docs
i have a button:

<button type="button" class="hidemusicbtn" onclick="hideMusic()" name="hide-music">Hide music</button> <br>

and in the script tag i have this:

function hideMusic(){
 document.getElementsById('actual-music').style.display = "none"
}```
but on click it does absolutely nothing, what have i done wrong?
rare gull
#

Does anybody know how to do reactions on replit? (using python btw)

hollow depot
rancid tulip
#

An ID should always be unique, that's why

hollow depot
sterile thicket
#
.then(msg => {
  msg.edit(embed)
})```
Doesn't work anymore?
sudden geyser
#

You can send embeds with { embeds: [...] }

feral aspen
#

Hey..

#

OH

#

You see.. I'm smart..

#

I found the issue.. oh god.

sterile thicket
earnest phoenix
sterile thicket
#
const collector = new Discord.ReactionCollector(
                    msg,
                    (reaction, user) => Object.values(reactionControls).includes(reaction.emoji.name) && user.id === message.author.id,
                    { time: 5*60000, dispose: true }
                );```
anything to change here, after v13?
because the bot is not reacting to the message author but itself
feral aspen
#

I love how I just switched 2 simple commands out of 113 (111 advanced) to slash commands.. now 111 left to go.. 😐

sterile thicket
feral aspen
#

❀️

compact sluice
#

Hey i.got type error in

let vote =client.topgg.hasvoted(message.aurthor.id)

if(!voted){
   message.reply('first vote me on top.gg') ```
Showing has voted undefined
sterile thicket
#

is that even a thing?

sterile thicket
compact sluice
#

I want a vote require commamd

#

So i maded with help of my friend

hollow depot
#

hasVoted() not hasvoted

compact sluice
#

Ok

sterile thicket
#

^

boreal iron
#

Is there a way to check if the bot has the applications.commands scope in a guild?

sterile thicket
#

not that I know of

boreal iron
#

Without trying to fetch the commands and handle the error.

sterile thicket
#

actually I don't know anything

compact sluice
#

Still showing same error

sterile thicket
compact sluice
#

Mhmm

sterile thicket
#

or .topgg is not how you should type it

hollow depot
wheat mesa
#

You're also passing in message.aurthor.id, which doesn't exist

compact sluice
hollow depot
#

oh yeah i remember

compact sluice
#

Yed

#

That i corrected

#

Actually this commamd maken with help of my friend

compact sluice
sterile thicket
compact sluice
sterile thicket
compact sluice
#

Umnn

earnest phoenix
#

oop sorry i thought that was py

#

idk d.js

compact sluice
#

Lel np

#

Np

digital ibex
#

whats the problem?

compact sluice
#

Showing type error hasVoted not defined

digital ibex
#

send the code as a text message

#

or in a pastebin

#

if its long

compact sluice
#
let vote =client.topgg.hasVoted(message.aurthor.id)

if(!voted){
   message.reply('first vote me on top.gg') ```
#

Ye

digital ibex
#

wheres hasVoted

compact sluice
#

2nd line

digital ibex
#

?

compact sluice
#

Clinet.topgg.hasVoted

digital ibex
#

send the actual error

compact sluice
#

Okie

#

^^

digital ibex
#

Client.topgg does not exist

sterile thicket
compact sluice
#

Is ok?

#

This only i putted butπŸ€”

digital ibex
#

i dont know

compact sluice
#

Umn

digital ibex
#

have u got client.topgg = or anything similar

compact sluice
#

client.topgg

digital ibex
#

like where are u defining client.topgg

#

what-

compact sluice
#

Oo

#

U mean main file

sterile thicket
#

He is still passing message.aurthor.id

compact sluice
digital ibex
#

i dont get what that has to do with his problem though πŸ€”

sterile thicket
#

you spelled AUTHOR wrong

digital ibex
#

its just a quick typo fix

#

yes

compact sluice
#

Umn lel leme check

digital ibex
#

just focus on one thing at a time, you're going to confuse yourself

compact sluice
#

It is ok

digital ibex
compact sluice
#

I want to make a vote require commamd actually

sterile thicket
#

log client first see if get result...

#

if yes then log client.topgg

compact sluice
digital ibex
#

.. yes client is going to log something

#

where are u defining client.topgg u still havent answered my question

sterile thicket
#

no error

#

console.log(client.topgg)

compact sluice
digital ibex
#

show me the code

#

i have no idea what index.js contains

#

???

compact sluice
digital ibex
#

you're not defining client.topgg anywhere

compact sluice
#

Mhm

digital ibex
#

so, define it and ur code won't error

compact sluice
#

Mhm

#

Now ok?

sterile thicket
#

use .env

#

since you are using replit, anyone can go and see your tokens

pseudo river
#

^^

compact sluice
#

As it is showing same error

#

But

digital ibex
#

just a note, u kinda need to learn the fundamentals of javascript / any language before making a discord bot

#

discords api is a beast

compact sluice
#

Umnn

digital ibex
#

but u done client.Topgg, u've still not defined client.topgg or client.Topgg

compact sluice
#

I just use tyt tutorials to make commamds

#

Yt*

digital ibex
#

watch yt tutorials and copy as much code as u want only if u understand whats going on

compact sluice
#

And try to make it as myself in a way as possible

compact sluice
#

Since

#

I try to make it as my way as possible

digital ibex
#

yes, if u understand whats going on you'll understand what to change and keep

sterile thicket
#

@digital ibex his index.js:

const Topgg = require("@top-gg/sdk")

client.Topgg = new Topgg.Api(sEcret token)```
compact sluice
#

Umn

#

Ik

#

Leme

#

Make a env

boreal iron
#

Why do even include the topgg/sdk in your index file and try to pass it? Include it in your 247.js

digital ibex
#

i see now

boreal iron
#

Useless to bind the class to your client if you need it in your module only.

compact sluice
digital ibex
#

console.log(client.Topgg) right beneath where u define it

compact sluice
boreal iron
#

Checking if the member has voted in your module is okay. Then save it's for example in your database if you need to keep that.

sterile thicket
#

His 247.js

module.exports = {
  name: "24/7",
   botPermission: ["EMBED_LINKS", "READ_MESSAGE_HISTORY","USE_EXTERNAL_EMOJIS","ADD_REACTIONS","CONNECT","SPEAK","DEAFEN_MEMBERS","MOVE_MEMBERS","USE_VAD"],
   
  aliases: ["247"],
  run: async (client, message, args) => {

let vote = client.Topgg.hasVoted(message.aurthor.id)

if(!voted){
   message.reply('first vote me on Top.gg')
// here we done you can do this in any command and make it vote only 
} else{



   const player = message.client.manager.players.get(message.guild.id);
        if (!player) return message.channel.send({
          embed: {
            color: "RED",
            description:' there is nothing playing'}}).then(m => m.delete({ timeout: 5000 }));

        // Check that user is in the same voice channel
        const { channel } = message.member.voice

         
        // toggle 24/7 mode off and on
        if (player.twentyFourSeven) {
            player.twentyFourSeven = false;
            return message.channel.send({
              embed: {
                color: "GREEN",
                description:' 24/7 mode is **disabled**'}});
        } else {
            player.twentyFourSeven = true;
            return message.channel.send({
              embed: {
                color: "GREEN",
                description:' 24/7 mode is **enabled**'}});
        }
  

}
}
}```
compact sluice
#

Off how u got full

#

I just send half ss

digital ibex
sterile thicket
#

anyone can see everything you did

novel snow
#

Pardon me, But what even is guildMembersChunk

compact sluice
compact sluice
digital ibex
boreal iron
#

Not gonna talk about your code and typos in it but do you really send a request to the topgg API any time someone runs the command to check if he has voted?

#

Checking if the member has voted in your module is okay. Then save it's for example in your database if you need to keep that.

#

One of a few typos to mention...

let vote = ...
if(!voted) ...
compact sluice
#

Now it is showing

#

Cannot read property id of undefined

signal estuary
lament rock
#

You can filter over the guilds the user is in (easier to filter over since users can only be in at max 200 guilds while bots can be in Infinite) and check for if the client is in that guild.

boreal iron
#

Is there a way to check if the bot has the applications.commands scope in a guild?

#

Without trying to fetch the commands and handle the error.

lament rock
#

Nope :)

boreal iron
#

errr. damn

eternal osprey
#

how tf do i add a \ as a string?

modest maple
#

what?

eternal osprey
#

As it only picks up the regex function of it

#

""

#
realfinal = 'Spotify-'+finalstring+`\`
#

it only sees that

#

\ as a regex function

sudden geyser
#

You're probably looking for \\

lament rock
#

\ is an escape character. You escape the escape

earnest phoenix
#

eee why do people concat looks so ugly

lament rock
#

Why do people use string concat instead of template literals

earnest phoenix
#

facts

#

looks so much better

sudden geyser
#

Concentration spanning multiple lines looks much better than templates spanning

boreal iron
shell crest
#

Can someone help me

#

I get this erro