#development

1 messages · Page 1403 of 1

remote vessel
#

are u a web dev tim?

solemn leaf
#

isnt is .settimestamp?

boreal iron
#

Could be needed to use the attributes on the img tag

quartz kindle
#

im a full stack dev

proper dome
#

well in fs we have readFileSync which stops code execution and in readFile it registers a callback but wht if we want dn't want to stop code execution and dn't want undefined

boreal iron
#

My picture is transparent in cases yours isn't

earnest phoenix
#

My music bot not play livestreams any buddy know why

remote vessel
quartz kindle
#

@proper dome wrap it in a promise or promisify it

heavy marsh
#

My server has over 10k+ members and I am trying to check if the user has the role Active Server Staff, if not kick the user from a different server that has less than 100 members. - discord.js v12

let user = await member.client.guilds.cache.get(`611881570202025986`).fetch(member.id);
    
if(!user.roles.cache.find(r => r.name === "Active Server Staff")) {
   await console.log(`[ Staff Server Kick ] ${member.user.tag} (${member.id}) was kicked from the staff server!`)
   await member.kick();
   return;
}

It just doesnt kick the user ...

quartz kindle
#

you're doing guild.fetch() which returns a guild, not a user

agile lance
#

.members.cache.get Instead of .fetch

#

if you add .members.cache.get it will return a member found in the guild

safe creek
#

does anyone know what goes into the txt requirments file for discloud hosting?

#

the support dont know

safe creek
heavy marsh
#
let user = await member.client.guilds.cache.get(`611881570202025986`).members.cache.get(member.id);
    
if(!user.roles.cache.find(r => r.name === "Active Server Staff")) {
   await console.log(`[ Staff Server Kick ] ${member.user.tag} (${member.id}) was kicked from the staff server!`)
   await member.kick();
   return;
}

Like this?

proper dome
pale vessel
#

await thonkhappy

solemn leaf
#

what is or for an if

#

for js

pale vessel
#

You await everything, holy

quartz kindle
remote vessel
safe creek
agile lance
safe creek
#

its not english

#

but if it was i would know

remote vessel
proper dome
warm marsh
#

What docs are you trying to read?

remote vessel
#

The main file of your bot, that is, the location of bot.run (). GENERAL is main.py
@safe creek

solemn leaf
#

is this right?

#

if (args[0] == "help" || !args) {

slender thistle
#

I don't see any python around here ngl

quartz kindle
#

i do

slender thistle
#

Oh God I see

agile lance
#

I recommend do if(args[0] == "help" || !args.join(" ")) {

quartz kindle
#

shiv is the python

slender thistle
#

owo

safe creek
slender thistle
#

Tim is the JS

quartz kindle
#

lmao

agile lance
solemn leaf
#

oh yeah

remote vessel
#

@safe creek go to the docs

#

and right click

safe creek
#

mmk

remote vessel
#

and click

#

translate

safe creek
#

oh

remote vessel
#

it will translate and do what u wnat

#

i dont knw py

#

i m learning -_-

solemn leaf
#

py is just english

#

smh

remote vessel
#

but their docs aren't -_-

#

their = discloud

solemn leaf
#

py is based off simple english

#

like legit

slender thistle
#

The hell is different about discloud even

solemn leaf
#

what is discloud

slender thistle
#

You need to specify packages in requirements.txt?

remote vessel
#

discord bot hosting

quartz kindle
#

what is dis

remote vessel
#

its a bot hosting service

slender thistle
#

america explain!!!

remote vessel
#

they host for free

#

and for paid too

quartz kindle
#

what is di

pale vessel
#

di z nuts

quartz kindle
#

ha

#

gottem

remote vessel
#

they use digital ocean

pale vessel
#

DO

quartz kindle
#

DO HAST

remote vessel
#

@safe creek btw if u want an advice

#

and u are looking for free hosting on discloud

#

u wont be able to do

#

cuz their free ram is jst 50mb

#

use repl and uptime

quartz kindle
#

the best free host there is, is google compute engine, but it requires a credit card to register

tired panther
#

Is there a way to have a bot, which is sharded, And then host shard 1 on a server and shard 2 on a another server?

solemn leaf
#

Im compressing my bot real quick

#

brb

tired panther
harsh blade
#

My music bot is kinda lagging every now and then, this because of network?

solemn leaf
#

No

#

bcs your local host

#

hahaha

harsh blade
#

??

#

What do u mean

solemn leaf
#

ram

harsh blade
#

ram and cpu all good

#

12 cores 4gb ram

quartz kindle
#

could be network, could be cpu

solemn leaf
#

if you open a app

#

or do something

#

it will lag

tired panther
harsh blade
#

its hosted from my companys servers

#

not connected to my pc

harsh blade
#

Hm, ill try transfering my bot to a faster node/location

tired panther
quartz kindle
#

what lib? discord.js?

tired panther
#

yes djs

quartz kindle
#
// client1.js
let client = new Discord.Client({
  shards: 0,
  shardCount: 2
})

// client2.js
let client = new Discord.Client({
  shards: 1,
  shardCount: 2
})
tired panther
#

because my bot is hitting 2k , and I do not have any server, rather had the idea to spilt it up in many free servers xD

quartz kindle
#

not a bad idea tbh

#

just note that you wont be able to use discord.js's sharding functions, like broadcastEval

tired panther
#

what, then my bot will not work

#

how much ram should a bot with 2k use?

quartz kindle
#

anywhere from 50mb to 1gb

tired panther
#

50 mb xD, my uses after a day 1 gb

quartz kindle
#

it could be as low as 5mb if you use a custom lib and cache nothing

tired panther
#

Is there a way to free it from cache ram

tired panther
quartz kindle
#

you can sweep caches with an interval

#

or use discord.js-light :^)

tired panther
tired panther
#

whats the error?

quartz kindle
#

all collections have a .sweep() method

earnest phoenix
#

where is the css tag?

#

for the navbar

quartz kindle
#

for example client.users.cache.sweep(user => user.id !== client.user.id) will remove all users except your bot

stoic girder
earnest phoenix
#
.page nav {
color: red;
}``` @stoic girder ?
earnest phoenix
#

@harsh blade

stoic girder
#

background-color I assume @earnest phoenix

zinc stratus
#

I may have to use Bot Designer For Discord to create more commands

earnest phoenix
#
.page nav {
background-color: red;
}```
#

this?

stoic girder
#

yeah try that

harsh blade
#

Its not volume lag, just lag spikes

#

Might be from my wifi

stoic girder
#

@earnest phoenix actually you need !important after the color or it wont work

harsh blade
#

😂

rustic nova
earnest phoenix
quartz kindle
#

what is amethyste-api

earnest phoenix
#

but i do not why this is coming

stoic girder
#
.page nav {
    background-color: red !important;
}

@earnest phoenix

earnest phoenix
#

ok

quartz kindle
#

@earnest phoenix you're using a module called amethyste-api and this module requires a token to use

quartz kindle
#

i dont know what amethyste-api is, just google it

earnest phoenix
stoic girder
#
const ameClient = require("amethyste-api")
const ameApi = new ameClient("token")
#

again googling for others

#

you need a token for that thing

earnest phoenix
#

?

stoic girder
#

don't ask me, you're the one using the api

quartz kindle
#

you're the one who's supposed to know lol

#

you're the one using it

earnest phoenix
#

hmm

#

yes

tired panther
#

How to see if a mentioned channel is in the guild?

stoic girder
rustic nova
#

you can't tell me this navbar doesn't look good

#

oh wait fucking copypaste

safe creek
#

^^^

stoic girder
#

yeah angelo looks fine to me

earnest phoenix
#

how to get DBL API KEY ?

stoic girder
#

especially with the contrast on hover

safe creek
#

looks ugly

rustic nova
stoic girder
#

maybe different "accent" of red

earnest phoenix
earnest phoenix
#

?

safe creek
#

my eyes

stoic girder
#

if you want white sure @earnest phoenix

#

lemme get the class

rustic nova
earnest phoenix
stoic girder
#

#menu .menu ul li a:hover { background: whatever }

Note that you might need !important here as well, and you may want to force only dark or light more in your bot edit page.

earnest phoenix
#

ok

rustic nova
stoic girder
#

has a certain vibe to it monkaHmm

safe creek
#

ikr

tulip ledge
#

Any idea why this isn't triggeren when I react to the message?

  this.on("messageReactionAdd", this.reactionHandler);

  async reactionHandler(reaction, user) {
    console.log(1)
    if (reaction.partial) {
      try {
        await reaction.fetch();
      } catch (error) {
        console.error('Something went wrong when fetching the message: ', error);
        return;
      }
    }
    console.log(2)
    if(reaction.message.id === "780471746918481940") {
      console.log(3)
      if(reaction._emoji.name === "📩") {
        reaction.message.channel.send("Received")
      }
    }
  }
safe creek
#

im still trying to figure out how to run multiple py files at once ffs

stoic girder
#

@earnest phoenix collected.first() - ain't this a message object? How are you trying to find users from it?

safe creek
#

in vsc

cerulean ingot
#
    async def on_dbl_vote(self, data):
        id=int(data["user"])
        member = self.bot.fetch_user(id)
        result = self.config.find_one({"id": id})
        print(id)
        if result is not None:
            try:
                await member.send(f"Thank you for voting for the bot you have recieved {self.coin}1500.")
            except:
                pass
            self.config.update_one({"id": id}, {
                                    "$inc": {"bank": 1500}})``` it didnt event print `id`
#

so the events not running maybe?

tulip ledge
#

shouldn't it always run when someone reacts to a message?

stoic girder
#

@tulip ledge is that Eris or? Unfamiliar syntax idk

cerulean ingot
#

can someone help me

tulip ledge
#

that's discord.js ;-;

stoic girder
#

@cerulean ingot maybe you should go to #topgg-api with this.

stoic girder
tulip ledge
#

yup

cerulean ingot
#

ok

tulip ledge
#

I'm using classes

#

And instead of using arrow functions I'm using normal functions

stoic girder
#

so does console even log "1"?

tulip ledge
#

nope

stoic girder
tulip ledge
#

I think I know why

#

;-;

stoic girder
#

Message caching thing

tulip ledge
#

The message isn't cached

#

yup

stoic girder
#

hehe stackoverflow for the win

tulip ledge
#

should I put it in my ready event?

cerulean ingot
#

i hope i can figure out my problem

earnest phoenix
#
#menu .menu ul li a:hover { background: whatever } {
background-color: white;
}``` like this?
#

Defected

cerulean ingot
#

in your style tag

stoic girder
#

@tulip ledge put what? client.channels.get(CHANNELID).fetchMessage(MESSAGEID); Can't you just cache the message like this before adding the reaction event?

#
#menu .menu ul li a:hover {
background-color: white;
}```
@earnest phoenix
tulip ledge
#

yeah nvm

#

I need to make a raw event forgot those existed

#

channel.fetchMessage is not a function, channel is a valid channel object, did this change in v12?

stoic girder
#

yep

tulip ledge
#

what did it change to in v12?

#

oh

pale vessel
#

channel.messages.fetch()

tulip ledge
#

ok ty

stoic girder
#

we need a stackoverflow search bot

#

there's one on top.gg but offline

tulip ledge
#

mmmmmh, I noticed an issue and have no clue how to fix it atm. When I remove the reaction and then add again it triggers the reaction remove event but when adding again it doesn't trigger the add event

cerulean ingot
#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        id = int(data["user"])
        member = self.bot.fetch_user(id)
        result = self.config.find_one({"id": id})
        print(id)
        print(data)
        print(data['user'])
        if result is not None:
            try:
                print('A')
                await member.send(f"Thank you for voting for the bot you have recieved {self.coin}1500.")
            except:
                print('B')
                pass
            print('C')
            self.config.update_one({"id": id}, {
                "$inc": {"bank": 1500}})``` isnt printing anything on vote
tulip ledge
pulsar perch
#

Can y9u guys

#

hlep

#

with the discord bot css

agile lance
#

I’m trying to have it log my id [ As a test ] and it isn’t working.

Code: let me = message.guild.members.cache.get('737918277866487928')

console.log(me.id)

Output:
undefined

tulip ledge
#

@agile lance do console.log(me)

pulsar perch
#

Any help?

#

Like with the css

agile lance
tulip ledge
#

console.log(message)

agile lance
#

Logging the message wouldnt work

tulip ledge
#

why not

agile lance
#

returned undefined -.-

tulip ledge
#

Thats ur issue

#

u need to do it in ur message event

#

or u won't be able to get any other properties of the message object

#

as for you @earnest phoenix console.log(collected)

agile lance
#

its not my issue considering it returned undefined no matter what

pulsar perch
#

Is there a guild

agile lance
#

:/

agile lance
pulsar perch
#

on what css

#

we can use

#

For the css in the desc of our bots

tulip ledge
#

@agile lance Alright, listen here
Lets say you get a basket with apples inside, now you want to count how many apples there are in there but you don't have the basker, how do you do that?

pulsar perch
#

i mean

#

documentation

agile lance
tulip ledge
#

Yes it is

#

You want to log your ID

#

You're getting the user object from the members object from the guild object from the message object

agile lance
#

the bot has me cached considering it let me add roles to me in the server and everything

stoic girder
#

@pulsar perch you can use inspect element to get class names

agile lance
#

so should i try

tulip ledge
#

if the message object doesn't exist you can't get the guild object, therefor you can't get the message object and therefor you can access the get method

tulip ledge
stoic girder
#

have no clue

agile lance
#
client.guilds.cache.get(`Guild ID`).members.cache.get(`My ID`)
#

Should that work then?

pulsar perch
#

AH

tulip ledge
#

that should work yes

pulsar perch
#

So

#

like

#

<p class"Class"> Test<p>

#

Right?

tulip ledge
#

thats html

#

not css

pulsar perch
#

Yes

tulip ledge
#

wait what do u mean Oliy

#

make what in a channel?

pulsar perch
#

<p class"Test" style:"">Here

#

so

tulip ledge
#

not really

#

using inspect element you can find the class names, using these class names you can change the css

molten yarrow
#
collected.first().message.channel.send(`${message.author.username} ha ganado!`)

collected.first() doesnt have the message.channel.send() function

tulip ledge
#

^^^

sudden geyser
#

doubt

tulip ledge
#

you can just do

message.channel.send(`${collected.first().user (not sure about this)} ha ganado!`)
#

Oh Lite

#

Now ur here

sudden geyser
#

you proably meant .first().channel and then the rest

tulip ledge
#

U might know how to fix

pulsar perch
#

why cant i use h3?

tulip ledge
#

my issue

sudden geyser
#

what's your issue

tulip ledge
#
  async raw(packet)  {
    // We don't want this to run on unrelated packets
    if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
    // Grab the channel to check the message from
    const channel = this.channels.cache.get(packet.d.channel_id);
    // There's no need to emit if the message is cached, because the event will fire anyway for that
    if (channel.messages.cache.has(packet.d.message_id)) return;
    channel.messages.fetch(packet.d.message_id).then(message => {
      console.log(0)
      console.log(packet.t)
      const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
      const reaction = message.reactions.cache.get(emoji);
      console.log(reaction.users)
      if (reaction) reaction.users.cache.set(packet.d.user_id, this.users.cache.get(packet.d.user_id));
      console.log(reaction.users)
      if (packet.t === 'MESSAGE_REACTION_ADD') {
        console.log(1)
        this.emit('messageReactionAdd', reaction, this.users.cache.get(packet.d.user_id));
      }
      if (packet.t === 'MESSAGE_REACTION_REMOVE') {
        this.emit('messageReactionRemove', reaction, this.users.cache.get(packet.d.user_id));
      }
    });
  }
#

Here's the code

agile lance
#

Code: let me = client.guilds.cache.get("746140615116325005").members.cache.get("737918277866487928") let g = client.guilds.cache.get("746140615116325005") me.roles.remove(g.roles.get(`779647031265329193`))

Error: g.roles.get is not a function

umbral zealot
#

roles.cache also.

tulip ledge
#

.cache

#

ye

agile lance
#

Ah, Thanks

umbral zealot
#

Everything is hidden in the cache

agile lance
#

Completely forgot about cache there

tulip ledge
#

why are u pinging alina?

molten yarrow
#

its in

collected.first()

and Vigintillion already typed the answer...

tulip ledge
#

@earnest phoenix if u need to find a property just log collected.first() and look for it yourself

#

I'm not sure the property is user

#

I'm not gonna write a whole reaction collecter just to find what property you need

#

We're here to guide you, not to give you the code

molten yarrow
#

its was .author i think

tulip ledge
#

author on collected.first()?!

#

I dont think so

sudden geyser
molten yarrow
#

yeah the author that reacted

tulip ledge
#

So what it's doing is when the message is uncached and gets cached again, then I react to the message the addreaction event fires but if the message is cached and I remove my reaction the removereaction event fires but then when I react to it again the addreaction event doesn't fire

#

bruh just log collected.first() and look for the property it's literally just english

#

like I've said multiple times already

sudden geyser
#

So it likely has something to do with if (channel.messages.cache.has(packet.d.message_id)) return

molten yarrow
#

oh its not .author | author is Bot

you get users collection

tulip ledge
#

mmmh yeah could be

#

but

#

then it should fire the normal reactionadd event right

#

and it doesn't

solemn leaf
#

how can I check if a user has a role?

tulip ledge
#

<user>.roles.cache.has(<role>)

#

iirc

stoic girder
#

@earnest phoenix add !important after white

earnest phoenix
#

ок

solemn leaf
#

can that be in an if?

tulip ledge
#

yes, both of then worked

#

but you wanted the user

#

and that's what I was saying

#

log collected.first() to find the user object

#

so, no one knows my issue I guess?

buoyant aspen
#

Hey- I want to remove every value in an array from a map. How could I do that in JS? (For example, I have a map called users, and I want to remove all users from that map whose ID is stored in the failedUsers array.)

earnest phoenix
#

@earnest phoenix whats the code for that?

tulip ledge
#

@buoyant aspen what do you mean

quartz kindle
#

loop over failedUsers and delete each user

buoyant aspen
#

I'm new to maps.

pale vessel
#

map.delete(key)

quartz kindle
#

you know how to loop over an array?

buoyant aspen
#

Yes, I do

tulip ledge
#

oh Tim you're here

#

perhaps your superior knowledge knows how to fix my issue

quartz kindle
#

then loop over the array and do what flazepe said for each item in the array

quartz kindle
tulip ledge
#

so

buoyant aspen
pale vessel
#

Yes

tulip ledge
#

I have this raw class wich emites to a reactionAdd event, but if the message is already cached and when I remove the reaction it fires the reactionremove event but then when I add the reaction again it doesn't fire any event

pale vessel
#

It's what you used to set something to the map (map.set(key, value))

#

Key would most likely be the id

tulip ledge
#
  async raw(packet)  {
    if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
    const channel = this.channels.cache.get(packet.d.channel_id);
    if (channel.messages.cache.has(packet.d.message_id)) return;
    channel.messages.fetch(packet.d.message_id).then(message => {
      const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
      const reaction = message.reactions.cache.get(emoji);
      if (reaction) reaction.users.cache.set(packet.d.user_id, this.users.cache.get(packet.d.user_id));
      if (packet.t === 'MESSAGE_REACTION_ADD') {
        this.emit('messageReactionAdd', reaction, this.users.cache.get(packet.d.user_id));
      }
      if (packet.t === 'MESSAGE_REACTION_REMOVE') {
        this.emit('messageReactionRemove', reaction, this.users.cache.get(packet.d.user_id));
      }
    });
  }

We already found out it's due to if (channel.messages.cache.has(packet.d.message_id)) return; but the issue is that when it's already cached it should just emot the reactionadd event but it doesn't

quartz kindle
#

did you update djs to 12.5.0?

tulip ledge
#

"discord.js": "^12.3.1",

#

guess not

quartz kindle
#

they fixed a bug with reaction events in 12.5.0

#

not sure it applies to your issue but worth a try

tulip ledge
#

jup

#

it's fixed now

heavy marsh
#

I am getting this error on discord.js v12 ```js
(node:11) UnhandledPromiseRejectionWarning: ReferenceError: Cannot access 'member' before initialization
at Client.<anonymous> (/home/container/events/guildMemberRemove.js:10:1)
at Client.emit (events.js:315:20)


Here is that code
```js
client.on("guildMemberRemove", async (member) => {

//Staff Server
if(member.guild.id == `700441653139472394`) {

if(member.user.bot) return;
await client.channels.cache.get(`700457110776971264`).send(`:outbox_tray: \`${member.user.tag}\` has left the staff team!`);

let guildA = client.guilds.cache.get(`700441653139472394`);
let guildB = client.guilds.cache.get(`611881570202025986`);
solemn leaf
#

read it

heavy marsh
#
at Client.<anonymous> (/home/container/events/guildMemberRemove.js:10:1)

is this line here

if(member.user.bot) return;
#

but I dont get why its not initialization

solemn leaf
#

its

#

member.bot

quartz kindle
#

no its not

forest mirage
#

bot is a property of a user

#

not a member

solemn leaf
#

okay

quartz kindle
#

@heavy marsh show the full file

heavy marsh
#
const { client, config }  = require("../bot.js");
const discord = require('discord.js');
const moment = require('moment');

client.on("guildMemberRemove", async (member) => {

//Staff Server
if(member.guild.id == `700441653139472394`) {

if(member.user.bot) return;
await client.channels.cache.get(`700457110776971264`).send(`:outbox_tray: \`${member.user.tag}\` has left the staff team!`);

let guildA = client.guilds.cache.get(`700441653139472394`);
let guildB = client.guilds.cache.get(`611881570202025986`);

let rolesName = ["CEO - Server Owner", "Lead Operations Manager", "Server Management Team", "Lead Moderator", "Lead Partnership Manager", "Lead Event Manger", "Lead Developer", "Operations Management Team", "Senior Moderator", "Moderator", "Helper", "Server Moderation Team", "Senior Partnership Manager", "Partnership Manager", "Server Partnership Team", "Event Host", "Server Event Team", "Java Developer", "JavaScript Developer", "Python Developer", "Server Developer Team", "Active Server Staff", "Staff On Break"] //All The 23 Role Names

  const member = guildA.member(member.user.id);
  const xstaff = guildB.member(member.user.id);

  const rolesToRemove = rolesName
    .filter(n => member.roles.cache.find(r => r.name === n))
    .map(n => xstaff.roles.cache.find(r => r.name === n))
    .filter(Boolean)
    .map(r => r.id);

await xstaff.roles.remove(rolesToRemove).catch(console.log);
console.log(`[Staff Member Leave] ${member.user.tag} (${member.user.id}) left ${member.guild.name} (${member.guild.id})!`);

return;
quartz kindle
#

this is the problem

#

give it a different name

heavy marsh
#

ooh ok

#

let me see

quartz kindle
#

also, if thats the full file, its missing closing brackets

heavy marsh
#

Nope its not the full file

solemn leaf
#

tim smart

tulip ledge
#
  async reactionHandler(reaction, user) {
    if (reaction.partial) {
      try {
        await reaction.fetch();
      } catch (error) {
        console.error('Something went wrong when fetching the message: ', error);
        return;
      }
    }
    if(reaction.message.id === "780490933497495583") {
      if(reaction._emoji.name === "📩") {
        let userData = this.db.ensureData(await this.db.get(`user-${user.id}`), this.config.userData, this.config)
        if(!userData.uuid) {
          try {
            return user.send("Please verify first before applying.\nYou can do so by using `!verify <IGN>`")
          }
          catch(e) {}
        }
        console.log(reaction)
        reaction.delete()
      }
    }
  }

Why does reaction not have a delete method?

solemn leaf
#

in game name

quartz kindle
#

because it doesnt

tulip ledge
#

how do I delete it then

solemn leaf
#

add remove?

#

I dont remember

quartz kindle
#

reaction.remove()

tulip ledge
#

oh

#

;-;

solemn leaf
#

yey

tulip ledge
#

and another weird issue I came across

earnest phoenix
#

Hmm

#

I need genk

#

*help

quartz kindle
#

you need a gank? ask your jungler

earnest phoenix
#

Nooo

wet scroll
#

It helps to explain what you need help with 🙄

#

We aren't mind readers

earnest phoenix
tulip ledge
#
  async raw(packet)  {
    if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
    const channel = this.channels.cache.get(packet.d.channel_id);
    if (channel.messages.cache.has(packet.d.message_id)) return;
    channel.messages.fetch(packet.d.message_id).then(message => {
      const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
      const reaction = message.reactions.cache.get(emoji);
      if (reaction) reaction.users.cache.set(packet.d.user_id, this.users.cache.get(packet.d.user_id));
      if (packet.t === 'MESSAGE_REACTION_ADD') {
        this.emit('messageReactionAdd', reaction, this.users.cache.get(packet.d.user_id));
      }
      if (packet.t === 'MESSAGE_REACTION_REMOVE') {
        this.emit('messageReactionRemove', reaction, this.users.cache.get(packet.d.user_id));
      }
    });
  }

This works perfectly except, the first time I add a reaction it doesn't trigger the event, only after the first one.

earnest phoenix
#

It says x

earnest phoenix
#

When I make my invite link

wet scroll
#

@earnest phoenix Did you consider putting your client ID

earnest phoenix
wet scroll
#

...

rustic nova
#

reread the documentation on discord

earnest phoenix
zinc stratus
#

Can i use Bot Designer For Discord????

quartz kindle
wet scroll
#

then put that in where it says to put your client ID

earnest phoenix
#

Oh

#

Wait

wet scroll
earnest phoenix
zinc stratus
earnest phoenix
#

Still don't work

solemn leaf
#

bcs thats your id?

quartz kindle
#

you did it wrong

solemn leaf
#

742513568767016992

#

not the bots id

#

nvm

earnest phoenix
tulip ledge
#

Tim, do u know a fix to my issue?

wet scroll
# zinc stratus Why

Because if you want to code, then you should learn how to do it rather than use software to do it for you.

quartz kindle
earnest phoenix
#

Wait

quartz kindle
earnest phoenix
#

Wait

#

Can you do it for me?

solemn leaf
#

you removed stuff

earnest phoenix
#

Thank you

#

So much

#

I love you no homo

solemn leaf
#

yes homo

earnest phoenix
#

Bro?

tulip ledge
#

reaction.remove() removes all reactions, and not the one from the user

zinc stratus
safe creek
#

lmao

quartz kindle
cobalt spruce
#

@quartz kindle tim would u help me on that script

#

?

zinc stratus
wet scroll
#

To start with, I have no clue what the Bot is supposed to represent and what is "Thumbnail"?

forest mirage
#

they are using bot designer

safe creek
#

how does the webhook api work?

heavy marsh
#

@quartz kindle Thank you - It worked now

safe creek
zinc stratus
#

$nomention $onlyForIDs[753097781182201906;] $setVar[Ban;true;$mentioned[1]] I have banned $username[$mentioned[1]] from using this bot!

forest mirage
safe creek
#

ew

tulip ledge
#

Tim do u also know a solution to why the first time I react to it it doesn't emit to the event?

zinc stratus
forest mirage
#

then you're out of luck lol

zinc stratus
#

To bypass

forest mirage
#

okay mate

quartz kindle
#

dont get yourself banned from servers then lul

#

wdym it only works in one channel

cobalt spruce
#

i tried to do "JOINTOCREATECHANNEL": ["id1", "id2"]

quartz kindle
#

that still doesnt make sense to me

cobalt spruce
#

uhh

#

look

#

that script is temp voice channel

#

u join a channel it detect that and then make new one and move u to it

#

but when i try on mutiple servers it dont work

quartz kindle
#

if(newState.channelID !== config.JOINTOCREATECHANNEL) return; //if its not the jointocreatechannel skip

#

you only allow it to run if it matches a specific id

quartz kindle
tulip ledge
#

mmmh no I haven't

cobalt spruce
quartz kindle
cobalt spruce
#

yee

quartz kindle
#

so if you want it to work on other channels you have to remove that

cobalt spruce
#

can explain why please

quartz kindle
#

isnt it self explanatory?

#

you only allow the function to run if the user joins a specific voice channel

#

any other voice channel the function will just exit

cobalt spruce
#

oh

#

ok

zinc stratus
zinc stratus
cobalt spruce
#

@quartz kindle did not work

zinc stratus
#

Lol. Bypassed ban

#

Lol🤣🤣🤣🤣

#

Im so gonna get banned drom discord for this

quartz kindle
#

you dont need a vpn for that lol

solemn leaf
#

who renamed me

cobalt spruce
#

@quartz kindle there was a problem

quartz kindle
#

what problem

cobalt spruce
#

u didnt understand me right

quartz kindle
#

perhaps you didnt explain right?

cobalt spruce
#

i want a spesific channels to make the temp rooms

#

maybe

#

not every channel

quartz kindle
#

ah so you want specific channel ids

cobalt spruce
#

yee

quartz kindle
#

because you just said "other channels"

#

like any channel

cobalt spruce
#

i didnt mean that

quartz kindle
#

to have multiple ids, do what you did before in the config file, with ["id1","id2"] etc

#

but change the code to includes

#

if(config.BLA.includes(state.channelID))

cobalt spruce
#

hmmm

#

if(config.JOINTOCREATECHANNEL.includes(state.channelID))

#

u mean this

#

hmm state is not declared

quiet topaz
#

I dont know, how to start my discord.js bot automaticly on boot on debian 10. Help would be nice

quartz kindle
#

with your voicestate variable

quartz kindle
quiet topaz
#

no,

quartz kindle
#

well thats one option

#

another option is using a service

cobalt spruce
#

Cannot read property 'channelID' of undefined

#

am dum af

quiet topaz
quartz kindle
#

there are many different ways to set it up, try googling it

cobalt spruce
#

@quartz kindle man am dum af

quiet topaz
#

im googling it 6 hours

cobalt spruce
#

Cannot read property 'channelID' of undefined

quartz kindle
#

just the user joined part

quiet topaz
quartz kindle
cobalt spruce
#

i just changed this

quartz kindle
#

find the differences between old code and new code

#

and you'll have your answer

cobalt spruce
#

am dum

#

couldnt fine anything

quartz kindle
#

dude..

#

you have 2 states

#

replace state with the new state

#

like you had before

cobalt spruce
#

the problem that i did

molten yarrow
quartz kindle
#

find the difference

cobalt spruce
#

nvm

#

i was doing other shit on the top

#

that why it didnt work

#

@quartz kindle thanks for ur help

quiet topaz
queen crescent
#

how can i make timestamps like discord? e.g today at time but when its been like 2 days it says the date e.g 12/25/2020

#

should i use moment to do like Today at ${moment(.....)} and use an if statement to check if the date has been 2 days

safe creek
#

will i need to make a cog to have my bot to be able to run multiple py files in visual studio code?

lyric mountain
#

vscode doesn't run anything, it's the terminal executing it

#

also u can't have more than 1 py file being ran per terminal

#

what you can have is a file calling another file

earnest phoenix
#

can someone help me on how to use exec, im trying to make a -eval console.log("test") command so it will output the console.log or whatever code is specified.. but idk how to get exec to works

lyric mountain
#

JS?

earnest phoenix
#

yeah

lyric mountain
quartz kindle
#

what does eval have to do with exec?

hollow prawn
#

Hi i'm re-doing my bot, and when I used the node init command following the discord.js guide I have much less node_modules in my bot's folder would that be an issue? using d.js library

sudden geyser
#

npm init is for creating new projects. Run npm install to install libraries.

#

If it looks like less but still works, it's probably expected behavior.

#

You'll know if it's wrong if you get an error.

hollow prawn
#

ah, sweet thanks, if it's gonna work with less libraries might as well go with that tbh

#

you can attach a .then after .send(message) i think

hollow sedge
#

depends on your language

hollow prawn
#

oh completely ignored the fact that it does depend on your language lol

hollow sedge
#

it's ok lol, majority of people are JS

#

fair assumption

tulip ledge
#

create a callback or assign the send method to a variable then .delete({ timeout: time })

#

no

#

wait no

blissful raft
#

I need to do this for an embed

tulip ledge
#

@earnest phoenix

#

they both dont rlly explain callbacks

#

this is the one

#

@earnest phoenix

blissful raft
#

Can I do .delete after I've already done .bulkDelete and .then

quartz kindle
#

if you did bulkDelete, then the message you want to delete is already deleted

finite nimbus
#
let winner = msg.reactions.cache.get('🎉').users.cache.filter(u => !u.bot).random();
TypeError: Cannot read property 'users' of undefined
kind epoch
#

Sa

finite nimbus
#

Help plz

opal plank
quartz kindle
#

lmao

opal plank
#

wouldnt you do something similar for a VM eval?

#

assuming you could do something like that and spawn a node process inside it like that

#

cuz your filter is only filtering for a reaction

#

awaitMessage()

#

you do know just that wont fix the issue right?

#

you want to start getting messages, but your filter and your collector are for reactions

#

also why async?

#

also also

#

first() may not always return something

#

cuz u set a timer

#

if the timer runs out first it will error

#

so, its wrong as is

#

also also also

#

embed builder = bad

#

also also also also probably a good idea to add a command handler

woven sundial
#

Hi, I'm trying to remove the reaction of the user who clicked on it.

my code ```js
msg.react("⏭️")
collectorR.on('collect', async (reaction, user) => {
console.log(msg.reactions)
await msg.reactions.cache.get("⏭️").remove(user);

  console.log(`Collected ${reaction.emoji.name} from ${user.tag}`);
});```

what should it do : remove the reaction of the user who clicked.

what does it actually do : removing the bot + user that clicked reaction

Did I make a mistake ?

opal plank
#

yes, now there are other 4 things i pointed out that you might wanna fix/improve

safe creek
#
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send.discord.Embed(
        title = "Command Invalid",
        description = "Command not found, Please make sure it exists and try again.")``` It should send an embedded error but it doesnt send it, it doesnt show any errors neither...
#

or did i miss something?

slender thistle
#

what in the fuck

safe creek
#

what

#

it should send an error message into the chat

slender thistle
#

ctx.send(embed=your_embed_object_here)

safe creek
#

ive never used the embeds before...

slender thistle
#

You are creating one there already

safe creek
#

oh

slender thistle
#

but you somehow managed to do ctx.send.discord.Embed

safe creek
#

oh i see

#

it works just doesnt send a message into the chat lol

#

is that a but with what i did?

#

bug*

slender thistle
#

Yes

safe creek
#

oh

#

lol

#

ima go report it

hollow prawn
#

I use fs.readdirSync for my bot commands, could I possibly do the same for the events? d.js library

slender thistle
#

send is a method of a messageable object (member, user, text channel, group DM)

safe creek
#

now where to do that

slender thistle
#

ctx supports using it as it is a shortcut for ctx.channel.send

safe creek
#

i see

slender thistle
#

in that method's parameters, you provide an embed keyword argument, value of which will be a discord.Embed instance

safe creek
#

where should i send the bug report and what should i put?

#

i seee

#

so is discord.embed like ctx.send but more fancy

#

or

slender thistle
#

...no

safe creek
#

oh

slender thistle
#

ctx.send literally just sends a message

safe creek
#

ahh ok

slender thistle
#

be it an embed or a simple message with content

safe creek
#

ohhh ok

#

so i basically found a bug without knowing?

slender thistle
#

so you basically fucked up

safe creek
#

oh

#

but didnt you say it was an bug?

slender thistle
#

never did

safe creek
#

oh thiught you did

drifting wedge
#

how can i load the html with with checkboxes already checked?

slender thistle
drifting wedge
#

pls ping me if you do respond

slender thistle
#

object/instance meaning the same thing here

drifting wedge
#

ctx is basically the object

#

so its like message.channel.send

#

but ctx.send

safe creek
#

so should i put the discord.embed behind the brackets

solemn leaf
#

new discord.embed()

safe creek
#

im so confused man

slender thistle
#

as am I

#

ctx.send(embed=discord.Embed(...))

#

P.S. rtfd

safe creek
#

oh

#

ok so like that

slender thistle
#

I need more water or I'll go nuts

#

brb

safe creek
#

but is that a bug because there was no error while coding so i assumed it was normal xd

slender thistle
#

it's very highly possible that the error was literally consumed

#

aka "handled" improperly

safe creek
#

huh i see

#

so no bug

slender thistle
#

well, it's a bug... created by you

safe creek
#

yay

slender thistle
#

I was there myself and had to learn it the hard way

safe creek
#

i found and made a bug xd

hollow prawn
#

should I log my bot's errors directly into a discord channel or do I read the error-log file and then output that into the discord channel whenever a new error gets added?

safe creek
#

hmmm

#

so should i report that somewhere? @slender thistle

sudden geyser
#

It's your choice, but if I were to do it, I'd have a logs/ directory then store the logs of the standard output (console.log) and the standard error (console.error) in the file.

slender thistle
#

Report what where who why

safe creek
#

the bug yuo said i made

slender thistle
#

It's you not handling your exceptions properly that an error happened without any output

#

You don't "report" it. You debug your program, see what the fuck you diddly voodoo'd and why it's doing a fucky wucky

safe creek
#

mmmk kekww

#

because you said bug so i instantly think REPORT REPORT WEE WOO FUCK SHIT

slender thistle
#

wee woo bug created wee woo must debug wee woo brrrrrr must fix

earnest phoenix
safe creek
#

bug made go bbbbbbbbbbbbbbrrrrrrrrrrrrrrrrrrrr

earnest phoenix
#

because .has cant have a array what do i use

quartz kindle
#

if you want to match any premium role, use array.some()

earnest phoenix
#

how would i fit it in with the code

#

because the array has roles (IDS)in it

safe creek
#
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send(embed=discord.Embed(
        title = "Command Invalid",
        description = "Command not found, Please make sure it exists and try again."))``` so that somehow didnt work....
#

unless i fucked up the embed pepe_susp

quartz kindle
sudden geyser
slender wagon
#
const express = require("express")
const app = express();
const config = require('./config.json');
const port = "4444";
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({
  extended: true
}));
app.use(bodyParser.json());
app.use(express.static(__dirname + '/public'));
app.set('views', __dirname + '/public/views');
app.set('view engine', 'html');

app.get("/", function(req, res){
    res.render("index.html")
});
app.get('/login', (req, res) =>
  res.redirect(`https://api.instagram.com/oauth/authorize?client_id=${config.app.id}&redirect_uri=${config.redirect.uri}&scope=user_profile,user_media&response_type=code`));

app.use(function(req, res, next) {
  res.status(404).send({ message: "Yikes bro wtf!" });
});
app.listen(port, function(){
 console.log(`Server is live in localhost port ${port}, good luck :D`);
});```
it throws cannot find module "html"
#

ping if anyone can help

quartz kindle
#

html is not a view engine

#

just delete it

slender wagon
#

would throw the same error without it

quartz kindle
#

even if you remove the view engine line?

slender wagon
#

i gotta double check 1 sec

safe creek
#

should send as an embedded error

#

but nothing sends

#

no errors neither

slender wagon
#

yup it still throws that error

sudden geyser
#

So the error is not being raised

#

Does running a command work

slender wagon
#

i think i will just start over with a clean project tomorrow step by step and not gonna bother to fix this one

solemn leaf
#

lol

tardy hornet
#

forgot how to put my app in the dyno

solemn leaf
#

?

tardy hornet
#

i made an app

#

and i have everything set up

#

but i dont remember the next step

#

with the dyno

zenith knoll
#

Hey

#

nvm im dumb

#

How do I call off the GuildMemberRemove event when the bot detects a ban event

safe creek
#

for filename in os.listdir('') do i have to list an folder or can i just list an file also can i list multiple files insde the listdir?

sudden geyser
#

It depends on the order of events received, which I don't think are in a fixed order. One workaround would be to request the audit logs and see if the removal was last due to a ban (and check the time of course).

#

do i have to list an folder or can i just list an file
Do you want to list only files or folders, or something else?

also can i list multiple files insde the listdir?
So you want to read all the directories recursively?

#

Like, are you looking to match a pattern or something? Could you reiterate what you want.

zenith knoll
#

How do I call off the GuildMemberRemove event when the bot detects a ban event

safe creek
sudden geyser
zenith knoll
#

what if the result is null

#

if the audit hasnt loaded

#

how would i know if i should mark it as a ban or leave

#

cause sometimes the bot returns null cause though it was a ban the audit didnt load when bot queried

sudden geyser
# safe creek for it to run code in other files as im pretty sure its possible using cogs if i...

You could use __import__(path) to import a file by a string. However, if you're using cogs (or extensions, better choice), all you need to do is pass the path to the file as a string and discord.py will handle the loading for you.

You could keep using os.listdir, but there's a more cross-platform approach. From the pathlib module, import Path, initialize it, and use the glob method to return a list of files and directories. For example: ```py
from pathlib import Path

for ext in Path().glob("cogs/*.py"):
...

zenith knoll
#

um k

#

o nvm sorry

#

not replied ot me

#

to*

sudden geyser
# zenith knoll how would i know if i should mark it as a ban or leave

It's just an approach I came up on the top of my head. Really, I don't think there's a good way of canceling one event when I don't know if it'll be guaranteed for one event to always be called before the second one (and I don't think it is). I'd personally handle both events or have a condition where I see if one of the two events has already been called and ignore the second one.

zenith knoll
#

Yea the question im asking is how to call off or ignore the second

#

Because my bot will have an antinuke feature but i need the executor for it lol

sudden geyser
#

oh, then you could have some local variable to record when the first one has been fired, then ignore the second one. For example, having an array of guildid-userid, see if the array has the element. If it doesn't, add it. If it does, remove it from the array and ignore second event.

zenith knoll
#

hmk thanks

safe creek
#

or am i getting something wrong here

#

its late and im not thinking dtraight

sudden geyser
#

now inside your loader, read the directory where you store the cogs and call bot.load_extension(...) where ... is the name but with / replaced for .

safe creek
#

wat

#

im confused

#

...?? wat

#

@sudden geyser

solemn leaf
#

what do you do for this now message.guild.roles.find

earnest phoenix
#

how can i make my bot display the users o servers count

#

?

#

Users of all servers that he's in

sudden geyser
#

Going back on my example: ```py
from pathlib import Path

for ext in Path().glob("cogs/*.py"):
...```
This is what your loader could look like. It basically reads all the files in the cogs/ directory, which is where we'll be loading the extensions.

Now, in the for iteration, it could look like: ```py
cog_name = ".".join(part for part in ext.parts)

bot.load_extension(cog_name[:-3])```
".".join(part for part in ext.parts) forms the cog name to load it by. cogs/Moderation.py will look like cogs.Moderation.py

bot.load_extension(cog_name[:-3]) will load the cog, but cog_name[:-3] will remove the .py postfix because it shouldn't be included.

In conclusion, this loads it by cogs.Moderation.

#

over engineering™️

safe creek
#

ahhhh i see

sudden geyser
earnest phoenix
#

discord.js

sudden geyser
#

You can use .reduce to total up the number of users across all guilds and get the total user guild with <Guild>.memberCount

earnest phoenix
#

how?

solemn leaf
#

what does this mean

#

Supplied roles is not a Role, Snowflake or Array or Collection of Roles or Snowflakes.

safe creek
#
async def load(ctx, extention):
    client.load_extension(f'cogs.{extention}')
    for filename in os.listdir('./cogs'):
        if filename.endswith('.py'):
            client.load_extension(f'cogs.{filename[:-3]}')``` so should i modifiy this too then?
#

its in my file that runs the bot

sudden geyser
solemn leaf
#

lite

#

what does Supplied roles is not a Role, Snowflake or Array or Collection of Roles or Snowflakes. mean

quartz kindle
#

it means what it says lol

solemn leaf
#

does it mean it isnt a role?

quartz kindle
#

yes

solemn leaf
#

how can I make a role then

#

?

sudden geyser
#

It means your input is not a:

  • Role instance
  • Snowflake (role ID)
  • Array or collection containing the two things I said above
solemn leaf
#

```

sudden geyser
solemn leaf
#

role.create?

safe creek
#

hmmm i see

solemn leaf
#

message.guild.roles.create()

safe creek
#

i am trying to grt it to load the commands inside the files so i ca then use them which is every file inside the folder but idfk

quartz kindle
solemn leaf
#

creating a role?

#
message.member.roles.add(message.guild.roles.cache.find(r => r.name == "Verified"))

this will error if their isn't a role called Verified

#

can I add like a catch?

quartz kindle
#

you dont need a catch for that, you just need an if check

solemn leaf
#

checking for???

safe creek
#

@sudden geyser im confised do you want to see the code via screen share and you can help me from there

#

we can do it via dms

quartz kindle
#
let role = message.guild.roles.cache.find(r => r.name == "Verified");
if(!role) return message.channel.send("role doesnt exist, please create one")
solemn leaf
#

so

#
                                    let role = message.guild.roles.cache.find(r => r.name == "Verified");
                                    if(!role) return message.channel.send("role doesnt exist, please create one")
                                    message.member.roles.add(role).catch()
quartz kindle
#

sure

#

cant leave the catch empty tho

solemn leaf
#

oh

#

imma remove that now

quartz kindle
#

the catch there will handle errors on the discord side, like failing to add the role because of a permission issue

solemn leaf
#

ok

earnest phoenix
solemn leaf
#

do I need the color data for roles.create?

earnest phoenix
#

@safe creek readthedocs

quartz kindle
#

should be optional

safe creek
earnest phoenix
#

Read the documentation

#

Stupid

solemn leaf
#

how do I catch again

#

.catch((err) => {
...
});

#

?

earnest phoenix
#

With python?

solemn leaf
#

js

sudden geyser
# earnest phoenix it doesn't help enough ;-;

@earnest phoenix .reduce works by you passing a function, and the .reduce method calling your function repeatedly until it's able to produce a final output.

The function you pass should have two parameters: accumulator and element. accumulator represents what's being accumulated. In this case, it'll be the total number of users across all guilds. element represents the current element we're iterating on. In this case, the current guild. To better understand it, we'll be calling them total and guild.

.reduce takes a second argument, which is the initial value total should be at the start. Since we want the total user count, this will be 0.

Now, your call probably looks like this: ```js
<Client>.guilds.cache.reduce((total, guild) => {...}, 0);

Now, how do we get the total user count? Simple. We need to add the accumulator with the guild's member count. To get the member count, do `guild.memberCount`.

Now, it looks like this: ```js
<Client>.guilds.cache.reduce((total, guild) => total + guild.memberCount, 0);

If you run it, it should be the total number of users.

earnest phoenix
#

Thx

split hazel
#

anyone know which hosts properly support tensorflow prebuilt libs for python

#

galaxygate cpus dont support the instruction set tf uses

pure lion
#

So when you think about it, java is just heavy js?

sudden geyser
#

nah

fathom nymph
#

Hey

sharp rock
#

hmm

fathom nymph
#

So I have leveling

#

system

#

and it wont work

rustic nova
#

quick: how long is a server id? is the length always the same?

mint charm
#

sometimes 1-2 number shorter/longer

fathom nymph
#

longer or shorter server

#

id

rustic nova
#

alrighty

fathom nymph
#

I have level system wont work

#

so uhh help?

solemn leaf
#

what would be a good database to save a users ign

hollow sedge
#

any of them?

solemn leaf
#

like space wise

hollow sedge
#

either way it's not going to matter

solemn leaf
#

so quick.db would be fine?

hollow sedge
#

i mean yeah..

solemn leaf
#

okay

#

thank

fathom nymph
#

help?

hollow sedge
#

unless you're storing a ton of igns

fathom nymph
#

a little help?

solemn leaf
#

100k

hollow sedge
#

uh ok

#

probably dont want to use quick db then

solemn leaf
#

okay

#

what should I use?

hollow sedge
#

look into SQL dbs

#

if your data is very structured

solemn leaf
#

it will just be like

#

<userid>@ign

hollow sedge
#

yeah i mean..if you're not storing any other data you should be fine with any DB

solemn leaf
#

ok

#

im not

hollow sedge
#

for python?

solemn leaf
#

js

earnest phoenix
#

how do I change channel permissions to give someone with MANAGE_MESSAGES Permission to look at the channel

#

dont know how to do it with ID

#

permissions.Overwrtie

hollow sedge
#

look at the docs or just try it

pseudo wadi
hollow sedge
#

to get the author's id

pseudo wadi
#

For the id of the person that sent the message

earnest phoenix
#

how can i add that to the status

#

@sudden geyser

sudden geyser
#

resolve the errors?

drifting wedge
#

how can i like make the switch background a specific color?

#

like i did the for first one?

#

i cant get it working for the second one

#

like how can i set the circle pill thing's background

solemn leaf
#

?

drifting wedge
#

like the background color

solemn leaf
#

css

drifting wedge
#

u see how i got the marine blue background?

#

ye ofc i know

#

but how?

#

where

solemn leaf
#

look for its id or class

drifting wedge
#

ive been trying for an hour

hollow sedge
#

is this your own website?

drifting wedge
#

mine, ye

#

why?

hollow sedge
#

you can just use element.style.background-color = #000000

drifting wedge
#

like if i do background color

#

this happens

#

it makes it work

#

but it leaves the other thingy too

#

you know wat i mean?

drifting wedge
#

like i dont know anything about js

#

so sorry lol

#

i only want this small part to be the color

rotund yarrow
#

hey i need help adding async to my command handler, can someone help?

hollow sedge
#

you could just add an onclick

#

in the element

#

like how you would add style by element

earnest phoenix
drifting wedge
#

i want it to be like that always

#

like have the background

earnest phoenix
#

i already tried

sudden geyser
#

well what is the error

hollow sedge
#

yes

#

oh so even if they leave?

drifting wedge
#

leave?

rotund yarrow
hollow sedge
#

like close the page

drifting wedge
#

no lol

#

like regarless of the state

#

so i got it working for toggled on

#

idont know

#

but i did

sudden geyser
#

just mark it as an async function and handle errors the async way

hollow sedge
#

idk, i suggest learning js then

#

you can't really make a dynamic website without JS

earnest phoenix
rotund yarrow
earnest phoenix
#

@sudden geyser

rotund yarrow
#

like in the command handler

#

im new to async

sudden geyser
#

that's a lot of errors

drifting wedge
sudden geyser
#

you mistook something

drifting wedge
#

its literally just setting the background

#

its static

sudden geyser
#

<Client> is a placeholder for your instance of the class Client

#

If you named it bot, you'd put bot

#

If you named it client, you'd put client

#

Of course, it must be in scope.

sharp rock
#

HM

earnest phoenix
#

oh

#

wait

#

what

#

the name of the file

sudden geyser
#

Second of all, the message in your terminal is not an error. It's a warning. You have too many message event listeners (<Client>.on("message", ...)).

earnest phoenix
#

?

#

oooooooo

sharp rock
#

code for,on 24 hours?

earnest phoenix
#

it's client

#

ye

#

s

sudden geyser
#

Barnie it's the name of a variable

hollow sedge
earnest phoenix
#

solved.

hollow sedge
#

essentially what you need to do is get the value of the button and use if statements to change the background-color

drifting wedge
#

i want the same

#

like regardless of the button

#

like this is da switch

#

if u unlcick it

#

i want the keep the dark blue thing

hollow sedge
#

ok then just change the background color when it's toggled on and not when it's off

drifting wedge
#

I WANT TO KEEP WITH WHEN ITS TOGGLED ON AND WHEN ITS OFF

#

do u understand

earnest phoenix
#

@sudden geyser THX so much for your help

#

it already works

hollow sedge
#

so just check if it's toggled on when you click it??

#

it's a button right?

drifting wedge
#

not really

#

its a checkbox

hollow sedge
#

same idea

drifting wedge
#

but i dont want it to change

hollow sedge
#

just check if it's checked

drifting wedge
#

like i wanto have the background

hollow sedge
#

YES IK

drifting wedge
#

regardless of the state