#development

1 messages ยท Page 1404 of 1

drifting wedge
#

so why would i need to check if its checked?

hollow sedge
#

i guess you wouldn't

#

either way just do it onclick

drifting wedge
#

why would i do it onclick?

#

literally

#

it is going to be the same

hollow sedge
#

how else would you do it?

drifting wedge
#

like background-color

#

but when i do it

#

it leaves this box

hollow sedge
#

you're trying to change the button's background color?

#

or the body

drifting wedge
#

yES

#

the button

hollow sedge
#

oh

#

makes more sense

#

you're getting the wrong element

#

find where the color is set in your CSS

drifting wedge
#

thats the thing

#

ive been trying to for the last 1.5 hours

#

i know where the white color thing is

#

but i legit cant figure out where

#

can i just overset it in html?

hollow sedge
#

could you share it?

drifting wedge
#

css?

hollow sedge
#

what does that even mean

#

yes

drifting wedge
#

u want 25k lines of css?

hollow sedge
#

are you using bootstrap?

drifting wedge
#

well kinda but not really

hollow sedge
#

just use the inspect tool on the button

drifting wedge
#

not sure how to explain it, but like we just found a bunch of css we thought we needed and put together

hollow sedge
#

look at the styles

drifting wedge
#

styles?

#

cant we just overwrite css with style tag?

hollow sedge
#

you could but how would you know when to change it

drifting wedge
#

lemme try something

#

gimme 20 secs

#

i gtg

#

ill be back

astral yoke
#

how would I get this to work?

#

if(user.includes(admin)) message.reply("cannot remove an admin!")

amber thistle
#

Includes admin? U mean a role?

astral yoke
#

admin is a role

#

let admin = message.member.roles.cache.has("710751019495194645")

#

then user is const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || bot.users.cache.get(args[0])

amber thistle
#

Thats for checking if the member who executed the command has the admin role

astral yoke
#

ah

amber thistle
#

U could do

#

user.roles.cache.has('admin role id')

astral yoke
#

Thank you

amber thistle
#

And also remove the || bot.users.cache.get(args[0])

#

Since the user could be at another server and that server doesnt has the same role

astral yoke
#

if(user.roles.cache.has('710751019495194645')) (node:13800) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined

dawn beacon
#

how can i fetch multiple documents in mongo db ?

#

please tag me if u know

astral yoke
#

no clue

gusty lynx
#

;-;

astral yoke
#

user is defined as const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || bot.users.cache.get(args[0])

quartz kindle
#

not mentioned and args is either an invalid id or not found in the cache, so it ends up being undefined

astral yoke
#

Thank you

astral yoke
#

if in bot.on message i have it so where it changes someones message into an embed, how would i save that so i can use it when someone reacts and it changes color based on how much reactions

dawn beacon
#

why i get undefined :/

safe creek
#

code inside the file that should be used by th cogs

#

sending 1 sec

agile lance
#

How can I make my bot leave servers below a certain amount? ( discord.js v12 )

restive lily
#
@commands.command()
    @commands.has_role("Meeting_Controls")
    async def start(self, ctx):
        user = ctx.message.author
        role = get(user.guild.roles, name="Meeting_Participant")
        await user.add_roles(role)

    @commands.command()
    @commands.has_role("Meeting_Controls")
    async def end(self, ctx):
        user = ctx.message.author
        role = get(user.guild.roles, name="Meeting_Participant")
        await user.remove_roles(role)```
Is there a way to make this command role everyone in the server the role? (server only has like 10 people) (Ignore the `ctx.message.author` it was for testing purposes)
*please ping me if you can help answer this inquiry*
#

@agile lance not sure how js works but if you can, make a check so the bot sees how many users are in it, then if its below, lets say 10 or whatever it leaves? sorry this may not help at all

agile lance
#

Hm, Iโ€™ll try it

earnest phoenix
#

You gotta do a filter() on the guilds collection

pale vessel
#

Loop through your servers and if the member count is below your amount, leave the server

earnest phoenix
#

And do a for loop to leave them

pale vessel
#

If you're going to loop you don't need to filter anyway

earnest phoenix
#

[Imagine it's not working as intended and all guilds are gone]

restive lily
pale vessel
#

You want to list everyone with the role?

zenith knoll
#

yo

#

Im trying to check how long it has been since a member has last kicked someone

#

wait a minute

restive lily
#

@pale vessel i want to role everyone a specific role

pale vessel
#

Add a role to everyone with a specific role?

restive lily
#

no so like lets say i do .start it roles everyone in the guild "Meeting_Participant"

pale vessel
#

What do you mean by "it roles"?

restive lily
#

the bot

pale vessel
#

It adds a role to everyone?

restive lily
#

"it" refers to the bot

#

so i do the command "start", the bot roles everyone in the guild the role "Meeting_Participant", is that possible?

#

someone told me to make a loop with ctx.guild.members

pale vessel
#

Yeah

restive lily
#

how does one create a loop? heh

pale vessel
#

But that sounds like an API abuse

restive lily
#

its for a server i own

#

its a private bot

#

for private use

pale vessel
#

Yeah and how many members?

restive lily
#

like 8

pale vessel
#

Oh

restive lily
#

its so when a user has that role they can speak

#

its for among us

#

:/

#

so people dont talk not in meetings

rustic nova
#

Trust me, i tried that

#

it ratelimits the fuck out of your bot

#

at like 4-5 users, it breaks completely. I did it through if one user muted (presumably with the role "master"), the other users will get muted too

#

but yeah, ratelimits

uncut river
#

tryna make a vote reward system that rewards all guilds that the user and bot are apart of, anyone got an idea of how to fetch all those guilds that the user is in?

#

@ me

opal plank
#

@rustic nova @restive lily What about using a muted role without permission to talk in VC rather than server/muting them. That endpoint is muhc better than the ones you trying with the manual mute

rustic nova
#

Works partially, until you have members that have admin permissions

#

or manage channels (iirc)

opal plank
#

account for that

#

check role permissions

#

its cached, shouldnt even be an issue to check for that

rustic nova
#

and then server-mute the users that couldn't be muted through the role?

opal plank
#

correct

rustic nova
opal plank
#

or add a ratelimiter yourself

#

now time to scrape DBL's API

rustic nova
#

have fun

wise quartz
#

how do i get the guild icon? (py)

#

ctx.guild.icon won't work for some reason

cerulean ingot
#

how do i change the color of this

#

the beackground of it

cerulean ingot
wise quartz
#

ah right

#

thanks

#

owh they added reply

#

looks dope

wise quartz
#

is it the long description or whatever its called in top.gg

#

where you can use code n stuff?

rustic nova
wise quartz
#

now thats useful

copper relic
#

If I wanted to embed my website into the site description what html code should I put?

pale vessel
copper relic
#
<iframe src="https://urlify.xyz"></iframe>
#

like that?

pale vessel
#

Yes

copper relic
#

its nt loading though, but if you go to the site, you see it works

#

??

flint oracle
#

Does anyone know a fix for:

MinigetError: Status code: 429
    at ClientRequest.<anonymous> (C:\Users\HP\Desktop\music\node_modules\ytdl-core-discord\node_modules\miniget\dist\index.js:163:31)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:469:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
umbral zealot
#

429 is rate-limited, meaning, the server is denying the request because you're making too many of them.

flint oracle
#

so this comes from either youtube or ytdl ;-;

umbral zealot
#

probably youtube.

flint oracle
#

but my api quota says that it is all okay

umbral zealot
#

This isn't about quota

#

It's about rate limits.

#

As in, limited by x/interval (just like discord has rate limits)

flint oracle
#

i find it weird that it only does that randomly once every few weeks/months

umbral zealot
#

Perhaps you get more requests in those cases.

flint oracle
#

it always happens after my bot crashes because of a 403 error

umbral zealot
#

Maybe you should catch errors then KEKW

pale vessel
#

Gotta catch 'em all

flint oracle
umbral zealot
#

I'm not very familiar with ytdl to be honest but I'm sure it has a way to catch errors and prevent crashes

flint oracle
#

it prevents crashing on every error even 429 except for the 403 error for some reason

proper bolt
#

is it ytdl or youtube search api

#

youtubes search api has limits per second, minute, week, month iirc

pale vessel
#

Ytdl is not for searching

blissful raft
#

With the status 429 on ytdl-core, I found that the only way to fix it in my case was to generate a new API key

sudden geyser
#

well you reached the quota

blissful raft
stable ingot
#

@chilly veldt
idk if someone already answered this, but here you go
client.guilds.cache.forEach(server => console.log(server.name))

halcyon linden
#

Emm

#

Hi

#

How can I change the nickname of an user?

#

with discord.js

#

I tried with message.member.setNickname and doesn't work

earnest phoenix
#

Hm

rustic nova
halcyon linden
#

also with the id but the same

rustic nova
#

has to work

pale vessel
#

very helpful hope

halcyon linden
#

Oh

#

thanks

rustic nova
#

actually the same thing i think

tardy hornet
#

i made a new app in heroku, where do i choose in the dyno that its not a web
?

#

i made the Procfile already

flint oracle
#

welp even creating new youtube api keys doesn't work ;-;

blissful raft
#

You need to put
worker: node index.js
In the Procfile

tardy hornet
#

i did

#

but i dont know how to update that so it will update in the web so it will let me

#

@blissful raft

blissful raft
#

Umm, I changed mine then it showed up in Dynos

tardy hornet
#

but i still need to update the code

#

in the working tree

near stratus
#

It may take some time

tardy hornet
near stratus
blissful raft
#

When I used heroku I had mine auto deploy from GitHub

near stratus
#

First time deploy manually then select auto deploy

#

Then after some time (1-3 min) The dinos will appear

#

You can turn off web and turn on worker from there

tardy hornet
#

its not letting me deploy

near stratus
tardy hornet
#

1s

#

okay while i didnt look

#

it didi it it self

#

now i just need to wait till the dyno will show me that option?

near stratus
#

Yeah

#

Like this

tardy hornet
#

k

#

when i try to push it it says

near stratus
#

Oh,
You're using Heroku git

#

I thought you were using GitHub

#

Well I don't know what I'm looking at
Sorry,
Can't help

astral yoke
#

how come in this code

#

when you restart the bot

#

it dosent let you do the code anymore?

#

like it dosent do the code if you stop and start the bot

mint charm
#

anyone know how to upload mp3 from assets?

astral yoke
#

does that have todo with the code or because of the function messageReactionAdd?

earnest phoenix
#

how to add external emoji in the bot commands please tell

mint charm
#

basicly put the emoji in your server, and do <(emoji name):(emoji id)>

#

i guess

#

if that's not react though

mint charm
#

wait, nvm i forget how it work

#

lemme try

earnest phoenix
#

ok

astral yoke
#

message.react(<Client>.emojis.cache.get("id"))

mint charm
#

<:(emoji name):(emoji id)> @earnest phoenix

earnest phoenix
#

ok

#

thanks

#

@mint charm btw i forgot how to get emoji id

#

please tell

astral yoke
#

\:reaction:

#

i believe

earnest phoenix
#

thanks

#

it worked

#

hi

solemn jolt
#

Hello

neon heart
#

hi, how to get messageAttachment url from my code? i want to put into embed.setURL

wheat valve
#

how would you get the reason to log in audit logs using .ban()? I am able to use the .kick(reason) and it logs it fine in the audit logs, but not for the ban command. Discord.js

jade willow
#

I might be able to help.

solemn jolt
wheat valve
#

Thank you!

solemn jolt
woeful wadi
fickle sapphire
#

Probably u define the member first and then you do member.ban({reason: reason});

#

?

carmine summit
#

NzgwNzA4ODc0OTE0NjI3NTk0.X7zBzA.-3gwV853BJTOa8LHb1ZCc25nkLs

earnest phoenix
#

?

#

bot token ?

carmine summit
#

nothing

#

no......

harsh blade
earnest phoenix
harsh blade
#

Can i do anything to remove the "undefined" part

carmine summit
earnest phoenix
#

there may be a error in your code

harsh blade
#

    async execute(client, message, _args, {config, Ticket}) {
        const embed = new MessageEmbed()
      .setTitle('DynamicBot help list')
      .setColor("32FF00")
      .setDescription(`DynamicBot Commands list!`)
      .addField('   :gear: **Admin**             :tools: **suggestion**         :moneybag: **Invites**\n\`,help admin\`   \`,help suggestion\` \`,help invites\`\n')
      .addField(' :love_letter: **Tickets**                :notes: **Music**              :gift: **Giveaway**\n\`,help tickets\`      \`,help music\`       \`,help giveaway\`')
carmine summit
#

add , false at the end

#

of

#
.addField(' :love_letter: **Tickets**                :notes: **Music**              :gift: **Giveaway**\n\`,help tickets\`      \`,help music\`       \`,help giveaway\`', false)```
harsh blade
#

Alr, 1 sec

neon heart
#

use "\u200B" at value

harsh blade
#

at value?

#

Im new to discord.js sorry

#

\u200B after the , ?

steep sun
#

Does sharding is necessary and does it works for a bot that is less than 2.5K servers??

neon heart
#

@harsh blade i am recommended to use description to make this

harsh blade
#

Hm

earnest phoenix
#

any one know a good bot hosting site

#

?

harsh blade
#

will try ig

rustic nova
harsh blade
neon heart
#

.addField("This is name", "This is value")
you can use
.addField("\u200B", "here your help command")

earnest phoenix
rustic nova
#

you're out of luck then

harsh blade
earnest phoenix
harsh blade
#

Wdym?

earnest phoenix
#

but you did not help me

#

to host the bot

harsh blade
#

Bruh

earnest phoenix
#

what

harsh blade
#

Like if i have " and ' mixed

unborn ridge
#

need a help

neon heart
#

lmao

earnest phoenix
neon heart
unborn ridge
#

i added code guildcreate event that bot will send messag to system channel of server but how can it send to any other channel like NQN

neon heart
#

\u200B is like invisible text,

astral yoke
#
    message.mentions.users.first() ||
    message.guild.members.cache.find(m => m.id === args[0]);```
```      message.channel.overwritePermissions(member.id, {
      VIEW_CHANNEL: true,
      SEND_MESSAGES: true,
      READ_MESSAGE_HISTORY: true,
    });``` anyone know why this errors with ```(node:18392) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites.```
unborn ridge
#

PLS

neon heart
unborn ridge
#

is there something like message.channel.name.includes?

#

@neon heart

harsh blade
#

That worked

#

thank u

neon heart
#

np

unborn ridge
#

i need some help

tame kestrel
#

hello! Currently I am trying to fetch information from the discord api using users/{id}, but I seem to be getting a 401. I'm properly authenticated and users/@me works, why doesn't the users/id work?

humble rock
#

Sorry, my guildMemberAdd event doesn't work

Event

const { MessageEmbed } = require('discord.js');
const canva = require('discord-canvas');
const welcomes = require('../database/models/welcome');


module.exports = (client) => {
    client.on('guildMemberAdd', async (member) => {

        if(member.bot) {
            return;
        } else {
            const wel = await welcomes.findOne({
                guildID: member.guild.id,
                guildName: member.guild.name
            });
    
            
                if(!wel.channelID) return;
                if(!wel.Message) return;
    
                const msg = wel.Message;
                const chann = wel.channelID;
    
                let card = await new canva.Welcome()
                .setGuildName(member.guild.name)
                .setAvatar(member.user.displayAvatarURL({ dynamic: true }))
                .setMemberCount(member.guild.memberCount)
                .setText(`Welcome to Server ${member.guild.name}`)
                .setDiscriminator(member.user.discriminator)
                .setBackground("https://cdn.mos.cms.futurecdn.net/2eUcV2529hH4DtBjHAH2b9-970-80.jpg")
                .setColor("border", "#07e65c")
                .setColor("title", "#07e65c")
                .setColor("username-box", "#07e65c")
                .setColor("discriminator-box", "#07e65c")
                .setColor("message-box", "#07e65c")
                .setColor("avatar", "#07e65c")
                .toAttachment();
    
                let embed = new MessageEmbed()
                .setImage(card.toBuffer())
                .setDescription(msg)
                .setFooter(`Joined at ${Date.now()}`)
                .setColor("#131413");
    
                member.guild.channels.cache.get(chann).send(embed);
        }

    });
}
#

Command:

const welcomes = require('../../database/models/welcome');

module.exports = {
    name: 'setwelcome',
    category: 'General',
    description: 'Set Weclome Channel for Welcome Message!',
    usage: 'f!setwelcome <#channel> <message>',
    run: async (client, message, args) => {

        if(!message.member.hasPermission("MANAGE_CHANNELS")) return message.channel.send(`You don't have \`MANAGE CHANNELS\` permission to do that!`)
        .then(m => m.delete({ timeout: 10000 }));

        let channel = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]) || message.channel;
        let msg = args.slice(1).join(" ")

        const settings = await welcomes.findOne({
            guildID: message.guild.id,
            guildName: message.guild.name
        }, async (err, guild) => {
            if(err) console.log(err);
            if(!guild) {
                const newGuild = new welcomes({
                    guildID: message.guild.id,
                    guildName: message.guild.name,
                    Message: msg,
                    channelID: channel.id
                });

                newGuild.save()
                .catch(err => console.log(err));

                return message.channel.send(`Please Retype the Command`).then(m => m.delete({ timeout: 5000 }));
            }
        });

        if(!channel) return message.channel.send("Please Select a Channel!");
        if(!msg) return message.channel.send("Please Specify a Message!");

        
        await settings.updateOne({
            Message: msg,
            channelID: channel.id    
        });


        message.channel.send(`Seted Welcome Channel: ${channel} **(${channel.id})**\nSeted Message: *${msg}*`);
    }
}

What happened?

neon heart
humble rock
#

Someone can help me?

#

Pls here....

pure lion
#

@humble rock you need to enable the intent at the portal

pure lion
#

go to the developer portal

humble rock
#

Yes

pure lion
#

go to your app

humble rock
#

Ok

pure lion
#

then the bot tab

humble rock
#

Ok

pure lion
#

scroll to the gateway intents and toggle on GUILD_MEMBERS

humble rock
pure lion
#

server members

humble rock
#

Ok

#

Thanks

pure lion
#

should work

humble rock
#

I'm trying

#

@pure lion, doesn't work ):

#

Someone can help me again?

earnest phoenix
#

@tame kestrel correct header yes?

#

Wait

tame kestrel
#

ye

#

I think I learned that u need to be authenticated with a bot account rather than a user's oauth2

rustic nova
#

just simply dm them

#

remember that this user has to be in a guild with the bot

cinder patio
#

variable names are case sensitive

pulsar bone
amber thistle
#
dbl.webhook.on('vote', vote => {
  let user = client.users.cache.find(user => user.id === vote.user).tag

  client.channels.cache.get("764317983131828277").send(`Thank you ${user} for voting Isla on top.gg`)
});

its not doing anything when i voted my bot

mint charm
#

self voting, i see GlowNaruhodo

pulsar bone
#

hey guys what is used for adding a delay sending messages

pale vessel
#

setTimeout();

#

You can wrap it inside a promise and do something like await delay(3000); send();

astral yoke
#

how would i store an embed properly so i can use it later? like one that was already sent i can edit later on a different file?

amber thistle
pale vessel
#

Use the test button

twilit rapids
#

@sly wing let's not

sly wing
#

?

#

whats dis

#

O WROG SERVER

#

MB

#

LOL

twilit rapids
pulsar bone
pale vessel
#

Then use setTimeout() or .then()

keen compass
#

how much ram is needed/enough for a full stack web development?

#

smh

quartz kindle
#

wat

#

you're comparing apples to oranges

keen compass
#

prob

south sinew
#

It completely depends on your application

#

For simpler projects you may not even need 1 gb, but anything that caches a decent amount of data in memory may need 2-64 times that, depending on what you are caching and how much

tribal siren
#

what does Presence Intent do?

#

I code for like 6 Months now and I never knew what it stands for and I want to know it now

south sinew
#

Basically allows the bot to access user's status and presence data

tribal siren
#

oh

south sinew
#

So like if they are online, idle, dnd

tribal siren
#

oh so that's why bot always said undefined to status before i turned that thingy

#

ok thank you

south sinew
#

I believe it also allows you to get their status / what game they are playing, not sure though as I've never tried using it for that

earnest phoenix
#

Hello, I am using discord.js I have an Id of a Server I Have a Bot on the Server How Do I Know How To Role A Member On That Server

earnest phoenix
#

yes

#

I need code snippet

tribal siren
#

member.roles.add(role)

earnest phoenix
#

buddy i have to do with the server was

#

A message will be written from dm to bot and should give it a role in the server specified in the bot

umbral zealot
tribal siren
#

i can't quite get what you're trying to explain

earnest phoenix
#

ok then i can specify the server with how the server was

#

I can't use message.guild

umbral zealot
#

what do you have then

earnest phoenix
#

I only have the reverse

umbral zealot
#

What's the reverse of messagse.guild? What event are you in?

earnest phoenix
#

let sunucu = client.guilds.cache.find(server => server.name === test);

umbral zealot
#

What event are you in

earnest phoenix
#

module.exports = async message => {

#

if (message.channel.type === "dm") {

umbral zealot
#

So it's a DM

#

You can get a member from a guild by doing guild.member("some user ID")

sleek glade
#

guys can you fix this problem ? : /app/bot.js:48 log(`Yรผklenen komut ismi: ${props.help.name.toUpperCase()}.`); ^ TypeError: Cannot read property 'name' of undefined at /app/bot.js:48:44 at Array.forEach (<anonymous>) at /app/bot.js:46:9 at FSReqCallback.oncomplete (fs.js:153:20)

earnest phoenix
#

oh thanksss

#

error ๐Ÿ˜ฆ

#

help

umbral zealot
#

what error

earnest phoenix
#

node:12347) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'member' of undefined

umbral zealot
#

then it didn't find that server by name.

carmine summit
#

How do I send a local image

#

as an attachment

pale vessel
#

In an embed?

carmine summit
#

in a normal message

earnest phoenix
#

no

carmine summit
#

i know how to do it in an embed

#

alright

#

in an embed

slim umbra
cobalt spruce
#

UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'Embed Master' of undefined

slim umbra
#

theres a pr in line to be merged thats removing it

carmine summit
#

wait how do i put local images in an embed

cobalt spruce
#

hmm

slim umbra
#

attach the image w .attachFiles

cobalt spruce
#

UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'Embed Master' of undefined
why i got this err

slim umbra
#

show code

cobalt spruce
#

mine?

earnest phoenix
#

If I send you the code, can you solve it?

slim umbra
earnest phoenix
#

let onaylama1 = db.fetch(onaylama_${message.author.id})
let onaylama2 = db.fetch(onaylama2_${message.author.id})
if (message.channel.type === "dm") {

if(!onaylama1) {
  
  return;
  
}


let rol = "778693229767950356"

let sunucu = client.guilds.cache.find(server => server.name === onaylama1);
let รผye = sunucu.member(message.author.id)

if (message.content.toLowerCase() == onaylama2) {
    
    message.channel.send('ok')
    (รผye.roles.add(rol.id))
    
    }

}

slim umbra
#

ur not check if the guild was properly found

cobalt spruce
# slim umbra yes
const Discord = require("discord.js");
const fs = require("fs")
const client = new Discord.Client();
const { prefix } = require('../config.json');
const tempvoice = require("../tempvoice.json");
module.exports = {
    name: 'tempvoice',
    aliases: ['tv'],
    description: 'Create a voice channel',
    usage: 'tempvoice',
    cooldown: 1,
    guildOnly: true,
    async execute(message, args) {

        client.tempvoice [message.guild.name] = {
            voiceid: args
        }
          fs.writeFile ("../tempvoice.json", JSON.stringify (tempvoice, null, 4), err => {
              if (err) throw err;
              message.channel.send(`Your Temp Voice Channel is set to ${args}`)
          })

        }};```
args ```js
    const args = message.content.slice(prefix.length).trim().split(/ +/);
slim umbra
#

and dont use <guild>.member

#

thats not where ur error occured @cobalt spruce

#

cant u read a stack trace

pale vessel
#

guild.member() is like literally guild.members.cache.get()

#

why do they even have that

slim umbra
#

idk

#

theyre depreciated it soonโ„ข๏ธ as well so u may aswell use the proper methods

cobalt spruce
#

got new one

carmine summit
cobalt spruce
#

client.tempvoice = require("../tempvoice.json");

pale vessel
carmine summit
#

potatoes

tulip ledge
#

asking for homework but it's also kind of development.
How to convert decimal to hexadecimal?

pale vessel
#

number.toString(16)

tulip ledge
#

no

#

like

#

without code

earnest phoenix
#

hello just wanna ask, embed sometimes doesnt appear. does it have to do being rate limited or cpu/ram usage?

pearl cobalt
#

ุชุจูŠ ุณูŠุฑูุฑ ุญูŠุงู‡ ูˆุงู‚ุนูŠู‡ ุฌุฏุง ุฑุฎูŠุต

#

ุจูŠ ุณูŠ

#

ุชุนุงู„ ุฎุงุต

tulip ledge
#

no advertising here

#

it's an advertisement ;-;

#

I asked my friend to translate it

tranquil copper
#

Anyone a idea how to get all online users a bot can see? I already got whitelisted by discord but its still not working

earnest phoenix
#

pls give me a nice css

tulip ledge
cobalt spruce
#

how i could get voice channel id

#

??

#

using my bot

pale vessel
cobalt spruce
tulip ledge
#

@pale vessel how to do it without code

pale vessel
#

Mafs

tulip ledge
#

?

pale vessel
#

What are you trying to do

tulip ledge
#

convert decimal to hexadecimal

#

its for homework

pale vessel
#

Hm

ionic silo
#

how to make a guild only command?

earnest phoenix
#

friends please help (member.roles.add (role)). catch (console.error) I wrote this code But it gives Error

ionic silo
#

i mean i can use my bot in dm, I want to make the command only can used in guild

cobalt spruce
#

@ionic silo ```js
if (command.guildOnly && message.channel.type === 'dm') {
return message.reply('I can't execute that command inside DMs!');
}

earnest phoenix
#

(node:16063) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'add' of undefined

#

help please

#

let rol = "778693229767950356"

fair river
#

Any idea how to make my giveaway bot to ask for invites? to join the giveaway?

    // Giveaway prize
    let giveawayPrize = args.slice(3).join(' ');
    // If no prize is specified
    if(!giveawayPrize){
        return message.channel.send(':x: You have to specify a valid prize!');
    }``` this is based on all commands (start.js)
earnest phoenix
#

let rol = "778693229767950356"

#

Are you sure this is the fault

fair river
#

help me please :c

carmine summit
#

if (command == 'a' || 'b' || 'c' || 'd')It doesnt seem to be working

#

it always returns true

fair river
#

the giveaway bot to ask for invites

#

like wumpus bot

#

to join the respective giveaway

#

Any idea how to make my giveaway bot to ask for invites? to join the giveaway?

    // Giveaway prize
    let giveawayPrize = args.slice(3).join(' ');
    // If no prize is specified
    if(!giveawayPrize){
        return message.channel.send(':x: You have to specify a valid prize!');
    }``` this is based on all commands (start.js)
#

yes, the bot to ask for invites, if i set the invites to min 5, everyone who join will receive: "You don't have enough invites to participate to this giveaway" if they don't meet the requirement

earnest phoenix
#

man, no, it doesn't work, i opened a new role and wrote his id but it gives the same error again

#

@earnest phoenix

harsh blade
#

Hey! So
I Created a help.js command that returns a list of sub help directories ( Help music, help invites etc) But when i type ,help music
It just shows help.js (help list) and not the help music.js command
Any ideas? Feel free to @ me

earnest phoenix
#

let rol = "780790848564232202"

opal plank
#

doesnt forcing users to join servers or ask them to invite people fall under join 4 join?

fair river
#

the giveaway bot to ask: "You want to set an invite requirement to join? " and if i put 5 for example everyone who has 5 invites to join, who doesn't is not allowed to join and the bot to remove his reaction @earnest phoenix

#

to invite

#

ppl

earnest phoenix
#

let onaylama1 = db.fetch(`onaylama_${message.author.id}`)
let onaylama2 = db.fetch(`onaylama2_${message.author.id}`)


    let rol = "780790848564232202"


    let sunucu = client.guilds.cache.find(server => server.name === onaylama1);
    let uye = sunucu.members.fetch(message.author.id)

         uye.roles.add(rol)



#

@earnest phoenix

opal plank
fair river
#

there is a bot

#

that does that

#

(it's a private project i don't want it to publish here etc)

earnest phoenix
#

@earnest phoenix please help

#

oke

tulip ledge
#

@earnest phoenix the erro doesn't mean that the the role doesn't exist

#

no

#

u can't add ID's as roles

#

u wanna use member.roles.cache.add

earnest phoenix
#

so what should i do

tulip ledge
#

member.roles.cache.add

#

@earnest phoenix u said the error meant that the role didn't exist, wich isn't true the error clearly sais that member.roles doesn't exist

earnest phoenix
#

(node:16810) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cache' of undefined

#

@tulip ledge

tulip ledge
#

TypeError: Cannot read property 'add' of undefined

#

Mmmh

#

log member

earnest phoenix
#

Would you like me to send the full code

tulip ledge
#

oh and I'm sorry u don't need cache to .add u only need it for some

tulip ledge
#

Just do:

console.log(member)
member.roles.add()
earnest phoenix
#

What should i write

tulip ledge
#

I wanna see what member is

#

its prob undefined

earnest phoenix
#

dm can you come, i want to send the codes

tulip ledge
#

sure ;-;

summer perch
#

how to customize bot page background. just gimme code, i tired multiople methods including a bit of css. jus tell me. am nub at css.

tulip ledge
summer perch
#

no work w3

earnest phoenix
#

@summer perch put it all in a div with this attribute: style="background-color: (hex color goes here);"

summer perch
#

wait but it image

#

and also i need whole stuff not sample am a NUB really

earnest phoenix
#

Before the description, put this: <div style="background-image: url('linktoimage');">

summer perch
#

ok

earnest phoenix
#

and at the end put </div>

summer perch
#

wait my description is md

#

@earnest phoenix my descrption is in md

earnest phoenix
summer perch
#

ok

earnest phoenix
#

Then add the stuff I sent

summer perch
#

k

#

@earnest phoenix i dont think thats it

earnest phoenix
#

Click enter markdown

summer perch
#

where?

earnest phoenix
#

Blue text right at top of that screenshot

summer perch
#

o ya i put the md there

earnest phoenix
#

Alright, on the right side click "raw html"

summer perch
#

k

#

next?

earnest phoenix
#

Copy the text that shows under that, and put it somewhere u can edit it

summer perch
#

kk

errant perch
#

Error: EMFILE: too many open files, open I keep getting this error I think i might know what the problem is. Is there anyway to like unopen or remove files from cache?

summer perch
#

ok next?

#

i put it on a editor

earnest phoenix
#

Now add the stuff I sent you at the start and end

summer perch
#

o

#

k

ionic silo
#

how to add cooldown to a command

summer perch
#

still

#

not work

#

wait at the end of the code?

#
<p><strong>Nitro Type Commands</strong><br><code>n.news</code> - An interactive view of the latest nitrotype news<br><code>n.register</code> - Link your NT account to your discord!<br><code>n.stats</code> - Shows the stats of a nitrotype user.<br><code>n.team</code> - Shows the stats of a NT team.<br><code>n.unregister</code> - Unlink your NT account from your discord.<br><code>n.verify</code> - Verify your account ownership after registering!<br><strong>Games&#39;n Currency</strong><br><code>n.bal</code> - Check Your Lacans!<br><code>n.guess</code> - A game where you guess a silhouetted Nitro Type car<br><code>n.noobguess</code> - A game where you guess a nitrotype car<br><code>n.leaderboard</code> - Check the users with the most Lacans!<br><strong>Meme&#39;n Image generation</strong><br><code>n.meme</code> - Fetches a meme from Reddit
<code>n.communism</code> - Join the soviet union!<br><strong>Useful</strong><br><code>n.bug</code> - Report a bug in the bot!<br><code>n.feedback</code> - Give the developers a feedback!<br><code>n.help</code> - Shows a list of commands and their   descriptions!<br><code>n.info</code> - Get info about this bot.<br><code>n.invite</code> - Invite this wonderful bot to your server!<br><code>n.ping</code> - Gives the latency between the client and the websocket.<br><code>n.server</code> - Join the support server!<br><code>n.shard</code> - Lists all the shards in the client instance.<br><code>n.suggest</code> - Suggest a feature or command for the bot.<br><em>We have many more commands. Just type <code>n.help</code> and you will see a list of a bunch of commands!</em></p>
``` like that?
earnest phoenix
#

the </div> goes at the end of all the code

summer perch
#

o

#

ok

earnest phoenix
#

and replace link to image with a url to the image u want

summer perch
#

oya k

earnest phoenix
#

@earnest phoenix If you go to your bot page there should be an edit button

summer perch
#

like whole back

earnest phoenix
#

@earnest phoenix Then edit the description, it works with HTML and MD I think

#

ok one moment typerious

summer perch
#

k

earnest phoenix
#

typerious whats the url to the background image you want

summer perch
#

ok

#

wait

#

the link is long idk why

#

wait ill get better img

#

yea this one

#

https://simplycoding.org/wp-content/uploads/2020/09/Nitro-Type.png

earnest phoenix
#

yeah that was the whole image, not just a link. which can be better sometimes

#

alright

summer perch
#

then follow

#

m2 doing

#

scroll abit up and start ig

earnest phoenix
#

Oily Ill help u with it in just a moment, almost done helping typerious

summer perch
#

ye k spit what next?

earnest phoenix
#

one second, im gonna send it to u

summer perch
#

kk

ionic silo
#

how to add cooldown to our command?

earnest phoenix
#

Typerious <div style="background-image: url('https://simplycoding.org/wp-content/uploads/2020/09/Nitro-Type.png'); background-repeat: no-repeat; background-size: cover;"> <p><strong>Nitro Type Commands</strong><br><code>n.news</code> - An interactive view of the latest nitrotype news<br><code>n.register</code> - Link your NT account to your discord!<br><code>n.stats</code> - Shows the stats of a nitrotype user.<br><code>n.team</code> - Shows the stats of a NT team.<br><code>n.unregister</code> - Unlink your NT account from your discord.<br><code>n.verify</code> - Verify your account ownership after registering!<br><strong>Games'n Currency</strong><br><code>n.bal</code> - Check Your Lacans!<br><code>n.guess</code> - A game where you guess a silhouetted Nitro Type car<br><code>n.noobguess</code> - A game where you guess a nitrotype car<br><code>n.leaderboard</code> - Check the users with the most Lacans!<br><strong>Meme'n Image generation</strong><br><code>n.meme</code> - Fetches a meme from Reddit <code>n.communism</code> - Join the soviet union!<br><strong>Useful</strong><br><code>n.bug</code> - Report a bug in the bot!<br><code>n.feedback</code> - Give the developers a feedback!<br><code>n.help</code> - Shows a list of commands and their descriptions!<br><code>n.info</code> - Get info about this bot.<br><code>n.invite</code> - Invite this wonderful bot to your server!<br><code>n.ping</code> - Gives the latency between the client and the websocket.<br><code>n.server</code> - Join the support server!<br><code>n.shard</code> - Lists all the shards in the client instance.<br><code>n.suggest</code> - Suggest a feature or command for the bot.<br><em>We have many more commands. Just type <code>n.help</code> and you will see a list of a bunch of commands!</em></p></div>

summer perch
#

wait spit

#

o nvm

#

ty

earnest phoenix
#

aight is that good

#

also id reccomend lighter color text on that background

#

@summer perch

summer perch
#

ok

#

wait what i meant was full background, not just text but page

earnest phoenix
#

I don't think it lets u do that

ionic silo
#

alr i'll test it

carmine summit
#

Why is it in the outside?

    const embed = new Discord.MessageEmbed()
      .setColor('#ffae6a')
      .setTitle('Potato')
      .attachFiles([`./potatoes/potato (1).jpg`])
      .setImage(`attachment://potato (1).jpg`);

    message.channel.send(embed);
summer perch
#

wait but other bot pages have

earnest phoenix
#

idk, that's the only way I know

summer perch
#

ok then

#

tysm man

carmine summit
#

hm?

earnest phoenix
#

np

#

Oliy, for ur background just use this: ```<div style="background-image: url(โ€˜yourimageurlhere'); background-repeat: no-repeat; background-size: cover;โ€>

Your description stuff here

</div>```

#

background color or image

#

aight use that then, replace the yourimageurlhere with a url to the imagte and it should be good

carmine summit
#

its local

earnest phoenix
#

Yep, just replace the 'yourimageurlhere'

#

np

carmine summit
#

hm?

#

how do I do that?

earnest phoenix
#

yeah its gotta be a URL, or base64 data

#

What does it look like

#

send the html

carmine summit
#

I cannot cuz the image is local

earnest phoenix
#

hi

#

aight one second

#

i just came to this channel and the first thing i saw is a guy sending his whole long description; not even on a paste site just as a big code block

#

@earnest phoenix ```<div style="background-image: url('https://i.ytimg.com/vi/h6yP6w2HW7c/maxresdefault.jpg'); /* background-repeat: no-repeat; */ background-size: cover;">

  • | Ennard El Bot De Discord |

| Bot con mรกs de 40 comandos!|

|Bot en 80+ servidores!|

Comandos y utilidades:

  • |Moderaciรณn: Kick & Ban|
  • |Comando 8ball|
  • |Comandos de Roleplay|
  • |Comandos Generales|
  • |Comandos Five Nights at Freddyโ€™s|
  • |Comandos Anime|
  • |Comandos de Diversiรณn|
  • |Comando de Roll|
  • |Comandos de Avatars/รconos|
  • |Comandos de la Tabla de Clasificaciรณn|
  • |Comandos de Informaciรณn sobre Servidores y Usuarios|
  • |Y mucho mรกs!|
    |Nuevas actualizaciones vienen pronto! Estate atento!|

</div>```

#

Some of the quotes were the weird styled ones

earnest phoenix
#

yeah

#

idk how to do that

carmine summit
#
<style>
body {
  background-image: url('https://i.ytimg.com/vi/h6yP6w2HW7c/maxresdefault.jpg');
  background-repeat: no-repeat;
  background-size: cover;
}
</style>
</head>```
#

@earnest phoenix

#

see if that fixes your problem

earnest phoenix
#

wait does using a style tag modify the whole page not just description?

supple sail
#

How can i edit a message and turned it into a embed in v11?

carmine summit
#

orrr

earnest phoenix
carmine summit
#
<style>
.body {
  background-image: url('https://i.ytimg.com/vi/h6yP6w2HW7c/maxresdefault.jpg');
  background-repeat: no-repeat;
  background-size: cover;
}
</style>
</head>```

<div class="body"></div>

earnest phoenix
#

oh the other guy was asking how to do that too

#

@summer perch Someone just sent how to do the whole background

carmine summit
#

@earnest phoenix help meh

earnest phoenix
#

the CSS affects the whole page

#

@carmine summit with wat

carmine summit
#

how do I display a local image in an embed

earnest phoenix
#

you need to read the file data with fs then pass the Buffer object containing the data to Discord.MessageAttachment constructor

carmine summit
#
    let i = Math.floor(Math.random() * 434)
    const embed = new Discord.MessageEmbed()
      .setColor('#ffae6a')
      .setTitle('Potato')
      .attachFiles([`./potatoes/potato (${i}).jpg`])

    message.channel.send(embed);
```this is code
#

but images go outside

earnest phoenix
#

i see

#

you are attaching images

#

what you wanted is to display the image inside the embed body

carmine summit
#

yes

earnest phoenix
#

to do that you need to set it as (don't remember for MessageEmbed class) url property of image property of an embed object

carmine summit
#

which I don't know how to do

earnest phoenix
#

found the method for MessageEmbed

#

MessageEmbed#setImage(<url>);

carmine summit
#

its local

weary torrent
#

Can someone please send me the code in dms for the 8ball command code for a discord bot codkng in Pydroid.3 that has hentai in it thatbif j made the bit send it it would auto play as if it was sent by a user??...

(e.g.) Send as a gif.

I just need it real quick to tesg something. Also... Ima edit it. If its ok with u.

pale vessel
#

We don't spoonfeed

#

You have to at least try and if you're stuck, we can help

earnest phoenix
#

@weary torrent we don't spoonfeed try figuring it out yourself and ask for help if you need with stuff

#

we don't just give you code

#

also i won't help with NSFW

carmine summit
#

no nvm

pale vessel
#

He just bolded the h word

#

h = heck

#

Bad word

carmine summit
#

how do I do it with local images

pale vessel
#

Try giving it a name

carmine summit
#

setImage only works for url I think

earnest phoenix
#

i think it's the same method you used earlier for attaching files

pale vessel
#

attachFiles({ attachment: "path", name: "name.png" }).setImage("attachment://name.png")

#

Like that

earnest phoenix
#
.attachFiles([`./potatoes/potato (${i}).jpg`])

use the same url for .setImage

carmine summit
weary torrent
#

Well... Can someone help me understand how to make the bot send gifs??
And it only shows the gif??

no link nothin??

carmine summit
#

ah

pale vessel
#

Ignored

#

Pensive

earnest phoenix
#

@carmine summit remove the [ and ]

earnest phoenix
weary torrent
#

how???

earnest phoenix
#

or if you have a direct link to it just send the link in the message body

carmine summit
#

im gonna try flazepe's

weary torrent
#

how donI upload thr file??

#

The**"

earnest phoenix
#

?

#

How to set activities changing every 20 seconds

#

?

carmine summit
earnest phoenix
#

@carmine summit lol potato handling tips

carmine summit
#

potatoes go brrr

earnest phoenix
carmine summit
#

I should put potato ingredients

#

nyehehehhe

earnest phoenix
#
setInterval(() => {
   /* change activity */
}, /* time in milliseconds */);
#

Thks

#

yw

sullen grove
#

Anyone knows how to set an custom image to a "game" playing on a bot? A game visualizer with a custom image

pale vessel
#

You can't use rich presences on a bot

#

or am I reading this wrong

#

probably

earnest phoenix
earnest phoenix
#

anyone also work with youtube_dl and ffmpeg and knows how to stop it from freezing the bot while processing a video?

quartz kindle
#

if you're doing it synchronously, then yes it will freeze

#

you should fire up a separate process/thread to do it

slender thistle
#

pain

quartz kindle
#

bread

opal plank
#

jam

quartz kindle
#

peanut

opal plank
#

butter

earnest phoenix
#

am i able to do it using subprocess?

quartz kindle
#

sandwich

opal plank
#

happiness

quartz kindle
earnest phoenix
#

aight

#

ill take a look into it

slender thistle
#

You might want to use asyncio for this

earnest phoenix
#

alot of my video editing commands use os.system("ffmpeg -i in.mp4 out.mp4")

#

annoying thing is that bots dont get a higher upload limit

#

so if its too big it just goes to my cdn on my website XD

quartz kindle
#

check this

earnest phoenix
#

if its too big

quartz kindle
#

ye good enough

#

you could look into something like streamable tho, or something that allows hotlinking

earnest phoenix
#

i could

#

i wanted to take advantage of having unlimited bandwidth and a stable upload speed

#

so i jsut used my own resources

quartz kindle
#

does your link not embed/preview automatically?

earnest phoenix
#

still trying to fix the opengraph tags

#

the were working but idk why

quartz kindle
#

rip

earnest phoenix
#

yop

torpid tiger
#

Error ```xl
TypeError: message.channel.messages.fetch(...).edit is not a function

earnest phoenix
#

the web server is jsut apache2 so i dont think that would be the problem

trim haven
#

alguรฉm br??

umbral zealot
torpid tiger
#

Thanks

#

Like .then((msg) => msg.edit())

#

Right?

#

It worked

zinc stratus
#

.work

earnest phoenix
#
dlpath = "/home/lombex2/optimbot/youtube"
        ydl = youtube_dl.YoutubeDL({
            'outtmpl': dlpath + "/" + "%(id)s" + ".ogg",
            'format': "bestaudio/best ",
            'nocheckcertificate': True,
            'writethumbnail': False,
            'postprocessors': [
            {
                'key': 'FFmpegExtractAudio',
                'preferredcodec': 'mp3',
            },
            {'key': 'FFmpegMetadata'},
            ],
            
            })
        with ydl:
            result = ydl.extract_info(
                cleanal,
                download=True
            )

@quartz kindle this what process the audios

#

i have no clue on how i would use this in subprocess

#

or asyncio

quartz kindle
#

look into the threading module

slender thistle
#

asyncio.run_in_executor do be hot

weary torrent
#

How do I make bot cogs??

I know haow to Im using a tutorial but...

On pydroid.3 mobile how do I??
I need a folder. Please dm me an answer xdd

slender thistle
#

threading is blocking afaik

sudden geyser
#

threading is not really concurrent in python

quartz kindle
#

its blocking?

#

lmao

sudden geyser
#

noop

#

have you heard of GIL?

quartz kindle
#

nope

sudden geyser
#

it's why Python is known for being slow, because you basically can only have one block of code doing something, not two blocks doing two different things

#

like, if you have two threads print a million numbers, I don't think it'll be any faster than not having threads at all to print 2 million numbers

earnest phoenix
#

i heard that threading in python is a literal nightmare

sudden geyser
#

it's easy to thread

#

it's just useless because there's no increase in speed

quartz kindle
#

i mean

#

js is the same

#

thats why threads exist in js

#

arent threads supposed to do exactly that?

sudden geyser
#

1

earnest phoenix
#

christ this hurts my brain

quartz kindle
#

whats the point of threads if they block the main thread wtf

#

or am i not understanding something?

sudden geyser
#

that's like if you want to join them, like if you made an HTTP request to a server and spun it off to another thread, then joined them together to get the value. At least that's one example, but not all use cases of threads need to be blocking

quartz kindle
#

at this point py is as confusing as php

slender thistle
#

I never even bothered with threading

#

if it works, leave it be KEKW

quartz kindle
#

with css

slender thistle
#

Learn CSS, use developer tools in your browser to find which selectors you need

static trench
#

What does a hard restart mean on a VPS?

lyric mountain
#

shutdown 'n boot up again

static trench
#

Will it bring my back back online?

#

I just moved to VPS.

lyric mountain
#

99% of the time you won't need a hard restart

#

actually, 99.999%

static trench
#

Ok

#

Will it bring the bot back?

#

Online

lyric mountain
#

no

static trench
#

Ok

lyric mountain
#

you will need to start the proccess again

static trench
#

Ok

summer acorn
#

When fetching ban logs from the audit logs, does it not fetch the logs without a reason?

lyric mountain
#

ig they're fetched even without a reason

#

because the log is still there, albeit missing a reason

summer acorn
#

Ok, since they didn't when I tried without a reason

lyric mountain
#

weird

outer perch
#

(node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

#

this is happening somewhere in another server

#

is there any fix? or a way to avoid receiving this in the logs if it's not fixable

summer acorn
#

you gotta catch that stuff

outer perch
#

well, now to find where the catch is missing

#

cuz I put a catch in almost everything

summer acorn
#

if you don't use catch, it'll just show you an error for missing permission

#

isn't it showing you where the error is?

#

like file; line

outer perch
#

nope

#

Heroku kinda sucks to show the full log

summer acorn
#

it's on a message.channel.send as I can see there

lusty torrent
#

Hi

ivory seal
#

how do i stop a setInterval?

summer acorn
#

by using clearInterval(intervalName)

ivory seal
#

ah ok thanks

summer acorn
#

although, you'll have to run it in the same code you're starting the interval

ivory seal
#

ye

summer acorn
#

so if you just want to end it after for example 24 hours, you should be fine with clearInterval

#

if not, I would at least use a database to check for when to clear it

outer perch
#

I've been using this catch line

.catch(err => { console.error(err); });
#

I know there are many ways to catch, but I don't know if any is better then another

lyric mountain
#

there ain't "many ways" to catch actually, only 2

#

it's either try-catch or Promise-catch

#

both will do essentially the same thing: execute a code section when an exception is thrown

#

what you do inside the catch block is what really matters

#

in your example, all you're doing is logging the error (which in JS is almost the same thing that appears if left uncaught, except the "you must catch" message)

ivory seal
#

can u clear a itnerval in a interval?

#
           
           state =true;
         console.log(state)
          if(!state){
            clearInterval(loop)
          }
          },500)``` this is my code and `state` is a boolean tho when state is null it still runs the interval can someone help
quartz kindle
#

.catch(console.error) does the same thing as .catch(err => { console.error(err); })

quartz kindle
ivory seal
#

ye but it doesn't work

#

even tho the boolean is null the interval still runs

#

and ive cleared the interval if state is null

quartz kindle
#

no more ok's after that

ivory seal
#

oh ok

#

let me try

quartz kindle
#

you're probably messing up your state

ivory seal
#

true

#

probs

sonic lodge
ivory seal
#
      client.on('voiceStateUpdate', (oldState, newState) => {
        var state = null
        if (!newState.channel){
         
          console.log('left')
          state = false;
          console.log(state)
        }
        if (!oldState.channel) {
          
          console.log('join')
          state =true;
          console.log(state)
        }
       
        
          let ifmute = newState.member.voice.selfMute;
         if(ifmute === false){
          var loop = setInterval(function () {
           console.log("ok")
           
          if(state === false){
            clearInterval(loop)
          }
          },500)
          
        }
        
      });``` weird this is my entire code but even though i leave the vc which makes the state false it still doesn't clear theloop @quartz kindle m
lyric mountain
#

you can't clear a loop that way

ivory seal
#

oh

#

then how?

lyric mountain
#

because loop is not defined yet

ivory seal
#

ohhh i get it

#

one sec

lyric mountain
#

try with a lambda + this reference

ivory seal
#

lambda?

lyric mountain
#

yeah, arrow function

#
setInterval(() => {
  //do stuff
  clearInterval(this);
})
#

idk if this works tho

ivory seal
#

ah ok

#

sec

lyric mountain
#

but since this will be referencing the lambda, it might work

ivory seal
#

this?

lyric mountain
#

yes

#

this references the object itself

ivory seal
#

sec

cinder patio
#

Arrow function don't have this

lyric mountain
#

idk how to explain

lyric mountain
ivory seal
#

nope

cinder patio
#

Yes, they're anonymous

ivory seal
#

still consoles a lot of times

lyric mountain
#

hm

#

idk how you'll be able to clear the interval within itself then

quartz kindle
#

you can

ivory seal
#

ye but it isn't working liek that for me

lyric mountain
#

js is really weird

cinder patio
#

Isn't the first argument of the function the interval?

ivory seal
#

what?

cinder patio
#

The first argument of the callback is the interval that's calling it

quartz kindle
#

the lambda function is essentially a callback, by the time it is called, the interval is already defined long ago

lyric mountain
ivory seal
#

lol

#

i just got to know whats lambda lol

#

googled it

quartz kindle
#

@ivory seal your problem is that you're creating a new interval on every single voice state update

ivory seal
#

oh

quartz kindle
#

you are not stopping older loops

ivory seal
#

is there any other way to track voice mins other than what im doing?

#

rn im just adding a number to a db

quartz kindle
#

yes

ivory seal
#

oh whats that

quartz kindle
#

when a user joins, save the timestamp

ivory seal
#

is that part of the object/

quartz kindle
#

when a user leaves, check the timestamp, and compare with the saved one

ivory seal
#

ah ok

#

is it part of the (oldState, newState) object?

quartz kindle
#

just make one yourself

#

Date.now()

ivory seal
#

ah kk

#

then i get those too and i subract it

#

and then save it to a db

quartz kindle
#

yes

ivory seal
#

should i use local vars for that or save those two values to a db?

quartz kindle
#

save it to a db

ivory seal
#

kk

#

tysm

#
        var time2 = ""
        if (!newState.channel){
         
          console.log('left')
          time2 = Date.now()
        }
        if (!oldState.channel) {
          
          console.log('join')
          time1 = Date.now()
        }
        var time3=time2-time1;
        let unix_timestamp = time3
        
        var date = new Date(unix_timestamp * 1000);
        // Hours part from the timestamp
        var hours = date.getHours();
        // Minutes part from the timestamp
        var minutes = "0" + date.getMinutes();
        // Seconds part from the timestamp
        var seconds = "0" + date.getSeconds();
        console.log(seconds)``` so just for testing i took 2 vars but it returns - values sometimes what do i dp?
outer perch
#

should I math.floor or math.round for rng?

#

and, if I put math.random() * 1 can I get 1 from there?

#

or 0.(9) at max. only?

quartz kindle
#

0.9 max

#

always floor

quartz kindle
ivory seal
#

its the same code lol

#

i just put the unix code timestamp to seconds

outer perch
quartz kindle
#

you have two separate variables, and only one of them is defined at a time

#

so essentially you are doing time3 = date - "" or "" - date

quartz kindle
outer perch
outer perch
#

but, aren't the possibilities only 0 and 1 at Math.flor(Math.random() * 2);?

quartz kindle
#

yes

outer perch
#

so yeah, that's what I want

#

either 0 or 1 to randomize a gender

#

cuz my shop has pets, and the gender has to be random

quartz kindle
#

if you only need rng between two states, just do Math.random() > 0.5

outer perch
#

when buying xD

quartz kindle
#

or < 0.5

outer perch
#

๐Ÿ˜ฎ

#

yeah true

#
const rndG = Math.random();
let gender = items.pets[pet].gender;

if (gender == 'random') rndG < 0.5 ? gender = 'โ™‚๏ธ' : gender = 'โ™€๏ธ';
#

basically this

surreal sage
#

How to 'find' a channel in a guild in Discord.js again?
My code:
user.voice.setChannel(message.guild.channels.cache.filter(ch => ch.name === ":microphone:XP Lobby ${args[1]}"))

earnest phoenix
#

filter() => find()

surreal sage
#

kk wait

earnest phoenix
#

" => `

surreal sage
#

yep, thanks

#

ya ik

#

it didnt format correctly on discord

#

i changed it in the message so it shows up right

earnest phoenix
#

English: How to create a ticket systeme but no wis data bas

Franรงais: comment crรฉe un sytรฉme de ticket mais sans data base

#

english: you don't

#

you need a database

#

Yes but for 1server

#

then use another bot i.e. tickety if it's for a single server

#

Oky

#

Thanks

obtuse jolt
#

does anybody know why d.js when I do

    .setTitle("Choose an option")
    .setDescription("Which setting would you like to configure?")
    .setColor("GREEN")
    .addField(":one: - Auto URL Scanning", "Enable or disable automated url scanning in this guild.")
    .addField(":two: - Auto Deleting Suspicious Links", "Enable or disable the deletion of suspicious links.")
    .addField(":three: - Auto File Scanning", "Enable or disable automated file scanning in this guild.")
    .addField(":four: - Auto Deleting Suspicious Files", "Enable or disable the deletion of suspicious files.")
    .addField(":five: - Auto Delete IPs", "Enable or disable the automated deletion of messages with IPs in.")
    .addField(":six: - Silent Mode", "Enable or disable reactions to safe files or urls.")
    .setFooter(`|  Created by ${client.users.cache.get("551854789990940699").tag}`, client.users.cache.get("551854789990940699").avatarURL())

    let m = await message.channel.send(embed).catch(e=>{return;})```

does this?
#
(node:1085079) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function

(node:1085079) 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(). (rejection id: 2)```
earnest phoenix
#

update your node.js to 12 or higher

obtuse jolt
#

its v12.5.0

#

latest release

earnest phoenix
#

๐Ÿค”

obtuse jolt
#

same issue with v12.0

earnest phoenix
#

are you sure

obtuse jolt
#

I get the same issue with

let m = await message.channel.send({embed: embed}).catch(e=>{return;})```
earnest phoenix
#

what does node output when you run node -v in a console

obtuse jolt
#

apparently its v10

#

im gonna update that annd try

tardy hornet
#

i know how to make a command that makes a role with a permission that i want it to have, but i dont know how to make it remove permission, help

earnest phoenix
#

yeah sec getting my magic crystal ball ๐Ÿƒโ€โ™‚๏ธ

boreal iron
tardy hornet
#

sorry for the stuppif question, library is node.js, etc right?

#

and language is discord.js, etc right?

#

@south sinew

quartz kindle
#

nope

#

language is javascript or js for short

#

library is discord.js

#

node.js is the "runtime" or the "javascript engine" that runs the code

sour steeple
#

I need a register bot codes help pls

stoic girder
#

@sour steeple could you be more specific with your question?

sour steeple
#

I want a registry bot infrastructure

faint prism
sour steeple
#

registration bot codes

faint prism
#

Ok, what do you mean by that

sour steeple
#

Im dont speak English

#

sorryy

stoic girder
sour steeple
#

Im from Turkey

stoic girder
#

Google Translate?

sour steeple
#

yeaa

stoic girder
#

I meant, you could use it

#

If you already do

#

it sucks

south sinew
faint prism
#

Are you asking how to submit an application for your bot?