#development

1 messages · Page 777 of 1

trim cape
#

I enrolled my bot to top.gg on january 4th

mossy vine
#

it was declined once and you readded it on the 20th

#

wait

eternal adder
#

Yep, was readded on the 20th, so you'll likely be waiting about a week to find out

late hill
#

why await

#

that code will check how many cached members (that aren't bots) each guild has and add them all together

#

which indeed could have the same user multiple times

#

What exactly do you want to do and why

quartz hill
#

I will get the total number of users on all servers. Then I will show this in the bot with setActivity

west spoke
#

doesnt js have a user length thing?

#

or no

earnest phoenix
#

string.length()

west spoke
#

not what I'm meaning

#

Like a list of all members the bot sees

amber fractal
#

Yeah all cached users oare on <Client>.users

west spoke
#

@quartz hill ^

amber fractal
#

Alternatively you can use reduce on <Client>.guilds by their member count

#

Or any other loop

#

Reduce just came to mind

quartz hill
#

thx

#

😄

late hill
#

I mentioned 2 possible issues

#

If you simply use the size of the users you will cancel out the user dupe issue

#

But it's still cache only

#

If you use the membercounts of guilds you cancel out the cache issue

#

But you'll still have multiple users multiple times

#

The membercount will also include bots which isn't what you wanted originally

#

Either way, ask yourself why you want this

#

It's just a meaningless statistic

#

To get it accurate would probably require "wasting" resources in some way

#

which isn't worth it?

#

If you're not making it accurate, it becomes even more meaningless

#

there's really no point at all

amber fractal
#

I dont think someone cares if their count is inflated tbh

#

Looping through each user of each guild to check if it's a duplicate or bot is simply too inefficient for a large bot to get any real benefit

modest maple
#

Can also be inaccurate at times

#

I've had it loop through before and duplicate guilds

west spoke
late hill
#

No one cares to begin with

#

Which is why you could just not do it

neat vapor
proper inlet
#

Hi, how can I edit channel permissions for @eveyone role? discord.js

#

Help, please

#

Help, please, i really need

vital lark
#

there should be a editPermission function

#

@neat vapor I would recommend using a package manager (Gradle/Maven) and not using the JAR

neat vapor
#

Yikes, have been struggling to understand Maven.

#

As well as with the download link.

vital lark
#

Gradle is amazing imo

blissful scaffold
#

I also used to dislike maven, but since I'm using it I started to like it a lot

floral bloom
warm marsh
#

What is the "best" data store for storing e.g. config? NodeJS orientated.

vital lark
#

what kind of config

#

normal config or guild settings

#

guild settings, I would recommend using MongoDB

normal config, I would recommend YAML or JSON

warm marsh
#

Guild config

#

{ prefix, embed, etc... }

#

kinda stuff

#

Seems overkill using mysql database for this.

sudden geyser
#

If the data is manageable, use a database (sqlite, mongo, rethinkdb) not including json. if it's constant, use json

#

@floral bloom if you do curl -I https://discordapp.com/api/v7/gateway in the terminal/command line your bot uses, does it say 200 OK?

vital lark
#

don't you need to do -H'Authorization: Bot <token>' also?

sudden geyser
#

nope

vital lark
#

oh

sudden geyser
#

at least not for that endpoint if it's just a get request

floral bloom
#

@sudden geyser Yes, it does. HTTP/1.1 200 OK

sudden geyser
#

Okay, how are you connecting to the gateway (source code and stack trace)?

#

and what library are you using (along with version)

floral bloom
#

Discord.js v11.5.1

Okay, how are you connecting to the gateway (source code and stack trace)?
What do you mean? All I'm doing with the bot is logging in and trying to send a message.

sudden geyser
#

I mean the source code where you call .login() (assuming it's logged in before you try sending a message). Are you sure you're using the client token and not the client secret

floral bloom
#

@sudden geyser I have the message function above the login function, however, I have never had a problem with it.
I use client.login(process.env.TOKEN); to login, and yes, I'm using the token.
I just don't know the problem, I'm doing everything the same as I normally do.

sudden geyser
#

yeah you won't have an issue with the event listener being above or below
does logging process.env.TOKEN log your exact token to the console?

floral bloom
#

As far as I know, yes, but I will double check.

#

Yes, it does.

#

Ohhhhhhhh, I think I found the problem!

sudden geyser
#

what was the issue?

floral bloom
#
client.user = require(`./users/${message.author.id}.json`);

client.user can't be written to, only read. 🤦‍♂️

west spoke
sudden geyser
#

Wouldn't it throw an error if you tried logging in (e.g. login is not a function)

#

also I tried that snippet now and I can't use my bot anymore so gg

floral bloom
#

No, because it logs it, but since I can't write to client.user it gives the 401 unauthorized error.

#

That's at the top of my message function, so no command works.

#

Now it works. 😂

#

Thanks for the help anyway. 🙂

mossy vine
#

excuse me are you making a json file for every user

modest maple
#
@BotObject.bot.event
async def on_shard_ready(shard_id):
    print(
        f"[Client Running] - Shard: [{shard_id}] [Online] - Ping: {math.ceil(BotObject.bot.latency * 1000)}ms | {BotObject.bot.user.name} ({BotObject.bot.user.id})")```
#

actually less stable than discord

#

like

#

i just want it to fire

#

on shard ready

#

this was supposed to be patched

#

but noooooooooo

#

we cant possibly have it work for every bot token

#

only some

#

👏 👏

west spoke
#

F

floral bloom
#

excuse me are you making a json file for every user
@mossy vine Yes.

modest maple
#

JESUS CHRIST

#

WHY

#

you know how much fucking storage and Reads and writes that will use

floral bloom
#

Because I can't get a database to work.

#

Well, yeah.

modest maple
#

jesus christ

#

tried a diffrent DB

#

and if you dont understand how

#

learn

#

cuz fuck me that is too far

floral bloom
#

I've tried MongoDB, SQL, SQLite, MySQL, RethinkDB, and others.

modest maple
#

i think you might wanna try again

hushed berry
modest maple
#

and if u still dont get it

#

go back to basics

#

cuz

#

that is just holy fuck

floral bloom
#

😞

green kestrel
#

Ok so my bot now consistently takes less than 1% cpu at all times with 880 shards... it’s all thanks to the upcoming gateway intents feature of discord api

mossy vine
#

880 shards. how big is your bot?

green kestrel
#

I just need to put some pretty interface on the intents stuff in aegis discord lib and I can submit a pr so all aegis users can benefit

#

Sorry, 880 guilds

#

Typoed

#

I hate using iPhone... the keyboard sucks compared to android gboard

#

If I had 880 shards it would be one shard per server lol, I have ten shards because it costs me no more CPU or ram than one shard, not noticeably any way

earnest phoenix
#

not all guilds will go on their own shard FYI

modest maple
#

cuz discord dont do big balanace

delicate zephyr
#

Why should it

#

Each shard is limited to 2500

#

If it can balance well enough under that limit it'll be fine

modest maple
#

yh

still merlin
#

Using visual stuido code rn

earnest phoenix
#

you have a spelling error

still merlin
#

Ah lol

earnest phoenix
#

cosnt

still merlin
#

Oh dumb me lol

#

Thanks

earnest phoenix
#

np lol

still merlin
#

I need to find that error now

#

thats gonna be fuun

earnest phoenix
#

it's when you declare the channel variable

#

or at least try to declare it

prime cliff
still merlin
#

?

earnest phoenix
#

wow the unicode version looks terrible lol

prime cliff
#

Yup lol

still merlin
#

Unicode are charecters that can be bypassed chat filters sometimes

#

I think

prime cliff
#

Discord allows it by default

still merlin
#

Wait how would I go about a delete message if swears command like I have a tempmute command and am creating a warn and music commands

earnest phoenix
#

don't bother with word filters

still merlin
#

Wdym

#

I could just use a codelyon video I've gotten recomended videos by him but cant be bothered to watch them as i already know how to code

earnest phoenix
#

there's an insanely huge number of ways to bypass a filter with a 2000 char limit

modest maple
#

its very satisfying having a command handler you built for memes work first time

earnest phoenix
#

Nice

#

Can Any Developer Who Is Good At Node,js Contact Me

#

I need help with mine

#

Plz

#

i need helop

#

Ok

#

So u have cmr

#

what

#

Cmd

still merlin
#

I want to copy there code into my bot

modest maple
#

try it and see

still merlin
#

ok lol

topaz fjord
#

Ew

#

Ew

earnest phoenix
topaz fjord
#

Swear filter

#

fuck that

modest maple
#

@earnest phoenix read the error

#

its the first line

mossy vine
#

show the full error

earnest phoenix
#

I'm not the best at creating bots

#

Mostly just websites

topaz fjord
#

You didn't install the module

earnest phoenix
topaz fjord
#

lmao

earnest phoenix
#

My Code Is Fine

#

I dId

still merlin
#

@earnest phoenix you sent a link and I tried it and I tried to load my bot Umi Bot and I coppied full text and;

topaz fjord
#

you didn't install the module

earnest phoenix
topaz fjord
#

it literally tells you why

mossy vine
#

copypaste devs dboatsOmegalul

topaz fjord
#

"MODULE_NOT_FOUND"

prime cliff
#

@earnest phoenix why does your bot request administrator perms 0_o

topaz fjord
#

just run npm i <packageName>

#

In console

#

@prime cliff mmLol cause admin > *

sudden geyser
earnest phoenix
#

i also didn't provide the link to the filter package; I provided a message that tells you that no filter will ever be accurate in discord with over a billion different combinations

still merlin
#

Oh

prime cliff
#

turtle > admin > *

topaz fjord
#

yes

#

ty

#

@mossy vine copy-paste dev indeed

queen bone
topaz fjord
#

run npm with sudo

earnest phoenix
topaz fjord
#

sudo npm i forever @queen bone

#

fs doesn't need to be installed

#

It's a default package

queen bone
#

now different error

topaz fjord
#

oh wait I'm fucking blind

earnest phoenix
#

I Am A New Developer

still merlin
earnest phoenix
#

So Idk Much About This Things

still merlin
#

I jsut want like a basic one that censors normal things like fck and sh*t

topaz fjord
#

fuck

earnest phoenix
#

don't

topaz fjord
#

yes

#

unless this is a Christian server mmLol

still merlin
#

Why thought I doubt anyone would go so far to use unicode just to swear

earnest phoenix
#

you'll have more false positives than true positives

#

which you will regret

still merlin
#

Ok

#

I'll finish my tempmute and ban commands

topaz fjord
#

@queen bone try updating npm

#

it seems to be an issue with old npm version

earnest phoenix
#

if you really want to have a filter don't let it do anything on it's own

#

instead notify a human and let them decide

topaz fjord
#

npm i -g npm@latest @queen bone

earnest phoenix
#

context > static checks in filters

still merlin
#

Honestly I want to try and block zalgo but like heck everything fails

topaz fjord
#

imagine blocking zalgo

#

Zalgo is best

#

zalgo is life

still merlin
#

was checking my code and found but it failed uswell half my code fails idk even why I have that ^^ must have been a second attempt that I didnt see lol

#

anyone know how to make a succsefull blocker for zalgo

queen bone
#

@topaz fjord ah that helped, thank you so much 😘

topaz fjord
#

np

#

I can thing if so many ways to get around that

#

*think of

delicate zephyr
#

^

topaz fjord
#

imgur

delicate zephyr
#

Tbh the more restrictions you put in place on a chat app the more ways people will find to bypass it

topaz fjord
#

I actually want to run a test to see how people finds ways around it

still merlin
#

anyway I deleted my code for that and am forcing myself to finish my ban command thanks everyone

topaz fjord
#

That way I can update my skills

#

for getting around stuff

queen bone
#

wait ... so bot won't detect blocked words if i strike them

mossy vine
#

bruh

topaz fjord
#

that's also technically api abuse

sudden geyser
#

the more restrictions and matches you try to find the more issues you may run into (e.g. normal words being blocked). just make it match exactly

topaz fjord
#

it updates a message whenever it is sent

#

so if you get 20 msg/s

#

you do 20 edits/s

queen bone
#

amazing

earnest phoenix
#

Turtle

topaz fjord
#

?

earnest phoenix
#

Do u know how to code like really good

#

If that mad scense

#

Sence

modest maple
#

that makes no sense

#

you dont code to make it seem cool

#

you code to make it practical

earnest phoenix
#

I just need help

#

With some thing

topaz fjord
#

Ask it here and someone will help

earnest phoenix
#

Ok

mossy vine
#

Do u know how to code like really good
@earnest phoenix pick up good habits and write performant yet clean code

earnest phoenix
#

What

#

???

#

OK....

mossy vine
#

is that not what you were asking

earnest phoenix
#

Nope

mossy vine
#

then what

earnest phoenix
#

What I was ment to say was is anyone professional at coding

valid frigate
#

are you searching for a collaborator on your project

mossy vine
#

we are discord bot developers, not professionals

modest maple
valid frigate
#

nobody asked

#

literally

earnest phoenix
#

I'm like trying to get like a tutor

valid frigate
#

anyways what are you looking for

#

ohhhh

#

have you first tried googling things like "how to do x in y language"

#

or do you want to learn the fundamentals of coding

earnest phoenix
#

Funder mental of coding a discord bot ik how to code some things like websites

#

But I'm not that good at it

valid frigate
#

well man to be brutally honest, a lot of people are usually really unfriendly towards beginners but let me see

sudden geyser
#

don't worry, i'm a no one but I like it bigsad

valid frigate
#

definitely google will be your first step

#

so if something is unclear on anything you find while searching google, you can ask here

earnest phoenix
#

Ok

#

Ty

valid frigate
#

np

queen bone
#

he is more like a frontend guy

valid frigate
#

on an additional note, cf8's code actually looks really wack because

  1. the console's first portion is repeating itself across all lines that log to the console (redundancy)
  2. its super blurry but your entire bot is in one file, which "good" code is across multiple files
#

and yes i saw that, he just wants to get started with some backend stuff

#

imho making a discord bot is a fairly ok way to get started learning about rest apis maybe, dont take my word on it

modest maple
#

@valid frigate thats not even bot code

#

xD

valid frigate
#

cog

sudden geyser
#

it looks like just the client and event handler

#

oh

valid frigate
#

command_handler

modest maple
#

atom is just meh

valid frigate
#

¯_(ツ)_/¯

modest maple
#

i prefer pycharm

valid frigate
#

same

modest maple
#

but cant scroll to fit it in to make it look long

#

xD

tiny tinsel
#

What make this code great is the syntax highlighting.

valid frigate
#

atom is a text editor therefore less powerful smh

queen bone
#

has anyone tried streaming music files from google drive ?
it is lagging for me

modest maple
#

its pretty good for clojure

valid frigate
#

but pycharm & other jetbrains ides eat ram for breakfast

modest maple
#

yh

sudden geyser
#

so does chrome

earnest phoenix
#

Is pyphon good for coding vysion

valid frigate
#

atom themes are pretty notorious as well

#

oh yeah it is

#

i hear python is a pretty good beginner language

earnest phoenix
#

Ok

tiny tinsel
#

Ruby is beginner friendly too.

modest maple
#

its pretty easy to get the basic idea of problem solving thinking with python

valid frigate
#

ruby is incredibly slow

queen bone
#

it is easier but to feel it easier you have to learn a little difficult language

valid frigate
#

additionally it's for fast prototyping

modest maple
#

but it does make people over-estimate their skill going from a basic project to an actual one

valid frigate
#

most devs start with javascript but python is somewhat median difficulty

tiny tinsel
#

@valid frigate Ruby is slow yes. But still beginner friendly lol.

modest maple
#

i started with C++

#

xD

valid frigate
#

once you get the hang of python you can dive into languages like c++ or c#

queen bone
#

most devs start with javascript but python is somewhat median difficulty

valid frigate
#

why quote? it's true

queen bone
#

thats how i started

tiny tinsel
#

I started with Visual basic.

valid frigate
#

vb is old so if you're older that would be the case

mossy vine
#

@valid frigate python and Clike languages are VEEEERYYYY different

tiny tinsel
#

That's 8 years ago.

valid frigate
#

you can dive

#

i didnt say they have a symbolic relationship

modest maple
#

for really basic af code

tiny tinsel
#

CrunchyBot

modest maple
#

just drag n drop files into cogs

#

n thats bout it

#

and yes

#

this bot is not called crunchy

#

but for some reason i name any running files <botname>bot

earnest phoenix
#

I am new to this and since invite manager is down I need help making a bot that tracks invites for my company server

sudden geyser
#

any of these:

  • wait for it to come back (if it does)
  • check if there's an alternative on the website that offers the same feature
  • or make your own by caching all the server invites, then checking which one is incremented upon member join to see which invite was used
earnest phoenix
#

Okay

#

I am trying to make my own

earnest phoenix
#

Does anyone know the code to track invites

summer torrent
#

which library do you use

#

@earnest phoenix

earnest phoenix
#

Well right now I am following this
NodeJS: https://nodejs.org/en/
Visual Studio Code: https://code.visualstudio.com/
Discord Developer Portal: https://discordapp.com/developers/
Permissions Calculator: https://discordapi.com/permissions.html

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications.  Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

rotund lance
#

seriously tho

#

wtf

#

why does this keep happening

#

servers randomly get dropped and re added all the time

vital lark
#

discord being shit

#

that's why

rotund lance
#

it sucks because all of those servers then get spammed with the welcome messages

#

again and again

vital lark
#

or they are spamming joining + leaving Shrug

rotund lance
#

nah it always happens in batches

vital lark
#

well, my best bet would be Discord

rotund lance
#

a handful of them get dropped, then get re added right away

#

do you ever see this?

delicate zephyr
#

@rotund lance you need to check if the server is going unavailable

vital lark
#

I would recommend having the guildUnavaliable/guildAvaliable events handy

rotund lance
#

hmmmm

#

that's a good idea

vital lark
#

no since my bot isn't big and doesn't get unavaliable events

prime cliff
#

The guild object should have an isavailable bool

vital lark
#

well it does

#

in discord.js & eris, there is Guild#avaliable

#

in JDA there is Guild#isAvaliable iirc

outer niche
#

ok so i have a text file and i want it to sat txt at the end how do i trn it on like the pic

rotund lance
#

it's just so annoying that discord drops the bots when a server goes unavailable

vital lark
#

it's just discord being discord

#

very stable™️

rotund lance
#

and then re-fires the server join event when the server is back

#

and it happens quick

#

like someone flicking the lights on and off

#

i hate this lol

vital lark
#

I would recommend checking if the guild is avaliable then run your shit, else don't do anything

rotund lance
#

aight

#

that's actually a really helpful suggestion

#

thank you

vital lark
#

no problem

rotund lance
outer niche
#

How can i run my python bot with a cammand

#

Like in a terminal

stable horizon
#

-Cd into your directory
-python3 [filename]

empty owl
#
   let everyone = message.guild.defualtRole
              channel.overwritePermissions(everyone, {
      VIEW_CHANNEL: false

#

Supplied parameter was neither a User nor a Role.

#

used to work

#

ig

#

whats the new way to deny @ everyone view channel

#

discord.js

summer torrent
#

"defualtRole"

empty owl
#

i did that

#

LAMo

#

lMAO im actually stupod

summer torrent
#
channel.overwritePermissions(message.guild.id, {
      VIEW_CHANNEL: false
})```
message.guild.id = everyone role
empty owl
#

m yea

#

default role still works too tho right

empty owl
#

okay

hard anchor
#

how can i get the "BOT DEVELOPER" role?

pallid aspen
#

I am busy with reading a JSON file, where there at the moment 8 items in it, the problem is i have a for loop now, but it doesn't count till 8 items, what is the problem im encountering?

             var importedJSON = JSON.parse(body);
                     for(i = 0; i < importedJSON.length; i++){```
summer torrent
#

@hard anchor by having a bot in top.gg

hard anchor
#

i do

#

anyways have fun

summer torrent
#

wait for approval

quartz kindle
#

@pallid aspen what is the json structure like?

pallid aspen
#

I think i fixed it 😛

#

forgot to put posts.length

quartz kindle
#

if the base key is posts then it should be importedJSON.posts.length

pallid aspen
#

Yes i noticed, so dumb.... xD

quartz kindle
#

:)

pallid aspen
#

Thanks for the help 😛

#

Last little question, how can i do this command every 10 mins for example?

#

Cause to execute this command, i need to enter a message before it executes, but i'd like to execute it every 10 mins

bright karma
#

is there any good ways to handle reading a string, then construct a regex and store it in a collection for caching with alot of regexes within a short time in node.js without the node process exceeding it's heap limit?

earnest phoenix
#

trying to turn the bot online

scenic kelp
#

You do not have node.js installed?

earnest phoenix
#

I do

prime cliff
#

do node -v

earnest phoenix
#

Ok on node?

scenic kelp
#

What?

prime cliff
#

On your console

scenic kelp
#

Type node -v into your console

earnest phoenix
#

OK

#

Okay*

#

Where is the console I am completly new to this

prime cliff
#

???

earnest phoenix
#

Command Promt?

scenic kelp
#

Where you tried to turn the bot on originally

#

Yes

earnest phoenix
#

Ok

sudden geyser
#

Did you recently install Node.js?

#

@earnest phoenix

earnest phoenix
#

Yes

#

Like 45 mins ago

#

Should I install the latest version

prime cliff
#

What does node -v show then or what version are you on?

sudden geyser
#

I've seen a friend of mine have that issue, and it was resolved by either restarting the computer (though I'd avoid that) or adding it to path or something. I'll search it up

Edit: is this useful? https://stackoverflow.com/a/28821955/11389072

earnest phoenix
#

I was on the older one

#

Should I get the new one

#

I will look

tiny tinsel
bright karma
tiny tinsel
#

My English is not perfect sorry.

#

But thanks I will correct it.

earnest phoenix
#

What is the hotkey to get to the terminal

#

As I was told to do that

sudden geyser
#

"Creating an Apex legends discord server never been that easy" could be, "Creating an Apex Legends Discord server has never been this easy."

tiny tinsel
#

Thanks.

earnest phoenix
#

Shall I restart all again?

#

@tiny tinsel Your bot description is a way better than some other bots I've seen, really good job so far :)

prime cliff
#

You should probably save your css/description somewhere just incase too since your bot is not approved yet :/

earnest phoenix
#

^

tiny tinsel
#

Thanks and I will save it right now.

green kestrel
#

jeeeez.... gateway intents are awesome

#

if your library adds support for gateway intents, i suggest you make use of them ASAP.

#

my cpu usage is currently showing as 0% but the graph takes some time to settle

earnest phoenix
#

After retrying it, The bot still aint going online

delicate zephyr
#

@green kestrel what do you use for that

green kestrel
#

the graphs? users, channels, messages and guilds are done via chewey bot stats

#

cpu is done via a shell script and a mysql table

#

bandwidth is done by MRTG/SNMP

#

facts learned comes directly from the bot

#

theyre all drawn via chart.js

eager cradle
digital ibex
#

Ok, what exactly is ur issue @eager cradle

#

oh nvm

#

i will take a look at the bin

eager cradle
#

thank you

digital ibex
#

are you using handlers?

eager cradle
#

yes

earnest phoenix
#

Hmm

#

Looks like you messed up in a line of code

eager cradle
#

it would be great to know what I messed up

earnest phoenix
#

Wait

#

I'm not sure

#

I had it and I lost it

coral trellis
#

We don't allow spoon feeding here

slender thistle
#

Xig one step ahead

earnest phoenix
#

That is true Xig

coral trellis
#

And just a fair warning don't say you'll only help someone if you get something in return

#

It's scummy

eager cradle
#

never asked to be spoon fed

#

I was told this is the best place to come to for this issue

#

thats why I am here

digital ibex
#

What is your console error?

#

is there a console error?

eager cradle
#
(node:6128) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received 'utf8'
scenic kelp
#

The error says your problem right there: A function is requesting a callback function but you're passing a string to it

earnest phoenix
#

Theres a INVAILID CALLBACK

#

Thats all we really can say

eager cradle
#

nevermind guys you are the best 😄

scenic kelp
#

Or, we can say that the callback value should be a function and not a string

earnest phoenix
#

^

#

Yes I was just thinking that

#

so a CALL BACK to a FUNCTION

#

Is that to much info?

#

Lmao

#

That was me when I was noob

#

What language you code?

#

Same

coral trellis
#

ty

earnest phoenix
#

Np I knew you were gonna say that

earnest phoenix
#

Does anyone know the coding used to track invites

#

So like this members has 4 invites

tiny tinsel
earnest phoenix
#

can someone help me i want to make a bot same as like luca

lofty vine
#

how do ye setup custom prefix for each guild??

sinful lotus
#

database

lofty vine
#

oo

#

but how? using fs?

sinful lotus
#

no, using a real database

lofty vine
#

um?

sinful lotus
#

mysql, mariadb, postgres, mongodb, cassandra are example of database

lofty vine
#

ooo thanks

sinful lotus
#

sqlite is also a database if you dont want setting up a database server, but I would not recommend it if you plan to scale your bot

lofty vine
#

okie thanks!

sand horizon
#

If you wanna go even simpler, I got started using an INI file and the python.config module

#

If you bot will only ever hold small, trivial preferences for servers, I'd argue a simple INI or JSON file isn't a bad idea

valid frigate
#

hi can anyone confirm if the most recent patch of jda (100) is causing login issues

#

ive seriously tried just rebuilding my bot from a new gradle project in intellij completely but either way doesnt work

lofty vine
#

jda..?

mossy vine
#

no issues like that are reported on its github

earnest phoenix
quartz kindle
#

d.js version?

earnest phoenix
#

12 dev

quartz kindle
earnest phoenix
#

oh okay

topaz fjord
#

don't IDs start at 0 for shards?

#

I think they do

earnest phoenix
#

They do

#

yes it's starting at 0 but you can add 1 (with + 1)

#

But what's the point

topaz fjord
#

or you could do /1 instead of /2

earnest phoenix
#

Is it possible to add an anti spam for like a level system? If so, how?

empty owl
#

@earnest phoenix what lib

earnest phoenix
#

discord.js

empty owl
#

Okay, how about you log their last message

#

And save their date.now

#

and the next time they send a message

#

check if that the current date.now minus the saved date.now is greater or less than like 5000(5 seconds)

#

if that is true, continue with the process

#

@earnest phoenix

earnest phoenix
#

ok thx

empty owl
#

your welcome

valid holly
#

oh moose

#

Your username sounds familiar

glad charm
#

Sounds like you aren't checking if the object exist or not.

#

Why not send the line or two of code where it errored at?

earnest phoenix
#

r3

#

salutare

quartz kindle
#

if (!args[0]) {

#

args is undefined

glad charm
#

Right

quartz kindle
#

how are you running the command?

glad charm
#

You are checking if it's undefined but also checking if there is a first element.

quartz kindle
#

in your main file

glad charm
#

You want to do if(!args.length)

quartz kindle
#

^ cant read length of undefined

glad charm
#

By checking the length, we can see if it has nothing inside the array.

#

Oh. Hmm

#

I guess they could be passing nothing.

#

I'm too used to TS at this point. 😦

quartz kindle
#

and then?

#

how do you use command.run()?

glad charm
#

if(!args) should be fine then

earnest phoenix
#

i have setup my website

#

and domain but showing this

quartz kindle
#

you have no args

glad charm
#

You give it no args there.

quartz kindle
#

yes

glad charm
#

Yes.

earnest phoenix
#

help me

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

glad charm
#

Lmao

mossy vine
#

did you only now find out that message links are a thing

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

no

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

that would raise a different error dv

#

invalid redirect_uri

restive furnace
#

if the redirect url dont have http or https it wont work

#

No.

#

I dont have 2FA active (yes im lazy to enable it), but still i can add my bot admin permission in oath2

#

auth

#

i mean my bot has admin perm too(no extra roles) and no 2FA enabled for me

#

so its not required.

earnest phoenix
#

@sage bobcat how i do it

#
let prefix = guild.prefix;
      if(message.guild.id === '264445053596991498') prefix = "nep!"
      
      const args = message.content.slice(prefix.length).trim().split(/ +/g);``` gives me `TypeError: Cannot read property 'length' of undefined`
blissful scaffold
#

prefix is not defined

uneven wyvern
#

is sharing only working with a index.js file?

earnest phoenix
#

is there a way to check if user has blocked dms?

uneven wyvern
#

Google exists

earnest phoenix
#

nvm

#

i got it my self

#

i will say same thing to you

uneven wyvern
#

I found it out alr

#

and spoon-feeding is not allowed

earnest phoenix
#

hi

#

bot confirms when

uneven wyvern
#

1-2 weeks

earnest phoenix
#

okey

green kestrel
#

so i started out with just a live and dev mode in my bot... so i can run with live or dev token.
i decided that if i needed to stress test i needed more than the 3 guilds the dev bot is in so i added a separate test mode.
test mode runs the bot with the live token but squelches all outbound messages and responses unless the message came from a test server, identified by its id.

can anyone think of any issues with that i may have missed? in short, when im running both test and live side by side no users can tell, because the test instance never answers them so i dont get double replies.

#

it does mean the bot double-replies on the test server, but the only one there is me and the bot

#

you can have a prefix as long as you like

#

personally i have mine as !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

#

:missingSarcasmEmoji:

sudden geyser
#

Brain could you share your code // examples of what you're doing? Is the bot replying twice to every message or something

edit: preferable a link

earnest phoenix
#

Just don't have common prefix

sudden geyser
#

you can have one, it'll just be muted here for people who don't care

earnest phoenix
#

2 instances of the bot are running

green kestrel
#

@sudden geyser no its not, apart from where i tell it it can. im more seeking feedback on if this may be a bad idea for another reason. basically i made a way to run the live bot in a test mode so i can run it twice, but squelch the messages to stop multiple replies.

#

this works, and it doesnt reply twice

#

but i wanted to know if there are any gotchas from this approach, it was a convenient way to run a test bot on 880 guilds

#

without disrupting users

earnest phoenix
#

Make an other bot

#

Other app

#

Other token

#

Other code

green kestrel
#

i already have another bot, with another token, but the dev bot is only on 3 guilds

#

so if i want to see how a change affects cpu usage on many more servers, i temporarily run in test mode instead

sudden geyser
#

actually scratch that (what I just deleted)

green kestrel
#

so over at ovh, live sporks runs, 880 servers, replies to messages anywhere its addressed. in my cupboard, test sporks runs, 880 servers, replies to messages only on test but shares its token with live

#

theres a separate dev token i use when im not bothered about giving it a real world user load

#

make sense now?

#

kind of hard to explain

quartz kindle
#

what i do is make the test script only answer to me

#

by checking my user id

#

i also give it a different prefix

green kestrel
#

ah

#

the only other thing i can think of thats bad is, if i do a booboo and get stuck in a loop, any bans etc will apply to live too as they share a token

#

so i have to be careful

#

basically test becomes step 2 in a 3 step process.... dev environment, there may be fundamental breakage... test environment, it shouldnt break... production environment

sudden geyser
#

yes

restive furnace
#

why prefix.json

#

you literially can if prefix == prefix1 || prefix2

#

(thats not formatted right)

#

yes

#

bruh

quartz kindle
#

you cant do prefix == prefix1 || prefix2

restive furnace
#

message content startswith i meant

quartz kindle
#

unless prefix1 is something that may not exist, and prefix2 is the fallback

valid holly
#

Tim you comfortable with gnome ?

quartz kindle
#

actually not even then

modest maple
#

I mean the example you used can be solved by just making it caps insensitive

quartz kindle
#

if used in a comparison, prefix2 will always return true if prefix1 doesnt exist

#

@valid holly you mean gnome desktop for linux?

valid holly
#

yep

quartz kindle
#

havent used it in a long time

valid holly
#

I'll DM you better, got a problem

quartz kindle
#

i think you'd better google, i probably wont be able to help

#

show code

#

in code blocks please

#

sigh..

#

i already downloaded it

#

you are not kicking anyone

#

where is member.kick()?

uneven wyvern
#

what's the background class for the top.gg Bot page ?

amber fractal
#

Have you tried inspect element

#

There's an element selector as well

earnest phoenix
#

Hi

tiny tinsel
#

Hello

#

@uneven wyvern You mean the white card?

earnest phoenix
#

I need a tutor

sudden geyser
#

in what

tiny tinsel
#

@uneven wyvern I think you're talking about .longdescription .content

earnest phoenix
#

For creating bit

tiny tinsel
#

Creating what?

earnest phoenix
#

A bot

#

bot

#

I don't think you need a tutor for that

#

that's why tutorials and docs exist

#

I mean for me a tutor would help but ok

#

¯_(ツ)_/¯

grim aspen
#

what

earnest phoenix
#
con.query(`SELECT * FROM **** WHERE id = ('${message.guild.id}')`, (err, rows) => {
        if(err) throw err;

        let prefix = rows[0].prefix;
        message.channel.send(prefix);

        let sql

        if(rows.id = empty) {
            sql = `INSERT INTO *** (id) VALUES ('${message.guild.id}')`
        }

        con.query(sql,console.log);
    });```
run INSERT if the XY GUILD ID is not found
that I could do it?
tiny tinsel
#

Empty is not something that exists.

#

You would have to check If rows[0] is null/undefined.

earnest phoenix
#
if(rows[0] = null) {
            sql = `INSERT INTO prefix (id) VALUES ('${message.guild.id}')`
        }```
#

it runs the same way if it is in sql

tiny tinsel
#

= is to set a variable.

#

if (rows[0]) should work

#

Try it.

earnest phoenix
#
  fieldCount: 0,
  affectedRows: 1,
  insertId: 0,
  serverStatus: 2,
  warningCount: 0,
  message: '',
  protocol41: true,
  changedRows: 0
} undefined```
#

LOPPING

tiny tinsel
#

if (!rows[0]) sorry I was right the first time.

still merlin
#

help!

#

my mute thing didnt work and I cant turn my bot online

earnest phoenix
#

.addrole

modest maple
#

You're using a space

still merlin
#

So I need to do person.addrole

tiny tinsel
#

Same thing as removeRole.

still merlin
#

person.addRole*

tiny tinsel
#

Except It is addRole.

still merlin
#

I'm really bad at javascript what do I type insted

#

nvm I found it I think

earnest phoenix
#

@tiny tinsel ```
code: 'ER_EMPTY_QUERY',
errno: 1065,
sqlMessage: 'Query was empty',
sqlState: '42000',
index: 0,
sql: undefined
} undefined undefined

LOPPINGjs
con.query(SELECT * FROM **** WHERE id = ('${message.guild.id}'), (err, rows) => {
if(err) throw err;

    let prefix = rows[0].prefix;
    message.channel.send(prefix);

    let sql

    if (!rows[0]) {
        sql = `INSERT INTO **** (id) VALUES ('${message.guild.id}')`
    }

    con.query(sql,console.log);
});
tiny tinsel
#

@still merlin Also setTimeout won't work If you're trying to mute the person for x amount of time.

still merlin
#

the command is

!mute @user time and then after time expires they get unmuted

#

so that dosent make sence tbh i dont know what Im doing that was all I could fiugure out

#

It worked thanks :) my bot is online

tiny tinsel
#

@earnest phoenix Let me read something.

#

@earnest phoenix Ok I see It returns an array so.

#

YOu want ot check if the array is emtpy.

#

instead of rows[0]

#

if (rows.length === 0)

#

Also Id check If It exists before sending the message.

earnest phoenix
#
  errno: 1065,
  sqlMessage: 'Query was empty',
  sqlState: '42000',
  index: 0,
  sql: undefined
} undefined undefined``` ```js
        if (rows.length === 0) {
            sql = `INSERT INTO prefix (id) VALUES ('${message.guild.id}')`
        }```
tiny tinsel
#

@earnest phoenix I see because you no matter what you try to execute the query.

still merlin
#

I have this issue I added a time but like my bot thinks I didnt my code is:

bot.on('message', message=>{
let args = message.content.substring(PREFIX.length).split(" ");

switch(args[0]){  
    case 'mute':
        let person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]) )
        if(!person) return message.reply("***__This user isnt found try again__***");

        let mainrole = message.guild.roles.find( role => role.name === "Waiting");
        let muterole = message.guild.roles.find(role => role.name === "muted");

        if (!muterole) return message.reply("*Couldn't find the muted role*");

    
        
        let time = args [2];

        if(!time){
        return message.reply("Please specify a time!")
        }

        person.removeRole(mainrole.id);
        person.addRole=(muterole.id)

        message.channel.send(`@$(person.user.tag) *has now been muted for $(ms(ms)time))}`)

        setTimeout(function(){

person.addRole(mainrole.id)
person.removeRole(muterole.id)
message.channel.send(@$(person.user.tag) has been unmuted)
}, ms(time));

    break;
}

})

tiny tinsel
#

put

con.query(sql,console.log);

In your condition ( if (rows...) )

still merlin
#

talking to me?

tiny tinsel
#

@still merlin Please use ``````

still merlin
#

Wdym

tiny tinsel
#

Code blocks

blissful scaffold
#

your code would be a lot more readable if you use code blocks

still merlin
#

I will screenshot

blissful scaffold
#

just put it in a code block please

modest maple
#

Use code blocks

#

Don't ss

still merlin
#

You want me to code block everything containing `'s??

blissful scaffold
#

only show us the relevant code

delicate zephyr
#

His code

#
bot.on('message', message=>{
    let args = message.content.substring(PREFIX.length).split(" ");

    switch(args[0]){
        case 'mute':
            let person = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]) )
            if(!person) return message.reply("This user isnt found try again");

            let mainrole = message.guild.roles.find( role => role.name === "Waiting");
            let muterole = message.guild.roles.find(role => role.name === "muted");

            if (!muterole) return message.reply("Couldn't find the muted role");



            let time = args [2];

            if(!time){
            return message.reply("Please specify a time!")
            }

            person.removeRole(mainrole.id);
            person.addRole=(muterole.id)

            message.channel.send(@$(person.user.tag) *has now been muted for $(ms(ms)time))})

            setTimeout(function(){
person.addRole(mainrole.id)
person.removeRole(muterole.id)
message.channel.send(@$(person.user.tag) has been unmuted)
            }, ms(time));


        break;
    }
})```
#

there

still merlin
#

Oh wow-

earnest phoenix
#

oo nooo

still merlin
#

thanks

delicate zephyr
#

no problem

still merlin
#

Wdym when I do !Mute user time it says add a time

delicate zephyr
#

for future reference starting your message with ``` and ending with ``` does that

still merlin
delicate zephyr
#

because

still merlin
#

its saying I didnt specify a time when I did

delicate zephyr
#

args [2]

#

do args[2]

tiny tinsel
#

@still merlin Did you try to console.log(args[2]);

delicate zephyr
#

@tiny tinsel he has a space there

#

thats the issue

still merlin
#

oh thanks

delicate zephyr
#

no problem

earnest phoenix
#

@tiny tinsel
I deleted the SQL contents ```throw err; // Rethrow non-MySQL errors
^

TypeError: Cannot read property 'prefix' of undefined js

con.query(SELECT * FROM prefix WHERE id = ('${message.guild.id}'), (err, rows) => {
if(err) throw err;

    let prefix = rows[0].prefix;
    message.channel.send(prefix);
    
    let sql

    if (rows.length === 0) {
        sql = `INSERT INTO prefix (id) VALUES ('${message.guild.id}')`
    }

    con.query(sql,console.log);
    
    let prefix = rows[0].prefix;
    message.channel.send(prefix);
});
still merlin
#

restaring my bot now thnx

tiny tinsel
#

That doesn't matter though @delicate zephyr

blissful scaffold
#

@earnest phoenix does rows[0] exist?

delicate zephyr
#

@tiny tinsel yea it does

#

with arrays

tiny tinsel
delicate zephyr
#

wait

#

I just noticed

tiny tinsel
#

I didn't even know either. I mean It is ugly though.

delicate zephyr
#

@still merlin You have 2 spaces after the mention btw, which is causing args[1] to be a space

#

you can use regex to fix that

still merlin
delicate zephyr
#

You have 2 spaces after the mention

tiny tinsel
#

@earnest phoenix That's why I said look If exists before getting the prefix.

earnest phoenix
#

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To termin ate the node process on unhandled promise rejection, use the CLI flag `--unhandl ed-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejecti ons_mode). (rejection id: 2) (node:13832) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr ecated. In the future, promise rejections that are not handled will terminate th e Node.js process with a non-zero exit code.
Help Plz

delicate zephyr
#

@still merlin i'll move to dms

still merlin
#

Ok thnx

#

Ill enable PMS

tiny tinsel
#

@earnest phoenix You are running your first query. Then you try to get prefix. Which doesn't exists.

still merlin
#

done

earnest phoenix
#

Someone Help

tiny tinsel
#

@earnest phoenix

con.query(`SELECT * FROM prefix WHERE id = ('${message.guild.id}')`, (err, rows) => {
    if (err) throw err;

    if (rows.length === 0) {
        con.query(`INSERT INTO prefix (id) VALUES ('${message.guild.id}')`, console.log);
    }

    let prefix = rows[0].prefix;
    message.channel.send(prefix);
});
delicate zephyr
#

@earnest phoenix Most of us here dont know java

tiny tinsel
#

It is javascript though.

#

node.js

#

@earnest phoenix Show snippets.

delicate zephyr
#

oh

#

yea

#

ok

#

It just looked weird cause he didnt use a code block

earnest phoenix
#

Whats Snippets

#

I AM NEW

tiny tinsel
#

@earnest phoenix Part of your code where the problem occurs.

earnest phoenix
#

@tiny tinsel SEE DM

#

okay did it succeed how disturbing it is? ```Error: ER_EMPTY_QUERY: Query was empty

code: 'ER_EMPTY_QUERY',
errno: 1065,
sqlMessage: 'Query was empty',
sqlState: '42000',
index: 0,
sql: undefined
} undefined undefined```

#

works just any command i write this gives the console this trouble?

#

current code ```js

con.query(SELECT * FROM prefix WHERE id = ('${message.guild.id}'), (err, rows) => {
if(err) throw err;

    let sql

    if (rows.length === 0) {
        sql = `INSERT INTO prefix (id) VALUES ('${message.guild.id}')`
    }

    con.query(sql,console.log);



    let prefix = rows[0].prefix;

if (!message.content.startsWith(prefix)) return undefined; // így lesz jó a prefix

let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
let commandfile = bot.commands.get(cmd.slice(prefix.length));
if(commandfile) commandfile.run(bot ,message, args, con);

});
});```

tiny tinsel
#

I just sent something earlier

blissful scaffold
#

Look at the code Nathan posted and compare it with your own code

tiny tinsel
#

I will try to explain better. So you're running your first query.

#

You check if It is empty with the if condition.

#

What happens If it is not empty?

#

It will try to execute sql.

#

That is empty because it doesn't go through your condition.

#
con.query(`SELECT * FROM prefix WHERE id = ('${message.guild.id}')`, (err, rows) => {
    if (err) throw err;

    if (rows.length === 0) {
        con.query(`INSERT INTO prefix (id) VALUES ('${message.guild.id}')`, console.log);
    }

    let prefix = rows[0].prefix;
    message.channel.send(prefix);
});```
earnest phoenix
tiny tinsel
#

👍

earnest phoenix
#

Hi

tiny tinsel
#

Sup.

earnest phoenix
#

Who wants to partner up like create a bot together

digital ibex
#

u know js?

#

and djs?

earnest phoenix
#

Wat

digital ibex
#

javascript

earnest phoenix
#

Oh I do

#

But I use cmd

digital ibex
#

anyways, message.mentions.first(); || message.author || what do i put here so you can search by name

valid holly
#

pass a string ?

#

or a discriminator

earnest phoenix
#

Wat

valid holly
#

replying to @digital ibex mate, don't worry

vital lark
#

also there is gonna be an error

#

there is a ;

digital ibex
#

oh, i just made that now

#

came back from school

tiny tinsel
#

Why would you check for the first mention or message author?

digital ibex
#

Ok, thank you

#

userinfo command

valid holly
#

probably <prefix><command> <args>

tiny tinsel
valid holly
#

he wants to return info based on arguments

#

if !<args> return author of the message

digital ibex
#

Thats not the best way to do it am i correct?

valid holly
#

It is

tiny tinsel
#

@digital ibex what do i put here so you can search by name

digital ibex
#

thank you Nathan

valid holly
#

Instead of author try .member

digital ibex
#

yea

#

okay. Thanks

valid holly
#

grab the member object then use the user object whenever

earnest phoenix
uneven wyvern
#

@digital ibex remove that semicolon

digital ibex
#

yea ik

tiny tinsel
#

@earnest phoenix What's the code?

#

It is hard to tell from a video what doesn't work.

earnest phoenix
#
bot.on("message", async message => {

    con.query(`SELECT * FROM prefix WHERE id = ('${message.guild.id}')`, (err, rows) => {
        if(err) throw err;
        
        if (rows.length === 0) {
            con.query(`INSERT INTO prefix (id) VALUES ('${message.guild.id}')`, console.log);
        }



        let prefix = rows[0].prefix;

  if (!message.content.startsWith(prefix)) return undefined; // így lesz jó a prefix

  let messageArray = message.content.split(" ");
  let cmd = messageArray[0];
  let args = messageArray.slice(1);
  let commandfile = bot.commands.get(cmd.slice(prefix.length));
  if(commandfile) commandfile.run(bot ,message, args, con);

});
    });```
tiny tinsel
#

Instead of return undefined;

#

Just return;

#

if (!message.content.startsWith(prefix)) return;

#

But I don't think that's the problem.

#

@earnest phoenix Do you have a onJoin event?

earnest phoenix
#

no

quartz kindle
#

if rows.length === 0, then there is no rows[0] and much less rows[0].prefix

earnest phoenix
#

?

vital lark
#

what Tim is saying is

#

if there are no rows (rows.length === 0), then there are no rows

#

else get the prefix from that row (rows[0].prefix)

quartz kindle
tiny tinsel
#

Oh yeah I forgot about that.

valid holly
#

@earnest phoenix is your bot reacting to every message on the server ?

#

And you can fix the null pointer error

#

By editing the default prefix onJoin

earnest phoenix
#

yes

valid holly
#

Basically whenever your bot joins a server write an SQL table with guild.id

#

Easiest way

tiny tinsel
#

The problem ain't that.

#

It is what Tim pointed.

valid holly
#

I was about to explain him that but surely a little bit rushed today nathan

tiny tinsel
#

I told Hedi earlier to check when the rows is empty.

blissful scaffold
#

You might also want to cache the prefix for each guild, else you do a SQL call for every message you receive

tiny tinsel
#

But you will have to get the prefix from that query too.

vital lark
#

well, just one query

#

and save it

valid holly
#

^

earnest phoenix
#

I'm confused. There's a lot of information

ruby talon
vital lark
#

yes

valid holly
#

yes

vital lark
#

it's been there since day 1

ruby talon
#

Really?

#

Lol

quartz kindle
#

i didnt know that was a thing

ruby talon
#

Me neither

valid holly
earnest phoenix
#

@valid holly @tiny tinsel I'm confused. There's a lot of information

valid holly
#

ok

earnest phoenix
#

now what the hell do i do

#

?

vital lark
#

they just told you

blissful scaffold
#

How do you get that info @ruby talon ?

ruby talon
valid holly
blissful scaffold
#

thanks ^^

valid holly
#

please

ruby talon
#

Sorry m8.

#

Anyone have experience with Rust?

valid holly
#

Channel for chatting about (bot) development. If you have questions, ask the questions and wait for someone who can answer to help you. Do not ask to ask. Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem. Do not @mention people randomly.

ruby talon
#

I know.

valid holly
#

@vital lark he'll need a default prefix eventually

vital lark
#

yes ur correct

valid holly
#
if(rows.length == 0) {
  let prefix = "prefixHere";
} else prefix = rows[0].prefix;
#

But fristly fix your message event

#

Your bot is reacting to every message

#

Even DMChannels

#

which are not part of a guild object

#

Define default prefix at top

earnest phoenix
#

how can i do that if the bot's joinola server is going to break the insert into

valid holly
#
bot.on("message", async message => {

var prefix = "yourPrefix"; // Change yourPrefix to whatever prefix you want your bot to have as default

  if(!message.content.startsWith(prefix) || message.author.bot || !message.guild) return;

});
#

Then

#

You can put the rest of the code reading SQL info

#

And change variable prefix accordingly to the guild's settings

#

I highly suggest you create a configuration for each guild when the bot joins

delicate zephyr
valid holly
#

Had to

earnest phoenix
#

but then it won't work well ```js
if(!message.member.hasPermission("MANAGE_GUILD")) return message.channel.send({embed: nyetEmbed});
if(!args[0]) return message.reply("Kérlek írd be az új prefixet");

    con.query(`UPDATE prefix SET prefix='${args[0]}' WHERE id = '${message.guild.id}'`, (err, rows) => {
        if(err) throw err;
    });```
#
    name: "setprefix"
}```
sudden geyser
#

don't insert the arg directly into the sql statement.

#

That's prone to SQL injection

delicate zephyr
earnest phoenix
#

I know well but it doesn't store any data

valid holly
#

Gave him a bit I think that's fine

#

doesn't store any data

#

what does args[0] do then

sudden geyser
#

I think they mean it doesn't hold any data at the moment (the db, which is still confusing as when it does, that's still risky). Like, what is going wrong exactly?

valid holly
#

Confusing confusing confusing

earnest phoenix
#

@valid holly -setprefix ?

#

? = args[0]

valid holly
#

Then it stores data

#

So it makes it open to Kinolite's statement

#

I suggest you to revise the JS, SQL docs and come back

earnest phoenix
#

sanitize 👏 your 👏 input 👏

modest maple
#

ngl im pretty happy with how simple this command handler is for like 30 mins of coding

#

drag n drop into file and just customise from that template

#

n thats it

topaz fjord
#

I like my command handler

modest maple
topaz fjord
#

This is mine @modest maple

#

I use annotations for mine

modest maple
#

ah yh

copper cradle
#

if we had decorators in go pensivecowboy

valid holly
#

I should improve my command handler aswell

#

Only for arguments tho, I handle everything from the command file

sudden geyser
#

don't know why but seeing __namehere__ makes me angry in syntax umarulaptop

modest maple
#

i mean that is the standard method for defining a global var in python or imports, can change but how i define anything that gets called from another file

stable horizon
#

^ or in classes

quartz kindle
#

python is weird™️

stable horizon
#

Nah

#

Then again, every language is weird in some way

opaque eagle
#

yes

modest maple
#

i need to make the Command handler order the help command by categorys

#

but thats gunna be annoying 😫

quartz kindle
#

i just hardcode my help command lul

eternal adder
#

I've got a custom help command, although discordpy's is good I've got a link to in depth detail

delicate zephyr
#

im writing my own discord lib

#

so LUL

modest maple
#

many many things broken when getting the categorys and position index

delicate zephyr
#

i forgot you wrote the crunchyroll bot

slender thistle
#

Make a crunchyroll API for me for free pl0x

modest maple
#

cuz of the crunchyroll update it not only killed their private API it also killed my one aswell

#

it crippled theirs and just oofed mine

#

i gotta rebuild all my websockets aswell

#

:(

pallid aspen
#

Can someone help me in the right direction for the following:

I have a JSON file, and if a user is not in that list, the user wil lose his/her roles.

#

I already have the way if you are in the list of JSON that you get the role, but doing in in a reverted way, I don't know yet.

#

So in short: if (user.id != JSON file) { remove roles. }

#

And that for every user.

tiny tinsel
#

@pallid aspen Watch for file changes.

pallid aspen
#

It's checked every 10 mins.

#

for the changes.

regal saddle
eternal adder
#

@regal saddle are you using the commands extension or..?

slender thistle
#

Looks like someone overwrote the discord.py Client class

#

... or isn't using the Bot class instead

#

the latter sounding more legit

regal saddle
#

@client.command() or without ()?

slender thistle
#

Parentheses recommended (I don't remember if the commit that allowed the decorators to be called without parentheses passed)

eternal adder
#

I was about to say, (for me) outside a cog is @bot.command() and inside is @commands.command()

slender thistle
#

But you gotta use the commands extension for built-in commands system

eternal adder
#

You need parenthesis

regal saddle
#

im confused af

eternal adder
#

You wouldn't want to check every member the bot knows of to see if they have the role in order to remove? It could probably be more simple, but I think a before/after would be good so:

  1. Read from the file you're checking (the "after" file)
  2. Compare with a "before" file
  3. Anybody in the before but not the after needs their roles removed
  4. Have the data in "after" copied to "before"? @pallid aspen