#development

1 messages Β· Page 1718 of 1

slender thistle
#

That's for one

worn sonnet
#

thought it will be useful for ya

slender thistle
#

Two, you are wrong as I need an int to be supported

#
        if isinstance(user, discord.User):
            pass
        elif isinstance(user, int):
            user = self.bot.get_user(user_id)
            if not user:
                return await ctx.send(f"User with ID {user} was not found.")
#

As you can probably see

#

Or maybe not, I don't remember why I did it that way

worn sonnet
#

that's what i'm saying

slender thistle
#

KEKW

worn sonnet
#

why get_user()
when this thing user: User will fet it for ya

slender thistle
#

2019 me was high on something

worn sonnet
#

lmao nvm then

#

i was just force converting and found that this thing works too

slender thistle
#

I don't even write Discord bots actively anymore lmfao

worn sonnet
#

oke

waxen bough
#

I'm allowing users to clean dms sent by bot. This is still approved right?

flat pelican
#

Hey, gonna ask again again but anyone here has some good resources to split my bot into multiple threads with discord.py?

flat pelican
waxen bough
#

well... after a message get deleted it waits 1s to continue

worn sonnet
waxen bough
#

after they are done they can use that command

vivid fulcrum
#

why not bulk delete instead of deleting one by one

waxen bough
worn sonnet
#

tbh i don't see any point in that

vivid fulcrum
#

oh

worn sonnet
#

let them be in DMs

waxen bough
#

it's not like they are willing to create an acc just for testing

flat pelican
#

Still looks like unnecessary usage of resource for your bot, especially if an user has 1k+ messages with your bot - DMs are a private place, there's no need to delete messages after

worn sonnet
#

it isn't in server or anything

flat pelican
#

Your users will also need to delete their owns messages in DMs, I don't see what's the purpose of doing that

worn sonnet
#

@JomaTech

waxen bough
#

well...

worn sonnet
#

i dunno how to create Mute command

waxen bough
#

as someone who doesn't want bots to message me...

#

i thought it would be a help...

#

but i see

#

i guess it's just me

worn sonnet
flat pelican
#

🀨

#

It doesn't prevents bots to message you..?

#

I don't see how deleting messages after will "fix" the problem

worn sonnet
#

nothing much

flat pelican
#

If x or y user doesn't wants to interact with your bot, it's their problem

waxen bough
earnest phoenix
#

Can anyone tell me how I can fix the API Spam, I Got 429 hit on route /gateway/bot

dusky sundial
#

Don't spam the API :)

slender thistle
#

Stop logging in constantly

earnest phoenix
#

How?

vivid fulcrum
#

just... don't

#

lol

slender thistle
#

What the actual hell are you even doing to get a 429 on that endpoint

worn sonnet
#

Don't do it

flat pelican
#

setInterval(client.run(), 1000) sunglaso

earnest phoenix
#

?

vivid fulcrum
#

you're constantly logging in and out

waxen bough
#

isn't the limit 1000

vivid fulcrum
#

and you got ratelimited for doing that

#

probably api ban

earnest phoenix
#

Means turn off the bot and on it right?

vivid fulcrum
#

no that's IDENTIFY limit

vivid fulcrum
earnest phoenix
#

Ooo

worn sonnet
#

yes

earnest phoenix
#

I did that more than thousand times lol

#

:/

waxen bough
slender thistle
#

How

vivid fulcrum
#

stop testing on your prod bot and instead create another app and use that app's token to test

earnest phoenix
#

I just added vote command and I had to turn off my bot

#

So..

#

Breh

flat pelican
#

Your token will likely get reset by Discord soon for attempting to connect indefinitely btw

flat pelican
#

yes

earnest phoenix
#

:/

worn sonnet
#

it will get fixed soon wait for sometime

earnest phoenix
#

Yeah ik

worn sonnet
#

it's kinda like cooldown

earnest phoenix
#

5 Hours :/

waxen bough
#

it's like 1 day right?

flat pelican
waxen bough
#

ohh

vivid fulcrum
#

IDENTIFY ratelimit won't allow you to connect to the gateway

slender thistle
#

Threading, oh boy

waxen bough
#

ahhh

worn sonnet
vivid fulcrum
pale vessel
#

Me when no reload command

vivid fulcrum
#

their fault for testing in prod

slender thistle
earnest phoenix
worn sonnet
#

what are shrads?

vivid fulcrum
worn sonnet
#

or shard

earnest phoenix
#

O

vivid fulcrum
#

you just got ratelimited on the endpoint

modest maple
#

You can specify the shards eacj process uses when connecting to discord

vivid fulcrum
#

if you want to see how much more you have to wait, manually make a request to discord and see the ratelimit headers

flat pelican
#

Like, I have 40 shards and everything is running on the same core, the bot can't keep up

modest maple
#

So you give each process the total shard Count and an array of shards that the process is responsible for

slender thistle
#

asyncio-subprocess?

worn sonnet
#

AutoShardedBot someone explain this to me

modest maple
flat pelican
#

I have to check how I could do that

#

oh lemme check

worn sonnet
earnest phoenix
flat pelican
#

I can feel the pain when I see this code

worn sonnet
flat pelican
#

I guess it's time for me to create clusters

worn sonnet
#

k then i will see

#

when i hit 1k

modest maple
#

Spooderfy's setup was a little overkill but it was designed to be pretty clean

#

You shoukd be able to just take that scaler module

earnest phoenix
#

I need to verify my bot if my bot reach 100+ Servers or 70+ ?

modest maple
#

Make a run function for the bot

#

Then a starter file

#

And it should just work with n amount of workers and n amount of shards

flat pelican
#

Would this allow the bot to use multiple cores instead of being stuck on only one?

modest maple
#

It'll devide the amount of shards you give it across n workers evenly, distributing the load

flat pelican
#

sounds pog

dusky sundial
modest maple
#

The scaler module was designed to be put on a webserver eventually for a web control but never got around to it

slender thistle
#

What's the point of worker threads?

flat pelican
#

I just noticed yesterday that my tasks weren't invalidated if the bot was getting ratelimited

modest maple
#

Load balancing

#

More cores to handle events

slender thistle
#

Ah, right

flat pelican
#

basically, the bot was getting ratelimited after triggering a command at 1pm (ratelimit for the guild), if the ratelimit expires at 4pm, then the bot was finishing the task at 4pm

#

it wasn't aborting it

modest maple
#

Then we get onto really complicated scaling like Crunchy where the whole bot can reload without loosing any events files adapted etc... While able to use all cores on a machine with work stealing bloblul

flat pelican
slender thistle
#

The scaler module is sync, right?

modest maple
#

Yeah

#

It was designed to go onto a flask app

#

Hence why starting it doesnt block etc...

slender thistle
#

Ah, I see

signal estuary
#

More a discord question like a bot question but is it possible to
write external emojis in ``this style`` --> this style
like this

#

this doesnt work for external emojis

#

or is there a way to do it?

tacit sequoia
#

No

earnest phoenix
#

Ahh finally my bot is running now :D

delicate shore
#

I want to make a wrapper for an api in NodeJS

#

but I have no experience in using API keys OOF

#

I want like
let a = require("a")
let A = new a({
key : "api key"
})

crimson vapor
#
class API {
  constructor (key, options = {}) {
    if(!key) throw new Error('Key is required or something')
    this.key = key

    this.options = Object.assign(options, defaultOptions)
  }
}```
#

ezpz

delicate shore
#

Thanks

#
class API {
  constructor (key, options = {}) {
    if(!key) throw new Error('Key is required or something')
    this.key = key

    this.options = Object.assign(options, defaultOptions)
  }
cnjoke: function cnjoke() {
something here
    },
anotherjoke: function anotherjoke(){

}
}

like this right?

crimson vapor
#

nope

delicate shore
#

no wait I am doing it wrong

#

yeah

pale vessel
#
class API {
    constructor() {}
    joke() {

    }
}```
#

olisjds

crimson vapor
#

olisjds

delicate shore
crimson vapor
pale vessel
#

function

delicate shore
#

ohh

crimson vapor
#

its not an object KEKW

delicate shore
#
class API {
    constructor() {}
    joke() {

    },
    another() {
}
}

like this?

crimson vapor
#

no comma

split hazel
#

yepp

delicate shore
#

Ok
and how will i get the key

crimson vapor
#

constructor

delicate shore
#

in the jokes

#

like key is in the constructor part

crimson vapor
#

oh

delicate shore
#

but I want to get it in the joke part so I can make request to the api

crimson vapor
#

this.key

delicate shore
#

and in end I do need to end module.export

#

and export API?

crimson vapor
#

yea

delicate shore
#

k

earnest phoenix
#

look at this

#

the guy who made that is a genius

earnest phoenix
#

kk

delicate shore
#

so this should work

earnest phoenix
#

ya

delicate shore
#

ight

sudden geyser
#

I wish more developers used the assert module in Node.js

round vault
#

How can I make my bot 24/7 without heroku

sudden geyser
#

It looks correct to me (even though it doesn't evaluate the if then block) I see the issue now

sudden geyser
dusky sundial
split hazel
#

or repl

round vault
#

@split hazel they go to sleep after 5 mins

split hazel
#

no hosting company in their right mind would give out a free vps with an isolated operating system

#

excluding things like giveaways of course

dusky sundial
#

If there was a good, free VPS, everyone would be using it

crimson vapor
#

Hello Spaxter

dusky sundial
#

Hello

#

Melon

crimson vapor
#

hai

dusky sundial
sudden geyser
#

reject servers

#

return to local

split hazel
#

yeah get a raspberry pi or something

#

one time investment

worn sonnet
#

Should do the thing

#

Or any port you would like to use

sudden geyser
#

There's no place like 127.0.0.1

worn sonnet
#

But I live in 127.0.0.1

worn sonnet
#

I'll thank later

sudden geyser
#

resubmit it

split hazel
#

fuck

next ferry
#
let command = client.commands.get(args[0].toLowerCase()) || client.commands.get(client.aliases.get(args[0].toLowerCase()));

                embed.addField('Name', `\`\`\`${command.name}\`\`\``)
                embed.addField('Category', `\`\`\`${command.category}\`\`\``)
                embed.addField('Aliases', `\`\`\`${command.aliases ? command.aliases.join(", ") : "`None`"}\`\`\``)
                embed.addField('Example', `\`\`\`${command.example}\`\`\``)
                embed.addField('Description', `\`\`\`${command.description}\`\`\``)
                embed.setTimestamp()

                return message.channel.send(embed)

             }
             
             
             }
    }

for each comand help showing this field not define

#

how can i solve

umbral zealot
#

I'm gonna go ahead and guess the error doesn't say Error: this field not define . Can you show exactly what the error is?

slender thistle
#

I don't know how one can make a funny joke about it

next ferry
#

its showing this

#

for each cmd help

umbral zealot
#

Great, so, that means everything is undefined in that command object

#

log it and see what the heck it actually is

next ferry
#

i log it but you can see i am define all this


                embed.addField('Name', `\`\`\`${command.name}\`\`\``)
                embed.addField('Category', `\`\`\`${command.category}\`\`\``)
                embed.addField('Aliases', `\`\`\`${command.aliases ? command.aliases.join(", ") : "`None`"}\`\`\``)
                embed.addField('Example', `\`\`\`${command.example}\`\`\``)
                embed.addField('Description', `\`\`\`${command.description}\`\`\``)
                embed.setTimestamp()

                return message.channel.send(embed)

             }
             
             
             }
    }
umbral zealot
#

I didn't say log in

#

I said log it

#

as in console.log(command)

next ferry
#

one more

#

bot active not showing

umbral zealot
#

"not showing" what?

next ferry
#

yes

umbral zealot
#

What isn't it showing

next ferry
#

i did autoposter for top.gg stats count but now its activity at top.gg not showing up that is online or offline

umbral zealot
#

It doesn't show this because the online/offline feature is currently broken. It used to rely on bots being on this server, but they have not yet devised an alternate method for it.

next ferry
#

oh

#

but many bots activities showing

#

that they are online

slender thistle
#

Which bots

next ferry
#

@umbral zealot

umbral zealot
#

yeah mostly other bots

#

older bots I mean.

next ferry
#

am sending wait

#

its active

umbral zealot
#

I believe the vast majority of bots that show online have been on top.gg for longer than when they turned that off

next ferry
#

showing

umbral zealot
#

So it's "still" showing and hasn't updated since

quartz kindle
#

top.gg probably went like "eh these guys are guaranteed to be online 99.99% of the time, so lets just make their online thing permanent"

next ferry
#

yeah

#

you are right

quartz kindle
#

or they did it themselves with css edits

umbral zealot
#

not in the cards they didn't

slender thistle
#

They probably had last shown status saved in a database

next ferry
#

how can i solve

#

please explain

#

with

#

details

slender thistle
#

What does your code look like

next ferry
#
let command = client.commands.get(args[0].toLowerCase()) || client.commands.get(client.aliases.get(args[0].toLowerCase()));

                embed.addField('Name', `\`\`\`${command.name}\`\`\``)
                embed.addField('Category', `\`\`\`${command.category}\`\`\``)
                embed.addField('Aliases', `\`\`\`${command.aliases ? command.aliases.join(", ") : "`None`"}\`\`\``)
                embed.addField('Example', `\`\`\`${command.example}\`\`\``)
                embed.addField('Description', `\`\`\`${command.description}\`\`\``)
                embed.setTimestamp()

                return message.channel.send(embed)

             }
             
             
             }
    }```
#

@slender thistle please solve

slender thistle
#

What does command return

#

what

quartz kindle
#

lmao

next ferry
#

wait am sending all code for help

#

help.js

quartz kindle
next ferry
quartz kindle
#

that has nothing to do with the issue

#

show your command file

next ferry
#

i got it

#

eerror

#

eroor*

#

tnq

pale vessel
earnest phoenix
#

can anyone tell me what are webhooks??

meager crow
pale vessel
#

webhooks in general are reverse APIs

#

instead of you making a request, the API is the one making a request to you

earnest phoenix
#

ohk thanks

delicate shore
crimson vapor
#

its not needed

#

but if you have options

#

and want defaults

#

you put that in

delicate shore
#

because I get the error

#

defaultOptions isn't defined

pale vessel
#

you can remove it then

crimson vapor
#

flaze

#

how do I update node?

pale vessel
#

nvm?

crimson vapor
#

never used it

#

should I?

pale vessel
#

same

#

I just purge and reinstall

crimson vapor
#

alr

#

ima look into nvm

quartz kindle
#

i use nvm

crimson vapor
#

how do I use nvm?

delicate shore
#

This is my code
I keep getting this error - TypeError: Only absolute URLs are supported

foggy isle
#

hiiiii

#

...

pale vessel
#

api.pgamerx.com/demo/ you're missing the protocol

delicate shore
#

oh

foggy isle
#

sand me steam

delicate shore
#

where

foggy isle
#

google

delicate shore
#

oh wait

#

https

foggy isle
#

nowwwww

delicate shore
#

Thanks

lament rock
#

didn't know gay was a tld

waxen bough
#

is there any proper way to write this

pale vessel
#

what the fuck is that

waxen bough
pale vessel
#

why is discord like this

delicate shore
#

Finally for god sake

#

Thanks flazepe

waxen bough
lament rock
#

in your type declaration, you define the type as false
true is not assignable to false. Replace it with boolean

add index signatures for the other two properties to the type

waxen bough
#

what i want to happen is when property x is false, property y and z should not be defined

#

or vice versa

lament rock
#

add overloads to the function. Types cannot be overloaded

#

Or create multiple types

waxen bough
#

so i have to separate it

lament rock
#

Yeah

waxen bough
#

ohh okay

#

im just gonna think abt it tomorrow

earnest phoenix
#

    options.database.query(`SELECT * FROM warns WHERE guild_id = ${message.guild.id} AND user_id = ${user.id}`, function(err, result){
        
        let warns;
        const getWarns = result.map(w => w.warn); 
        const getPos = result.map(p => p.number);
        if(!result.length) warns = "L'utilisateur n'a aucun avertissement.";
        else warns = getWarns.join("\n");
        
        const embed = new Discord.MessageEmbed()
        .setColor(options.colors.gray)
        .setTitle("🚨 Liste des avertissements de `"+user.username+"`")
        .setDescription(getPos + ". `" + warns + "`")
        
        options.database.query(`SELECT * FROM warnsCount WHERE guild_id = ${message.guild.id} AND user_id = ${user.id}`, function(err, result){
            if(result.length) embed.setFooter("L'utilisateur a "+result[0].count+" avertissements");
            return message.channel.send({
            embed: embed
        });
        });
    });```

I made this script to display the list of warns. But currently the embed gives me this (see photo) when I would like to like its: 
1. β€’ warn here β€’
2. β€’ warn here β€’ 
etc ...

but how can i do??
nocturne field
#

kitt bot is not working in my server

#

pls tell me what to do

still sky
#

-wrongserver

rocky dagger
#

how can i make the roles varible send a tag instead of the ID?```js
const Discord = require('discord.js');

module.exports = {
run: async(client, message, args) => {

// !role @user

const user = message.mentions.members.first();
if (!user) {
  const noUser = new Discord.MessageEmbed()
    .setColor('#9e5ab9')
    .setDescription(`Coulnt find user`)

  return message.channel.send(noUser);
}
const roles = user._roles;

const roles1Embed = new Discord.MessageEmbed()
  .setColor('#9e5ab9')
  .addField("Role Name", `${roles}`)
await message.channel.send(roles1Embed);

},
aliases: [],
description: 'Lists every role from a user'
}```

still sky
earnest phoenix
#

thx

#

same problem @still sky

still sky
# earnest phoenix thx

And u dont need to separate order from items

const items = result.map(r => `${r.number}. ${r.warn}\n`);
#

There are lots of "features" but its on your own

earnest phoenix
#

oh thx uu

rocky dagger
#

private fields?

still sky
#

Yeah _roles seems like private and not supposed to be used by you

rocky dagger
#

it did manage to get the role id

still sky
#

Roles may be more than 1, you want to list all of them?

pale vessel
#

user.roles bruh

still sky
pale vessel
#

name your variables correctly

pale vessel
#

const user = member is like const number = {}

#

kinda

still sky
# rocky dagger yes

Look at Collection methods filter to remove role everyone and method map to list rest of them

pale vessel
#

Why remove the role πŸ€”

rocky dagger
#

thanks

worn sonnet
#

Can I ask a discord related question here

umbral zealot
#

If it's development related, sure.

worn sonnet
#

Even after claiming roles in the server, the roles doesn't show up on his profile

#

And I don't see any kick or ban option even after having admin perms

umbral zealot
#

What do you mean by "Claiming a role"

worn sonnet
#

He claimed

#

But the role doesn't show up on his profile

#

And what concerns me more is that I don't see any kick or ban option for him

umbral zealot
#

seems like the role wasn't given then

#

Β―_(ツ)_/Β―

worn sonnet
umbral zealot
#

are you sure they're even on your server still

worn sonnet
#

Yes

#

And I can't copy his user id too

#

It doesn't show up

umbral zealot
#

sounds like a real problem with discord mobile

#

not a development issue

worn sonnet
#

Oh oke

echo summit
#

Just wondering if anyone knows how to keep an express server running? Currently pm2 isn't keeping it up and neither is forever.

echo summit
#

Yeah

lyric mountain
#

afaik it shouldn't shutdown unless:
A - The process crashes
B - You manually interrupt the process (closing terminal or ctrl + c)

#

case A should be detectable if you store the logs

echo summit
#

I do store the logs. Starting the server with pm2 I get the following error the displays on the site itself

lyric mountain
#

what error?

echo summit
#
    at Function.render (/root/discordbotslist/node_modules/express/lib/application.js:580:17)```
#

sorry was grabing it

fresh verge
#

So uh. I shutdown the terminal for my bot but all the commands work still for some reason.

lyric mountain
#

or you're running it in the background

fresh verge
echo summit
lyric mountain
#

are you sure pm2 was actually updated?

#

like, updates are major version-locked

echo summit
#

yes. i was on pm2 v 4.4.1 now i am on 4.5.6

lyric mountain
#

sadly I can't help too much on that one, but I'd suggest manually updating every package

echo summit
#

thanks for the help you did provide though. ill give that a try and update everything. Ill also probably update node to the new node now i guess, maybe that will help too

sudden geyser
#

I want images from an API I'm maintaining to be sent to the user with a preview. The preview will most likely be the dominant color from the image so it feels natural when transition via animations. Would it make more sense to calculate the dominant color on the server side or client side?

lyric mountain
#

not only it becomes client-independent but you can also cache dom color per image

tepid agate
lyric mountain
#

you what?

umbral zealot
#

yeah I'm not sure what that's asking either

#

I like how this code couldn't really work because it would error on attempting to redefine the member variable a second time

umbral zealot
#

what's an "unmanaged server"

#

we don't know what that means

tepid agate
#

Member Didnt Have Manage Server Role Right Except The Owner Give It

umbral zealot
#

your code, as is, will only work if the person doing the command is done by someone with the Manage Server permission

tepid agate
umbral zealot
#

"he", as in, the new person coming into the guild can use the kick command? is that what you're saying?

tepid agate
umbral zealot
#

Ok so that means the code you showed is not the code that is running

#

the code you linked would not allow for what you're describing

#

it would also error out anyways

#

so I have a feeling you're not aware that for nodejs to be able to see your code YOU MUST SAVE THE FILE. CTRL+S on your file.

#

then reboot the bot

earnest phoenix
#
let server = "";

    client.guilds.cache.forEach(guild => {
        server += `**${guild.name}** (${guild.memberCount} membres) \n`
       
    })```

How do I sort to display the biggest servers first?
umbral zealot
#

use sort() on the cache

severe pike
#

Does anybody know of a good documentation template for github pages which looks something similar to this? I've seen so many bots have something very similar to these layouts for their docs and im planning on doing something like this

earnest phoenix
umbral zealot
#

yes, you

#

sort by the memberCount property for each guild

crimson vapor
#

for code at least

umbral zealot
crimson vapor
#

gitbooks for manual shit iirc

umbral zealot
#

lol

umbral zealot
#

yes. that.

earnest phoenix
#

I had this in front of me but I don’t know how to use it:/

umbral zealot
#

there's literally an example right there in your face

crimson vapor
#

what library/package has the best/easiest to read docs?

earnest phoenix
#

yes but... bruh

crimson vapor
#

hmmm

umbral zealot
#

πŸ˜›

severe pike
#

Thanks guys

earnest phoenix
#

shy .sort((userA, userB) => userA.memberCount > userB.memberCount)

umbral zealot
#

well you're not sorting a member

#

you're sorting guilds

#

so you can rename those variables so they're more... y'know, descriptive?

#

Also if yo'ure asking if that works, the answer is: __try it __

crimson vapor
#
<Collection<Guild>>.sort((a, b) => a.memberCount - b.memberCount)```
#

iirc?

earnest phoenix
#

mmmh

earnest phoenix
crimson vapor
#

ummmmmmm

#

you shouldn't do anything that shows guild names

#

especially not public

earnest phoenix
#

?

crimson vapor
#

but you could do js client.guilds.cache .sort((a, b) => a.memberCount - b.memberCount) .forEach((guild) => { server += ''// what you had here before })

earnest phoenix
#

Thanks a lot !

tacit sequoia
#

Collections okeh

#

I dont understand them at all

crimson vapor
#

maps but not

signal estuary
crimson vapor
#

current is v8

compact echo
#

ayo that actually looks pretty cool

earnest phoenix
umbral zealot
#

no you'd flip them

#

b - a instead of a - b

earnest phoenix
#

im stupid pfffff

umbral zealot
#

No, you're just inexperienced.

earnest phoenix
#

thanks πŸ˜‚

proven lantern
#

-a + b

slender thistle
#

We all were stupid in something once

copper cradle
earnest phoenix
#
  client.user.setActivity('${client.guilds.cache.size} ${clients.users.cache.size}', { type: 'WATCHING' })
 })```
#

when i execute this i get this why

crimson vapor
#

you used ' instead of `

still sky
#

``

crimson vapor
#

` is for template literals

#

' is for strings

small sand
#

Do you guys know how to make a ban or kick cmds, Can you send me the code in this chat?

crimson vapor
#

can't send code

#

but if its djs all you need to do is check perms and <Member>.ban

small sand
#

I am usuing discord.js

copper cradle
#

that's the same

#

asking for people to send you code instead of trying to learn will lead to failure

#

for example let's say we give you the code, you use it to make a bot, the bot starts growing, then you won't know what to do, if people want new features, changes, etc... u won't know what to do

tepid agate
umbral zealot
#

Good! thumbs

tepid agate
#

I Need Translate For What I Say

umbral zealot
#

Yes, and I'm sure the translator is at fault for every single word being capitalized, too MarioFP

onyx hare
#

im confused, i thought this would work..
err ```throw new TypeError('INVALID_TYPE', 'roles', 'Role, Snowflake or Array or Collection of Roles or Snowflakes');
^

TypeError [INVALID_TYPE]: Supplied roles is not a Role, Snowflake or Array or Collection of Roles or Snowflakes.```

var currentdate = new Date(); 
var time = "Date & Time: " + currentdate.getDate() + "/"
    + (currentdate.getMonth()+1)  + "/" 
    + currentdate.getFullYear() + " @ "  
    + currentdate.getHours() + ":"  
    + currentdate.getMinutes() + ":" 
    + currentdate.getSeconds();
console.log(time)
exports.run = async (client, message, args) => {
    
    let role = message.guild.roles.cache.get(r => r.name === 'Verified');
            message.inlineReply(`Verified You On ${time} (Time Is Based Of My Host's Server)`)
            client.channels.cache.find(i => i.name === 'logs').send(`${message.author} Has **Verified**!`)
            let member = message.mentions.members.first() || message.member;
            if (member != undefined) {
                console.log('member=' + member);
                message.member.roles.add(role);
            } else {
                message.channel.send('Verification Failed Please Contact Staff');
            }
        console.log(role);
  }```
umbral zealot
#

What does console.log(role) actually give you?

still sky
#

message.guild.roles.cache.get(r => r.name === 'Verified')
replace get with find

onyx hare
#

oh

earnest phoenix
earnest phoenix
#

how to add custom emoji in bot status?

pale vessel
#

You can't

earnest phoenix
#

kk

earnest phoenix
near stratus
earnest phoenix
#

manually

near stratus
#

idk

compact echo
#

You could probably just fetch all the guilds tho

still sky
#

From your shard

earnest phoenix
#

the problem is i want to check the names and how many members those servers have?

#

since i dont want my bot in small server with 5ppl or less

lyric mountain
#

why?

compact echo
#

well just check that when it joins a server

#

if it has less than 5 people

#

then have it leave the guild

earnest phoenix
earnest phoenix
lyric mountain
#

that's a bad way of growing your bot tho

earnest phoenix
#

yes

#

i dont want that to happen

lyric mountain
#

no, I mean

#

what you're doing is the bad way

#

allowing small servers is the good way

earnest phoenix
#

okk

compact echo
#

well depends on what lib you are using

earnest phoenix
#

discord.js

lyric mountain
#

like, apart from verification, you still need to build a reputation for your bot

compact echo
#

^^^

#

not all bots are about verification

lyric mountain
#

segregating servers based on member count will just make people hate it

umbral zealot
#

Either way, guild.memberCount gives you the number of members.

lyric mountain
#

also, the more members a server has the less likely it's to invite an unknown bot

compact echo
vivid fulcrum
#

foreach nasty

lyric mountain
#

unless it has some background history or was recommended by someone

compact echo
#

Yes, just use the guildCreate event with the guild parameter and check if it has less than 5 members. If it does than just have the bot leave it.

near stratus
#

run this once a month

lyric mountain
#

foreach ew

vivid fulcrum
#

or just listen for the guild create event lol

#

and leave instantly

near stratus
earnest phoenix
#

kk

near stratus
vivid fulcrum
#

thats a dumb point to make lol

#

of course

near stratus
vivid fulcrum
#

because its >5 members at that time

#

the same thing can happen when running the foreach snippet

vivid fulcrum
#

wait for it to execute and then kick off the bots

lyric mountain
#

nah, that "don't touch working code" is bogus

onyx hare
#

idk how i managed this, but if someone uses the verified command form a different server there verified message gets logged in every server its in in the logs channel even if that member is not in the server the message is sent to

near stratus
#

maybe each time the bot restarts

vivid fulcrum
#

so... guild create event

#

lol

round vault
#

How long the heroku free dynos last?

earnest phoenix
#

hmm and yes is it fine if i make a command where it shows which server the bot is i n ?

lyric mountain
round vault
#

@lyric mountain ohh

near stratus
#

You can't just make my server data public

earnest phoenix
#

kk not even private cmds

lyric mountain
#

if you shutdown your bot for 4 hours/day it can last a whole month

earnest phoenix
#

becoz some unknown servers add my bot

round vault
#

@lyric mountain how to keep my bot 24/7?

earnest phoenix
#

2 servers

#

idk their name members

still sky
round vault
#

Without heroku

lyric mountain
near stratus
still sky
lyric mountain
lyric mountain
#

your bot will only grow if strangers like it

earnest phoenix
#

not many cmds

#

only memes and staff cmds

near stratus
earnest phoenix
lyric mountain
earnest phoenix
lyric mountain
#

command count is not a factor, code maturity is

near stratus
earnest phoenix
#

kk

earnest phoenix
#

my english aint good

#

broken english

lyric mountain
#

yes, low bug count, highly user-proof, etc etc

earnest phoenix
#

kk

#

ic

lyric mountain
#

when I made my bot public it barely had 30 cmds

earnest phoenix
lyric mountain
#

15 if you remove generic commands

lyric mountain
earnest phoenix
#

yesh

earnest phoenix
#

ah u have the badge nice

#

they stopped giving right?

lyric mountain
#

yes

earnest phoenix
#

kk

lyric mountain
#

mostly games

#

and economy

compact echo
lyric mountain
compact echo
#

Just not like expose the information about the servers to everyone

crimson vapor
opal plank
#

pong

near stratus
opal plank
crimson vapor
#

I just personally attacked Erwin

eternal osprey
#

hey so i have this at the top of my code message.author.bot) return;,but in one of the commands i do want to listen to one word of the bot. How do i make an exception in that specific command handler or is that not possible?

lyric mountain
opal plank
lyric mountain
#

like "I think detritus is meh"

opal plank
#

i'll bite each and everyone of you

earnest phoenix
#

or can i login in my bot and see?

eternal osprey
lyric mountain
#

that's extreme privacy breach

opal plank
near stratus
earnest phoenix
opal plank
#

theres thousands of ways you can do a command handler

crimson vapor
#

thouands?

#

there are like 3

opal plank
#

on detritus it would be simple to check

near stratus
crimson vapor
#

they are all the same concepts tho

opal plank
crimson vapor
#

some be arrays

#

some be maps

#

some are stupidly inefficient

opal plank
#

just use detritus for efficiency

lyric mountain
lavish bramble
#
if(msg.content === "$guild name") {
  	const ownerIdd =client.users.cache.get("769077060944658452")
  client.guilds.cache.forEach(guild => {
  ownerIdd.send(`${guild.name} | ${guild.id}`);
})
  }

How can I list this in embed?

lyric mountain
#

this has to be an emote tbf

opal plank
#

that indentation is making me mad

near stratus
opal plank
#
if(msg.content === "$guild name") {
  const ownerIdd =client.users.cache.get("769077060944658452")
  client.guilds.cache.forEach(guild => {
     ownerIdd.send(`${guild.name} | ${guild.id}`);
  })
}```
#

fucking dammit

lavish bramble
#

Mmmm?

near stratus
#

why is it ownerIdd not ownerId ?

opal plank
#

you should concat them instead

lyric mountain
#
if(msg.content === "$guild name") {
  const ownerIdd = client.users.cache.get("769077060944658452")
  for (const guild of client.guilds.cache) 
    ownerIdd.send(`${guild.name} | ${guild.id}`);
}
opal plank
#

if your bot is in 100 servers, you'll get 100 messages

#

make it all 1 message

near stratus
lavish bramble
#
    .addField(client.guilds.cache.forEach(guild => guild.name))
crimson vapor
lavish bramble
#

In embed

#

But not working

near stratus
lavish bramble
#

πŸ˜…

green kestrel
#

mmmmm, this is looking promising

crimson vapor
#

wdym?

opal plank
green kestrel
#

left hand side - triviabot cluster using D++
right hand side - triviabot cluster using aegis... on a GOOD day.

#

(green rows are native threads)

#

so its using half the ram, and under half the cpu

near stratus
crimson vapor
#

his bot
his lib
old lib
htop + stats

lyric mountain
#

brain brain brain brain brain

green kestrel
#

@near stratus triviabot is my bot. D++ is my discord library. aegis is the discord library i was using previously. the image is some diagnostics of my testing showing that ive done what i set out to do and made something better. im flexing.

crimson vapor
#

so left is the current stats menu?

near stratus
#

oh okay

crimson vapor
#

right*

#

left is htop

green kestrel
#

the new one isnt running on the dashboard atm, its in test mode

green kestrel
#

so im using htop to monitor it

lyric mountain
#

htop is cool but, I miss %st data

green kestrel
#

i dont really miss that

earnest phoenix
#

how do i add async here?

green kestrel
#

but i dont get the fascination with bashtop

#

bashtop looks like a toddler was set loose with crayola in my terminal

lyric mountain
#

bashtop?

#

ah

green kestrel
#

@earnest phoenix add awaits

lyric mountain
#

it kinda looks cool tho

#

with all those graphs

near stratus
supple bone
#

pls

earnest phoenix
lyric mountain
#

member is not cached

#

or don't exist

near stratus
#

where is Member ?

earnest phoenix
lyric mountain
#

read my second message

near stratus
#

you forgot the cache maybe

crimson vapor
#

io

#

wyd

#

make the entire function async

earnest phoenix
#

noup doesnt work

near stratus
crimson vapor
#

then just use the async func

cinder patio
#

I'm pretty sure it's server.members.fetch

earnest phoenix
near stratus
earnest phoenix
crimson vapor
#

do <Collection>.get || <MemberManager>.fetch()

near stratus
vivid fulcrum
#

you can just straight up call fetch

#

fetch calls get implicitly

earnest phoenix
near stratus
cinder patio
#

or you can just message.member || fetch...

near stratus
#

@cinder patio he Can't see above^^^

vivid fulcrum
#

the member in the message is granted to be cached

cinder patio
#

ah

onyx hare
#

how would i catch this to not error and force the bot to restart if the channel cant be found (Since not everyone has a log channel) ik i need to add a return somewhere and message.channel.send(""Unable To Log Verification As Logs Dont Exsist")
````message.guild.channels.cache.find(i => i.name === 'logs').send(${message.author} Has **Verified**!)```

near stratus
quartz kindle
#

channel = bla.find()
if(!channel) return

snow urchin
#

https://i.callumdev.pw/3dz21.png
I have this to check if a session is available, and if not, authenticate with discord, but for some reason whenever it authenticates, it redirects back to the page it was on, as it should, but then creates an infinite loop, its as if the session was not created.
If I remove the check for a session after the user has authenticated atleast once then it works fine, with session being loaded. It's as if session does not become active after signing in until the page fully loads and renders, why could this be and how could I overcome this?

cinder patio
zenith terrace
crimson vapor
#

hi Tim

snow urchin
cinder patio
#

Never used next.js or next-auth, can't help ya

quartz kindle
zenith terrace
#

bla bla

quartz kindle
#

bla bla bla

zenith terrace
#

bla bla bla bla

near stratus
#

bla bla bla bla bla

zenith terrace
#

@quartz kindle

if(bla) bla = blabla.then().then().then().then().then(await await await await await await await await message.channel.send('bla'))```
quartz kindle
#

ex dee

crimson vapor
#
const bla = (str) => {
  if (str.length > 1) {
    return bla(str+= (Math.random() * 100).toFixed(0))
  } else if (str.length < 1) {
    return bla(str+= (Math.random() * 10).toFixed(0))
  } else if (str.length = 1) {
    return bla(str+= ((Math.random() + 1) ** 5).toFixed(0))
  } else throw new Error('huh?')  
  return
}

bla(0)
#

bla time

#

I messed something up

frigid mountain
#
const discord = require('discord.js')

module.exports = {
    name: 'maths',
    run: async (message, args) => {

const maths = require('./maths.json'); 
const item = maths[Math.floor(Math.random() * maths.length)]; 
const filter = response => { 	
   return item.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase()); 
}; 
   
   
   message.channel.send(item.question).then(() => { 	
       message.channel.awaitMessages(filter, { max: 1, time: 15000, errors: ['time'] }) 		
           .then(collected => { 		
               	message.channel.send(`${collected.first()} is correct`); 		
           }) 		
           .catch(collected => { 
               message.channel.send('Sorry but your answer was incorrect'); 		
           }); 
});
           }
}

what the error mean?

vivid fulcrum
#

your json file is not valid json

fervent goblet
#

is there an easier way to use node canvas?

lusty quest
#

define easy

quartz kindle
#

easier how?

#

there are many frameworks for it

#

depends on what you want to use it for

umbral zealot
#

canvas-constructor is a good start

lusty quest
#

using chart.js and canvas gave me so much headache until ive figured out how to properly use chart.js

quartz kindle
#

though using canvas directly gives you unparalleled freedom

#

in exchange for a lot of math

thick nexus
#
@bot.event
async def on_message_edit():
   await bot.process_commands(message)

Would this work lmao

#

so it would process messages for commands if they edit?

umbral zealot
#

does it?

zenith terrace
#

try it

cinder patio
#

canvas-constructor barely adds anything to canvas lol

#

Chained methods okay I guess but that's it

worn sonnet
#

hey help!!!!!!

#
r_subreddit = await reddit.subreddit(f"{sub}")
posts = []
hot_subs = r_subreddit.hot(limit=5)
for submission in hot_subs:
   posts.append(submission)
#

and i get this error

#

TypeError: 'ListingGenerator' object is not iterable

#

so how do i extract data from it?

#

umm...

signal estuary
crimson vapor
#

idk

crimson vapor
#

thats quite literally all I heard

cinder patio
signal estuary
cinder patio
#

How is the styling for the buttons gonna work

signal estuary
cinder patio
#

oooo

signal estuary
cinder patio
#

interesting

#

so it's in the api already

signal estuary
#

but It doesnt work correctly

#

thats how I saw it

#

and on the computer I cant see anything

cinder patio
#

Maybe the person who screenshot it is using canary

#

or the dev build

signal estuary
#

Maybe. idk how to use a dev build ^^

#

But you can remove now attachements

#

thats new it think in discord

latent heron
#

Yeah button embeds are getting coded into the new API

#

They look nice af

signal estuary
#

Im looking forward to try it

cinder patio
#

I'm waiting for dropdowns

earnest phoenix
#
const desc = [];
const getMap = result.map(x => x.warn);
for(let i = 0; i < getMap.length; i++){
    desc.push(`${i + 1}. ${getMap[i]}`);
}```

I want to remove a data in my MYSQL database using this, but how to get the data from i = 2
still sky
slender thistle
#

What's your file structure like and where are you importing those modules from

earnest phoenix
#

If the administrator wants to delete a data with the identifier (i) which is equal to 2 (or 1, or 3 etc..), then delete the data
@still sky

slender thistle
#

Okay

worn sonnet
amber wagon
#

Guys is there any guides on how to host database on any vps like vultr
Currently I'm using mongodb as a database

quartz kindle
#

there should be plenty of them

worn sonnet
#

I mean the mongodb

#

Is it easy to learn

amber wagon
#

Yes mongodb is easy for me for now

zenith terrace
#

once you know the basics of mongo its easy

amber wagon
#

But if I m using vps I can use the storage it provides instead of mongo

worn sonnet
#

Like
SELECT col FROM table WHERE primary_key == 1

#

That's how it goes in every db right?

still sky
#

Except indexes

amber wagon
#

No it has functions like find , update basically id based database

#

Similar to json

worn sonnet
#

I'll try learning it πŸ˜€

#

Cuz I wanna shift to other db from SQLite

earnest phoenix
#

@still sky Look, desc send this (there is currently data). And {i +1} it’s the number at the start of the sentence is 1. and 2.

amber wagon
#

I wanna move from it coz it's not very cheap also I wanna use the storage comes with vultr

worn sonnet
#

Which is server based
And can be accessed from anywhere
Unlike SQLite which is only accessible where it's stored

boreal iron
worn sonnet
#

Yeah yeah

earnest phoenix
worn sonnet
#

Damn now everyone be pointing out that thing

earnest phoenix
#

i help u

worn sonnet
worn sonnet
#

I dunno what to do with that ListingGenerator thing which it returns

#

Using praw lib

#

For Reddit

boreal iron
boreal iron
#

Which will help you to create a decentralized database you can access from anywhere

earnest phoenix
#

what db do you use

worn sonnet
earnest phoenix
#

ye

worn sonnet
#

SQLite

vivid fulcrum
#

if you at least attempted to google this, you'd find this information

earnest phoenix
#

yes

#

stackoverflow > all

still sky
still sky
#

I'm not sure if it exactly what you want

earnest phoenix
#

@worn sonnet is a first result…

worn sonnet
#

And the results showed up for ListGenerators

#

I got some weird quora answers

#

Saying generators are not iterable and so on

earnest phoenix
#

On the topics of stackoverflow, you will have very little nonsense

earnest phoenix
worn sonnet
#

There was one video so I followed him too resulting in the above code

#

Worked for him but not for me

vivid fulcrum
#

almost as if

#

videos aren't up to date

#

🀯

worn sonnet
#

😭😭

vivid fulcrum
#

stop watching youtube videos and start reading doc pages

earnest phoenix
#

@still sky No, he returned all the table

worn sonnet
#

I looked into the doc and
Dumb me was looking into praw doc instead of async praw

earnest phoenix
#

@worn sonnet use mySQL instead

still sky
earnest phoenix
#

i have only 2 record in my table

#

but yes

still sky
#

Change indexForDelete to 1 ...

earnest phoenix
#

mmh ok

worn sonnet
#

Will look into that answer tomorrow

earnest phoenix
#

returned all the table @still sky

earnest phoenix
still sky
earnest phoenix
#

@worn sonnet Take a host?

#

vps*

earnest phoenix
worn sonnet
#

It has workbench and someother thing

#

I dunno how to get started

#

And which password is for what

#

U can say I'm completely lost on MySQL

earnest phoenix
#

@worn sonnet
Do the passwords need to be stored on your phone or in a secure place?

#

It will cost you less to take a vps than to leave your poor computer on all the time (level of electricity bills)

still sky
#

update .filter((_, i) => i !== Number(id) - 1)

earnest phoenix
#

ok!

#

Ok he returned only 1

#

but with object Object

#

but

still sky
#

.join('\n')

earnest phoenix
#

when i do the command with 2, he returned only 1.

#

if i use the command with 3, he returned all record

#

but always object Object

still sky
#

where your .send()?

earnest phoenix
#

const updatedDesc = result.filter((_, i) => i !== Number(id)).map((warn, i) => ${i + 1}. ${warn}).join("\n");
message.channel.send(updatedDesc)

#

i have remplaced console by .send

#

i have removed - 1 and when i do the command with 2, he show me 2 record so it’s good

#

but i don’t want this, i want to show only the record = 2

still sky
#

You wanna keep order number, dont you?

earnest phoenix
#

yes

still sky
#

Otherwise I cant understand what exactly you need

quartz kindle
#

use reduce

earnest phoenix
#

Example: i have :

  1. data here
  2. data here

how can i show only 2.

still sky
#

Your ordering based on indexes in array, you need connect ordering with something else

#

IDs for example

#

Even so you wont get order numbers between commands

#

Mb with awaiting message, if its like "minisession" for one commad

#

You can define list after query, set ordering, show it -> await message -> do side effects, delete and show updated

leaden kestrel
#

i have a bot that coded in java

#

discord.js

#

and i have working music bot with some mod commands

#

and i need more

earnest phoenix
#

How can i check if result returned [] in mysql?

leaden kestrel
#

what

vivid fulcrum
#

do you mean if the query returned no rows

leaden kestrel
#

oh

#

nvm

earnest phoenix
#

i have try if(!result.length) but he tell me « cannot read property length »

leaden kestrel
earnest phoenix
#

??

#

what??

leaden kestrel
#

like warn

vivid fulcrum
#

which library are you using to interact with mysql

leaden kestrel
#

i want to make on

earnest phoenix
#

javascript

leaden kestrel
#

i want to make one

#

yes

vivid fulcrum
#

library

earnest phoenix
#

mysql2 set

#

sry

leaden kestrel
#

discord.js

#

same one

earnest phoenix
#

no

leaden kestrel
#

i need that in warn

earnest phoenix
#

Ok and?

leaden kestrel
#

please

earnest phoenix
#

why me?

#

go along your path

leaden kestrel
#

because u bot developer

earnest phoenix
#

and?

#

it’s not a reason

vivid fulcrum
#

according to the docs if no rows are returned the result will be an empty array, it shouldn't be undefined

#

what's your code

leaden kestrel
#

and ur active rn

earnest phoenix
#

ask mee6 owner to give you warn command

leaden kestrel
#

okay

#

i guess not

earnest phoenix
#

    database.query(`SELECT * FROM prefix WHERE guild_id = '${message.guild.id}'`, function(err, result){
        let prefix;
        console.log(result)
        if(!result) prefix = data.prefix;
        else prefix = result[0].prefix;```
vivid fulcrum
#

oh god

#

please use prepared statements

#

you're going to create an sql injection vuln somewhere in your code

earnest phoenix
#

no

vivid fulcrum
#

??

earnest phoenix
#

No I do not intend to create an injection

#

just select

vivid fulcrum
#

i don't think you understand what i'm saying

earnest phoenix
#

traductor is so bad

wicked crown
#
Cannot read property 'find' of undefined
    at Object.run (/home/runner/Jester-Bot/commands/music/play.js:74:35)```
#

thats my code

#

can someone help?

vivid fulcrum
#

why are you copypasting code

wicked crown
#

doesnt matter now

vivid fulcrum
#

yes it does

wicked crown
#

can u help me or not?

vivid fulcrum
#

where did you copypaste it from lol

wicked crown
#

doesnt matter now

#

anw

#

can u help me?

vivid fulcrum
#

it matters

#

because that code isn't yours and you have no idea what you're doing

wicked crown
#

omfg

#

just help me

vivid fulcrum
#

your client doesn't have a queue property

#

don't copypaste code next time

#

also

opaque acorn
#

SyntaxError: C:\Users\MagiK\Desktop\BOT SENGOKU NADEKO\config.json: Unexpected end of JSON input

vivid fulcrum
#

running music bots isn't really profitable nor sustainable anymore for small bot devs

vivid fulcrum
opaque acorn
#

valid json

#

wat

vivid fulcrum
#

invalid, not valid

opaque acorn
#

in the result says valid

vivid fulcrum
#

are you able to share the file?

#

remove any sensitive information, i.e. your bot token

opaque acorn
#

yue

#

{
"token": "secret",
"prefix": "*"
}

tacit sequoia
#

That seems correct