#development

1 messages · Page 1020 of 1

spare mirage
#

so its 1 if and no more SHITTY else if

quartz kindle
#

exactly

#

you already have a list

#

the list is client.commands

pure lion
#

Oh god OHGOD

#

Uhhh

quartz kindle
#

so instead of checking every single possible command, you get it directly from the list

pure lion
#

I just realised

spare mirage
#

so I run/execute client.commands

quartz kindle
#

for example

pure lion
#

When I write a disable command for all my commands I'm gonna have to stack 100+ else ifs

#

:D

quartz kindle
#

client.commands.get(command) will give you a command, if it exists, otherwise it will give you nothing

#

so you can do

#
cmd = client.commands.get(command)
if(cmd) { cmd.execute(...) }
#

and that replaces all if elses

spare mirage
#

so that wll execute them all?

quartz kindle
#

whatever command people write, it checks if it exists in the list, if it does, execute it, else ignore it

#

the list being client.commands

spare mirage
#

so...

#

cmd = client.commands.get(command)
if(cmd) { cmd.execute(...) }
this works

quartz kindle
#

yes

spare mirage
#

and .. will be the... things I require to execute

#

how do I say that

quartz kindle
#

parameters

#

or arguments

#

yes

tulip ledge
#

its arguments right? Since parameters are what the functions ask for and arguments are what you give right?

spare mirage
#

but then... how does the bot know the PREFIX+command

tulip ledge
#

Or am I being stupid again

solemn latch
#

You already did those checks

#

From what i remember

tulip ledge
#

I have a feeling he just copied code without knowing what it does

solemn latch
#

Do prefix check first.
Then do command check
Then execute command

#

Or well, whats defined as cmd

quartz kindle
solemn latch
#

Gg sold out of ryzens last night

quartz kindle
#

Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70GHz

#

rip

pure lion
#

That's

solemn latch
#

I was going to get a second tonight

pure lion
#

Big

tulip ledge
#

Tim .eval client.commands.get("help").enabled = false; does not set it to false

#

It just logs false

#

Any idea why?

spare mirage
#

It doesnt make sense

solemn latch
#

What doesnt

spare mirage
#

what is the command

#

I never use PREFIX somewhere

quartz kindle
#

@tulip ledge is the help command an object?

spare mirage
#

so how does command know my prefix and command

solemn latch
#

I think you deleted your prefix checker line

tulip ledge
#

Yes

#

I logged it

quartz kindle
#

and the enabled property doesnt get added to it?

#

it did

tulip ledge
#

nope

#

stays true

quartz kindle
#

wait

tulip ledge
spare mirage
#

I think you deleted your prefix checker line
@solemn latch What do you mean?

solemn latch
#

@spare mirage the part with the prefix, where it returns if the prefix isn't at the beginning was fine. You can keep that at the start

#

Since the prefix will be the same no matter what

quartz kindle
#

if .get() returns run and command

#

then you should do .get().command.enabled = false

tulip ledge
#

OH

#

Yeah

#

Ty

spare mirage
#

ive never had that @solemn latch My cmmands always were msge.content.startsWith(BLABLBLABL) {}

solemn latch
#

Yeah

tulip ledge
#

Still not

solemn latch
#

Thats all fine @spare mirage

tulip ledge
#

It still is true

spare mirage
#

wait then what ever was my prefix checker

quartz kindle
#

weird

tulip ledge
#

@spare mirage

#

If you wrote it yourself you should know

solemn latch
#

^

spare mirage
#

ahh I see

#

I just didnt know what it was called

#

LMOAO

solemn latch
#

You wrote it tho right?

tulip ledge
solemn latch
#

So yoh should know what it does 🤔

quartz kindle
spare mirage
#

yes

#

I shouldve known

#

client.on('message', message =>{
    if(!message.content.startsWith(PREFIX) || message.author.bot) return;
 
    const args = message.content.slice(PREFIX.length).split(/ +/);
    const command = args.shift().toLowerCase();
 
    const cmd = client.commands.get(command)
    if(cmd) { cmd.execute(bot, message, args) }
    ```
tulip ledge
#

weird

spare mirage
#

this will work then?

solemn latch
#

Try it 🤔

quartz kindle
#

why are you mixing bot with client

tulip ledge
#

lol

quartz kindle
#

other than that, yes it should work

spare mirage
#

I always do that

#

thats me

#

like nobody uses bot

tulip ledge
#

But

#

It wont work

lusty quest
#

looks like it started with github copy/pasta

tulip ledge
#

You never defined bot

spare mirage
#

@lusty quest uhh yes.. when I first started I used a github copy pasta

tulip ledge
#
client.commands = new Discord.Collection();
 
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
    const command = require(`./commands/${file}`);
 
    client.commands.set(command.name, command);
}
 
 
client.once('ready', () => {
    console.log('Codelyon is online!');
});
 
client.on('message', message =>{
    if(!message.content.startsWith(prefix) || message.author.bot) return;
 
    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();
 
    if(command === 'ping'){
        client.commands.get('ping').execute(message, args);
    }
});
spare mirage
tulip ledge
#

Define fs?

pure lion
#

@spare mirage we're not gonna keep helping you like this

quartz kindle
#

@tulip ledge might have something to do with the require cache

spare mirage
#

Oh I need to require

tulip ledge
#

The require cache for my commands.

#

?

solemn latch
#

I'm so confused

#

On whats happening with that code

#

Using bot and client?

tulip ledge
#

While bot isnt defined

#

He just copied some github stuff then rewrote it using a tutorial or something idk

quartz kindle
#

@tulip ledge try this client.commands.set(command.name,{run:command.run,command:command.command}) or however your commands are structured

#

basically instead of using the required object directly, you extract and rebuild it

tulip ledge
#

Oh

#

Well

#

I use aliases aswell

#

So thats not gonna work

quartz kindle
#

doesnt matter, as long as you rebuild the object

tulip ledge
spare mirage
#

const cmd = bot.commands.get(command) cannot read property of get

tulip ledge
#

Then I need to change the aliases aswell

solemn latch
#

Use client

tulip ledge
#

Alright

quartz kindle
#

or just do this client.commands.set(command.name,Object.assign({},command))

tulip ledge
#

?

quartz kindle
#

@spare mirage mixing client and bot again

tulip ledge
#

I have no idea how that'd work

spare mirage
#

xD

#

cuz I kinda dont

quartz kindle
#

@spare mirage whenever in doubt if its bot or client, always use the same that you use for <>.on("message")

tulip ledge
#

Just ignore him Tim

#

He clearly doesn't know basic js

spare mirage
#

thats mean

#

I know the basics of the basics

tulip ledge
#

Learn basic js before asking questions

spare mirage
#

¯_(ツ)_/¯

lusty quest
#

didnt i told you a few days ago to learn some basics

spare mirage
#

Doing that now @lusty quest gets boring and annoyinh trying to learn for 5 hours

digital ibex
#

oh boy, justii... please

lusty quest
#

its fine to ask but it gets annoying if you ask the same basic questions over and over

#

i had always issues to learn stuff from just plain reading stuff, i can better memorize stuff if i do it myself. If i run into issues i usually google for a solution or try some stuff that maybe work

spare mirage
#

:3

#

Im a retard

#

Didnt save

obtuse jolt
solemn latch
#

Discord

spare mirage
#

^

obtuse jolt
#

Damn

spare mirage
#

do u have a ping command?

obtuse jolt
#

I do

spare mirage
#

do u have HIGH bot ping?

obtuse jolt
#

no

solemn latch
#

Discord is slow about stuff like that

Especially when adding them in order

spare mirage
#

u can use .then right?

solemn latch
#

You send the request, wait for it to be added and discord to tell you it was added.
Then you send the next

#

Its just a naturally slow process

spare mirage
#

oof

obtuse jolt
#

It works but it’s just

#

s l o w

#

But some bots do it really fast tho

spare mirage
#

maybe bots that run on py? you have a wait command there right?

restive furnace
#

ugh

obtuse jolt
#

Speed of reactions should depend on the language tho

#

It’s only doing the same thing in the end

restive furnace
#

it doesnt depend on the language, it depends on the library, and how the library process and send data (mostly).

obtuse jolt
#

discord.js

sinful belfry
#

it looks like a discord issue tbh

obtuse jolt
#

It’s done it ever since I added it

spare mirage
#

it is

sinful belfry
#

sometimes it can be super quick with reacting, other times it is just sluggish as hell

#

when did u add it?

obtuse jolt
#

Like 2 weeks ago

#

I think

#

1 or 2 weeks ago

sinful belfry
#

hmmm

obtuse jolt
sinful belfry
#

what does ur code look like for making it give these reactions?

obtuse jolt
restive furnace
#

wheres await zoomeyes

#

on those m.react's

obtuse jolt
#

It’s unnecessary for my use case

earnest phoenix
#

async await

solemn latch
#

your sending all of them at the same exact time. maybe the library is rate limiting them?

lusty quest
#

i dont think he cares about the order so async is not needed

obtuse jolt
#

Not really it tells you what the numbers respond to

solemn latch
#

i know if i send 5 messages at once, the library will rate limit me

lusty quest
#

also i have a command that adds mutiple reactions, its still sluggish but not as slow as you have it

obtuse jolt
#

It makes no sense because it’s not fast then wait then resume it’s just slow

solemn latch
#

try spacing them out a bit 🤔

obtuse jolt
earnest phoenix
#

the ratelimit for reactions is 1/0.25

solemn latch
#

so he would be hitting it

lusty quest
#

hmm i have the same speed for my command

solemn latch
#

and djs's built in ratelimiter would slow it down

lusty quest
#

i guess its API limitation then

obtuse jolt
#

Sad times

earnest phoenix
#

some libraries don't respect doubles and round it to 1/1

#

reactions on my bot are much faster

solemn latch
#

ima try removing await on mine

#

virtually no diffrence in speed

obtuse jolt
#

It might be 1/1

solemn latch
#

🤔

spare mirage
#

am I blind? ||please not again||

earnest phoenix
#

you tell me

lusty quest
#

you got litteraly told last time you asked what the issue is

spare mirage
#

no I didnt?

#

am I really that blind?

earnest phoenix
#

you can't give us a glob of code and tell us "theres an error find it"

#

learn to do it yourself

#

we're here to assist you not to do it for you

#

stop being a help vampire

spare mirage
#

stop being a help vampire
atleast im not a please feed me code im hungry vampire

#

¯_(ツ)_/¯

solemn latch
#

well

#

you kinda are

#

🤔

#

also, i went to bed, with you asking questions, and woke up to you asking questions. since then every time i look here, its you asking questions

#

honestly, if you need that much help, hire a teacher

earnest phoenix
#

@tim mmLol

spare mirage
#

@solemn latch I wasnt asking questionts that whole night xD

#

I kinda tried to make the command work for 5 hours

#

and it didnt work

solemn latch
#

sure, but nearly every waking hour for me, for the past almost 48 hours youve been in here

#

asking for help

pale vessel
#

is it weird that when you know a programming language, you think "why does this guy not know? it's so easy"?

spare mirage
#

Yes I guess

#

u know it

#

And The guy ||me|| doesnt

pale vessel
#

my brain just thinks it's common sense, i'm well aware it's not

spare mirage
#

Just a question? If u were me: new to coding

#

new to discord bots

solemn latch
#

new to coding, and new to discord bots dont go well together

spare mirage
#

would u ask questions here?

solemn latch
#

when i started, i started with things like basic scripts

pale vessel
#

would u ask questions here?
@spare mirage not really, i'd google

#

google helped me learning programming languages, 100%

spare mirage
#

thats ur EXPERIENCE

solemn latch
#

when i started i didnt ask anyone any questions for months

spare mirage
#

without experiience

#

what would u do?!?

solemn latch
#

google

#

🤔

pale vessel
#

without experience, you would google lmao

solemn latch
#

and started learning things i was capable of

pale vessel
#

i just refer w3schools, mdn, and some other sites like stack overflow to see how people solve their problems

#

it's not hard when you're used to it

#

official docs too, i guess

sudden geyser
#

w3schools is kind of cringe

spare mirage
#

without experience, you would google lmao
Without experience? Im here without experience with a group of 7000+ experienced coders

pale vessel
#

mhmm

spare mirage
#

I bet u cold find more awnsers here

pale vessel
#

they sometimes don't provide all functionality

solemn latch
#

but we are not here to help you find those answers

#

you are

sudden geyser
#

it's more like a lot of their guides are outdated

#

at least the most basic example is their introduction to javascript

pale vessel
#

but w3schools explains everything in layman's terms so if you don't get what you're reading, there's a big problem

solemn latch
#

^ thats why experinced coders dont like w3schools

pale vessel
#

i refer mdn since they're up to date with their versioning and stuff

#

so i can see which node versions i need for a certain function, etc.

#

they also tend to give every detail

#

@solemn latch sup

solemn latch
#

i was going to ask about pupetter

#

but i think im going to put it on my second server, and just serve the requests

#

i got grafana setup today, got a really nice dashboard with recent commands and stuff.
going to use puppetter to view stats via a command

earnest phoenix
#

is there a shorter way to do ``` if(bool !== true || bool !== false) { return "boolean expected"; }

sudden geyser
#

typeof something === "boolean"

earnest phoenix
#

hmm ok thanks

spare mirage
#

if else? maybe

earnest phoenix
#

if else would make it longer

spare mirage
#

Oh lol

#

yes

earnest phoenix
#

is general the emergency room?

spare mirage
#

thats me tryiung to code

sudden geyser
#

that's when you have an issue and you couldn't find the answer on google

earnest phoenix
#

do you guys know how to make a /sudo bot like one of those counting bots

spare mirage
#

?

#

I know how to make say commands

sudden geyser
#

What is the sudo command supposed to do.

spare mirage
#

like /sudo In minecraft

#

u sudo a player/user to perform a command or say smtng

sudden geyser
#

Okay, what library and language are you using (gamer ash)? You'd just need to mimic whenever a message is created but set different properties for whatever instance is passed.

spare mirage
#

@sudden geyser I dont think bots can sudo

digital ibex
#

so im having a bit of a security issue with something... i have a website and if u do mywebsite.com/users/userID u r logged into the users account without having to put the password or anything in.. any ideas how I can make them have to put a password in without directly going to users/userID? im using expressjs

sudden geyser
#

they can if you can mimic it. at least I've done it before

spare mirage
#

whats that?

#

i bet its possible but I dont think its worth it xD

sudden geyser
#

for the sudo command?

spare mirage
#

yes

sudden geyser
#

it's not that hard

spare mirage
#

seems like a dang lotta code though

digital ibex
#

no its not, learn nodejs

spare mirage
#

seems

sudden geyser
#

like if you're using nodejs, one way is copying the message object, changing a few properties, then emitting a new message create

spare mirage
#

the bot will send the message?

#

not the mentioned guy

sudden geyser
#

that's a different type of sudo (and not as easily doable by a bot)

spare mirage
#

else ur just running a say command @sudden geyser

pale vessel
#

please read

spare mirage
#

just verify

#

-_-

earnest phoenix
#

Are their french people please

#

French good developer

spare mirage
#

ye

earnest phoenix
#

T’es fr?

spare mirage
#

zapto is

low phoenix
#

Why comes by 🇩🇪 the \🇩🇪

spare mirage
#

idk really

#

Deutchland?

#

idk

low phoenix
#

Deutschland = Germany

pale vessel
#

shitpost somewhere else

spare mirage
#

okok

low phoenix
#

whats the correct for 🇩🇪

spare mirage
#

?

#

right?

low phoenix
#

sry *correct

#

i need for my bot

spare mirage
#

: flag_de :

#

do U mean this

#

?

low phoenix
#

yes

spare mirage
#

there u go

low phoenix
#

Only add ":-flag_de-:" to the code?

spare mirage
#

you cna just copy paste the emoji to the string

#

ok gn

#

byeee

pure lion
#

Nobody here that needs help?

#

@spare mirage learn js

#

My work here is done

solemn latch
#

gj

bright meadow
#

What's the rate-limit of editing messages as a bot? like how many edits per what time unit is a bot allowed to make?

#

ping me on answer

sinful belfry
#

5 every 5 seconds @bright meadow

bright meadow
#

alright thanks

#

so i wont get rate-limited if i edit one message every 30 seconds?

sinful belfry
#

@bright meadow nope

bright meadow
#

tyvm

earnest phoenix
#

H

quick flame
#

Is it possible to change the display of the bot image on your voting page?

#

Looking to get this made into a circle, not a square and can't figure it out.

valid frigate
#

create a circle clipping mask and just put it over the entire design

#

depends on what software this is

quick flame
#

Is it not possible to do it with html editing?

#

I see other bots have made alterations to their pages with stuff like it.

digital ibex
#

hi

#

so im having a bit of a security issue with something... i have a website and if u do mywebsite.com/users/userID u r logged into the users account without having to put the password or anything in.. any ideas how I can make them have to put a password in without directly going to users/userID?

#

im using expresjs btw

digital ibex
#

what

#

i've already built my website

#

and done the user auth thing, its just a security flaw im trying to fix

valid frigate
#

ohh wait you were talking about the bot page

#

@quick flame use border-radius: 50% on .bot-img img

quick flame
#

sorry- quite new to this editing stuff, do I add this to the bot description?

valid frigate
#

ya you add it to the style tag

#

you can have inline css

quick flame
#

so,

<style>.bot-img img border-radius: 50%</style>

theoretically, this should work? or am I tripping?

#

@valid frigate (sorry for the tag pal)

valid frigate
#

css rules look like this

#
.class {
  property: value
}
odd radish
#

how can I make the profile picture on top.gg round?

honest perch
#

With css

odd radish
#

i know but i dont know how

honest perch
#

Google it

autumn eagle
#

Is there any way to fetch messages of a member and get the amount of total messages sent by user?

#

From here

livid rivet
#

smells like API abuse

autumn eagle
#

Not really, I'll just use it like this, !messageamount @granite pagoda
response: User has "x" messages.

livid rivet
#

but fetching is an API call

#

which means: limited

earnest phoenix
#

add like +1 to a database everytime the user sends a message

quartz kindle
#

the search endpoint is not available to bots

digital ibex
#

Hi

#

I made a website and the login & create account stuff already works fine - not the issue, but if u do to mywebsite.com/users/userID u are logged in an account which isn't urs without having to enter a password, same with discord, if I do https://discord.com/channels/server-id-im-not-in its just gonna load, whereas my one just logs u right in. I've looked into express-session but am still confused. can someone help me please. thanks :D

earnest phoenix
#

how do you check the amount of guils/ members in python
like how do you find out how many servers your bot is in

digital ibex
#

look into client.guilds (len(client.guilds))

earnest phoenix
#

ooh

#

ok

#

how can i make my bots create a webhook

digital ibex
#

read the documentation.

#

I dont have the link rn, but thats where u get the info from.

earnest phoenix
#

ik

#

but im not sure what docs i should look at

digital ibex
earnest phoenix
#

d.py would have the webhooks?

digital ibex
#

yes

#

should do anyways, if not, u'd have to create it urself mmLol

earnest phoenix
#
import discord
from discord.ext import commands
from pyfiglet import Figlet

class Utility(commands.Cog):


    def __init__(self, client):
        self.client = client


    @commands.command()
    async def pyg(self, ctx, font, *, text):
        f = Figlet(font=font)
        await ctx.send(f"```{f.renderText(text)}```")
    
    @commands.command()
    async def servlist(self, ctx):
        guilds = await client.fetch_guilds(limit=150).flatten()

        await ctx.send(f"I am in these guilds: {guilds}")

def setup(client):
    client.add_cog(Utility(client))


    
``` why does it say client is not defined?
umbral estuary
#

which database option i should use?

lyric mountain
#

The right one for your scenario

#

Json? MongoDB

#

Heavy relationship? PostgreSQL

autumn quarry
#

why do people use databases like mongo

umbral estuary
#

is there a recommended one?

lyric mountain
#

Lightweight? SQLite

#

Half brain? JSON db

warm marsh
#

JSON isn't a database.

lyric mountain
#

That's too much for only half a brain

empty owl
#

@umbral estuary choose the one right for you

#

any good features about enmap

#

tho

warm marsh
#

Someone asks for a recommendation and then you sarcastically mock them, That's kinda rude.

umbral estuary
lyric mountain
#

That's called discouraging

#

And since he doesn't use a db, that's not mocking him

empty owl
#

jsons can easily get corrupted

lyric mountain
#

The three options I gave are pretty much a choose-one

warm marsh
#

In a sarcastic manor.

lyric mountain
#

If you're using heroku, forget about sqlite

empty owl
#

if your using heroku forget about all file based databases

heavy anchor
#

^

warm marsh
#

And since he doesn't use a db, that's not mocking him
That's like saying haha you can't ride a bike because you've no legs.

#

Same difference.

lyric mountain
#

That's....actually extremely different

warm marsh
#

No.

#

The outcome is the same.

heavy anchor
lyric mountain
#

He doesn't use databases yet, so my mocking didn't target him at all

empty owl
#

haha you cant ride a bike because youve got no legs is just making fun of the disabled person

lyric mountain
#

Saying a legless person can't ride a bike is plain bullying

#

Also, they can

#

I've seen it already

warm marsh
#

Not using their legs.

empty owl
#

no but laughing about it is mean

#

but just saying it is just saying it

#

shoving it in their faces is mean

#

why are we getting off topic

lyric mountain
#

Back to topic, choose one

MongoDB -> JSON-like management
PostgreSQL -> Really fast for entities with lots of relationships with other entities
SQLite -> The lightest database you'll find out there, absurdly fast and can be used as a cache, but very few data types

umbral estuary
#

so use SQLite

lyric mountain
#

Just appended the drawback

umbral estuary
#

Oh

candid hinge
#

i need someone to come rate my bot real quick dm me

lyric mountain
#

No

candid hinge
#

😦

lyric mountain
#

Wait 2-4 weeks and it'll be reviewed by one of the mods

#

Or you could find some friends and invite them to your server

tired nimbus
#

hey guys Im having trouble with the youtube player api

#

you see, Im trying to get the duration of a video but It always returns undefined

#

Im using player.getDuration()

#

actually I think I fixed it....

hazy sparrow
#

bot is not showing anything in console, nor showing any error, nor coming online ._.

delicate shore
#

guys

#

my unban command is not working

#

nothing is logging into console

hazy sparrow
#

nothing logging for me also

solemn latch
#

are you logging anything

#

🤔

hazy sparrow
#

yes

solemn latch
#

and thats not running?

#

🤔

hazy sparrow
#

bot is not online either

solemn latch
#

do you have client.login ?

#

at the end of the file

hazy sparrow
#

yes

crimson vapor
#

a bot does not take 20 mins to start, what is your code?

hazy sparrow
#

wait

#

@crimson vapor

crimson vapor
#

ok

#

at the end of the code you have client.login("token")})

#

which is correct and wrong

solemn latch
#

Your logging in inside an event

crimson vapor
#

make it js }) client.login("token")

hazy sparrow
#

ok

solemn latch
#

An event that only can happen after logging in

hazy sparrow
#

worked

#

ty

#

also another question

#

how do i make a new embed inside a command handler?

earnest phoenix
#

have you tried reading the docs

hazy sparrow
#

its saying "Discord is not defined"

#

this one?

earnest phoenix
#

those are not official docs

solemn latch
#

More of a js issue than a docs issue

earnest phoenix
#

yeah

solemn latch
#

Things need to be defined where you are using them

#

If your in a module, it wont have acess to the discord var you defined in the main file, unless you pass it on, or re require it

hazy sparrow
#

so i have to do the const Discord = require discord thingy in the handler too?

solemn latch
#

You actually don't need the entirety of discord

crimson vapor
#

only in every file you use Discord

#

^

solemn latch
#

You can just get the embed part

hazy sparrow
#

You can just get the embed part
@solemn latch how do i get just that part

crimson vapor
#

const { MessageEmbed } = require('discord.js')

hazy sparrow
#

oh

#

ty

#
const embed = new MessageEmbed

or

const embed = new Discord.MessageEmbed
#

which is correct

crimson vapor
#

both

hazy sparrow
#

umm

#

ok

#

ty

restive pebble
#

smool

#

.addField

hazy sparrow
#

ok ty

stark terrace
#

so as my bot has grown past over 13k servers and over 4.5m users, should i consider moving away from d.js to a more memory-efficient lib such as eris? i do see a lot of larger js-based bots are using eris and im assuming its mainly for the reason of efficient memory usage?

hazy sparrow
#

how to get a author's ID

torn ravine
hazy sparrow
#

ty

mild flower
autumn quarry
#

download the gif

#

and then put it into your bot's folder

#

then have the bot send that file

mild flower
#

hmm

#

ok

autumn quarry
#

(tutorial for sending images)

mild flower
#

ok will watch it

hazy sparrow
#
 .setThumbnail(message.author.avatarURL)
#

does this still work

#

v12

#

discord.js

earnest phoenix
#

yea

hazy sparrow
#

ok ty

earnest phoenix
#

@hazy sparrow

hazy sparrow
#

?

earnest phoenix
#

have you studied abt Js?

hazy sparrow
#

a bit

#

not fully advanced

#

yet

earnest phoenix
#

learn fully before making bot

#

smh

hazy sparrow
#

ok

earnest phoenix
#

still 3 month left foor bot verification bro, learn first then code

hazy sparrow
#

wait

#

wrong question

#

oof

lusty quest
#

you can still verify your bot after the deadline, it will be still needed to get past 100 guilds

hazy sparrow
#

are there any max limit for how many fields can be in a embed?

lusty quest
#

25

hazy sparrow
#

ah ok

wary flame
#
response.forEach(async guild => {
                var permissions = new Permissions(guild.permissions)

                var eval = await ws.shard.broadcastEval(`this.guilds.cache.get("${guild.id}")`)
                for(var i = 0; i < eval.length; i++) {
                    var r = response[i]

                    if(r === null) continue

                    eval = r
                }
            })

Can someone explain to me how the variable eval is the same guild every cycle of the loop? I have checked guild.id is different every cycle

lusty quest
#

why did you have a loop in a loop?

wary flame
#

I am looping trough the guilds the user is in and looping trough the responses of my shards because only one shard has the actual guild

lusty quest
#

where is response defined?

wary flame
#

Response IS defined

lusty quest
#

where?

wary flame
#

As I said every cycle of the foreach loop guild.id is different

lusty quest
#

nvm now i get it

wary flame
#

I define it by using node fetch and .then

#

But how is eval the same guild on every cycle?

#

My bot is not even in that guild

lusty quest
#

its possible that it only cycles throu the first guild

wary flame
#

Not is is not possible

#

As I said every cycle guild.id is different

lusty quest
#

then your issue is the cache in the eval

wary flame
#

So every cycle the response of my shards should be different right?

#

How do I fix that?

lusty quest
#

i guess its a caching issue

#

i dont know, i never was on the point for sharding a bot and i havent had the headache attached to it

wary flame
#

I dont need to shard I just decided to take the headache now, if I do it later it will be more work

lusty quest
#

maybe discord.js-light could help (a D.js client that got some modifications for better caching behavior)

#

or wait until someone with more knowledge is here

wary flame
#

I think I will wait, moving to another library seems like something I should do as last solution

lusty quest
#

d.js-light is mostly regular d.js but with some smaller changes on the caching behavior

wary flame
#

Is usage the same?

lusty quest
#

most of it

#

exept the cache usage

wary flame
#

I see, it removes the stupid .cache

fast trench
#

learn fully before making bot
@earnest phoenix was this really needed 😅

earnest phoenix
#

yeah

lusty quest
#

it doesnt remove the cache it just optimize is

wary flame
#

Oh?

fast trench
#

how was that needed?

lusty quest
#

it still caches but under rules you can define

#

the creator of the Lib is also here on the Discord

wary flame
#

I noticed that

lusty quest
#

i guess he can answer your the questions better. if you see Tim he can help you

#

i found out about this lib yesterday and already implemented it into one bot, now i want to see how it performs

#

it should cut down on Ram usage of the bot

wary flame
#

Does it help on CPU or only RAM?

#

Only RAM...

#

I guess

lusty quest
#

i dont have large CPU usage on my Bot(s) so i cant really tell if there is a improvement

solemn latch
#

Most the stuff that really ever affects cpu much, are not caused by the library

mild flower
#

How do I add the avatarurl emoji in my embedds

#

(no i cant google this cus i dontn know what to google 🤷)

spare mirage
#

docs

#

embed

#

docs

mild flower
#

could you explain it further?

spark willow
#
let e = new Discord.MessageEmbed()
.setFooter(`Added by ${msg.author.tag}, msg.author.displayAvatarURL()`)
#

¯_(ツ)_/¯

mild flower
#

thank u

#

just what I needed

solemn latch
mild flower
#

yes

#

I agree

#

but who cares lol

solemn latch
#

Its a question that 2 minutes looking at the docs woulda given the result

#

Its always good practice and wastes less time

mild flower
#

ok ok

#

chil

spare mirage
#

:D command handler works

pure lion
#

Okay cool now learn js please and thank you

spare mirage
#

ok that was kinda toxic

hazy sparrow
#

why is it showing the [object object}

const { MessageEmbed } = require('discord.js')


module.exports = {
    name: 'server',
    description: "this is to see the server name and server member count",
    execute(message){
        const newEmbed = new MessageEmbed()
        .setTitle('Server Information')
        .addField('Server name:', message.guild.name)
        .addField('Server Count', message.guild.memberCount)
        .addField('Server Owner', message.guild.owner)
        .addField('Server Roles', message.guild.roles) 
        .setColor(0x592040)

        message.channel.send(newEmbed)

     }
 }
delicate shore
#

my ban command is not workonig

#

loll

cinder patio
#

Because message.guild.roles is an object

hazy sparrow
#

but i want it to display all the roles of the message.guild

delicate shore
#

sorry unban commadn

#

is not working

spare mirage
#

@delicate shore docs

cinder patio
#

map them, roles.map(role => role); or roles.map(role => role.toString());

hazy sparrow
#

ok ty

delicate shore
#

@delicate shore docs
@spare mirage i followed it but

spare mirage
#

show me ur code

earnest phoenix
#

@hazy sparrow dm me real quick

hazy sparrow
#

ok

restive pebble
#

take a look at this

spare mirage
#

lmaoo

#

I was about to do that

delicate shore
#

show me ur code
@spare mirage ok

#
f (command === "unban") {
    let User = msg.mentions.first()
    let Reason = args.slice(1).join(` `);
    if (!User) return msg.reply(`Who are we unbanning?`);
    if (!Reason) Reason = `Unbanned by ${msg.author.tag}`;

    if (msg.member.hasPermission("BAN_MEMBERS"))
      return msg.rely(
        "Only people with permission to ban members can use this"
      );

    msg.guild.fetchBans().then(bans => {
      if (bans.some(u => User.includes(u.username))) {
        let user = bans.find(user => user.username === User);

        msg.guild.unban(user.id, Reason);
      } else if (bans.some(u => User.includes(u.id))) {
        msg.guild.unban(User, Reason);
      } else {
        return msg.reply(`This person is not banned`);
      }
    });
  }``` @spare mirage
spare mirage
#

message.guild.members.unban @delicate shore

delicate shore
#

n

#

no

#

when i write message

#

it saus unexpected token

#

message

#

so i write msg everywhere

#

idk why

spare mirage
#

ok

#

msg.guild.members.unban

old plover
#

Hi

shadow flame
#

need help

delicate shore
#

ok ;lemme seee

#

e

pure lion
#

@delicate shore

#

h

wheat valve
#

The "Only people with permission to ban members can use this" line, the one right above it says "msg.rely" not msg.reply, that may cause issues @delicate shore

delicate shore
#

oh

#

lol

#

@pure lion ???
?

pure lion
#

Nvm it's fine

spare mirage
#

we already said that yesterday

delicate shore
#

i corrected that

#

but idk

earnest phoenix
#

you're also allowing people who don't have permissions to ban to execute the command, not the other way around

delicate shore
#

how

wheat valve
#

!message

delicate shore
#

i sent the code by mistake ^^

#

i have wirteen ! msg onyl

#

only

wheat valve
#

if (!msg.member.hasPermission("BAN_MEMBERS"))

like this

delicate shore
#

i sent old code :/

pure lion
#

await > .then imo

earnest phoenix
#

buzzy, don't spoonfeed

pure lion
#

^^^^

wheat valve
#

Okay

earnest phoenix
#

await > .then imo
this tbh, you'll see await/async pattern more than promise pattern in enterprise environments

pure lion
#

a

delicate shore
#

buzzy, don't spoonfeed
@earnest phoenix bruh

#

i sent u the old code

#

i mentioned

#

it

#

bruh bruh

#

brvh

pale vessel
#

cringe

wheat valve
#

cry is right though-

delicate shore
#

brvh

hazy sparrow
earnest phoenix
#

Will this work?
let args = message.content.split(Prefix.length).slice(" ");

pure lion
#

Why don't you

#

Tryitandseeee

delicate shore
#

bruh

earnest phoenix
#

Tryitandseeee
@pure lion on smartphones...

#

i don't have access to my pc rn

delicate shore
#

then

earnest phoenix
#

just trying to figure out smth before i go yeet myself at my pc

slender thistle
#

It's a good idea to keep notes of your ideas in an easily accessible place and then try them when you are on PC

pure lion
#

Try it and seeeee when you're on your pcccccccc

earnest phoenix
#

It's a good idea to keep notes of your ideas in an easily accessible place and then try them when you are on PC
@slender thistle that's literally why I'm trying to figure out stuff before I yeet myself at my pc because my mom won't let me "play" on my pc rn

restive pebble
#

why that gif has bbc on top

slender thistle
#

Trying stuff out on repl.it is also an option

earnest phoenix
restive pebble
earnest phoenix
#

No

restive pebble
#

glitch is gay

slender thistle
#

repl.it doesn't suck as a testing environment

earnest phoenix
#

No u

delicate shore
slender thistle
#

I've literally used it many times on phone and on PC when I didn't have a compiler/interpreter installed

restive pebble
#

it automatically installs required package

delicate shore
#

msg.user.mentions.first or what is it?

earnest phoenix
#

imagine skidding

restive pebble
#

ok

pure lion
#

mentions.users@delicate shore

delicate shore
#

oh

pure lion
#

Why did you change that I had it correct

delicate shore
#

message.mentions.users.first?

restive pebble
#

message can have other mentions also lol

pure lion
#

Well do .members because you're unbanning and you need a member object

delicate shore
#

ok

earnest phoenix
#

also

#

you might want to parse the argument instead

#

if the command is a single arg and you expect a mention it's fine

delicate shore
#
let User = msg.mentions.members.first```
#

is this correct

pure lion
#

Try it and see

earnest phoenix
#

but when you have multi-argument commands you should probably parse arguments instead of getting the first mention as that can be out of order

delicate shore
#

ohhh

#

ok its giving an error

restive pebble
#
let User = msg.mentions.members.first```

@delicate shore function lol

delicate shore
#

?/

#

()?

slender thistle
#

Will this work?
let args = message.content.split(Prefix.length).slice(" ");
Also, wouldn't this also respond to prefixes of the same length?

restive pebble
#

¯\_(ツ)_/¯

calm saddle
#
let User = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
delicate shore
#

ahh

restive pebble
#

or find is better

delicate shore
#

error

earnest phoenix
#

scenario:
you have a mycoolcommand <user argument> <string argument>

problem:
someone can input mycoolcommand hey everyone look at @somemention !!, if you use message.mentions.users.first, it will grab @somemention and not what you expected as the first argument

pale vessel
#

Also, wouldn't this also respond to prefixes of the same length?
@slender thistle it returns if the message content does not start with the prefix

#

(hopefully they did that)

delicate shore
#

my bot is

#

trash

pale vessel
#

we know

delicate shore
#

😦

restive pebble
#

lol

slender thistle
#

I don't think guild.member is a function or a constructor? @calm saddle

pale vessel
#

it is

slender thistle
#

oh really

calm saddle
#

it is

pale vessel
#

yeah, converts a userresolvable to a member iirc

restive pebble
#

yes

slender thistle
#

🤔 Just d.js things I guess

#

Nice

delicate shore
#

so

#

should i do with args

#

like

restive pebble
#

.find .get .mentions

#

use any lol

calm saddle
#

cache.find/ cache.get

lusty quest
#

and i switch now to a different d.js libary

calm saddle
#

those u need nowdays

delicate shore
#

i have never used cache.get

#

what is it's usage??/

restive pebble
#

.get()

calm saddle
#

not 12v?

restive pebble
#

like map lol

delicate shore
#

but

#

idl

#

fuk me

#

bye

calm saddle
#

bwai bai

restive pebble
#

hmmm

pure lion
#

Hmmm²

earnest phoenix
#

Wow that escalated quickly

calm saddle
#

mmHmm

lusty quest
#

i never know you can ragequit from a help channel

pure lion
#

myBrain()

delicate shore
#

i never know you can ragequit from a help channel
@lusty quest knew*

pure lion
#

i never know you can ragequit from a help channel
Call center scammers: first time?

slender thistle
#

@delicate shore You are 12?

delicate shore
#

no

pure lion
#

Uh oh

delicate shore
#

14.5

slender thistle
#

🙃

regal raven
#

🙃

restive pebble
#

bruh

pure lion
#

HM

delicate shore
#

i was born in 2005

calm saddle
#

lwl

regal raven
#

We are chatting?

earnest phoenix
#

How do I make my own discord bot?

summer torrent
#

@slender thistle it is lib version lul

delicate shore
#

ok

#

okokoko

calm saddle
#

so he 15 this year?

delicate shore
pure lion
#

How do I make my own discord bot?
@earnest phoenix which language would you like to make it in (code)

delicate shore
#

so he 15 this year?
@calm saddle yep

calm saddle
#

idk am bad at maths

earnest phoenix
#

How do I make my own discord bot?
have you tried the channel that's literally named frequently asked questions

calm saddle
#

oh yay

slender thistle
#

Quite an interesting way to phrase that but alright

pale vessel
#

they deleted the message

restive pebble
#

what

pale vessel
#

never mind whatever

slender thistle
#

nah it was me

earnest phoenix
#

@earnest phoenix which language would you like to make it in (code)
@pure lion what code?

#

Well it's my first time coding

restive pebble
#

js py cpp

summer torrent
#

learn a programming language

delicate shore
#

ok

pure lion
#

Yes do that first

restive pebble
#

sololearn or mdn

delicate shore
#

bruh

#

i thought i am the one who is bad at coding

slender thistle
#

-faq 3 13 -c

gilded plankBOT
delicate shore
#

i found a guy

#

whose bot is verified

#

and he made bot with DBD

restive pebble
delicate shore
#

brvh

earnest phoenix
#

I � Unicode

keen willow
#

hey @delicate shore hat

lusty quest
#

if you edit it enought its allowed

#

the same goes for DBM

delicate shore
#

hey @delicate shore :hat:
@keen willow hi

restive pebble
#

DISCORD bot maker is good tho

delicate shore
#

what is command to dm someone

#

like

#

if i do

restive pebble
#

message.author.send

delicate shore
#

dm @role

hidden summit
#

What is the upload limit for bots?

calm saddle
#

i just realized im 7 months in from coding d.js ; ^ ;

delicate shore
#

it dms everyone with role

pure lion
#

Oh

#

That might be API abuse

delicate shore
#

yeh

pure lion
#

Not sure

delicate shore
#

but

#

still

#

i wanna abuse

earnest phoenix
#

Lmfao

pure lion
#

Loop

restive pebble
#

yes lol

#

u can find peoples

delicate shore
#

xd

restive pebble
#

in side tha role

delicate shore
#

peoples?

restive pebble
#

and use for loop

delicate shore
#

oh

#

but

restive pebble
#

lol

delicate shore
#

glitch bans every project

#

with for loop

#

😦

restive pebble
#

dont use lol

lusty quest
#

wtf?

pure lion
#

yo I've never used a loop before

restive pebble
lusty quest
#

get a proper vps

keen willow
#

caution, don't be mad

but i do my websites in ||asp.net|| EO_eyes

earnest phoenix
#

DID SOMEONE SAY G L I T C H!?

calm saddle
#

yo I've never used a loop before
@pure lion same

restive pebble
#

for loops are best

delicate shore
#

brvh

restive pebble
#

lol

calm saddle
#

i use glitch

delicate shore
#

😦

earnest phoenix
restive pebble
#

dm everyone

pure lion
#

I use server boi

restive pebble
#

in ur bot

earnest phoenix
#

😂😂😂

delicate shore
#

ok

#

so how to dm a specifif cperosn

#

person

#

like

pale vessel
#

read docs

#

please

#

please

#

please

delicate shore
#

s!dm @restive pebble you good?

keen willow
#

please

pure lion
#

Get person as a <user> then send them a message lololololol

delicate shore
#

so

#

but

#

msg.user.send?

#

whaat is it

pure lion
#

But yes read the docs before you go anywhere else

delicate shore
#

lol

#

link?
?

calm saddle
#

my bots muted here for some reason :(

delicate shore
#

docs sucks s

pure lion
#

Msg is a message object, meaning it holds info about where the message was sent

lusty quest
#

@calm saddle common prefix

calm saddle
#

the prefix is .. :(

delicate shore
#

bruh

#

lol

lusty quest
#

then request a mod to unmute it

delicate shore
#

hey

calm saddle
#

too shy

#

lmao

delicate shore
#

lmaon

#

guys

#

help me pls

#

bruh

keen willow
#

caution, don't be mad

but i do my bots in ||vb.net|| EO_eyes

lusty quest
#

now i need to get to my next idea. how to remove stuff from a MongoDB collection that havent been updated for x time

delicate shore
#

ok

#

help mem

#

my bot says who u banning boi

calm saddle
#

what kinda method you using

#

idk if methods the right word

#

english hates me nowdays

earnest phoenix
#

caution, don't be mad

but i do my bots in ||vb.net|| :EO_eyes:
@keen willow
🚔

calm saddle
#

oh sheet

#

call 911

keen willow
#

i do everything in .net EO_eyes

earnest phoenix
#

vb is so verbose i don't like working with it at all

#

i like .net

#

just not vb

keen willow
#

i cook in .net

earnest phoenix
#

i work with c# all the time

calm saddle
#

coding

earnest phoenix
#

i even made a realtime interpreter for a minecraft server so i can make c# plugins omegaLUL

#

DID SOMEONE SAY G L I T C H!?

calm saddle
#

i did

#

:>

keen willow
#

well, i don't know c# and i need it for asp.net, so i just call a dll made in vb.net to do that IssouLaChancla

calm saddle
#

i need more brain cells to read that

earnest phoenix
#

progrmr

calm saddle
#

lmao

keen willow
#

i need more brain cells to read that
@calm saddle probably

calm saddle
#

xDD

keen willow
#

progrmr
@earnest phoenix well, it's faster than learning c#

earnest phoenix
#

how shall i get the command author's name and avatar in the embed?

#

Just deleted system32 and my pc is already speeding up thanks random YouTuber with no mic and notepad

keen willow
#

ho and btw, i can run js in vb.net 1pSpicy

earnest phoenix
#

it's not that different, it's just that keywords are mostly replaced with symbols

#

it's all the same in IL code after all KEKW

calm saddle
#

Just deleted system32 and my pc is already speeding up thanks random YouTuber with no mic and notepad
@earnest phoenix indian?

earnest phoenix
#

Idk no mic

#

Just a note pad

keen willow
calm saddle
#

oh

#

Just a note pad
@earnest phoenix definitely indian

keen willow
earnest phoenix
#

imagine running js in vb.net in c# for asp.net server :blobthinkingglare:
imagine not using an SPA framework as your frontend

calm saddle
#

smh

earnest phoenix
#

SPA is the future

regal raven
#

What is spa?

earnest phoenix
#

single page application

regal raven
#

Interesting Thonk

keen willow
#

ok, so i'm working on a project, can someone send me a video in dm?

#

anything will do

calm saddle
#

what u working on

keen willow
#

a secret project

#

you'll know if you dm me a video IssouLaChancla

calm saddle
#

ooh

#

what video

keen willow
#

anything

regal raven
#

Huh

#

Ok

earnest phoenix
#

What is the best coding language for a discord bot

#

there is none

#

such thing as a "best language for x" doesn't exist

#

you can do anything in everything

slender thistle
#

HTTP requests in Brainfuck?

earnest phoenix
#

it all comes down on how you use the language and tools available to you to implement it

#

possible @slender thistle mowpiffygootem

#

i made a c# interpreter

regal raven
#

What is brainfuck?

lusty quest
#

you can use brainfuckjs

regal raven
#

Interesting name

earnest phoenix
#

a language that fucks with your brain

regal raven
slender thistle
#

I completely forgot about interpreters lmao

#

True

lusty quest
#

or use COW

regal raven
#

I can milk it xD

lusty quest
#

i gift someone 1 year Nitro if he make a Working Bot in COW

regal raven
#

😂

spare mirage
#

whats cowe

regal raven
#

Cowe 😂

calm saddle
#

I can milk it xD
@regal raven im calling the cops-