#development

1 messages ¡ Page 515 of 1

midnight widget
#

woah

oblique sequoia
#

Database 101: Its a base for data

topaz fjord
#

@oblique sequoia *because it doesn't want to be attacked with corruption

oblique sequoia
#

or the RAM void. Where dead memory sections go.

earnest phoenix
#

I need help, I'm making a command that ban all Users that is in the database. The problem is that is giving too many errors.

hollow fulcrum
#

IndexError: tuple index out of range

#

await ctx.send("**Command list:**```{0} - {1}```".format('\n'.join([cmd.qualified_name for cmd in client.commands])),''.join(ree))

#

where ree = ["" if x==None else x for x in [cmd.qualified_name for cmd in client.commands]]

earnest phoenix
#

I use discord.js with sqlite

hollow fulcrum
#

I use python

slender thistle
#

if x==None

#

What is x

carmine echo
#

Why can't level store objects? If I put in an object, I always get [object Object] when I get it.

slender thistle
#

@hollow fulcrum Uh, I see a parenthesis after client.commands thing

#

There are two of them, actually

#

That's the issue

hollow fulcrum
#

ty

hollow fulcrum
#

``python

#
    ello = ree[eee] + [" - "] + [cmd.qualified_name for cmd in client.commands][eee]
TypeError: must be str, not list```
#

can someone explain this error

#

please

carmine echo
#

Did you write the whole bot yourself?

hollow fulcrum
#

some of it i copied and pasted

#

but this is original

#

😃

carmine echo
#

It freaks me out that arrays are named lists in python. The error is , that whatever you're trying to do with it should be a string. And you are using an array.

#

And arrays are the thingies that have [] around them

hollow fulcrum
#

yus

carmine echo
#

I'm guessing eee is not a number

hollow fulcrum
#

it is

#

for eee in range(blah blah blash)

carmine echo
#

Also how do you even code with such horribly named variables

winged shell
#

I need help on databases, how do I start using it and how do I start off with them. I really need to add some useful commands to my bot to help it become more useful.

carmine echo
#

Language?

winged shell
#

forgot to mention

carmine echo
#

py GWeeeSataniaDisgust I want nothing to do with py lol

winged shell
#

pog alright

hollow fulcrum
#

databases are hosted, so get a mysql database from ebay or 000webhost or something

carmine echo
#

I've tried py today. Everything about it creeped me out.

hollow fulcrum
#

and just google how to use mysql

#

profit

carmine echo
#

If you're using js and want something really basic, use enmap. very good thing.

hollow fulcrum
#

stop making people switch to js fam

carmine echo
#

js is superior fam

winged shell
#

i like py better

hollow fulcrum
#

i'll be learning java next year i hope

carmine echo
#

js is very useful, especially for web development. Many programmers hate it, but imo it's much better than py

#

and there are amazing things such as node

#

Rewrite your bot in js.

#

lol

winged shell
#

Yes, I should rewrite 5 months of work.

heady anvil
#

java's the best

astral quail
#

Is there a way to see what invite code the user used when they join a server?

#

Using Eris btw.

earnest phoenix
#

yep

#

store invite counts + their code before an user joins

#

user joins

#

check all invite counts

#

look what increased with 1

#

return that code

astral quail
#

oh shit

#

that's pretty smart

earnest phoenix
#

Lol

#

Now all you should check out is HOW to do it in eris xD

slender thistle
#

@winged shell what database do you even want to use

winged shell
#

anything that i can use

slender thistle
#

I have only used sqlite and mongodb so far

topaz fjord
#

a database is where data hides so its safe from corruption and ram which is where dead memory sections go

#

mongodb >>> *

winged shell
#

im aware on what a database is

slender thistle
#

Aye sir

winged shell
#

i just dont know how to use/make one

slender thistle
#

mongodb is gud :^)

winged shell
slender thistle
winged shell
#

oml

slender thistle
#

@carmine echo People use what they want RenShrugGif

carmine echo
#

ok

slender thistle
#

@hollow fulcrum What error is that even

hollow fulcrum
#

idek

slender thistle
#

All I can guess from there is your [] + [] shit

hollow fulcrum
#

i fixed it now

#

a long time ago

slender thistle
#

Oh actually nvm, list + list works too

carmine echo
#

GWcodesPython list

GWcodesJs array

Which is better?

slender thistle
#

Opinions differ

#

I am used to lists, so I'll vote for list

topaz fjord
#

golang slice is better

carmine echo
#

arr.slice(1, 5)

topaz fjord
#
// array of string
[]string

// array of ints
[]int
carmine echo
#

GWcodesPython len(str)

GWcodesJs str.length

Which is better?

topaz fjord
#

len

carmine echo
#

no

topaz fjord
#

bc go has it aswell

#
// Object with type string: string
map[string]string
slender thistle
#

As I said already, it's about opinions, not "X is better than Y because I Want It To Be Like That"

carmine echo
#

You're obviously really wrong

topaz fjord
#

he isn't tbh

carmine echo
#

All languages are trash.

#

Apart....

#

assembly

slender thistle
#

Okay, your opinion is yours. I am not the one to tell you what to like.

carmine echo
#

So you can't tell when something is obvious sarcasm.

#

ok

slender thistle
#

Got you there boi :^)

inner jewel
#

python lists are called that because of https://en.wikipedia.org/wiki/List_(abstract_data_type)

In computer science, a list or sequence is an abstract data type that represents a countable number of ordered values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (pote...

warm quarry
#

Someone is trying to get my bot removed for “spamming his server” even though I didn’t spam it. People in my server spammed them but I didn’t know anything about it. How do I make sure that DBL won’t remove my bot?

earnest phoenix
#

tell the person they are a moron

#

they can't unless they try to impersonate you and somehow trick the moderators, also this is the development channel. (Pst. someone was asking to do that previously)

#

and blacklist them from your bot

slim heart
#

alright so i keep getting errors from phin right

#

and its saying all these aren't valid links what not

#

but it shouldn't be trying to get all of them because they dont .match(/http/)

sick cloud
#

urls need a http and stuff and all so, yeah your regex is a bit broken

slim heart
#

how do i fix it lol?

#

?

topaz fjord
slim heart
#

ok well the same thing happens when i do arg[i].match(/http/gi)

earnest phoenix
#

that errir is not even related to ur regex

#

ur just a brainlet and making a request to an argument

#

instead of joining it into 1 string

#

idk what ur doing

#

or are u doing some magic

#

i mean starting with http isnt right but still

slim heart
#

I'm trying to test if each argument might contain a link and if it does request the link to see if its a valid website

earnest phoenix
#

🤔

#

is this some anti link spam feature

slim heart
#

no

earnest phoenix
#

u know somebody will just put a link and get ur bots ip

#

then ddos amonkaS

#

so u shouldnt do that

slim heart
#

It's too prevent my censor bot from picking up website links that contain random characters and ends up censoring

earnest phoenix
#

ah ok

slim heart
#

and also with this you wouldnt be posting anything so it wont send the ip

earnest phoenix
#

uhh topkek what?

slim heart
#

or atleast thats what the person said above lol

#

i asked this question be4

earnest phoenix
#

im pretty sure it will send HEAD request or something

slim heart
#

and then i started actually trying to do it and it does this

earnest phoenix
#

whatever link ur using it will 100% get ur ip

slim heart
#

if so then tell @sick cloud that

earnest phoenix
#

lmao tony

sick cloud
#

what

earnest phoenix
#

also JPB u should do /regex/.test(string) to get boolean

#

for the if

slim heart
#

just did that still does the same thing

earnest phoenix
#

just a nitpick

slim heart
#

it trys to run phin on everything regardless of it it matches the regex???

earnest phoenix
slim heart
#

idk y

#

@sick cloud do you know why

#

u told me to use phin

sick cloud
#

no

#

its your regex

#

not phin

slim heart
#

how?

#

.match and .test have never failed me before why now?

earnest phoenix
#

do a console.log in the if for regex match mmLol see if it matches always

slim heart
earnest phoenix
#

sure ur not doing phin somewhere else? lmao

#

check line numbers in ur error

slim heart
#

wait a second

earnest phoenix
#

no way

slim heart
#

its running phin

#

but its not doing this:

earnest phoenix
slim heart
earnest phoenix
#

then its somewhere else

slim heart
#

qwedjkqwedhuiwqjd

#

whatd i say

earnest phoenix
#

check line number in error

slim heart
#

its phin

#

umm....

#

my failed attempt from earlier

#

is what was killing the code

earnest phoenix
#

did u leave it in? kek

slim heart
earnest phoenix
#

IM DEAD

slim heart
#

and im back once again

#

2 second later

#

because even if its a thing it still errors

#

like it gets status code 200

#

actually i think i have to do it in editedswearfilter because the whole thing yeah

#

lol

#

y e e ee ee es

#

and it still doesnt work

#

ok

#

yk what

#

hhh

#

idec

#

lol

valid frigate
#

what are you making

steel heath
#

How can I make my bot leave the server in another shard

earnest phoenix
#

ipc

manic badger
#

What are shards?

earnest phoenix
#

google

steel heath
#

o wait i think broadcasting is working lol

sick cloud
#

broadcast eval

quartz kindle
#

broadcasteval if guild.id === id -> leave

earnest phoenix
#

well dont servers get assigned to shard based on id?

steel heath
earnest phoenix
#

some formula iirc

#

so no need to broadcast

#

u can calculate which one to send to

#

idk if d.js can do that. eris btw EZPopcorn

quartz kindle
#

(this.guilds.get(id) ? this.guilds.get(id).leave() : return) ?

#

xd

sick cloud
#

^

earnest phoenix
#

but return isn't an expression

placid flax
#

so that webhook thing from yesterday was a really good idea

#

not only do i not have to use a bot, but i can run a simple webserver to listen and post said webhook

#

n0w i just have to teach nginx to behave

#

aka website/api redirects internally to webapp:12514

#

but website/api:80 doesnt

earnest phoenix
#

I used dnd in client.user.setStatus and it didn’t work

sick cloud
#

what lib

inner jewel
#

http implicitly uses port 80

#

https uses 443

earnest phoenix
#

Nvm it was a typo

placid flax
#

i should be moar clear

#

http://mydomain/api redirects to mydomain:<some weird port>

#
$ curl http://<my domain>/api -X POST -d @test.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (7) Failed to connect to <my domain> port 80: Connection refused
#

eg this

#

/etc/nginx/sites-available/default:

        location /api {
                proxy_pass http://localhost:21514/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }


#

this might be out of the scope of this channel tbh

topaz fjord
#

does the / endpoint exist on your server

#

@placid flax

placid flax
#

as in /api?

#

ohhhhhhhh

#

my "web app" is trying to be /

#
@app.route('/', methods=['POST'])
async def listener(request):
    if request.method == 'POST':
        #print(request.json)
        
        #return HTTPResponse(body=request.json,status=200,content_type='application/json')
        the_embed = await build_embed(request.json)
        webhook.send(embed=the_embed)
        return HTTPResponse(status=200)
    else:
        raise exceptions.abort(400)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=21514)
#

i SUPPOSE i could try making it /api instead of /, that might do something

topaz fjord
#

I usually put the vps ip instead of localhost but idk if that could be the problem

placid flax
#

thunkign yea cause im using 0.0.0.0 on the other 3 web apps i have running

#

i mean i can curl to <mydomain>:<weridport> and it works fine

#

but i cant curl <mydomain>/api

earnest phoenix
#

help me

#

did youtube dl die?

sick cloud
#

it did

earnest phoenix
#

@sick cloud omg what is the plan

#

tooonnnnyyyyyyyyyyyyyyyyyyyyyyyyyyyy my project is failing

#

because of youtube

#

omg

#

i wanna kill you

bright spear
#

dont mention people for help...

earnest phoenix
#

dude @bright spear its tony he is my friend

#

wait yt down?

bright spear
#

did u try reinstalling the thing

earnest phoenix
#

tb>play duck song

sick cloud
#

ytdl died

earnest phoenix
#

uh oh

sick cloud
#

use another api

bright spear
#

youtube is not down

earnest phoenix
#

oh im dumb

#

lma

#

@bright spear what do you mean

#

its not down

#

!!!

bright spear
#
#

does it look down to you

earnest phoenix
#

omg

#

that is youtube

#

not youtube dl?

bright spear
#
wait yt down?
#

i was responding to him not you

earnest phoenix
#

oh cool

#

i was talking about youtube-dl

bright spear
#

if reinstalling the package doesnt work maybe create an issue in the package's repo

sick cloud
#

ytdl is dead

earnest phoenix
#

and how do you do that

sick cloud
#

how many times do i say it

#

before it sinks in

#

ytdl.
is.
dead.

earnest phoenix
#

5 times

sick cloud
#

use another package

earnest phoenix
#

1 more is left

#

sir

sick cloud
#

dead.

west raptor
#

ytdl

#

is

#

fucking

bright spear
#

lol

west raptor
#

dead

earnest phoenix
#

@sick cloud i dont know how to do that help me

#

tony.....

west raptor
#

.- .

earnest phoenix
#

i was planing to study but now i cant because i have to fix this

sick cloud
#

google

earnest phoenix
#

@sick cloud google owns youtube why would google want to help me?

#

when i am harming youtube

sick cloud
#

ok fine

sinful lotus
#

ytdl is dead

#

Thonk ?

earnest phoenix
#

yea

sinful lotus
earnest phoenix
#

daam what the hell is yum?

sinful lotus
#

yeah it IS dead

earnest phoenix
#

# yum install youtube-dl

sinful lotus
#

thats not ytdl, thats different to what we use lmao

#

works perfectly fine

earnest phoenix
#

it makes me more when not much people facing the issue

sinful lotus
#

¯_(ツ)_/¯

earnest phoenix
#

oooooooof

sinful lotus
#

for sure its clearly in your code

#

or the lib

#

not youtube

earnest phoenix
#

my code

#

was working fine

#

always has been working fine

#

@sinful lotus what lib are you?

sinful lotus
#

Javascript

#

Discord.js

earnest phoenix
#

o

#

:(

#

aaaaaaaaaaaaaaaaaaaaaaaaaaaa

#

i need a bot in js now

#

thats is it my bot is going to be coded in js

oblique sequoia
#

blocked

earnest phoenix
#

Because i am freaking done with those stupid stuff

shy rose
#

simple but quick q whats the max number of bots a user can own?

quartz kindle
#

is there a limit?

#

never heard of one

sick cloud
#

25

shy rose
#

25bots?

sick cloud
#

25 bots/dev apps

#

it was raised from 10

shy rose
#

k thanks 😄

sick cloud
#

np

topaz fjord
#

regex is hard

quartz kindle
#

25 per discord account?

topaz fjord
#

it literally took me forever to do this

#
reg := fmt.Sprintf(`<[@!?]+?%s>$|^%s[a-zA-z]+$`, s.State.User.ID, regExpEsc("tb!!"))
quartz kindle
#

ew regex

shy rose
#

thats a pretty simple regex lol

topaz fjord
#

idfk regex

#

ok

#

so it wasnt simple to me

quartz kindle
#

i cant regex either

winged shell
#

Can I pretty please with a cherry on top have a tutorial on SQLite because I'm dumb :(

topaz fjord
wise bridge
#

Don't forget to use a lib such as aiosqlite

earnest phoenix
#

Anyone knows why this happens?

earnest phoenix
#

try node bot in console

amber stone
#

what are shards?

earnest phoenix
#

Does anyone know how to run a script when you start a node application?

#

style="width:100.2% margin-right:20px!important"

#

there would be no colour

#

when i do it

#

well gray

#

ops what ever

bright spear
#

@amber stone multiple connections to the discord API because the max for one shard is 2500 servers, sometimes each shard runs in a separate process

earnest phoenix
#

am i missing something?

#

yea

#

i did

#

mess everything up

#

nvm

tawdry anchor
#

Hello! Is there any date when bot certification application will open? (I know early november, but is there ~date?)

earnest phoenix
#

this is broken

#

oh

tawdry anchor
#

apt-get

earnest phoenix
#

t

#

yea

#

i just saw

#

thanks

#

guys?

tawdry anchor
#

lol

#

apatche?

earnest phoenix
#

yea

#

i am going to host my website

#

pal

tawdry anchor
#

apache2

#

But I recommend nginx

earnest phoenix
#

apatche

#

lmao

#

thanks, umm whats the differents

#

i heard nginx is better

#

but i never tried it

#

nginx handle many concurrent connection better m9

#

aaaa

#

ok

#

fine

#

where is nginx directory?

#

type "whereis nginx" in console

#

or google

#

i got it

#

but the issue

#

or /etc/nginx

#

is

#

lol

#

the issue is

#

it doesnt work

#

!!

#

like the directory does

#

check status. is it running?

#

but when i put the website in the direcotry it doesnt work

#

is configured correctly?

#

do you need to config nignx?

#

idk if default will just work for the www data folder or whatever

#

best to view a tutorial

#

i always just wipe the config since im using it as reverse proxy lol

#

ouch

earnest phoenix
#

guys

#

is there is anyway

#

i could stream music on a vps without it the sound stopping when i close remote connect?

#

why would you do that

earnest phoenix
#

Hey, i need help. The console says DiscordapiError: Unknown User

young cradle
#

You have provided either a user you don't have shared servers with or an invalid one.

steel heath
#

why am i getting "Possible EventEmitter memory leak detected. 11 message listeners added." when i use broadcasteval lol

steel heath
#

how can i use internal sharding thing and is that really possible to get guild datas in a shard from a different shard without broadcasteval

sick cloud
#

anybody able to tell me how to update to babel v7

west raptor
sonic glade
#

Look, I have this error: Error: Can not find module './staff.js' but I do not have in any file a require or include of that file, what could it be?

slim heart
#

Is it coming from your file alone or is it coming from an npm package?

#

send the exact console

sonic glade
#

My github don´t have module.js

earnest phoenix
#

@sonic glade that is from node.js itself

slim heart
#

look at line 550

sonic glade
#

And what can I do ?

#

I have 197 lines ...

earnest phoenix
#

and it says that it can't find a file called staff.js

sonic glade
#

.

earnest phoenix
#

yes

#

but theres no file called staff.js

#

in your directory

sonic glade
#

but .. what is the problem then?

#

I can not use my bot thanks to this error

earnest phoenix
#

that there is no file called staff.js

slim heart
#

also why do u have two discords?

#

check music.js is the only thing i could think of?

sonic glade
#

I do not know, one has capital letters in the D and the other does not, that's what makes me not error

slim heart
#

oh- anyways---

#

yeah, wait is the github public?

sonic glade
#

Yes

slim heart
#

Send?

sonic glade
#

DM send

earnest phoenix
#

why would you need his github

#

theres no problem revolving around his github

sonic glade
#

I do not know, but it's public so I could see it anyway

slim heart
#

I'm looking at the code

#

ohohohoh

#

yeah

#

try using just ""

sonic glade
#

ok?

earnest phoenix
#

literally all he needs to do is create a file called staff.js in the current directory

slim heart
#

well he shouldn't have too

sonic glade
#

Same error :c

earnest phoenix
#

but hes trying to get a file that doesn't exist

sonic glade
#

😐

slim heart
#

yes so get rid of the thing calling the file

#

he should actually fix the problem instead of doing some halfassed solution

sonic glade
#

If I do not have the file created or anything that requires or includes it, why does the error come out?

earnest phoenix
#

changing the `` in a file to a "" is not a part of the problem

slim heart
#

Was just trying

#

Atleast I'm not telling him to make a useless file

earnest phoenix
#

that he is trying to get

#

@sonic glade if you don't know the file just stop trying to get it

slim heart
#

No he's not trying to thats the point

#

He doesn't want to get "staff.js"

earnest phoenix
#

yes

sonic glade
#

Gentlemen, I added the code that of the command / staff and I started with these errors, but I do not understand why they come out if I do not have the file nor the require and / or the include

slim heart
#

first off, you should make the / as a prefix

#

im just kinda of throwin pots out

earnest phoenix
#

@sonic glade can i see this github thanks

sonic glade
#

Resolved, thanks to both of us, I deleted a code that had an old command reset the bot and now it was fixed, I do not know what that command would have to be but good @earnest phoenix @slim heart

#

😛

slim heart
#

o o f

earnest phoenix
#

hmm

sonic glade
#

Is there any way to make an embed that when using for example: / owners shows you the users with the owner role?

bright spear
#

yes

#

how to do it depends on the lib you use

sonic glade
#

I use discord.js

bright spear
sonic glade
rocky mesa
#

Is there a way to join a server through my bot. Like my bot has been joining servers and I want to join one of them. Like a command !backdoor [server id] and it will send me the invite to the server? Im new to code so sorry if i dont understand anything

west raptor
#

what lib?

rocky mesa
#

oh sorry

#

discord.js

west raptor
#

just fetch a random channel from the server

#

and create an invite on the channel

rocky mesa
#

what if im not in the server though

west raptor
#

(btw i think this might be against tos lol)

rocky mesa
#

ive seen other big bots use it

west raptor
#

¯_(ツ)_/¯

#

wait

#

wdym

rocky mesa
#

about what

west raptor
#

SkarffToday at 19:32
what if im not in the server though

earnest phoenix
#

do not add a backdoor

#

unless the users request an action

#

it shouldnt do anything

west raptor
#

or your bot has a tos

#

stating you can do that

#

lol

earnest phoenix
#

do not add a backdoor

rocky mesa
#

okay..

#

its for support though

#

like if they need help they can do !support and it will send a team an invite

ruby dust
#

What

#

The fuck

rocky mesa
#

nvm

bright spear
#

help should show the command list

rocky mesa
#

example

ruby dust
#

Help is a common command to get a brief information about a bot or how to use it, not to ask for support to scrap invites to those servers

rocky mesa
#

it was an example command

ruby dust
#

A terrible example then

rocky mesa
#

ill edit it then jeez

ruby dust
#

Either way, it's not bad to have it, as long as the user fully committed for support to join and actually knows what the command does

rocky mesa
#

ya

#

idk how to make it though

bright spear
#

dream already sent the link

rocky mesa
#

yeah but im dumb lmao

#

idk how to incorporate .createInvite() into a command

#

ill go to stackoverflow to ask 1 sec

west raptor
#

fetch the channel

#

if any

#

and use channel.createInvite()

#

Also it would be better just to send a support server invite for a support command.

rocky mesa
#

would guild.channels.first().createInvite() work?

#

also yeah I realise it now but im in to deep

ruby dust
#

That will force it to use the first channel, and there is a possibility that that channel may now be accessible for creating invites

#

You should loop through channels and see which one allows you to create the invite to

west raptor
ruby dust
#

Channel can also mean a category channel

west raptor
#

^

rocky mesa
#

oh

bright spear
#

it would be easier to just try it for the channel they tried it in

west raptor
#

^

rocky mesa
#

ya

bright spear
#

but it would be more likely to work if u just go to the guild invites list and get the first one

west raptor
#

or you can filter through the type the channel

earnest phoenix
#

any librarys that have voice recognition that would work with a discord voice channel? like a fs stream?

sick cloud
#

you'd have to code voice recognition yourself

#

but discord.js might be the best there

#

it has onvoicestream and all afaik

zenith moss
#

I’m curious, I’ve seen a lot of bots show how many commands have been ran since the last restart. Anyone have any idea on how I would do that?

bright spear
#

just increment something whenever a command is used

zenith moss
#

I’ve doing that but ehh

#

My brain is hurting right now trying to get something done before I get off

lament rock
#

So. I've been working on a little project which requires me to emulate memory

let memory = {}

class Table {
    /**
     * A class that acts as a means of emulating a chunk of memory
     * @param {String} name A String to prefix memory addresses with
     * @param {String} id A unique ID in which to fill memory addresses with
     * @param {Array} values An Array of values to populate the table with
     * @returns {Array} An Array of memory addresses that were filled
     */
    constructor(name, id, values) {
        this.name = name;
        this.id = id;
        this.values = values;
        values.forEach((item, index) => { memory[`${name}${id}${index}`] = item; });
        this.addresses = Object.keys(memory).filter(o => o.startsWith(`${name}${id}`));
        return this.addresses;
    }
    /**
     * Destroys the table from the memory
     * @returns {void} void
     */
    destroy() {
        void this.addresses.forEach(item => delete memory[item]);
    }
}

I call something like:

new Table("U", "320067006521147393", [1, 2, 3]);

And it does what it's supposed to but I'm wondering if there might be a better storage method I could use for what I'm trying to achieve at least or if there's any way I can improve on this

worldly steeple
#

@lament rock The void keyword in destroy(), in this case, does nothing. You can remove it and behavior will be the same. return this.addresses; in the constructor also does nothing, you can remove it.

lament rock
#

so, if I were to set something to = a new Table, it would be pointless to return an array?

worldly steeple
#

yes, "this" is always returned from the constructor, you don't get to choose what to return from it

lament rock
#

Ah right. I could just call this.addresses

sick cloud
#

so does anyone know how to get babel to compile all code in a dir

#

not just one file

keen drift
#

How you compiling it right now thonkang

steel heath
#

Anyone know how to use internal sharding in d.js (master?)

sinful lotus
#

^ you just add it on option.shards

#

on your client options

steel heath
#

o, is that all? And can i ask you a question about if you know how it works

sinful lotus
#

well I never tried it myself on the production code, but on internal sharding, you dont create new client instance per shard

#

although things can get problematic when you use internal sharding on a big bot

steel heath
#

how so

sinful lotus
#

because javascript is single threaded

#

if you got a lot of guilds for example 20k, you are stuffing 20k guilds on a single thread

steel heath
#

oof i have 28k i need the only one client instance bevause i dont want to broadcast eval everytime on the dashboard for guild stats etc.

sinful lotus
#

you will suffer from single thread disadvantage tho

#

if you dont want to broadcastEval why not make the shards send a message to the master process

#

then master process will do the computation and get the data from there

steel heath
#

umm, can u explain it

sinful lotus
#

Shards will send a message to the Master Prcoess through this, and on that message is the data you want from that shard.
https://discord.js.org/#/docs/main/master/class/ShardClientUtil?scrollTo=send

steel heath
#

well, how am i going to find the guild and send the data to the dashboard

sinful lotus
#

send a message to shards from the master process. if shards can send message to master process, master process can send messages to shards too

#

and on the shard, process the data you want to get, then only the shard that has the data will send back a message to the master process

steel heath
#

oh ok, thank you very much i'll try that qwabsHeart

hardy sierra
#

Guys

#

How can i make like

#
Name1, name2,name3```
#

That has "ADMINISTRATOR" permission

knotty steeple
#

check for those that have it

earnest phoenix
#

@hardy sierra js?

amber junco
#

Hey! My 8ball cuts out the first word of the question... Can someone help?

earnest phoenix
#

yea send code

amber junco
#

me?

earnest phoenix
#

yes

amber junco
#

@hardy sierra
You mean like this?

{
  "token": "hi theere",
  "prefix": "!",
  "admins": ["478583597633372172","414764511489294347"],
  "uBlack": [],
  "gBlack": []
}
#

k

#
const Discord = require("discord.js");

module.exports.run = async (client, message, args) => {
  if(!args[0]) return message.reply(":uUntick: Usage: {prefix}8ball <Question>");
let replies = ["Yes","No","Ask again later!","I dont know","Sure","Percisly","Very doubtfull","My program says no","Sign points to yes","Most likely","Outlook not so good!","Without a doubt","Better not tell you now!","Conentrate and ask again!","It is certain","Outlook good","Yes-definetly","You may rely on it","Dont count on it!","Reply hazy, try again","Most likely.","My sources say no"]

let result = Math.floor((Math.random() * replies.length));
let question = args.slice(1).join(" ");

let ballembed = new Discord.RichEmbed()
.setAuthor(message.author.tag)
.setColor("#FF9900")
.addField("Question:", question)
.addField("Awnser", `${replies[Math.floor(Math.random() * replies.length)]}`)
.setTimestamp();

message.channel.send(ballembed);




 }

module.exports.help = {
  name: "8ball"
}
#

there

earnest phoenix
#

let question = args.slice(1).join(" ");

#

1 is the 2nd element

#

array start at 0

#

so ur removing the first word

amber junco
#

huh

#

yes

#

Is it possible to fix?

earnest phoenix
#

yes... just dont slice the first element

amber junco
#

oh ok

#

So I should cut out:
let question = args.slice(1).join(" ");

#

right?

earnest phoenix
#

no, you need to join args, but you dont need to slice the first element

amber junco
#

So the code should be:
let question = args.(1).join(" ");

#

Or something

#

I am a retard so yeah...

earnest phoenix
#
amber junco
#

bear with me pls

#

Is that Java?

west raptor
#

huh

amber junco
#

nvm

zenith moss
#

@amber junco,
let question = args.join(" ");

amber junco
#

Ye I get it...

#

I just fixed it

#

Thanks

zenith moss
#

Np

west raptor
prime cliff
#

@amber junco pst he said array start at 0

amber junco
#

ik

prime cliff
#

So 👏

amber junco
#

I figured it out by myself

#

lmao

west raptor
#

Only lua afaik starts at 1

#

which is WEIRD

amber junco
#

?

#

oh

#

lmao

#

wtf

sick cloud
#

lua is dumb

amber junco
#

How do you get Certified Developer?

#

get 100 upvotes?

#

1000?

#

100 servers?

west raptor
#

No

#

Apply

amber junco
#

Where?

west raptor
#

You can't right now

amber junco
#

oh

west raptor
amber junco
#

k

sage fractal
#

Using discord.js how do i get my bot to display how many users there are all together in all of the servers?

#

nvm got it

#

was doing client instead of bot

earnest phoenix
#

Hey, I have a daily command. But the problem is that quick.db is always crashed, and I decided to do it on sqlite3. But I don't know. Someone could help me?

ruby dust
#

what exactly is the problem

slender thistle
#

Not knowing SQLite3? thonk_think

earnest phoenix
#

that quick.db is always crashing @ruby dust

ruby dust
#

still no context, show code at least

earnest phoenix
#

@ruby dust

ruby dust
#

I don't see the sqlite code, or does it differ between languages?

#

I'm using python fyi

slender thistle
#

quick.db crashing? ThinkFish

ruby dust
#

also, in my experience you don't need to require the file itself, you just need to let sqlite connect to it

steel heath
#

hey, how do I set on message event for shard?

ruby talon
#

@bitter sundial , I'm tagging you for this question, since you are one of the web devs/administrators.

So I saw that patchbot had a clean page on dbl.
The question is, can every user do that, is it free?
If you can do that, how?

bitter sundial
#

css

ruby talon
#

'k.
And do you just need to put in in the place where the HTML code should stand?

ruby dust
#

in long description

ruby talon
#

'k

#

Thats what I meant.

#

xD

cold harness
#

in discord.py, is there something along the lines of embed.remove_field?

cold harness
#

thank

steel heath
#

how to use discord js shard's sending message to master process and read it from other shards...

steel heath
#

o thank you

#

it didnt change anything and i dont know why

#

it doesnt log anything when i do client.shard.send()

sick cloud
#

process.send

earnest phoenix
#
            return Math.floor(Math.random() * Math.floor(max));
          }
let flipped = getRandomInt(2);
        if(flipped == "1") {
//code
} else {
//code
}```
#

Why doesn't that every randomize?

sick cloud
#

let me guess

#

you copied that code off the internet

#

and thought it'd work

earnest phoenix
#

er no

sick cloud
#

so your saying you made that code

earnest phoenix
#

Indeed.

sick cloud
#

lol, yeah right

#

theres a simple error there anyways

#

dream dont spoon him

west raptor
#

yea i know

#

I see it

earnest phoenix
#

Alright, get the fuck out of here if your not going to help. Don't just say that there is an error because I obviously don't see it.

gilded blaze
#

When comparing the flipped variable it is an integer. You compare to a string.

sick cloud
#

@gilded blaze spoonfeeder

gilded blaze
#

shut it

sick cloud
#

"get the fuck out of here"

#

do you know js

#

if not

#

i suggest you google it

west raptor
#
earnest phoenix
#

@gilded blaze Does't 2 equal signs compare strings?

sick cloud
#

you need 3

gilded blaze
#

Learn JS

sick cloud
#

or just do value == 0

gilded blaze
#

and he doesn't need 3

sick cloud
#

use a number

#

why do you wanna compare a number to a string anyways

earnest phoenix
#

oof no ""?

sick cloud
#

exactly

#
if (flipped == 1) {
    /* code here */
} else {
    /* more code here */
}
earnest phoenix
#

spoonfeed

#

lmfao

#

i think that i can manage removing a ""

west raptor
#

its not spoonfeed but ok

earnest phoenix
#

he gave me the code

#

(╯°□°)╯︵ ┻━┻

#

thats the exact definition of spoonfeeding

west raptor
#

oh wow an if and else statement such spoonfeed!!11!!1!

earnest phoenix
#

😛

zinc tusk
#

what exactly does permissions.freeze() do?

west raptor
#

d.js?

zinc tusk
#

yes

west raptor
#

Looks like it makes them unchangeable

zinc tusk
#

oh thanks

slim heart
#

What's actually going wrong here? Because this only happens if there's only 1 arg (after I .split(' ')) but if it's one argument it always does this idk...

topaz fjord
#

we need to see code

slim heart
#
for(i=0; i < arg.length; i++) {
            if(arg[i].match(/http/gi)) {
                linkbypass.links.forEach(bs => {
                    let bsr = new RegExp(bs, 'gi')
                    if(arg[i].match(bsr)) {
                        arg = arg.filter(f => f !== arg[i])
                    } 
                })
            } else {
            arg[i] = arg[i].replace(/("|\*|\.|'|\||\\|\/|`|\<|\>|@|#|!)/gi, '')
            }
        }```
(actual code)
#

?

visual zenith
#

How to put a list of servers into embed pages like i want to separate 50 servers in 1 page

slim heart
#

@visual zenith What's your goal. And also your lib?

visual zenith
#

my lib is discord.js

#

and my goal is to put 50 servers in each page

slim heart
#

Ok so I can help you

#

So wdym by page?

visual zenith
#

embed page

slim heart
#

Like a website page?

#

Oh I see

visual zenith
#

like page 1 has 50 servers and page 2 has another/different 50 servers

#

i already mapped it out

slim heart
#

SO there's probably a much better way of solving this, but you see I'm dumb so what I'm gonna tell you to do is forEach your guild array and push it to a separate array and then use your key for every 50

#

l o l

visual zenith
#

forEach?

slim heart
#

I mean it'd work-

#

yeah

visual zenith
#

like this?

  const guildNames = client.guilds.map(g => g.name).forEach()
slim heart
#

so just do js let srr = [] bot.guilds.array().forEach(guild => { srr.push(guild.whateverpartoftheguildyourtryingtodisplay) })

#

you want guild names?

visual zenith
#

yes

slim heart
#

so

let srr = []
client.guilds.array().forEach(guild => {
srr.push(guild.name)
})```
#

and that'll give you a list containing all the guild names

#

so it'd look like
srr = ["guild1", "guild2"] so on

visual zenith
#

i only have 74 so just up to 74?

slim heart
#

Well actually your map does the same thing

#

so

#

im confused what you really need help with-

visual zenith
#

like page 1 has 50 servers and page 2 has another/different 50 servers

#

or one page has 50 and the other 24

slim heart
#

Oh so you need help actually putting them into the embed?

visual zenith
#

yes

#

absolutely

slim heart
#

Ok yeah I can't really help you past that point, if I told you what to do you'd end up with code looking like:

embed = {
blah
fields = guildNames[0]
fields = guildNames[1]
fields = guildNames[2]
fields = guildNames[3]
visual zenith
#

blah ?

slim heart
#

or well if you want to actually if you just want to put only the name

#
let str = ""
for(i=0; i<50; i++) {
str = str +"\n" + guildNames[i]
}```
#

m a y b e

#

try that?

#

Also

#

I don't think you could fit 50 server names in one embed

#

since it's a limit of 2000 characters

visual zenith
#

so how many?

#

10?

slim heart
#

Not sure

#

It depends on what people name there servers

#

I mean I think you'd be fine with 20-30?

#

But people can just make their server name really long and it'd screw up whatever page it's on

visual zenith
#

once i use that code u gave me

#

do i just console log?

slim heart
#

yeah str should be a guild name then a line break then the next guild name etc.

visual zenith
#

so i just attach it to a embed?

slim heart
#

Just replace that i<50 with whatever number of guilds you want in it

visual zenith
#

what about the next page after one reaction?

slim heart
#
const guildNames = bot.guilds.map(g => g.name)
let str = ""
for(i=0; i<100; i++) {
if(i<50) continue;
str = str +"\n" + guildNames[i]
}```
#

so that'll do 50 to 100

#

again probably a better way of doing it but thats my janky way

visual zenith
#

wait so what happens if it goes over 100? like i press the ➡ 2-3 times?

slim heart
#

then just make more of those

#

that i<100 is the end of the number so (50-100) and then that if(i<50) continue is the start so (50-100)

#

so here I'll build you some code for up to 200

visual zenith
#

now.... how would I put this all into the embed?

#

since its an array

slim heart
#
const guildNames = bot.guilds.map(g => g.name)
let oneto50 = ""
let fiftyto100 = ""
let onehto150 = ""
let twohto200 = ""
for(i=0; i<50; i++) {
if(!guildNames[i]) break;
oneto50 = oneto50 +"\n" + guildNames[i]
}
for(i=0; i<100; i++) {
if(i<50) continue;
if(!guildNames[i]) break;
fiftyto100 = fiftyto100 +"\n" + guildNames[i]
}
for(i=0; i<150; i++) {
if(i<100) continue;
if(!guildNames[i]) break;
onehto150 = onehto150 +"\n" + guildNames[i]
}
for(i=0; i<200; i++) {
if(i<150) continue;
if(!guildNames[i]) break;
twohto200 = twohto200 +"\n" + guildNames[i]
}```
#

no all of these are giving you a string

#

so in the embed just say the variable and it should put them all in an embed

earnest phoenix
#

thats very sloppy code

visual zenith
#

xD

slim heart
#

shhh

#

it works

earnest phoenix
#

can we laugh at it

slim heart
#

So look

#

when i do it, it gives me a guild name, then it line breaks, then a guild name

#

so in the embed

#

just use the variable oneto50 and it'll add them in (i think)

#

I'm not the best with embed but I'm pretty sure that'd work?

earnest phoenix
visual zenith
#

but im using this code for embed pages

                forwards.on('collect', r => {
                    if (page === pages.length) return;
                    page++;
                    embed.setDescription(pages[page - 1])
                    embed.setFooter(`Page ${page} of ${pages.length}`);
                    msg.edit(embed)
                });
slim heart
#

I have a seperate embed developer so

earnest phoenix
#

wtf

#

are you too shit to make an embed

slim heart
#

Ok well you should be making an embed with json imo

earnest phoenix
#

no

visual zenith
#

i know how to but im having karma

slim heart
earnest phoenix
#

they are sloppy

slim heart
#

use that

earnest phoenix
#

no

#

dont

visual zenith
#

this is my reaction embed pages

        const embed = new Discord.RichEmbed()
            .setColor('RANDOM')
            .setFooter(`Page ${page} of ${pages.length}`)
            .setDescription()
        message.channel.send(embed).then(msg => {
            msg.react('⬅').then(r => {
                msg.react('➡')

                const backwardsFilter = (reaction, user) => reaction.emoji.name === '⬅' && user.id === message.author.id;
                const fowardsFilter = (reaction, user) => reaction.emoji.name === '➡' && user.id === message.author.id;

                const backwards = msg.createReactionCollector(backwardsFilter, {
                    time: 60000
                });
                const forwards = msg.createReactionCollector(fowardsFilter, {
                    time: 60000
                });

                backwards.on('collect', r => {
                    if (page === 1) return;
                    page--;
                    embed.setDescription(pages[page - 1])
                    embed.setFooter(`Page ${page} of ${pages.length}`);
                    msg.edit(embed)
                });

                forwards.on('collect', r => {
                    if (page === pages.length) return;
                    page++;
                    embed.setDescription(pages[page - 1])
                    embed.setFooter(`Page ${page} of ${pages.length}`);
                    msg.edit(embed)
                });
            });
        });
earnest phoenix
#
const { MessageEmbed } = require('discord.js');
const embed = new MessageEmbed()
    .setTitle('this is so easy')
    .setDescription('mmlol');
msg.channel.send(embed);
slim heart
#

i guess just make .setDescription(oneto50)

earnest phoenix
#

v12 btw

slim heart
#

Not sure how it works so-

earnest phoenix
#

just readthedocs

visual zenith
slim heart
#
const Discord  = require('discord.js')
const guildNames = bot.guilds.map(g => g.name)
let oneto50 = ""
for(i=0; i<50; i++) {
if(!guildNames[i]) break;
oneto50 = oneto50 +"\n" + guildNames[i]
}
const embed = new Discord.RichEmbed()
            .setColor('RANDOM')
            .setFooter(`Page 1 of 69`)
            .setDescription(oneto50)
        message.channel.send(embed)```
#

here

visual zenith
#

and put emotes on it too

slim heart
#

Wym?

visual zenith
#

like \➡ and \⬅

slim heart
#

Yeah ik

visual zenith
#

so it edits the embed and changes it

slim heart
#

I was just replacing the top part of ur code

visual zenith
#

to the second page

#

i got the top part already

slim heart
#

I'm not gonna write the whole thing for you

#

Just use the same concept man

visual zenith
#

do i need to change this?

                forwards.on('collect', r => {
                    if (page === pages.length) return;
                    page++;
                    embed.setDescription(pages[page - 1])
                    embed.setFooter(`Page ${page} of ${pages.length}`);
                    msg.edit(embed)
```?
#

like the description part

slim heart
#

hmph

#

I think so

#

?

#

Lol

visual zenith
#

but it needs to change after every reaction clicked

slim heart
#

just do like if(page == 1) somevar = oneto50
if(page == 2) somevar = fiftyto100
if(page == 3) somevar = onehto150
if(page == 4) somevar = onefiftyto200

#

and then setDescription(somevar)

#

Like I could write it for you but I'm not about to spoonfeed you code. Even if its my shitty code, its still spoonfeeding

visual zenith
#

🥄 👱

#

is it possible to do page[i++] ? is there a similar way just like that?

amber junco
#

Is it possible to have a command ex:
!servericon

#

and the bot gives you the server icon

#

and
ex:
!embed hi there

#

is it possible?

bitter sundial
#

somevar = page * 50

amber junco
#

huh?

#
const Discord = require("discord.js");

module.exports.run = async (client, message, args) => {
  let target = message.mentions.users.first() || message.author;
  message.channel.send({files: [{ attachment: target.displayGuildURL, name: "Guild.png" }]});
}

module.exports.help = {
  name: "serveravatar"
}
#

my current failed serveravatar

#

code

lament meteor
#

error?

amber junco
visual zenith
#

How to make a game like slot machines, blackjack, etc.

bright spear
#

@visual zenith search for tutorials

#

We won't code things for you

visual zenith
#

but there arent any

bright spear
#

Try being more specific

#

But if you want to store data first you'll need a database

visual zenith
#

i already have a database

#

its from enmap

serene cobalt
#

Try using Plexi Development

#

They're good at djs

#

@visual zenith

#

Also postres > Enmap

visual zenith
#

i asked but there is no response

#

u sure thats spelled right?

#

postres

serene cobalt
#

Do you know what patience is?

#

Also I misspelt it

visual zenith
#

yes i do

serene cobalt
#

postgres

visual zenith
#

im waiting thats all

#

i post it on multiple servers so I can find different ways of doing it

serene cobalt
#

ew repeat post

amber junco
#

const Discord = require("discord.js");

module.exports.run = async (client, message, args) => {
  let target = message.mentions.users.first() || message.author;
  message.channel.send({files: [{ attachment: target.displayGuildURL, name: "Guild.png" }]});
}

module.exports.help = {
  name: "serveravatar"
}

my current failed serveravatar
code

earnest phoenix
#

What

#

The icon?

amber junco
#

Servericon

#

Serveravatar

earnest phoenix
#

sending message incorrectly tickYes

#

msg.guild.icon I’m pretty sure

#

blindly asking for help tickYes

amber junco
#

rip

#

lmao

earnest phoenix
#

clueless and asking in multiple places to annoy as many people as possible with a googleable question tickYes

serene cobalt
#

taco gets alll the internet points

amber junco
#

I did, none of them are using the same message handler

earnest phoenix
#

its not working because (and if you read the error you would know this)..

#

it must be a string

#

or buffer

bright spear
#

Lol

earnest phoenix
#

if u make attachment u have to download the file iirc and send a buffer

#

not just send the url

#

or just put in in an embed

amber junco
#

oh ok

bright spear
#

The string option is a url iirc

#

But they are trying to do user.displayGuildURL Thonk

earnest phoenix
#

undefined 4Head

#

story of every d.js users life

serene cobalt
#

Not working and asking in dapi general

#

Story of djs

earnest phoenix
#

not asking in anidiots.guide

serene cobalt
#

kek

#

how to make bot?!?!??!!?

mmLol

sinful lotus
#

usual new coders right now. Fork guide bot without analyzing how it works.

serene cobalt
#

I used to fork a tut bot like that

#

Now I'm not an idiot

wicked summit
#

Hi

#

i need help with lavalink

#

Are somebody use discord.js-lavalink ?

#
{ Error: Parse Error
    at Socket.socketOnData (_http_client.js:441:20)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:94:17) bytesParsed: 0, code: 'HPE_INVA
ID_CONSTANT' }
``` my bot got that error
sinful lotus
#

discord.js latest master will not work on discord.js lavalink

#

if you do use master

restive silo
#

or tell jacz to update

sinful lotus
#

or just use d.js voice

amber junco
#

!embed Hi there

earnest phoenix
#

@amber junco what is that lol

amber junco
#

nvm

earnest phoenix
#

lets take a minute of silence to appreciate that we are live

#

Now that it has been a minute, is is possible to add rich presence to a bot?

slender thistle
#

Nope

amber junco
#

How do I find a channel's id?

mossy vine
amber junco
#

No.. like in numbers

#

264445053596991498/272764566411149314 <=== is this channel id ?

gilded blaze
#

You need context. If you got the id from a channel then yes it is a channel id.

amber junco
#

client.channels.get("CHANNEL_ID").send(bugreportEmbed);

#

So.. CHANNEL_ID Would be replaced by, in this instance: 264445053596991498/272764566411149314
right?

gilded blaze
#

If those are channel id's then yeah

amber junco
#

oh ok

#

That is id for this channel

quartz kindle
#

just one of the numbers, not both

#

the id for this channel is 272764566411149314

hushed berry
#

wtf

#

someone managed to get this as their track's position lmfao

sick cloud
#

theres literally none there so i'm super confused

quartz kindle
#

it has to be there somewhere

sick cloud
#

it isnt

earnest phoenix
#

send code

sick cloud
#
client.user.setActivity(`yt help [${guildCount}] [${client.shard.id}]`);```
#

100% not there

quartz kindle
tight heath
#

@hushed berry well done

#

Now use a proper way for those smh

terse pier
#

It's ok with discord terms of service to use

import discord
client = discord.Client()
#few more lines of code
await client.login('<user email>', '<password>')
#

@tight heath ?

tight heath
#

No?

#

Automated user accounts are generally banned.

#

And will get you banned from Discord.

terse pier
#

So, why it's included in that library?

tight heath
#

In which one?

terse pier
#

And there is nothing in documentaion about it

tight heath
#

Also maybe because they didn't deprecate it yet

#

Because like

#

Devs also have a life

#

I mean I didn't believe it at first either; I'll he honest

quartz kindle
#

Discord's API provides a separate type of user account dedicated to automation, called a bot account. Bot accounts can be created through the applications page, and are authenticated using a token (rather than a username and password). Unlike the normal OAuth2 flow, bot accounts have full access to all API routes without using bearer tokens, and can connect to the Real Time Gateway. Automating normal user accounts (generally called "self-bots") outside of the OAuth2/bot API is forbidden, and can result in an account termination if found.```
#

11 months ago

tight heath
#

But here you go

#

Also perhaps you're using an old version or unmaintained library.