#development

1 messages ยท Page 603 of 1

idle basalt
#

well your friend doesnt know much then because python is perfectly fine

#

no

#

if you know any js then its probably a good place to start. you might know some of it from html when you use script tags

earnest phoenix
#

Okayy

idle basalt
#

like i said, almost every language has a library that will make it easy (well, easier) for you to make a discord bot. the final product isnt going to be affected much by your decision

#

especially if youre a beginner

#

its commonly recommended to learn a language before making a bot though, because youll be learning 2 things at once (the library and the language) which is more difficult

earnest phoenix
#

So basicly no difference between python, javascript and c++

#

I think im gonna start w/ c++

idle basalt
#

in terms of discord bots, not much (that will matter to you)

earnest phoenix
#

It doesnt look to hard

idle basalt
#

they are vastly different in other uses

#

but for discord bots specifically, theyre just different paths to the same goal

earnest phoenix
#

Okay

#

C++ is a good begin right?

idle basalt
#

sure

barren sky
#

I mean if you're good at it ofc

#

JS and Python are mostly popular and easier than C++ sadly.

#

Believe it or not

earnest phoenix
#

Ohw... okay

idle basalt
#

i recommend js if you know no programming languages and only want to make a discord bot

#

its probably the simplest and has a lot of support and tutorials out there to help you out

earnest phoenix
#

I actuarly ((((bad grammar so sry))) want to make applications in the future

idle basalt
#

well it depends what you want to make

earnest phoenix
#

I dunno yet

#

But tnx for your help

idle basalt
#

ok good luck

earnest phoenix
#

If i in the future need some more info, can i just send you a dm?

barren sky
#

I agree with what syztum said. I prefer Js and Python bc it's easier although game devs mostly use C++ interestingly enough.

zealous veldt
#

C++ is a very good language to know

idle basalt
#

its not that interesting. c++ is much lower level and is thus much faster

zealous veldt
#

Because it's incredibly versatile and very efficient

idle basalt
#

you need that speed for games

inner jewel
#

games usually do c++ because it's fast and has predictable performance

zealous veldt
#

In fact many languages are made in c++ lul

idle basalt
#

std::cout << "c++ sucks dont @ me" << std::endl

inner jewel
#

eg no gc so you won't have a (pseudo)random pause when you don't expect one

earnest phoenix
#

So js python or c++

idle basalt
#

honestly, your first language doesnt matter that much

barren sky
#

Oh. I mean I don't see C++ very often and is hard to understand for newcomers (at least for me) so that's why I said that in the first place.

earnest phoenix
#

The best is just All of em๐Ÿ˜‚ xd

quartz kindle
#

for a beginner, c++ is much harder

idle basalt
#

theyre all similar enough that once you know one itll be easy to hop

#

c++ is hard to get into

inner jewel
#

although in some cases GC'd langs can win (in theory c++ could win even in those cases, but such code would be unmaintainable)

earnest phoenix
#

Im in for a challenge

#

Is it a lot harder than js

idle basalt
#

id say yes

inner jewel
#

modern c++ isn't that bad

quartz kindle
#

considerabily id say

barren sky
#

I know this seemed like a noob question but I don't see anybody asking about it nor in the rules as far as I looked everywhere so I'm unsure so here:

If I use a music extension/module for my bot, will it still be allowed to be in DBL or it just counts as cloned/forked repo. I'm making like a simple Discord.js bot using Node.js and say I want to use a npm music module (e.g discord.js-musicbot-addon) for my Discord.js bot. Thanks in advance. (I hope it's detailed enough.)

inner jewel
#

you could start with c/c++

zealous veldt
#

I would reccomend starting with java if you want to stick with c style syntax, as if you start with a strictly typed language it's easier to learn other stuff along the line.

inner jewel
#

in fact, a lot of people do

idle basalt
#

ye most universities start you in c++

zealous veldt
#

I mainly started with JS and I'm finding it incredible hard to pick up strictly typed languages

dusky marsh
#

I already answered that for you @barren sky

amber fractal
#

My first lang was C#

inner jewel
#

yeah

barren sky
#

Oh

idle basalt
#

i started with js and strict typing isnt hard at all

amber fractal
#

Wasnt that difficult

inner jewel
#

that's one of the problems

earnest phoenix
#

Im only 15 btw

idle basalt
#

use ts youll get the hang of it quicc

earnest phoenix
#

To young?

amber fractal
#

I'm 15

idle basalt
#

your age doesnt matter

amber fractal
#

It's how much time you'll put into it

inner jewel
#

going from strictly typed to "untyped" is usually easier

zealous veldt
#

I started with c# but pretty quickly switch to js so that kinda screwed me over lol

earnest phoenix
#

Tnx for the advise

idle basalt
#

there are devs way better than me at 15 lol

earnest phoenix
#

Lell

barren sky
#

@dusky marsh In which channel and where to find your answer. (I just couldn't find it then. Also ping as my reply so I'm sorry if you hate pings.)

inner jewel
#

if you want to start with c++, i'd recommend one of the newer versions

earnest phoenix
#

Okay

inner jewel
#

they add stuff that makes your life easier

dusky marsh
#

It's canarado from darkos server lol

earnest phoenix
#

What version is the newest?

inner jewel
#

c++17

idle basalt
#

c++69

#

kappa

earnest phoenix
#

tnx

idle basalt
#

ill be so hype when they get to 69

earnest phoenix
#

Lmao

idle basalt
#

unfortunately ill probably be 69 myself and not find it that amusing anymore ๐Ÿ˜‚

earnest phoenix
#

My mind will always be with such humor

#

But i gtg to bad

#

Bed*

#

Almost 3am

#

Tnx for the advise everyone

#

Seeya๐Ÿ‘‹๐Ÿป

earnest phoenix
amber fractal
#

Doesnt work on my computer either

gleaming tulip
amber fractal
#

Why do you have the script for google ads twice

earnest phoenix
#

for remuneration

#

i delete it 1 month ago

amber fractal
#

Well it's stil lthere tho

#

Was something reverted?

earnest phoenix
#

I delete it from google adsense

eager rivet
#

how would i make it show how many servers

frail terrace
#

anyone know when the Stats event is sent on Lavalink or SharpLink?

hushed quarry
inner jewel
#

lavalink should send stats every 1m

opal adder
#

opinion
typescript = js + java = java for web

obsidian shoal
#

yo wassup justiiinnnn

eager rivet
#

nothing

earnest phoenix
#

Why my CPU?

sinful lotus
#

how many guilds you have
what features your bot have
@earnest phoenix

lament meteor
#

on the other hand u should prob get a vps

earnest phoenix
#

I'm making a chat filter, but i want the servers admins,owners to be able to turn it on/off if anyone can help this is my code : `client.on('message', async message => {
let msg = message.content.toLowerCase();

for (x = 0; x < profanities.length; x++) {
if (msg.includes(profanities[x])){

      message.delete()
     
      return;     
  }

}
});
`

lament meteor
#

@earnest phoenix do u know how to use a db?

grave sundial
#

How can I send a message to someone special from botum?

earnest phoenix
#

Get user id, Then send him @grave sundial

grave sundial
#

message will send to my botum

earnest phoenix
#

Why you need it?

bright spear
#

@grave sundial what lib

grave sundial
#

my bot how to send a special message

lusty dew
#

Mk so I ma using this new linter cause someone recommended it

#

and I am getting this error

#

which errors everything else using stuff from discord.js

eager rivet
#

how do you get certified bot?

lusty dew
#

Apply for cert

eager rivet
#

๐Ÿ‘€

earnest phoenix
#

@eager rivet hi

eager rivet
#

i gotta eat dinner brb

#

oh hi

idle basalt
#

panda, theres a page on setting up eslint in the discord js guide

lusty dew
#

I already used that

#

Lol

idle basalt
#

oof did you fix the wrror

lusty dew
#

No

idle basalt
#

how are you importing d.js? are you using es6 imports or commonjs modules

lusty dew
#

commonjs module

idle basalt
#

can you show the code that gets you the error?

lusty dew
#

Ye give me a sec

#

Hmm odd

#

It isn't erroring anymore GWqlabsThonkery

idle basalt
#

aha youre welcome

lusty dew
#

Like 10 seconds ago it was

idle basalt
#

thats how i fix problems ๐Ÿ˜ค

lusty dew
#

Ah mk nvm it just took a while to load it is erroring now

idle basalt
#

smh

eager rivet
#

what are the requirements for cert
?

idle basalt
#

if you dont look, the error isnt there >:(

lusty dew
#

Lol

idle basalt
#

show me the erroring code

lusty dew
#

I will tmrw

#

My PC crashed

#

And it isn't coming back online

idle basalt
#

aw big rip

lusty dew
#

Yea

#

It just started doing this today

hidden heron
#

what's wrong

mossy vine
#

send your code

hidden heron
#

bot.channels.get('566571862415638528').send(@everyone Vote for the next mode)

mossy vine
#

huh

#

the string is correct

hidden heron
#

yup, that's confusing

gleaming tulip
#

did you disableEveryone when creating the Client?

mossy vine
#

^

#

thats most likely whats going on @hidden heron

hidden heron
#

you mean the permission?

gleaming tulip
#

no

mossy vine
#

no

gleaming tulip
#

what library is that, discord.js?

hidden heron
#

yeah

gleaming tulip
#

when you created the discord.js Client

#

did you set disableEveryone to true?

hidden heron
#

oh right!

#

that's what's wrong

#

forgot to disable it

#

thanks

gleaming tulip
#

you can enable it in the .send() as well I think

#

or well, disable

#
.send('whatever', { disableEveryone: false })```
quartz kindle
#

are you sure you can mention people that way?

#

usually we do <@USERID>

earnest phoenix
#

yes sending @everyone works anywhere unless the lib has it's own rules

trail dagger
#

Okey i am a bit new to Discord.py Rewrite ๐Ÿ˜ฎ So i am wondering why i get this error

Command raised an exception: AttributeError: 'Member' object has no attribute 'server_permissions'

On this code @commands.command() async def kick(self, ctx, User: discord.Member=None, *, reason='No reason was given'): if ctx.message.author.server_permissions.kick_members: if not user: await ctx.send('Please specify a user') else: embed = discord.Embed(color=0x80ffff) embed.add_field(name='Member', value=member, inline=False) embed.add_field(name='Kicked by', value=ctx.message.author, inline=False) embed.add_field(name='Reason', value=reason, inline=False) await ctx.send(embed=embed) await ctx.kick() else: await ctx.send('You dont have permission to use this command')

quartz kindle
trail dagger
#

I know but what do i change it to?

quartz kindle
#

have you tried reading the rewrite docs?

trail dagger
#

yes

unique nimbus
#

You don't need to do that

quartz kindle
#

you can find what you need in there

mystic prairie
#

my bot was thrown from dbl What is the reason

quartz kindle
trail dagger
#

I am just saying it i have better stuff to do today

#

I do not want to look truh that again

#

So no kick command

#

oof

quartz kindle
#

lmao

#

i mean, if you actually want to program stuff, you absolutely have to read and understand docs, as they are everywhere and required for everything

dusty cipher
#

is someone pro js?

earnest phoenix
#

Yes? @dusty cipher

#

I'm pro

dusty cipher
#

try{}catch(e){}

earnest phoenix
#

?

dusty cipher
#

still stops bot

earnest phoenix
#
// code
} catch(e) {
console.log(e.stack)
}```
dusty cipher
#

and what if error did happen during try?

earnest phoenix
#

The bot send the error to the console

#

Without crash

dusty cipher
#

and regardless of the error i want him to complete whole what is in try?

earnest phoenix
#

The try function just trying something, if he cant its returning a error, its not possible to complete the whole

dusty cipher
#

thanks

earnest phoenix
#

Np

dull bobcat
#

How come this:

for (i = 1; i <= 2; ++i) {
    console.log(i);
}
// 1
// 2

doesn't do the same thing as:

for (i = 1; i <= 2;) {
        console.log(++i)
}
// 2
// 3

?

quartz kindle
#

because the ++i in the for line sets the variable for the next loop, not the current one

#

statement is executed before incrementExpression

dull bobcat
#

Ok thanks

earnest phoenix
#

hello

#

do you know how can i manage webhooks

#

by discord

#

but from a website

echo pasture
#

so

#

@earnest phoenix yeah you just need to make a webhook tool

earnest phoenix
#

oh

#

K

echo pasture
#

you dont know how to make one ?

earnest phoenix
#

so i will make a post command to the webhook url

#

and all be fine

echo pasture
#

yeah

lofty hamlet
#

I have a voting system on my bot but the problem is that I have to wait a few minutes before the vote is taken into account by my bot is it normal? ๐Ÿค”

vagrant bison
#

which page do you recommend for endpoints anime? [json

west raptor
#

https://i.imgur.com/6ywvUUF.png

extern crate discord_rpc_client;
use discord_rpc_client::Client;

use crate::types::CommandOptions;

pub fn rpc(opts: CommandOptions) {
    let mut a = Client::new(opts.client_id);

    a.start();

    a.set_activity(|x| x
        .state(opts.state)
        .details(opts.details)
        .assets(|a| a
            .large_image(opts.large_image)
            .large_text(opts.large_text)
            .small_image(opts.small_image)
            .small_text(opts.small_text)))
       .expect("Failed to set activity");
}```
#

ihave no idea how to fix this

#

someone pls help this has been like pissing me off for a while now pls

latent oasis
#

js how to get all member(with bots) and all channels FROM ALL GUILDS????

earnest phoenix
#

STOP SHOUTING??!!

quartz kindle
#

<client>.users has all online users from all guilds

#

to get offline users you need to either fetch them, or enable all users in your client settings

gleaming tulip
#

isn't Client.users a collection of users that weren't offline as in READY

earnest phoenix
#

iirc discord doesnt even send all online users if the member count is big

slim heart
#

wait in jsdoc how do you do it like discord.js redirects string to the mozilla definition?

amber fractal
#

?

lofty hamlet
#

I have a voting system on my bot but the problem is that I have to wait a few minutes before the vote is taken into account by my bot is it normal? ๐Ÿค”

slim heart
#

@amber fractal yes but in jsdoc how can i make that auto

mossy vine
#

doubt you can

#

what do you even mean

slim heart
#

like how look at discord.js.org and go to the docs, when there's a "string" type parameter

#

its auto linked, in jsdoc how can i make it redirect to another link instead of typedef

#

like this

earnest phoenix
#

have you tried digging through the source code

slim heart
#

jsdoc source code or this source code?

earnest phoenix
#

d.js' website

slim heart
#

i dont think thats it

#

im talkin about jsdoc

quartz kindle
worn plinth
#

anybody willing to offer me a bit of help with spinning up my bot on heroku?

zealous veldt
rugged pond
#

oh sorry :x

narrow flare
broken elm
#

cant get heroku to do the ting

#

host my bot

#

in js

idle basalt
#

ok

#

and how do you expect us to help

broken elm
#

i just need to know the basics damn

#

i have my github repo and my client.login(process.env.BOT_TOKEN) on heroku is a config var with my token as it's value

#

the config var is also named BOT_TOKEN

idle basalt
#

have you created a Procfile

broken elm
#

yep

#

worker: node mocha.js

idle basalt
#

so is the problem with pushing to heroku?

broken elm
#

i don't know what the problem is tbh

idle basalt
#

or is your code on heroku but it wont turn on

broken elm
#

the code is on github..

idle basalt
#

yes but heroku has to know about it

#

you need to add another remote to push to heroku

broken elm
#

hmm

idle basalt
#

ive always used the cli so i never have to visit their website again

broken elm
#

ugggghhhh

idle basalt
#

if its deployed, try going to the dunos and swapping them

#

you need to turn on the dyno you specified

broken elm
#

did that

#

already

idle basalt
#

uhhhh idk man

#

ive always used the cli and im not at my desk to test shit for you lol

#

oof

#

you can try clicking more and logs for some sort of error

sonic pivot
#

So I'm using discord.js

#

was wondering what best way to get users count is?

#

bc client.users.length is always wildly off

lusty dew
#

client.guilds.users.size

#

iirc

slender thistle
#

Uhh

#

Doubt that

sonic pivot
#

same

lusty dew
#

Wait

#

yea no I realize my mistake now ๐Ÿ‘€

#

I was thinking of servers

sonic pivot
#

like I could go through each guild and summ the guild.memberCount, but like there will be overlap and stuff

idle basalt
#

guild.memberCount is accurate

#

you can sum total members with reduce

lusty dew
#

yea but it also counts bots

idle basalt
#

if you want to remove certain users, you can filter the collections beforehand

lusty dew
#

I think you can filter out bots can you not?

idle basalt
#

but you wont be accurate since not everything will be cached

#

just reduce the guilds collection on memberCount

#

the overlap wont be significant enough

#

if you can only have unique users then youll have to cache EVERYONE

vagrant bison
#

heroku is shit

idle basalt
#

not news

sonic pivot
#

my issue is

#

I have several servers

#

where people are in multiple servers

#

but yea

#

imma just add them all up

#

and accept slightly higher stats

#

bc I'm too lazy to implement it properly

idle basalt
#

it would also be too inefficient to implement unique user count

sonic pivot
#

yea

#

thats what I've realized

idle basalt
#

client.guilds.reduce((a, c) => a + c.memberCount, 0)

#

enjoy

lusty dew
#

question though

#
client.users.filter(user => !user.bot).size
#

This works as well no?

idle basalt
#

the users collection only stores the cached users

#

try it and youll see very different results

lusty dew
#

I get the exact number of members

#

just without bots

#

if I did memberCount

#

I get nine

#

and if I take out the bots I get the same amount
client.users.filter(user => !user.bot).size

#

this returns

idle basalt
#

9 my dude

#

theyre all cached

lusty dew
#

I know they are

#

Lol

idle basalt
#

try it on a bot with a lot of users

#

for example, my bots users collection has 25k while membercount is 50k

lusty dew
#

yea

#

I got 11 at first

#

but I just restarted my bot

#

and I got the appropriate amount

#

But I understand what you mean

idle basalt
#

its not accurate in the slightest, especially when your bot grows

inner jewel
#

that will work for small guilds

#

on larger guilds it breaks

#

also filter(...).length is horrible

#

you generate a ton of garbage

#

reduce would be better

lusty dew
#

who used .length?

idle basalt
#

i gave the reduce line

#

and he used .size

lusty dew
#

Ye

idle basalt
#

as collection.filter returns a collection

inner jewel
#

users.reduce((a, user) => a + (user.bot ? 0 : 1), 0)

idle basalt
#

what

inner jewel
#

filter(...).size is horrible

#

you create a new huge collection that's thrown away immediately

lusty dew
#

users.reduce((a, user) => a + (user.bot ? 0 : 1), 0) returns the number of users minus the bots

idle basalt
#

this is horrible in general

lusty dew
#

by the looks of it anyway

inner jewel
#

yes

lusty dew
#

I just evaled it as well

#

and it works

#

lol

inner jewel
#

it'll break if you have uncached users

#

eg a guild with > 250 members

#

smaller guilds have all members sent always

#

larger guilds have only online members sent

#

others will be missing until they do something, when they'll be cached

idle basalt
#

can you dont.. just
client.guilds.reduce((members, guild) => members + guild.memberCount, 0)

inner jewel
#

because that doesn't do the same

#

it counts bots

idle basalt
#

you cant not count bots accurately

inner jewel
#

count all users not bots

#

and fetch all users

idle basalt
#

thats ridiculously inefficient

inner jewel
#

it's just iterating a collection and incrementing a counter

idle basalt
#

but youre right i even mentioned that myself when this started. you can get accurate counts but it would be really annoying

lusty dew
#
    at Object.run (/home/kawaii/Clap Bot/commands/cuddles.js:41:33)
    at process._tickCallback (internal/process/next_tick.js:68:7)```
#

is it not

#

new Discord.MessageEmbed() ?

#

Oh wait

#

Just notices the error

#

xD

earnest phoenix
#

anyone want to shed light as to why the system isnt saving the modifications done to each planet

lusty dew
#

Nope

worn plinth
#

anyone here every deploy a bot to heroku, were there any gotchas? Changes you had to make to the .json's or any thing?

#

mine crash with npm errors everytime i try to start them

left sinew
#

Eh

#

Back again

#

So I made a bot and have it in my server

#

And need help on how to get code into it

earnest phoenix
#

what library are you planning to use

left sinew
#

What does that mean? :/

#

I feel like a dumb ass rn

earnest phoenix
#

the programming language library

trim saddle
earnest phoenix
#

should probably backtrack, learn a language and then come back to this

left sinew
#

I have the line of Python Code

earnest phoenix
left sinew
#

Lines

earnest phoenix
#

but you don't understand them great go learn python

#

you should learn the language before you try and make a bot

vast cairn
#

^^

left sinew
#

I only need to do a calculation, but if I have to do that i'm just gunna give up

lusty dew
#
const Discord = require('discord.js');
const moment = require('moment');
const fetchVidInfo = require('youtube-info');

module.exports.load = (client) => {
  // eslint-disable-next-line dot-notation
  client.commands['remove'] = {
    conf: {
      name: 'Remove',
      desc: 'Removes a song from queue',
      usage: '-remove {index} or @Clap Bot remove {index}',
    },
    async run(message, args) {
      if (!message.member.voice.channel) return message.reply('You must be in a ``VOICE CHANNEL`` to use this command!');
      if (!message.guild.members.get(client.user.id).voice.channel) return message.reply(`${client.user.username   } must be in a \`\`VOICE CHANNEL\`\`, use -join to make it!`);
      if (client.music.queues.get(message.guild.id).length === 0) return message.reply('There are no songs in the queue!');

      const player = client.music.players.get(message.guild.id);

      const input = args[0];


      if (!input) {
        message.reply("You must tell the bot what song you want to remove based on the songs' position");
      }
      const index = input - 1;

      console.log(player.queue.splice(index, 1));
    },
#

That is erroring

worn plinth
#

looks like it can't find the file?

#

did you do something like name is discord.js.js

lusty dew
#

It is the discord.js npm package

#

๐Ÿ‘€

#

so no I didn't rename it at all

#

also I have this error as well

#

I just started using eslint lol

mint cradle
#

Can this be more efficient?

idle basalt
#

@lusty dew the second one is because they expect you to return something if you ever return

#

its to keep your code consistent

#

the first one uhhh im not sure

#

i just googled the error and it seems like everyones disabled it

#

i dont have the rule off myself so im not really sure what could be causing the problem

lusty dew
#

I fixed it lol

#

I didn't have the linter set up properly

idle basalt
#

ah that makes sense

lusty dew
#

Yea

idle basalt
#

gratz BlobThumbsUp

lusty dew
#

I forgot to add in the rules based on the discord.js guide on esint

#

eslint*

idle basalt
#

consistent return is a finnicky rule

lusty dew
#

Lol

#

ye

slender thistle
#

@mint cradle string.isdigit() could be done instead

#

Returns boolean value

#

@mint cradle

verb = 'using'
print(f'{verb} f-strings instead of concatenation is better')```
mint cradle
#

First I get

#

Second, I don't. Sorry.

lusty dew
#

They are telling you how to use f strings

mint cradle
#

I mainly ment the RespondBlyat() function

#

This one is a bit long

lusty dew
#

they told you how to use f strings and how to use variables in the f string from outside

mint cradle
#

Is this for the RespondBlyat() function?

lusty dew
#

Idk

mint cradle
#

Oh just random

lusty dew
#

Wdym just random?

#

they were telling you f strings are better then concatenation

mint cradle
#

concaenation???

#

I'm not a native English speaker and my English is not so good.

lusty dew
#

concatenation like

#
print("Hello " + "I am " + "your friend")
#

when you add strings together

mint cradle
#

Ah yes

#

And what should it be?

#

Because I always use the +

lusty dew
#

I suggest like shivaco suggested use f strings

mint cradle
#

(but I don't understand what there was said)

lusty dew
#
hello = "Hello " 
iAm = "I am "
yourFriend = "your friend"

print(f'${hello} ${iAm} ${yourFriend}')
#

I think you can put all the same variables in one ${}

#

I can't remember though

mint cradle
#

Aha

#

So is this faster or why it's better?

lusty dew
#

Yea

#

using f strings are better then concatenating

mint cradle
#

I get it, thanks for explaining!

#

Have a great day/night.

slender thistle
#

@lusty dew f

#

Not $

#

This isn't JS

#

You don't need them

lusty dew
#

yea sorry

#

xD

#

I am used to using js not py

#

:p

slender thistle
#

@mint cradle They also give better performance from what I have heard

lusty dew
#

Ye

#

I haven't used py in a while

dusty cipher
#

what is max size of a json file till it dead and need to be mysql?

#

100?

#

mb

lusty dew
#

google

#

it

spring ember
#

@dusty cipher the problem with json isn't only the size but the concurrency issues

#

Also everytime you read from it you read the whole file

#

And then parse the whole file

dusty cipher
#

damn

#

well

#

hmmmm

#

it wont be a problem to sawp to my sql i just wanted to know how much is effective , but seems dondish u are right

#

nested objects looping is nuts

mint cradle
#

Firebase is best

quartz kindle
#

i'd say up until about 10mb, a json db is manageable, if you use it correctly

dusty cipher
#

thanks i got my own server ill see how json handling going if not i can simply swap to mysql

quartz kindle
#

just avoid disk access as much as possible and you should be fine

#

ie: read file once and save it in a variable, do operations to it, and only write back to disk when absolutely necessary

dusty cipher
#

โค

quartz kindle
#

also be very careful and make sure you're writing valid data (keep backups)

#

because any error will destroy your entire database lul

teal tree
#

Is this python?

dusty cipher
#

this is the thing

#

im doing something huge for a game

#

no im just js, php, some go

drowsy lily
#

someone recommending to use a json "db" in a non-ironical way must be the most retarded thing ive read today

#

use sqlite if you want a small managable db

quartz kindle
#

im not recommending it, im saying its manageable and plausible if used correctly

#

specifically because the question was about json limitations

dusty cipher
#

2mb json file works just fine so far

#

i was wondering for bigger thats all about it

#

many websites, web apps nowadays also work on jsons

drowsy lily
#

sorry for my intrjection

#

json dbs are totally fine to use

#

nothing bad will happen

#

carry on

unique nimbus
#

I use json files however people does have preferences on what's superior

drowsy lily
#

yeah its really all about preference

dusty cipher
#

it just depends on size of db i guess thats all

drowsy lily
#

yeah

dusty cipher
#

and what

lusty dew
#
constructor(player) {
  if (!(player instanceof Player))
    return super(iterable)
  super()
  this.player = player
  this.onEvent = this.onEvent.bind(this)
  player.on("event", this.onEvent)
}

this code makes no sense I understand from this.player down but above that I don't

#

My friend told me to use it

#

and explained it

trim saddle
#

rule 1 of code

#

don't ever copypaste if you don't understand it

lusty dew
#

I understand a good bit of it

#

just i don't see why

#

my linter is screaming at me telling me not to duplicate super()

#

is that not allowed?

drowsy lily
#

just dont tell those nerds who engineer sqlite with a test coverage of 100% and about 1.6 million test cases that all their work could just be replaced with json files

#

that would really ruin their day i guess

dusty cipher
#

i wont , and im just coding since 2 years now im just thirsty guy try's everything but at one point i find my way

quartz kindle
#

lmao

#

sqlite is pretty much one of the best dbs in the world atm

#

but it still has a learning curve that json doesnt have, so its also a matter of lazyness/skill

gritty bolt
#

Ive been trying for the past hour to get my AWS SSL to work
and sure enough it just wont

#

No error or anything

#

Ive set up the cloudfront

#

And it just doesnt

lusty dew
#

Do you guys allow nsfw bots at all?

dusky marsh
#

I think as long as your bot doesn't directly state the use of nsfw stuff on the site, it's fine

rustic edge
#

can someone tell me how I make my bot go online, please? I'm a bit new ๐Ÿ˜…

earnest phoenix
#

ask it nicely

dusky marsh
#

^

oblique edge
#

@rustic edge Do you have any start to the creation of your bot, or are you starting fully from scratch

rustic edge
#

I have only one command

oblique edge
#

What library is it?

rustic edge
#

library?

#

๐Ÿ˜“

fiery birch
#

what did you code the bot with?

rustic edge
#

with Node and Notebook++

fiery birch
#

uhm

#

notepad++?

rustic edge
#

yeash

#

sowwy

fiery birch
#

]]faq 3

covert turtleBOT
#
Frequently Asked Questions ๐Ÿ“œ

Click the link to get more information on the question:
3) How do I make a bot?

fiery birch
#

i suggest u follow guides that are linked there to learn a bit about programming since you seem new

rustic edge
#

owki thank chu

lusty dew
#

Question

#

How can I do something like

#

-help [command name]

#

Probably should have put that in code locks eyes

#

-help [command name]

#

I want to be able to do that

bright spear
#

just check args?

lusty dew
#

yea I had the idea of doing

#
if(client.commands.has(input)) return //stuff here```
#

but that doesn't seem to work

bright spear
#

well it depends on what framework/command handle you're using

lusty dew
#

This is my command handler

#

That should work no?

hushed quarry
#

debug your code

#

add print statements everywhere and see where it fails

oblique edge
#

^This guy gets it

cold harness
#

i officially hate c++

#

it takes 20 minutes to compile my code

hushed quarry
#

then make a library

cold harness
#

well tru

hushed quarry
#

i remember my professor talking about how libraries can avoid the compiling time, but i forgot what he meant bc he showed us like this whole 3 step process

#

it was complicated

inner jewel
#

if you compile parts of it to a library, you won't have to compile them again

#

until they change

cold harness
#

i might just shift my c++ caffe code to python

#

wait how would you do that

earnest phoenix
#

how would i check if the message author is a bot?

lusty dew
#

using?

#

what lang

#
    throw err;
    ^

Error: Cannot find module 'discord.js'```
earnest phoenix
#

python

oblique edge
#

if message.author == client.user:
    #Do thing
#

@earnest phoenix

earnest phoenix
#

im not trying to check if it is my bot

oblique edge
#

oh derp

#

my bad

earnest phoenix
#

i have been told it is menber/user.bot

oblique edge
#

Under the weather and havent had coffee

earnest phoenix
#

lol

#

your good

oblique edge
#

message.author.bot would return True

#

@earnest phoenix true for both original and rewrite of discord.py

earnest phoenix
#
    @commands.Cog.listener()
    async def on_message(self, message):
            if message.author == self.bot.user:
                return

            user = await self.bot.pool.fetch("SELECT * FROM leveling WHERE userid = $1 AND guildid = $2", message.author.id, message.guild.id)
            if not user:
                    await self.bot.pool.execute("INSERT INTO leveling VALUES ($1, $2, 1, 0)", message.author.id, message.guild.id)

            user = await self.bot.pool.fetchrow("SELECT * FROM leveling WHERE userid = $1 AND guildid = $2", message.author.id, message.guild.id)
            await self.bot.pool.execute("UPDATE leveling SET xp = $1 WHERE userid = $2 AND guildid = $3", user['xp'] + 1, message.author.id, message.guild.id)

            if await self.lvl_up(user):
                embed=discord.Embed(title="Congrats!", colour=discord.Colour.blurple(), description=f"{message.author} is now level {user['lvl'] + 1}", timestamp=datetime.datetime.utcnow())
                embed.set_footer(text="GBot")
                await message.channel.send(embed=embed)```

this is my code, i just don't know how i would put it in
oblique edge
#
if message.author == self.bot.user:
                return
if message.author.bot:
                return
#

if youre trying to return on the author being a bot

#

@earnest phoenix

earnest phoenix
#

I was testing it. Thanks, it worked

#

i dont want bots on my leaderboard or my bot sending level up messages

zealous veldt
#

owowowo

lusty dew
#

@earnest phoenix Big oof

earnest phoenix
#

@lusty dew so um

#

about your account

#

...

#

:p

lusty dew
#

Uber

#

I swear to god

#

If you wiped

#

ima quit gsim

#

@earnest phoenix

#

-.-

earnest phoenix
#

lol

#

i mean

#

we just finished the rewrite

#

of the codebase

#

so like

lusty dew
#

Smh

lime fiber
#

My bot is online.

earnest phoenix
#

is it though

#

oh.

zealous veldt
#

nice advertising

earnest phoenix
#

refresh maybe idk

lime fiber
#

i don't want to advertise -.-

earnest phoenix
#

or maybe start up the bot

#

again

lime fiber
#

It says ???

earnest phoenix
#

restart your bot

#

just try anything

#

idk

lime fiber
#

ok

#

๐Ÿ˜„

earnest phoenix
#

hopefully it works

languid dragon
#

i know you're trying to help

#

but if you don't know the answer, don't answer

earnest phoenix
#

ok

languid dragon
#

your bot is not in this server so it's going to appear as "???"

lime fiber
#

oh...

languid dragon
lime fiber
#

My collab trolled me on github and added a DM leave message -.-

languid dragon
#

ok..

lime fiber
#

So that is the reason?

languid dragon
#

why would i know?

lime fiber
#

And is there a way to add it again to this server? I already deleted that line.

languid dragon
#

ask the mod who removed it

lime fiber
#

ok, thanks.

earnest phoenix
#

So what npm package do i use for mongo

zealous veldt
#

Mongoose is quite nice

earnest phoenix
#

What

#

Anyways looking at the mongo docs

db.inventory.insertMany([
   // MongoDB adds the _id field with an ObjectId if _id is not present
   { item: "journal", qty: 25, status: "A",
       size: { h: 14, w: 21, uom: "cm" }, tags: [ "blank", "red" ] },
   { item: "notebook", qty: 50, status: "A",
       size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank" ] },
   { item: "paper", qty: 100, status: "D",
       size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank", "plain" ] },
   { item: "planner", qty: 75, status: "D",
       size: { h: 22.85, w: 30, uom: "cm" }, tags: [ "blank", "red" ] },
   { item: "postcard", qty: 45, status: "A",
       size: { h: 10, w: 15.25, uom: "cm" }, tags: [ "blue" ] }
]);```
I suppose "inventory" in db.inventory is a table in the database?
#

Huh

earnest phoenix
#

Right

slate wing
#

Hello can I report a Bug?

#

hello?

languid dragon
#

]]faq 9

covert turtleBOT
slate wing
#

thanks

earnest phoenix
#

hey guys looking for bot host will pay 20$ after 2 every 2 month for 2 year

earnest phoenix
#

not understand

trail dagger
#

Someone want to make a discord.py rewrite Help menu together? DM me

lyric radish
#

How can i access variable from another shard? [Discord.js]

sinful lotus
#

@lyric radish broadcastEval

#

Example of broadcastEval
it is arranged in the order of shards

Shard 0 Data is the first item on that arrray and so on.
"this" is your client in broadcastEval, so for example you want to get a user

client.users.get(id) will be this.users.get(id)

trail dagger
#

On discord.py embeds how do i get title, desc and icon_url because i have tried alot of stuff but didnt work

topaz fjord
#

@sinful lotus or internal sharding

sinful lotus
#

@topaz fjord Internal sharding is fine up to 10k guilds depending on youur code structure

#

going more than 10k guilds would be not favorable for internal sharding

calm token
#

Can someone help me about the script to show the total number of total server where my bot is present

#

please

earnest phoenix
#

language and lib?

quartz kindle
#

@sinful lotus whats the downsides of internal sharding on 10k+ guilds?

sinful lotus
#

@quartz kindle Javascript itself

quartz kindle
#

you think node cant handle much more than that?

sinful lotus
#

yeah single thread limitations but that would depend on your bot functions

#

if you do a lot of cpu intensive task on your bot without relying on sub process

quartz kindle
#

ah true, but then you also need a multicore vps

sinful lotus
#

most vps are multicore

#

unless you are on the tad cheaper side

quartz kindle
#

yeah im on the cheaper side for now

#

im at 800 guilds

#

my bot isnt ready for sharding, it needs a rewrite

#

im thinking if i go for internal or normal sharding

sinful lotus
#

I dont see you need a reason for sharding if you are less than 1.5k guilds even

quartz kindle
#

yeah im not gonna do it now

sinful lotus
#

cluster sharding if you dont mind

#

for example we have 10k guilds in a bot

#

it is possible to have 5k guilds in 2 process

#

its achieved by cluster stuff on sharding

#

where in 1 process will have 2 internal sharding or websocket connections

#

so 2.5 + 2.5 = 5k guilds

quartz kindle
#

yeah i was thinking on going that route

#

you think its a good method?

sinful lotus
#

it is a good method cause for example I have 10k guilds and I would do normal sharding

#

I would need 4-5 process on normal sharding to accommodate that

#

and that would consume more memory due to user caches not being shared

#

where in on the cluster route

#

5k guilds can share the same user caches

#

which will bring you better memory consumption

quartz kindle
#

yeah

sinful lotus
#

because you will only need 2 process

#

vs 4-5 process

#

but if you want more performance over memory

#

then traditional is better

quartz kindle
#

even if running more than 1 process per cpu?

#

like if you have 4 processes but 2 cpus

sinful lotus
#

yeah your os would give your 2 process per each core

#

I run 26 shards on 16 core system

#

I dont have problems

#

cpu usage hovers 8-16%

quartz kindle
#

alright, thanks for the explanation

sinful lotus
#

no problems

real portal
buoyant wagon
#

its not approved yet

real portal
#

uh, ok thanks

late hill
#

I currently use internal sharding to put 2 shards per process

#

works pretty well

earnest phoenix
#

don't even attempt internal sharding without zlib-sync + erlpack lol

#

if we're talking discord.js at least

sinful lotus
#

never do that @earnest phoenix

#

heap allocation failure GWahreeVampySmug

earnest phoenix
#

@sinful lotus whaddya mean

sinful lotus
#

I used zlib-sync + erlpack + bufferutil on my bot

#

its not internal sharding

#

but my bot crashed due to heap allocation failure

#

memory leak

#

lmao

earnest phoenix
#

i'm using same the combination

#

great performance improvements, no memory issues

sinful lotus
#

I removed zlib-sync but used and kept erlpack + bufferutil

#

no more leak no reconnects

earnest phoenix
#

i had reconnection problems because of uws

#

but zlib-sync is a lifesaver for me

sinful lotus
#

same to that

#

uws caused me a lot of issues

#

reverting to ws + erlpack & bufferutil was perfect

#

probably wont change it again

calm token
#

@earnest phoenix Discord.js

earnest phoenix
#

hey um does anyone here use node.js

sinful lotus
#

just ask your question

earnest phoenix
#

what do i do if node is saying there's an error on a line that doesn't exist in my code

#

the text doesn't exist either

#

it's saying line 109, but my code only goes up to 107

hushed harbor
#

can you post the code?

earnest phoenix
#

i also keep having issues with the ending brackets to close off the code, because before it was saying that was the error.

#

that's the final command, i'm using discord.js

quartz kindle
#

sometimes the error message is on the wrong line

#

your problem is line 103

earnest phoenix
#

I don't know how to fix it

quartz kindle
#

look closely

earnest phoenix
#

that's how the brackets were on every other line of the tutorial i followed

quartz kindle
#

you opened two brackets, but closed only one

earnest phoenix
#

i think

hushed harbor
#

}})

earnest phoenix
#

oh

#

im stupid

hushed harbor
#

Sometimes you look at it for so long, it takes another set of eyes.

quartz kindle
#

but its better if the second set of eyes explains/shows the problem, and doesnt just spoonfeed lul

earnest phoenix
#

it's throwing this error now, did i not do the brackets right?

#

i didn't even add a semicolon

#

@calm token your client has a guilds property, it's a collection of all guilds your client is in, just use size on that

quartz kindle
#

@earnest phoenix that part looks right, maybe you have another open bracket somewhere that you forgot to close

calm token
#

Okay thanks !

earnest phoenix
#

I just checked, and all of the brackets are closed off right

#

It's just this particular one

#

it's saying there's an error that doesn't even exist

hushed harbor
#

@earnest phoenix Unexpected End of Input suggests that there could be an extra bracket somewhere

#

or possibly an open array bracket or parenthetical.

earnest phoenix
#

I have basically no knowledge of javascript so discord.js was not a good choice for me to start out with apparently

hushed harbor
#

Not 100% foolproof, but it can catch those obvious mistakes

earnest phoenix
#

The final string is balanced so im gonna check other stuff

hushed harbor
#

It might make sense to drop the whole file in

fiery birch
#

yo, you can download an IDE like vscode btw and get a plugin called "Bracket colorizer"

#

colors pairs of brackets the same so you know if they open and close and stuff

#

very good and useful

earnest phoenix
#

I'm using Notepad++, because using Notepad was b a d

#

I was using basic notepad to make the js files

hushed harbor
#

whew

#

whatever works though!

earnest phoenix
#

All the individual things are balanced I think

#

eeeeexcept my commands

#

frick

#

i have no idea how to fix this

#

this is the code im using

#

i followed a tutorial for the majority of them

#

because No Javascript Or Discord.JS Experience

hushed harbor
#

client.on("message", async message => { is never closed

earnest phoenix
#

do i need to close the parentheses?

fiery birch
#

you always close parantheses when the function is done

hushed harbor
#

@fiery birch had the right suggestion. I'm sure there's a good syntax highlighter/linter for Notepad++ that will point out discrepancies. When I get hit with one of these issues, I make a copy of the code in a separate file and start deleting functions until the error is resolved, then add them back one at a time.

fiery birch
#

client.on("message", async message => { should be client.on("message", async message) => {

#

i think

#

idr

#

really recommend vscode over notepad++ if you're willing to try it tho

hushed harbor
#

nope! it's missing }); later down the line

#
// bunch of stuff
???
earnest phoenix
inner jewel
#

client.on("message", async message) => { is invalid

earnest phoenix
#

where do the brackets need to be?

fiery birch
#

wait what should it be @inner jewel

hushed harbor
#

look around line 95, after the last command function in that set.

inner jewel
#

async message => { ... }

#

the syntax is [async] args => body

hushed harbor
#

a new client.on("message", (message) => { is started, but the previous one (started at line 25) is never closed with });

earnest phoenix
#

OH MY GOD IT'S FIXED

#

god im stupid i forgot about the beginning part

#

aaaand it crashed because i don't know how to define msg

hushed harbor
#

It's good practice to write the closing brackets before you start into the the rest.

when you start a function, do something like:

 (args)=>{



} //close it right now before you go back and fill in the rest
#

then just arrow up a few lines and get to it

earnest phoenix
west raptor
#
client.on('message' msg => {
    //...
})```
earnest phoenix
#

semicolon

west raptor
#

picky

mossy vine
#

colon

west raptor
#

dont need it

mossy vine
#
client.on('message', msg => {
    //...
})```
earnest phoenix
#

you needed a comma

mossy vine
#

oh

#

its called a comma

#

not a colon

#

im retarded thanks

earnest phoenix
#

np

inner jewel
#

)

earnest phoenix
#

and iโ€™m pretty sure a semicolon is needed at the send of that statement

inner jewel
#

it isn't

earnest phoenix
#

oh kay

mossy vine
#

im fucking retarded oK

#

and no

#

it aint required in js

inner jewel
#

but i'd recommend using it since JS can sometimes fuck up ASI (automatic semicolon insertion)

earnest phoenix
#

i just fucked up the code oh my god

hushed harbor
#

yeah js doesn't care about semicolons. Just pick whether to use them or not, and be consistent.

earnest phoenix
#

I'm using Discord.JS

#

do you know javascript

#

also i still can't figure out how to define msg

mossy vine
#

we told you

inner jewel
mossy vine
#

you should learn the language properly first before making a discord bot with it

earnest phoenix
#

I'm used to using Discord Bot Maker coding systems

#

you defined message

#

as the arg

hushed harbor
#

line 98 is where it's defined.

earnest phoenix
#

so you need to use message.reply not msg

hushed harbor
#

everywhere else in that code, you've defined it as message, not msg

earnest phoenix
#

oh im dumb

#

have you learned javascript

#

I haven't touched javascript since i did a basic course that I never finished in seventh grade

fiery birch
#

teaches it decently, recommend using it to understand the language a bit more

hushed harbor
#

pay attention to the actual errors you're getting. They're usually pretty up-front about what's going on. (x is not defined means you haven't set up that variable.)
if the error is confusing, hit google. (or ask here, these folks seem like a helpful bunch)
+1 code academy to brush up on the basics

earnest phoenix
#

I think that was what I used actually

#

Either that or khan academy

hushed harbor
#

Both are rad. The big thing is making sure you understand why it's failing instead of just fixing.

#

Then, the next time you get that Unexpected end of input, you'll think Oh hell, I must have dropped a bracket somewhere

earnest phoenix
#

I know the defining variables thing is important because of a specific error i kept having in GameMaker that I didn't understand until I used my best friend google

#

oh i forgot to say thank you
THANK, HUMANS

#

can somebody pleease tell me how can i use oauth2 in my discord.js app

#

thanks from now

#

I think you go to the developers page, then click on the oauth2 tab

#

...

#

great joke dude

#

๐Ÿ˜ฆ

mossy vine
#

what do you need to use it for?

earnest phoenix
#

for login

#

dude im literally clueless about anything that doesn't involve creating the bot application

#

i wasn't sure what you meant anyways

calm token
#

what is "np" please ?

earnest phoenix
#

no problem

calm token
#

ah okay thanks you very much

earnest phoenix
#

np

mossy vine
#

why would a user need to log in for a discord.js app

earnest phoenix
#

because they will have something in a json file and when they enter the file will get printed in to the screen

#

*a data

#

if anybody wants to help me please DM me thanks from now

#

is this for a webpage

lime sluice
#

Can any JS dev help me?

#

trying to hunt a bug

zealous veldt
#

]]moreinfo

covert turtleBOT
#

If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.

lime sluice
#

Ok so basically

#

I have a bot thats using Discord.JS

#

I made a music system, how ever the queue is a bit bugged and I can't seem to fix it

#

Whats happening is

#

When you first call the bot, it all works well

#

but when the bot leaves the channel and the players is destroyed

#

and you call the bot back.

#

The songs get stuck in the queue

#

once the bot has stopped playing the song requested, it'll sit there and not do anything

#

queue wont even shift

#

No errors are logged to console.

spring ember
#

You should clean up when stopping

#

Also why is the queue a Map object

lime sluice
#

Why not?

earnest phoenix
#

im hovering between 35%-45% cpu usage from what i suspect to be internal sharding

#

that normal?

mossy vine
#

maybe?

spring ember
#

What library

calm token
#

Hello everyone, someone would have an idea to make the bot repeat a phrase that one chooses?

vast cairn
#

Hi, fellow Hugo

quaint umbra
#

is there an accepted "best practice" for how to handle a bot not having the permission to speak in a channel?

#

so far i've just failed silently but i've observed that some people spam a command expecting it to work

#

and then get frustrated and just kick the bot thinking it's broken

idle basalt
#

if the bot cant speak theres nothing you can do short of dming them or messaging in another channel

#

both of which are very annoying

#

just make sure your bot is well documented and has clear instructions for how to use it and what permissions it needs

lusty dew
#
            booru.posts({tags: input, limit: 1}).then(posts => {
                const index = Math.floor(Math.random()*posts.length)
                const post = posts[index]
                console.log(post)
            });
#

I am getting undefined from this, but the documentation for the npm package says to do this.

#
const booru = new Danbooru('https://testbooru.donmai.us');
#

I have it requesting from the test site

#

Mk I got it to work with the test site

#
const key = 'Nahyoucan\'thavethis';
const login = 'GodlyFoox';
const authenticatedBooru = new Danbooru(
    `https://${login}:${key}@sonohara.donmai.us`
);
            authenticatedBooru.posts({tags: input, limit: 1}).then(posts => {
                const index = Math.floor(Math.random()*posts.length)
                const post = posts[index]
                console.log(post)
            });
#

then I tried this

#

and I got undefined

west spoke
#

...

#

Um

#

K

drifting mantle
#

does anyone have this error with discord.js 'Invalid WebSocket frame: RSV2 and RSV3 must be clear'?

scarlet bane
#

asking for nsfw help

west spoke
#

Yeh

drifting mantle
#

how

#

is that nsfw

west spoke
#

Not your suggestion

#

Or question

#

The one above it

drifting mantle
#

oh

west spoke
#

Danborru is a NSFW api

drifting mantle
#

oh

lusty dew
#

Danbooru

#

also has a

#

safebooru website

dusty cipher
#

hello?

lusty dew
#

What

uneven scarab
west spoke
#

Channel is meant for help with bots

#

Do you need help?

uneven scarab
#

yep

#

how do i create a custom command list that people can use

west spoke
#

Like let's say

#

=help <module>

#

That?

lusty dew
#

you need command handler

uneven scarab
#

im using Java Script

lusty dew
uneven scarab
#

whats that

west spoke
#

What I sent?

#

O

#

Nvm

#

I dum

lusty dew
#

He asked what a comamnd handler was

west spoke
#

Yeh I realized

lusty dew
#

it is something that helps you load commands from another folder

#

so you dont have to put all your commands in one file

#

you can have a command called
hug.js and have the hug command in it
pat.js have the pat command in it

#

and the command handler loads those commands and makes them usable

west spoke
#

Like for python

uneven scarab
#

i use JS

west spoke
#

Ik

lusty dew
#

Ye