#development

1 messages ยท Page 1014 of 1

quartz kindle
#

or use .then().catch() instead

spare mirage
#

ok

#

brb

cobalt spruce
#

can u guys help me

tight plinth
#

@cobalt spruce define args

cobalt spruce
#

How

#

@tight plinth am newbie

#

lol

tight plinth
#

Well learn how to code before asking questions here

cobalt spruce
#

Well this is a bully

lusty quest
#

its nothing against you, but it helps both sides

#

we could show you how it works but you will not understand it and maybe get a similar question in the future

opal plank
#

making bots is an intermediate level project, you are trying to bite more than you can munch

lusty quest
#

i learned most coding while writing a bot, but i usually lurked around github and stackoverflow

cobalt spruce
#

let args = message.content.substring(prefix.length).split(" ");
Do i define args like this?

opal plank
#

its the same as wanting to write an essay in russian without knowing russian

#

yeah, that'd work

cobalt spruce
#

@opal plank

#

do i need any thing like

#

Mathjs

#

or any thing else

solemn latch
#

math is part of javascript

opal plank
#

^^

delicate shore
#

@pure lion now?

cobalt spruce
#

hmm

#

so why it wont work

#

there is no error

honest perch
#

you overcomplicated your code

cobalt spruce
#

@honest perch Uhhh

#

@honest perch do u have any uncomplicated idea

#

?

solemn latch
#

if(args[1])
works just the same in this case

honest perch
#
if (!args[1]) {
      return message.channel.send("something here");
solemn latch
#

.toString is a bit excessive, you know all your strings are already strings

delicate shore
#

@restive pebble can u help with volume in YT_Search

honest perch
#

eightball[Math.floor(Math.random() * eightball.length)]

delicate shore
#

because in that vol 5 is normal

restive pebble
#

pong

delicate shore
#

if we do 100 it's earrape

restive pebble
#

yt-search is not volume lol

#

its discord.js

delicate shore
#

oh that

#

only

solemn latch
#

probably should just set it to a forced volume

#

for now

delicate shore
#

i have

#

to 5

solemn latch
#

then whats the issue

restive pebble
#

setLogarithmic

#

idk

delicate shore
#

that 5 is normal

restive pebble
#

how it works

delicate shore
#

if we do 10 it's earrape

solemn latch
#

dont let users put it on 10

delicate shore
#

if we do 50 it's mega ear rape

#

and if 100

#

then RIP

restive pebble
#

.play(lol,{
volume:50})

solemn latch
#

if above 5, put at 5

delicate shore
#

??

#

can i do like this

#

that kindly choose music in units

restive pebble
#

yes

#

compare

delicate shore
#

like 1 unit = 20 percnt

#

2 unit = 40

restive pebble
#

and if larger than 5 return some'

solemn latch
#

thats basic math

#

๐Ÿค”

delicate shore
#

what is command

#

to change volume

#

like

solemn latch
#

i suggest setting it at 5, and not letting users change it.
just like most music bots do

restive pebble
#

volume setLogarithmic

solemn latch
#

and then let users change it via their settings

pure lion
#

@delicate shore @delicate shore

#

I FIXED IT LMAOOOOOO

delicate shore
#

if(command === "volume"){
const bruhggg = Args[1]
.setvolume to Argas 1
}

#

@delicate shore @delicate shore
@pure lion wot

potent dust
#

K so how would i like get the latency of the client on discord.js

solemn latch
#

client.ws.ping

potent dust
#

thanks

restive pebble
#

@delicate shore .setVolume

delicate shore
#

Ok

restive pebble
#

in decibals

delicate shore
#

.setvolume ?

#

.setvolume = bruhggg?

restive pebble
#

function

pure lion
#

()()()()

delicate shore
#

()()()()
@pure lion
DMS pls ๐Ÿ˜ข

modest maple
#
    TEST_ARRAY = PgArray(VARCHAR.with_constraints(limit=5), array_depth=2)
    print(TEST_ARRAY.produce_table_query(name="bob"))```
#

not so stinky Postgres datatypes ๐Ÿ˜ซ

potent dust
#

So uhh im looking for some yt tutorials for discord.js bots but i always end up seeing something outdated/unfinished, is there any documentation for discord.js or such?

modest maple
#

yes

#

its called discord.js docs

#

๐ŸŽ‰

#

amazing am i right?

restive pebble
#

So uhh im looking for some yt tutorials for discord.js bots but i always end up seeing something outdated/unfinished, is there any documentation for discord.js or such?
@potent dust https://discord.js.org/

spare mirage
#

how do async functions work?

restive pebble
#

wut

#

asynchronous

solemn latch
#

asynchronously

restive pebble
#

ok

spare mirage
hazy sparrow
#

Nice

spare mirage
#

nope

#

it doesnt

#

const Discord = require('discord.js')

  module.exports = {
    name: 'kick',
    description: "this is a kick command!",
    execute(Discord, bot, message, args){
        async function f() {
            if (message.member.hasPermission("KICK_MEMBERS")) {
                if (message.mentions.members.first()) {
                    try {
                       await message.mentions.members.first().kick().then(message.channel.send("I just Kicked his" ));
                    } catch {
                       await message.reply("I do not have permissions to kick " + message.mentions.members.first());
                    }
            }else {
              await message.reply("You do not have permissions to kick " + message.mentions.members.first());
           
    
    
          
        }
          }
        
}}}

await is only valid in an async functions

solemn latch
#

yes

restive pebble
#

does it work?

spare mirage
#

no

restive pebble
#

yes

spare mirage
#

thats the error

solemn latch
#

why did you put it in a function

#

๐Ÿค”

restive pebble
#

async execute

solemn latch
#

execute is already a function

spare mirage
#

uhhh

restive pebble
#

async execute

spare mirage
restive pebble
#

๐Ÿ‘

solemn latch
#

try it

#

๐Ÿค”

restive pebble
#

try

spare mirage
#

ok ok

#

can anyone join my test server?

solemn latch
#

use an alternative account to test kick ban features

tight plinth
#

^

solemn latch
#

fully testing those commands can take hours, no one really wants to sit through that

spare mirage
#

yes I have an alt...

#

but it kinda crashes my laptop

#

backup laptop

#

fkn intel core i3

#

@Justii#3473, I do not have permissions to kick 632266069146468384
I get this response :/ how can I make it:
@Justii#3473, I do not have permissions to kick USER not userid

lusty quest
#

how did you get the userid?

spare mirage
#

message.mentions.members.first());

solemn latch
#

he is just logging the member object

restive pebble
#

.username

#

or .tag

solemn latch
#

which logs the id

earnest phoenix
#

<member>.user.id

restive pebble
#

or .tag

#

better

spare mirage
#

uhh

#

this is confusion

earnest phoenix
#

Actually the object works fine too

restive pebble
#

ur choice lol

solemn latch
#

i suggest looking at the docs for those kinds of questions

spare mirage
#

ok

#

imma just redo this shit

cobalt spruce
#

@solemn latch help

spare mirage
#

Problems

#

u have 1

#

fix it

#

@cobalt spruce

cobalt spruce
#

@spare mirage what is

spare mirage
#

go to problem

#

s

cobalt spruce
#

@spare mirage it dont matter

spare mirage
#

ok

#

uhh

#

what if u use if (message.content.startsWith())

cobalt spruce
#

@spare mirage UR LIKE A GOD

#

U SAVED ME

lusty quest
#

name needs to be lowercase

cobalt spruce
#

OMG

spare mirage
#

:P

#

I think ur const command is wrong

lusty quest
#

phew almost got my bot ratelimited (again)

spare mirage
#

btw nvm

#

@lusty quest whats that

#

xD

cobalt spruce
lusty quest
#

if you spam the Discord API your bot will get ratelimited and locked out of the api, depending on the endpoint for 24 hours

cobalt spruce
#

@spare mirage should i change it

lyric mountain
#

lul don't tell me you're putting all your commands inside a single file

cobalt spruce
#

@lyric mountain no command handler

#

yup

lyric mountain
#

that's insane

cobalt spruce
#

cuz it broked my last bot

earnest phoenix
#

how do i initiate an auto poster?

spare mirage
lusty quest
#

add the client on the dlb client

spare mirage
#

TypeError: Cannot read property 'position' of undefined

lusty quest
#

const dbl = new DBL(process.env.API_TOKEN, { webhookPort: 5000, webhookAuth: process.env.WEBHOOK_AUTH},client); @earnest phoenix

#

replace the process envs with your credentials

lyric mountain
#

cuz it broked my last bot
@cobalt spruce you can only put a handful of commands inside a single file before it becomes barely readable

earnest phoenix
#

and that pushes everything automatically?

lusty quest
#

yes

earnest phoenix
#

How often?

lusty quest
#

idk

pure lion
#

how do i get the first 10 values of an array?

lyric mountain
#

maintenance will become a hell, and don't get me started on "adding new features"

spare mirage
#

can someone help me with my error?

earnest phoenix
#

<array>.slice(0, 10);

pure lion
#

ty

cobalt spruce
#

@lyric mountain ok

#

i have like 10 or soo commands in my old bot

lyric mountain
#

you don't need to use a third-party command manager, the logic behind it is quite simple

spare mirage
#

let authorHighestRole = message.member.highestRole.position;
TypeError: Cannot read property 'position' of undefined

lyric mountain
#

but using none is simply a no no

lusty quest
#

wait for some reason my bot wont post to dbl anymore

lyric mountain
#

ain't it ratelimited?

spare mirage
#

Please help me

lyric mountain
#

highestRole is undefined

#

if you don't give us more code to look at we can't help u

spare mirage
#

kick command

lusty quest
#

i havent spammed the DBL API for now

#

and the current Guild count on the Webpage is 3 days old

lyric mountain
#

@spare mirage maybe one of the two members don't have roles at all

spare mirage
#

uhh

#

makes sense

lyric mountain
#

no roles = no highestRole = undefined

spare mirage
#

how can I do it without roles?

#

cuz my server doesnt have roles

lyric mountain
#

use an if-else clause

earnest phoenix
#

then check if server doesnt have roles

lyric mountain
#
if (member.roles) //execute if there's at least one role
else //else do this
spare mirage
#

uhh

#

ok

earnest phoenix
#

doesn't member.roles return a collection

#

it does

lyric mountain
#

doesn't it give false if empty?

earnest phoenix
#

then if(member.roles) will always be truthy

lyric mountain
#

js is weird

earnest phoenix
#

Doesn't

#

You check it's size

#

just check if highestRole is defined before using it

lyric mountain
#

@spare mirage ```js
if (member.roles.highestRole) //execute if there's at least one role
else //else do this

spare mirage
#

*brain hurts*

#

I suppose all other servers expect test servers have roles

lyric mountain
#

all servers are supposed to have at least 1 role

spare mirage
#

everyone right?

lyric mountain
#

but no member is supposed to have a role assigned to them

#

everyone is kinda excluded in some libs

pure lion
#

hey i'm having an issue with a yt search command

spare mirage
#

I really dont know what to do

cobalt spruce
#

why i cant do any good script

pure lion
#

line 491:

      let VIDEOS = VIDEO10.videos.slice(0, 9)

line 637:

            msg.channel.send(`Please choose a song (1-10)\n\n${VIDEOS.map(v => ++index + v.title).join('\n')}`)

err:

(node:30472) UnhandledPromiseRejectionWarning: ReferenceError: Cannot access 'VIDEOS' before initialization
cobalt spruce
#

...

lyric mountain
#

indent that thing smh

cobalt spruce
#

@lyric mountain

#

HELP ME

#

am died

lyric mountain
#

you haven't said what's your issue

cobalt spruce
#

alot of errors

lyric mountain
#

channel ain't defined

#

that's a single error

cobalt spruce
#

hmm

#

ik

#

but how i fix it

#

?

#

@lyric mountain

lyric mountain
#

stop mentioning me

cobalt spruce
#

ok

lyric mountain
#

you didn't define channel anywhere

magic jackal
#

client.channels.cache.get

cobalt spruce
#

@magic jackal that is a id formate?

spare mirage
#

imma create one new command

#

lmaooo

cobalt spruce
#

lol

spare mirage
#

moderation is so fkn hard to make

#

I actually hate it

pure lion
#

no its noooooooooot

spare mirage
#

it is

cobalt spruce
#

IT IS HARD AF

pure lion
#

slowmode is literally 2 lines

spare mirage
#

im talking about BANS KICKS MUTES

#

fkn 40 lines

pure lion
#

oh those

#

ban and kick ez

spare mirage
#

no u

pure lion
#

mute, heh

#

mute.

cobalt spruce
#

@spare mirage bruh

#

kick and ban are in discordjs

celest schooner
#

bruh moderation commands are so fricken annoying to make

cobalt spruce
#

website

pure lion
#

smeh

celest schooner
#

like wtf its not even fun

cobalt spruce
#

u need only to add perms

pure lion
#

coding is always fun

cobalt spruce
#

YES

celest schooner
#

i hate coding moderation commands

cobalt spruce
#

when u kill ur pc

pure lion
#

if it makes you feel any better heres how to kick people

cobalt spruce
#

@pure lion bro how i make my bot globaly?

celest schooner
#

globally?

cobalt spruce
#

like logs could be seen in only one server

celest schooner
#

use a database

#

and set values for each server

cobalt spruce
#

@celest schooner no

#

if my bot in 1k server

#

what i do

#

Ha

celest schooner
#

uh you dfo the exact same thing

cobalt spruce
#

the bot give them values

#

or what

celest schooner
#

you make a command so the owner can set values themselvesx

cobalt spruce
#

...

spare mirage
#

@cobalt spruce copy pasting is for dumb people

#

lmaoo

cobalt spruce
#

@spare mirage NAH

spare mirage
#

kinda is

cobalt spruce
#

Nope

still merlin
#

it is

spare mirage
#

u dont learn

#

I try...

lyric mountain
#

imagine a big locker

#

each belonging to a server

pure lion
#

haha sike

spare mirage
#

xD

#

imagine

pure lion
#

gotta work for it jajajajaj

lyric mountain
#

each server has their own data stored inside their locker

#

that's basically a database

pure lion
#

they call it cache because it explodes when you stop looking at it

celest schooner
#

they call it cache because no one can afford it

#

how do you linebreak in react

lyric mountain
#

actually, just put the strings inside brackets

#

and handle it like a normal string

#

\n

celest schooner
#

Okay thanks

still merlin
#

help me pls im using the dbl vote stuff to send a embed to a channel and i get error

 .addField(`Voter`, vote.user)
                     ^

ReferenceError: vote is not defined```
celest schooner
#
<h1>{"text\n"}</h1>
            <button onClick={continueButton}>Continue</button>```
#

it doesnt work

regal raven
#

What are clusters and shards?

celest schooner
regal raven
#

Any link an to explanation would also be appreciated

earnest phoenix
#

shards are self explanatory, they split a big bot into smaller parts hence "shards"

regal raven
#

Oooh

earnest phoenix
#

clusters are mostly used in huge bots where each shard has its own machine but they're interconnected

#

so they can communicate with each other

torn ravine
#

does anyone know a good way to store message embeds

earnest phoenix
#

elaborate

spare mirage
#

breh

pure lion
#

does anyone know a good way to store message embeds
@torn ravine store the values then put it into an embed

still merlin
#

I cant even read that

torn ravine
pure lion
#

db

spare mirage
pure lion
#

dont use json

#

dont

torn ravine
#

of course not

spare mirage
#

SyntaxError: Invalid or unexpected tokenv

earnest phoenix
#

you have a syntax error, you can identify and fix it yourself

#

stop copypasting your code here expecting that people will fix your code for you

spare mirage
#

bruh

#

ive been searching for 10 mins

earnest phoenix
#

that's not an excuse

still merlin
#

Suggestion: Learn js before you make a bot, that helped me out a lot-

torn ravine
#

@spare mirage there's something in your code that shouldn't be there

earnest phoenix
#

the stacktrace tells you at which exact line it identified a syntax error

#

learn to work with your environment

lyric mountain
#

@spare mirage first step: INDENT UR CODE

#

finding the issue will be 10x harder if the code isn't properly indented

spare mirage
#

?

#

@lyric mountain wdym INDENT

slender thistle
#

spaces/tabs before the actual code

lyric mountain
#
if (something) {
  somefunction(aa, bb);
  if (anotherthing) {
    //stuff
  }
}
#

compare to this:

#
if (something) {
somefunction(aa, bb);
if (anotherthing) {
//stuff
}
}
hasty lotus
#

Hey, i'm trying to make a role reaction system, with the event messageReactionAdd, but when i set the reaction it just doesn't work. I tryed to add a console.log at the forst line of the event block, but it doesn't log. Does messageReactionAdd event only work with messages sent after the process start ?

spare mirage
#

ahh ok

smoky spire
#

yes unless you have partials on

hasty lotus
#

yes
@smoky spire yes who ?

smoky spire
#

you

hasty lotus
#

what is partials ?

#

๐Ÿ˜…

#

and how do i enable it ?

smoky spire
#

makes it so the event just emits an object with the id so you can fetch it instead of not emitting the event

slender thistle
#

Partials are basically barebones objects that might not have some properties

smoky spire
#

it's in the clientoptions

hasty lotus
#

what client options ?

#

where ?

#

๐Ÿ˜“

spare mirage
#

IM about to smash my pc

hasty lotus
#

IM about to smash my pc
@spare mirage why ? ๐Ÿคจ

celest schooner
#

whats this React Hook "useState" is called in function "titlePage" which is neither a React function component or a custom React Hook function

pure lion
#

https://hasteb.in/iweqabod.js
its still returning this error:

(node:30472) UnhandledPromiseRejectionWarning: ReferenceError: Cannot access 'VIDEOS' before initialization

but i declared VIDEOS above already

spare mirage
#

this shit is so fkn dumb

hasty lotus
#

@pure lion what line ?

pure lion
#

wait brb

spare mirage
#

should work

pure lion
#

14, 160

#

var at 14

hasty lotus
#

the error is on line 14 ?

earnest phoenix
#

whats this React Hook "useState" is called in function "titlePage" which is neither a React function component or a custom React Hook function
@celest schooner
since react hooks are functions and not actual classes, they can't have fields, so to have a variable that's tracked by a state you use useState which returns the variable and the function to update the variable

#

updating the variable triggers a re-render

hasty lotus
#

line 14 is the let declaration line

earnest phoenix
pure lion
#

the error is on line 14 ?
@hasty lotus no the error is on line 160 sorry

hasty lotus
#

guys how do i user and enable "partials" ?

#

oh ok

spare mirage
hasty lotus
#

@pure lion you haven't declared it

#

you declared it in the case "play" block

pure lion
#

w-

#

balls

hasty lotus
#

and you try ton get it in the search block

#

:/

celest schooner
#

@earnest phoenix const [continued, setContinue] = useState(false)

earnest phoenix
#

read your error @spare mirage

celest schooner
#

isnt that what im doing

spare mirage
#

I did :/

earnest phoenix
#

...yeah InternetRamen?

hasty lotus
#

guys how do i use and enable "partials" ?
...

earnest phoenix
#

read the docs

#

they cover it

hasty lotus
#

djs docs ?

earnest phoenix
#

yes

spare mirage
#

like forreal there isnt a syntax error at line 9

#

and if there is im fkn blind

pure lion
#

omg im a retarded

#

:D

#

@hasty lotus ty

hasty lotus
#

np

earnest phoenix
#

uh

digital ibex
#

no

earnest phoenix
#

no

digital ibex
#

try searching partial in the search bar, it might show

hasty lotus
#

๐Ÿ˜ฆ

earnest phoenix
hasty lotus
#

hmm ok

#

guys

#

event the partial thing doesn't work

#

๐Ÿ˜ฆ

daring garden
#

Am I right that the bot needs manage messages permissions to remove a userโ€™s reaction, even on the botโ€™s own message?

hasty lotus
#

yes

#

i think so

daring garden
#

unfortunate

#

Guess I can just delete the message and resend it with updated content/reactions

#

Thatโ€™s no fun tho

spare mirage
#

bruhhhhh

hasty lotus
#

it's possible

#

bruhhhhh
@spare mirage what ?

spare mirage
#

ban commands are weird

earnest phoenix
#

How do i make the bot reply when a user dms him? And can i use bot.once inside of bot.on

hasty lotus
#

why ?

spare mirage
celest schooner
#

If i have
<h1> </h1>
<button> </button>
in jsx how do I make it so the button is under the heading and is in the center?

spare mirage
#

been trying for 30 mins

earnest phoenix
#

This is probably not the question you'll ask here @celest schooner

celest schooner
#

{"\n"} doesnt work

hasty lotus
#

How do i make the bot reply when a user dms him? And can i use bot.once inside of bot.on
@earnest phoenix

client.on("message", async (msg) => {
  if(msg.channel.type == "dm") {
    msg.channel.send("Dm message recieved")
  }
})```
potent dust
#

I have this error ;-;

Cannot read property 'execute' of undefined

This is the line that gives me the error

client.commands.get('status').execute(message, args);
earnest phoenix
#

@earnest phoenix

client.on("message", async (msg) => {
  if(msg.channel.type == "dm") {
    msg.channel.send("Dm message recieved")
  }
})```

@hasty lotus what's async

hasty lotus
#

@potent dust show the content of your external command file

#

async is for await, but nvm i haven't used await here

#

just i always use it

#

^^

spare mirage
#

u dont need asyncc

earnest phoenix
#

does message.channel.send in the above dm the user?

hasty lotus
#

yep

#

it checks if the type of the channel is dm

#

if it is, then sending a message in the dm type channel will send a dm

#

๐Ÿ˜‰

earnest phoenix
#

also can i use bot.once Inside bot.on

spare mirage
#

can I make the bot copy the messages the ppl send to my bot and let my bot send them to me?

hasty lotus
#

no

#

bot.once will execute when the bot will recieve the event

#

but only once

#

bot.on will execute every time the bot recieves the event

earnest phoenix
#

i want that exactly

hasty lotus
#

can I make the bot copy the messages the ppl send to my bot and let my bot send them to me?
@spare mirage well, technically yes, but idk i might be forbidden by the ToS

#

and it's just spying

#

๐Ÿ˜‚

earnest phoenix
#

but i want bot.once INSIDE bot.on so it sends a DM to the user when he types !smth and waits for another message in the dm but only once

spare mirage
#

I dont think it is

#

Im dont with this error

hasty lotus
#

but i want bot.once INSIDE bot.on so it sends a DM to the user when he types !smth and waits for another message in the dm but only once
@earnest phoenix well an event inside another event isn't possible

earnest phoenix
#

f

hasty lotus
#

but you can make a variable

#

like a Set()

#

and add every users to this set

#

and if the set has the user you return

earnest phoenix
#

can i make it so when someone types !smth it dms ghe user with "type smth" and when thw user types "smth" the bot excecites smth but only once can the command smth be dmed to the bot if the user has ran !smth and this is getting confusing

spare mirage
#

uhh

#

english pls

hasty lotus
#

eeh

#

same reaction as Justii

#

x)

spare mirage
regal raven
#

A while ago my bot showed
1400 members in 15 servers and now it shows 8800 members in 195 servers i think there is a problem is there?

#

Did my bot get verified and a lot of people added my bot?

solemn latch
#

how are you measuring members and guilds

#

๐Ÿค”

earnest phoenix
#

Your bot should have the tag verified

regal raven
#

By getting length of server list and adding the length of member list from each server

#

It worked perfectly

solemn latch
#

got eval command?

hasty lotus
#

https://hastebin.com/osubepikeb.cs
ive been searching for 40 mins now please help
@spare mirage sorry, i don't see any errors there, try to remove the const banReason line

spare mirage
#
        var mcount = bot.users.cache.size
        var scount = bot.guilds.cache.size
        var tcount = bot.channels.cache.filter(c => c.type === 'text').size
        var vcount = bot.channels.cache.filter(c => c.type === 'voice').size

this always works

hasty lotus
#

By getting length of server list and adding the length of member list from each server
@regal raven use client.users.cache.size

regal raven
#

I just re ran the code and it is fixed now

#

Noice

hasty lotus
#

and client.guilds.cache.size

regal raven
#

For js?

hasty lotus
#

yes

solemn latch
#

users.cache.size is only the number of of cached users btw

hasty lotus
#

aren't you using djs ?

regal raven
#

No

#

I use python

#

๐Ÿ˜

hasty lotus
#

oh ok sry then

regal raven
#

It is easier for me

silent berry
#

how do i fetch a invite from a server? i have there id and i want to check how many bots are there

regal raven
#

No problen

lyric mountain
#

how do i fetch a invite from a server? i have there id and i want to check how many bots are there
@silent berry no need to use an invite

#

just fetch the guild itself

regal raven
#

I use len(client.guilds) to get server count and a loop to get member count in each server and add them

spare mirage
#

still doesnt work @lyric mountain

silent berry
#

im js

regal raven
#

Nicr

lyric mountain
#

what doesn't work?

spare mirage
#

the ban command

#

same error

#

oops

#

wrong ping

#

xD

lyric mountain
spare mirage
#

@hasty lotus

silent berry
#

@lyric mountain so what do i do?

lyric mountain
#

1 - get a guild by its id
2 - filter the members in it using the .filter(m => m.user.bot)
3 - get the size of the collection

hasty lotus
#

but

#

wait

#

index.js

#

line 17

#

what is there ?

spare mirage
#

@hasty lotus

hasty lotus
#

it's so weird

spare mirage
#

ikr

#
bot.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(message.content.startsWith(PREFIX + "ping")) {
        bot.commands.get('ping').execute(Discord, bot, message, args);
    }else if(message.content.startsWith(PREFIX + "image")) {
        bot.commands.get('image').execute(Discord, bot, message, args);
    }else if(message.content.startsWith(PREFIX + "stats")) {
        bot.commands.get('stats').execute(Discord, bot, message, args);
    }else if(message.content.startsWith(PREFIX + "purge")) {
        bot.commands.get('purge').execute(Discord, bot, message, args);
    }else if(message.content.startsWith(PREFIX + "ban")) {
        bot.commands.get('ban').execute(Discord, bot, message);
    }
});
 // commands

bot.login(token); //logs in
#

is there smtng wreong here

solemn latch
#

well, your using a command handler, but only using half the features of it for one

spare mirage
#

?

solemn latch
#

you dont need to if else for every command

lyric mountain
#

you could do like bot.commands.get(args[0].replace(PREFIX, "")).execute(Discord, bot, message, args);

solemn latch
#

^

#

thatll get the right command, and run it

spare mirage
#

that shouldnt be the problem

hasty lotus
#

xDD

spare mirage
#

I define args in ban.js

hasty lotus
lyric mountain
spare mirage
#

no

solemn latch
#

seems index line 17 is the loading of the command

#

which likly means its a command giving that error

lyric mountain
#

use another file for commands

#

don't put everything inside index.js

spare mirage
#

I DONT

#

thats the handler

solemn latch
#

put comments before things

lyric mountain
#

ah, nice then

solemn latch
#

not after

#

๐Ÿค”

prime trout
#

a question, but if my bot exceeds 100 servers (and is not verified) what happens?

spare mirage
#

nothing

slender thistle
#

Until October 7th, nothing

prime trout
#

what happens next?

slender thistle
#

After that, no one will be able to invite it anywhere

solemn latch
prime trout
#

ah

solemn latch
#

your bot already sends args in execute

#

why redefine it

lyric mountain
#

also your bot will be ddosed with the presences payload if you don't have the user_presences gateway

spare mirage
#

uhh

lyric mountain
#

which requires verification

prime trout
#

you refer to me@lyric mountain

solemn latch
#

i would bet the vast majority of bots dont need user_presenses

lyric mountain
#

yes

spare mirage
#

const args = message.content.slice(PREFIX.length).split(/ +/);
they diferent index.js ^
const args = message.content.split(' ').slice(1);
ban.js ^

prime trout
#

?*

solemn latch
#

should just disable the intent

#

you should send the same args everywhere

#

its much more consistant

spare mirage
#

kk

#

imma test that

#

still errors though

solemn latch
#

also, theres not a lot of reason to send Discord and your bot everywhere.
you can require discord(or specific parts of discord) in any file you need.
and message has message.client which is the same thing anyway

earnest phoenix
#

If my bot DOESN'T do stuff like downloading the whole member list and it reaches 100 servers, what happens

solemn latch
#

args doesnt need slice if your using the one in your command handler

#

since you already sliced it

lyric mountain
#

If my bot DOESN'T do stuff like downloading the whole member list and it reaches 100 servers, what happens
@earnest phoenix post october 7th, you won't get to 101 servers

spare mirage
#

args doesnt need slice if your using the one in your command handler
@solemn latch then what

#

im tired and done with this but I want to finish

solemn latch
#

you can just join them

spare mirage
#

const banReason = join(' '); โ€‹

#

?

solemn latch
#

no

#

join args

calm saddle
#

you need to understand how the args work

spare mirage
#

:/

calm saddle
#

then it will be very easy

still merlin
#

google arguments in js

calm saddle
#

but we all use different methods

earnest phoenix
#

If my bot DOESN'T do stuff like downloading the whole member list and it reaches 100 servers, what happens

lyric mountain
#

If my bot DOESN'T do stuff like downloading the whole member list and it reaches 100 servers, what happens
@earnest phoenix you ๐Ÿ‘ won't ๐Ÿ‘ reach ๐Ÿ‘ 101 ๐Ÿ‘ servers

solemn latch
#

right now, nothing

spare mirage
solemn latch
#

after october you need to be verified by discord to have more than 100 servers

earnest phoenix
#

Why

spare mirage
#

new api

lyric mountain
#

because that's a verification-wall

#

to prevent spam bots

earnest phoenix
#

I don't like coinflips between life and death

lyric mountain
#

that ain't a coinflip

#

it's a simple requirement

#

verified = 100+ servers

earnest phoenix
#

My frnd's bot was blocked for being "abnormally popular"

lyric mountain
#

yes

craggy token
#

I've seen some spambots that were verified by Discord

solemn latch
#

temporarily blocked*

craggy token
#

so it's not even safe

lyric mountain
#

that's because it had unnatural growth

earnest phoenix
#

Peeps invite your bot too fast = discord yeets your bot

solemn latch
#

thats a temporary thing

#

๐Ÿค”

lyric mountain
#

so it's not even safe
@craggy token if the owner is banned from discord, they'll not be able to verify ever again

earnest phoenix
#

Also what's the requirements for verification and what stuff will my bot get blocked for

craggy token
#

@craggy token if the owner is banned from discord, they'll not be able to verify ever again
@lyric mountain daym that sucks

spare mirage
#

but still
please help

still merlin
#

omg

#

google args

#

in js

spare mirage
#

bruh

lyric mountain
#

@lyric mountain daym that sucks
@craggy token well, only if you get banned for making spam bots

spare mirage
#

const banReason = args.join(' '); โ€‹

#

this should fkn worek

solemn latch
#

in some of your lines, your running execute in diffrent ways

lyric mountain
#

Also what's the requirements for verification and what stuff will my bot get blocked for
@earnest phoenix use common sense and you'll be fine

earnest phoenix
#

I have an economy system and people can donate me bitcoin and get coins inside the bot. Donnly got banned for making money off of the API so will my bot get blocked too?

solemn latch
calm saddle
#

const banReason = args.join(' '); โ€‹
@spare mirage are you using handler

earnest phoenix
#

Dank memer does so

spare mirage
#

yes

solemn latch
#

be consistant

#

throughout

still merlin
#
let Your name Here = args.slice(Your args here).join(" ");
lyric mountain
#

I have an economy system and people can donate me bitcoin and get coins inside the bot. Donnly got banned for making money off of the API so will my bot get blocked too?
@earnest phoenix you won't get blocked for that

#

that's called donation

calm saddle
#

const banReason = args.join(' '); โ€‹
@spare mirage you need to slice off the argument where you mention who you wanna ban

craggy token
#

yeah I believe donation and premium perk stuff is safe

spare mirage
#

I did in indexsj

craggy token
#

but an absolute paywall isn't

earnest phoenix
#

But donnly only took maintenance fees

#

And they got banned

#

And there are giveaway servers that make money by other peeps advertsing their server

#

So

lyric mountain
#

use ๐Ÿ‘ common ๐Ÿ‘ sense

#

if it feels like illegal, it probably is illegal

earnest phoenix
#

I don't have that

spare mirage
#

const args = message.content.slice(PREFIX.length).split(/ +/);

#

@calm saddle

solemn latch
#

your removing just the prefix there

#

and splitting

#

your command name is still in args

earnest phoenix
#

how do i do that for mentions inside messages

solemn latch
#

and the mention is also in args

earnest phoenix
#

like cut out the mention part

#

and leave the rest off the message

solemn latch
#

all mentions? or just the first one?

#

!command mentionhere other things

#

or
!command things mention things

earnest phoenix
#

so it removes everything before the mention including the mentikn

solemn latch
#

js?

spare mirage
#

const args = message.content.split(' ').slice(1); @solemn latch this better?

earnest phoenix
#

like :
!sometextbeforemention @earnest phoenix sometextaftermentionandyesiusejavascript
Then it splits the message so args is sometexaftermentionandyesiusejavascript

spare mirage
#

im done

calm saddle
#

no the one you had in index.js is good

spare mirage
#

ive been trying this command for 3-4 hours

earnest phoenix
#

I store EVERYTHING in index.js should i worry

calm saddle
#

but in the actual code let msg = args.slice(1).join(" "); do that

spare mirage
#

still doesnt work

#

Im about ot just copy paste from github

calm saddle
#

so it is slicing of the part where you mention the user and joining the rest of the args

#

with space

#

dayym

lyric mountain
#

I store EVERYTHING in index.js should i worry
@earnest phoenix yes

#

that's a massive issue

calm saddle
#

our methods are different

torn ravine
#

copy pasting is never a good idea. atleast watch a tutorial if you're going to be lazy

lyric mountain
#

dude's writing a bible

solemn latch
#

im prepared to read it

drowsy jewel
#

lmao

earnest phoenix
#

i wanna make a C!give <mentioned user <amount> thingy in my bot, this is the code i want to run:

try {if (db.get(`userBalance_${message.author.id}.balance` < (the amount in the message)  
{
message.channel.send("poor you don't have enough muny");
} elseif (<no mentioned user> || <no amount specified>) {
message.channel.send("you typed the command wrongly, thr syntax is C!give <user> <amount>");
} else {
db.subtract(`userBalance_${message.author.id}.balance`, <amount>
}
db.add(`userBalance_${<mentioned user's ID>}.balance` , <amount>);
catch(err) {
message.channel.send("some error occurred, hope my dev is online tell him to check the logs");
}

But how in the world do i actually do thia and i wrote a bible @solemn latch @lyric mountain

#

Never code on smartphones

#

HAIL KEYBOARD

lyric mountain
#

lemme make it a bit more readable

earnest phoenix
#

And there was probably wrong syntax there

#

And please DM me if I'm offline I'm off to sleeeeep

#

you're also writing a bible

#

can you learn some js & d.js

solemn latch
#

no

#

i refuse to learn anything

earnest phoenix
#

Who has lines of giveaway codes please in json

pure saddle
#

karลŸm

#

git รถฤŸren

solemn latch
#

code in json?

pure saddle
#

kimse sana bedava kod vermiyor

earnest phoenix
#

json olarak mฤฑ

#

Or js

#

Tf are yoi trying to say @earnest phoenix

pure saddle
#

json kodlarฤฑ vereyim ben

lyric mountain
#

lol, I give up trying to format that

solemn latch
#

lol

earnest phoenix
#

i refuse to learn anything
@solemn latch I didn't said to u

solemn latch
#

just stick it in vs and hit format

earnest phoenix
#

Thank you @pure saddle

#

You just saved ten years

pure saddle
#

git รถฤŸren

earnest phoenix
#

Woo

lyric mountain
#

just stick it in vs and hit format
@solemn latch not possible, so many syntax issues

solemn latch
#

ah

earnest phoenix
#

Yes

pure saddle
#

kimse sana hazฤฑr kod vermeyecek

#

ยฏ_(ใƒ„)_/ยฏ

solemn latch
#

lol

#
try {
    if (db.get(`userBalance_${message.author.id}.balance` < (the amount in the message)  
{
        message.channel.send("poor you don't have enough muny");
    } elseif(<no mentioned user> || <no amount specified>) {
        message.channel.send("you typed the command wrongly, thr syntax is C!give <user> <amount>");
} else {
            db.subtract(`userBalance_${message.author.id}.balance`, <amount>
                }
db.add(`userBalance_${<mentioned user's ID>}.balance` , <amount>);
catch(err) {
                        message.channel.send("some error occurred, hope my dev is online tell him to check the logs");
}

earnest phoenix
#

english only in this channel

solemn latch
#

my vsc did okay

#

it tried

lyric mountain
#

your vsc is having a seizure

earnest phoenix
#

Who has the lines of giveaway code and invite manager please in json

#

no

#

no ?

pure saddle
earnest phoenix
#

tf are you trying to say

solemn latch
#

json isnt a programming language

#

๐Ÿค”

lyric mountain
#

he wants some spoonfeeding

pure saddle
#

yep

lyric mountain
earnest phoenix
#

lol

pure saddle
#

:spoonfeed:

earnest phoenix
#

but i want too

#

French Lynes ?

pure saddle
solemn latch
#

someone said theres a giveaway library

earnest phoenix
solemn latch
#

for discordjs

earnest phoenix
#

The json codings its parreil que js?

lyric mountain
#

67k per month, holy circus

earnest phoenix
#

json is a notation

solemn latch
#

๐Ÿค”

earnest phoenix
#

JavaScript Object Notation - it isn't a programming language

#

if you expect to be spoonfed - no

#

just explain me how i can use args to:
User sends message: C!give @earnest phoenix 6000
let usertogivecoins = @earnest phoenix
let amounttogivecoins = 6000;
then some code that i have figured out
how do i do that

#

spoonfeed me lol

lyric mountain
#

split the message into an array

earnest phoenix
#

my mom SOMETIMES feeds me while im playing Minecraft

solemn latch
#

i dont know mongodb, which i think is what you use?

#

๐Ÿค”

lyric mountain
#

this is a test message with split will become [this, is, a, test, message]

earnest phoenix
#

npm i discord-giveaways Its not the lines of code @solemn latch

pure saddle
#

wdym

solemn latch
#

its a library

still merlin
solemn latch
#

for doing what you want

earnest phoenix
#

On the site there are no lines of code

solemn latch
#

yes there is

pure saddle
#

we dont give code (spoon-feed)

#

go learn or use npm packages

earnest phoenix
#

Ah

craggy token
#

dw if you're a beginner it takes some time for everything to click in

lyric mountain
pure saddle
#

xd

earnest phoenix
#

I am French and my translators beuge

misty sigil
#

how do i use a github webhook

#

it returns 400 every time i swear

solemn latch
#

github to discord?

#

or

misty sigil
#

g > d yes

solemn latch
#

๐Ÿค”

earnest phoenix
misty sigil
#

i have tried that

solemn latch
#

its the first result

#

or second

#

i use the second

#

๐Ÿค”

lyric mountain
#

@earnest phoenix dude, I'm gonna save that url for future spoonfeed defence

earnest phoenix
#

if it doesn't work - congrats you managed to mess up a step by step tutorial with pictures

solemn latch
#

๐Ÿค”

#

honestly the rules should be error messages or concepts only.

ie, if you have an error, you can ask.
if you have a concept(a direction, a method of doing something, whatever, broad ideas) you can ask.
asking things like, how do i handle args is really a google type of question 95% of the time.

earnest phoenix
#

the general rule of thumb is to do research on your question, if you cannot find your answer then you'd go and ask on places like discord guilds // forums

solemn latch
#

yeah

earnest phoenix
#

but uh over half of "bot developers" here never heard of the term research

opal plank
#

imagine reading docs, pfff

digital ibex
#

thats just sad

spare mirage
sudden geyser
#

it means the ban string key could not be found in the commands collection/map

spare mirage
#

ahh fixed

opal plank
#

edwin ๐Ÿ‘€

strange trout
#

What type of VPS specs do you guys have?

opal plank
#

no vps here, running my bots on my database server machine

solemn latch
#

i have two.
a 2gb with 1 core E5-2697V2
my second is a 1gb with a ryzen 3900x core

#

i plan on getting a few more of the ryzen vps's

signal bear
strange trout
#

I probably need to upgrade once my main bot grows more

#

I have the base DO plan

plucky harness
#

How to make a restart command

#

My bot is running on tmux Ubuntu

solemn latch
#

nodejs?

plucky harness
#

I don't use pm2

#

So only option is os

#

But it's not very good

solemn latch
#

๐Ÿค”

plucky harness
#

Py

solemn latch
#

youd have to make the command run a script that stops the bot, and starts it again i think

plucky harness
#

Yes

#

But thing is how to do it

#

Using os its not a very good idea

solemn latch
#

why not use pm2

plucky harness
#

Pm2 is not for py

#

Or at least doesn't work well

solemn latch
#

pm2 can work with python from what i understand

#

hmm

topaz fjord
#

pm2 can run py

#

ez

plucky harness
#

Will it start it as a tmux session

solemn latch
#

if you have something that can start the program automatically you can also just close it.
doesnt have to be pm2.
which you should have something auto restarting the bot.

plucky harness
quartz kindle
#

@solemn latch have you tried running a benchmark on the ryzen machine?

solemn latch
#

nope. they are okay.
not nearly the speed i was expecting

#

still really good for $5 a month

#

i can run a benchmark, just lmk what

quartz kindle
#

curl -sS https://raw.githubusercontent.com/jgillich/nixbench/master/nixbench.sh | sh

#

try running that

earnest phoenix
#
{ MongoWriteConcernError: No write concern mode named 'majoritys' found in replica set configuration
#

help me

#

idk why

solemn latch
quartz kindle
#

no cpu passthrough?

solemn latch
#

nope

#

๐Ÿค”

quartz kindle
#

rip

#

sha256 looks good tho

#

much better than mine

solemn latch
#

intresting

low phoenix
#

'${client.guilds.channel}.size' what is the correct? I don't find in the documation.

solemn latch
#

left is my worse cpu
rights the better

opal plank
#

@low phoenix what are you trying to do?

solemn latch
#

size needs to be inside the {}

quartz kindle
#

aes needs cpu passthrough, otherwise its running in software mode

low phoenix
#

@opal plank count the channels of all servers.

opal plank
#

even if it was, guild.channel isnt a method. guild.channelS, is

solemn latch
#

ill ask my vps provider

#

๐Ÿค”

opal plank
#

@low phoenix ${client.guilds.channels.size}

low phoenix
#

For v11?

earnest phoenix
#

yes

opal plank
#

v12

#

always use updated versions

low phoenix
#

v12 is bad

#

i like v11

opal plank
#

v11 is going to be deprecated

#

good luck with something that wont work in a few months

quartz kindle
#

v11 will stop working soon lmao

low phoenix
#

why

opal plank
#

cuz its old

low phoenix
#

๐Ÿ˜ฉ

#

its one version

opal plank
#

stop being afraid of updating your old code

#

theres a guide that shows precisely all the changes in syntax

pure lion
#

okay its time to start learning express

#

any tips before i begin?

opal plank
pure lion
#

thats how i lea-

opal plank
#

i feel like at this point of me being here, i learned that its almost a requirement to tell people to check docs beforehand

pure lion
#

i learn through the docs lma9lma9

cunning gorge
#

Im trying to have a config option for users to customize there rank card color with a hex color, how do I check if the users argument is a valid hex code? Please ping me if you have an answer ๐Ÿ™‚

pure lion
#

check if its 7 letters long, starts with #

opal plank
#

fuck i had a regex long ago for that

#

lemme see if i can find it rq

low phoenix
#

discord.js-commando is only right for v11?

cunning gorge
#

But that doesnt account if a letter has Z

#

or something

pure lion
#

then check if it includes z too lol

opal plank
#

/^#[0-9A-F]{6}$/i.test('#AABBCC')

pure lion
#

*copies loudly*

cunning gorge
#

lel

#

thx

#

thats the i.test part?

opal plank
#

the test is what you test on the regex

#

you dont know regex, do ya?

pure lion
#

i dont

#

teach me oh great one

cunning gorge
#

nope

opal plank
#

/^#[0-9A-F]{6}$/i this is the regex, the test is a method for testing a string , which here is the '#AABBCC'

pure lion
#

/^#[0-9A-F]{6}$/i.test(string)

#

epic

cunning gorge
#

Ah, so instead of that I would put the argument?

opal plank
#

test will test the string and return true or false

#

you can do match, test, anything with the regExp

cunning gorge
#

ooo gotcha

#

thanks mate

opal plank
#

๐Ÿ‘

cunning gorge
#

So for example
does this work?

if(/^#[0-9A-F]{6}$/i.test(args[1]) == false){
return;
}
lyric mountain
cunning gorge
#

or is that not a correct way of doing it

opal plank
#

works, yes, but its a shit way of doing it

cunning gorge
#

oof, whats a better way lel

low phoenix
#

whats the discord.js-commando for v12?

pure lion
#

try it and s e e e e e e e e e e e e e e e e

opal plank
#
if(!/^#[0-9A-F]{6}$/i.test(args[1])) return;```
cunning gorge
#

thanks

opal plank
#

read this later

cunning gorge
#

Thanks!

quartz kindle
#

@low phoenix its not officially released yet afaik, you have to install from github

pure lion
#

:look_away_drake: learning through yt
:happ_drake: learning through the docs

opal plank
#

for the love of god, dont learn from youtube

#

nor get the "pre-made bots"

pure lion
#

ew

#

ewewewewew

opal plank
#

thats the "i dont know what im doing and i dont wanna go thru the effort of learning" way of doing things

#

both are just copy-pasting

low phoenix
quartz kindle
#

you have to uninstall the v11 one first

low phoenix
opal plank
#

you have to uninstall the v11 one first

low phoenix
#

yeah

opal plank
#

run npm uninstall discord.js-commando

#

then npm install discordjs/Commando

quartz kindle
#

you have to wait, sometimes npm is slow, especially on windows it can be slow as fuck

opal plank
#

@quartz kindle yo tim, how'd you get certified dev role?

solemn latch
#

i dont think they give em out anymore

small prairie
#

Make a bot, Get it certified

quartz kindle
#

i was lucky

opal plank
#

hmmm interesting

quartz kindle
small prairie
#

They stopped that right?

opal plank
#

i got a bot, no certified role lul

quartz kindle
#

i think so

small prairie
#

ye

solemn latch
#

!givecert @opal plank

quartz kindle
#

i heard people are waiting for an answer for over 6 months

small prairie
#

before only offline way was there

solemn latch
#

i tried

small prairie
opal plank
#

hmmm interesting, what was it about before when it was opened?

#

im guessing same as bot developer but they went throughly into your code?

small prairie
#

not at all

quartz kindle
#

they dont go through your code

small prairie
#

just for unique good and nicely presented bots afaik

opal plank
#

not even Discord goes thru the code when verifying

quartz kindle
#

they test stability, uptime and uniqueness

opal plank
#

hmmmm, guess my bot would pass rather easily on that

#

too bad it aint opened anymore

solemn latch
#

mine wouldnt

opal plank
#

would love the colorful role

small prairie
#

Mine would too the one i just put in for approval

quartz kindle
#

afaik my bot is still unique across the entire discord lul

small prairie
#

what does it do lmao?

opal plank
#

i got one unique not only on discord, but on other platforms too

#

its integration type

quartz kindle
#

its a fully featured astrology command line software lmao

small prairie
#

Weird lmfao

solemn latch
#

tims the biggest nerd here in this server, woo confirmed

small prairie
#

Also i was just testing around with my test bot

quartz kindle
#

lmao

small prairie
#

i just found out its not Logging in

#

ready event is never firin

lyric mountain
#

tim looks like some kind of Drake 'n Josh series actor

small prairie
#

If i change the token to something random i do get the invalid token error

#

But right now its just nothing

lyric mountain
#

are you sure?

opal plank
#

what

small prairie
#

Yes

quartz kindle
#

drake n josh lmao

lyric mountain
#

does it give some timeout error?

small prairie
#

have been trying for letss see 15 mins now
nope

opal plank
#

a token needs to be a token