#development

1 messages · Page 423 of 1

austere meadow
#

yeah like that but it doesn’t include edits

native narwhal
#

Well shouldn't edits be included in bot:msg:channel

austere meadow
#

hmm maybe

#

i guess that would make sense

native narwhal
#

Consdering an edit is a patch request

#

to the same route

#

I think 🤔

austere meadow
#

5/5s sounds fine
i was wondering because i had this great idea but i didnt know if it would hit the ratelimits

#

but i dont think it even comes close

native narwhal
#

What is the idea?

austere meadow
#

i can’t share mmLol

native narwhal
#

Awe 😂

austere meadow
#

mainly because i dont know if its possible

native narwhal
#

I mean if you share I could give my opinion on if it is possible or not >:P

austere meadow
#

i can tell you in dms i just dont want people stealing my idea

native narwhal
#

Yeah I get that

slender thistle
#

Share in DMs plz. eyesLeft

halcyon abyss
#

those rates are not shared between shards, are they ?

native narwhal
#

I dobut it

fluid basin
#

They are I guess

#

Since it uses token for api auth, ratelimits are tracked using token as identifier I suppose

#

But maybe it gets increased for bigger bots

native narwhal
#

50 messages per 10s global across mutliple shards doesn't make any sense, makes more sense per shard

fluid basin
#

Well idk

native narwhal
#

I am not sure

fluid basin
#

honestly no one knows xD #discord-internals

native narwhal
#

Someone get me a Discord employee

fluid basin
halcyon abyss
#

even per shards I find this limit really restraining

native narwhal
#

50/10s sounds really bad

#

Maybe they have changed it

halcyon abyss
#

With a 1k guild pr shard

fluid basin
#

idk told you it might vary depending on number of guilds etc.

#

just probably undisclosed xD

#

especially for bigger bots

native narwhal
#

Does anyone know someone that works for Discord mmLol

earnest phoenix
#

nop

vestal cradle
#

@earnest phoenix can i ask a question

earnest phoenix
#

Yea?

vestal cradle
#

how do you check of a user when you don't have mention or id just example Duck#9999

#

with a bot of course

earnest phoenix
#

with what lib

vestal cradle
#

i can give a command example too if you want

earnest phoenix
#

What library are you using

vestal cradle
#

js

#

wait is that a library

earnest phoenix
#

Js is a language

#

Are you using Discord.js?

vestal cradle
#

Yes

earnest phoenix
#

You use .find() with "tag" as your property

ruby dust
#

@vestal cradle idk how discord.js works, but one I can tell is discord.py has a member object predefined in different ways, mentioning, name, user id, and it will handle it for you

vestal cradle
#

oh thank you @earnest phoenix sorry for super late am working on a game project lalal

twin basalt
#

I mean, show it in the user's language

spring ember
#

I18n

#

which basically means you make a json (or whatever data structure like it) and make response strings

twin basalt
#

But the bot is in english and the footer is in Portuguese

spring ember
#

you code the footer

twin basalt
#

It's probably translated client-side

spring ember
#

umm send message id

twin basalt
spring ember
#

they send a timestamp

#

yes it is client side

twin basalt
low rivet
#

for discord.py:
discord.Embed(timestamp=datetime.datetime.now())

#

that's a hardcoded timestamp @twin basalt

#

It doesn't use discord's timestamp thing in embeds

twin basalt
#

You mean the client-side translated one or the last one I sent?

low rivet
#

the one u sent

#

the code example is the client side translated one

twin basalt
#

oh nice

#

discord.js would be
<RichEmbed>.setTimestamp(Date.now())

#

Lemme see if it works then

spring ember
#

d.js also has {embed:{timestamp: Date.now()}}

twin basalt
#

yeah

#

But I think that looks ugly xD

spring ember
#

that's what I do with Eris, sooo

trim plinth
#

that's because eris doesn't have the embed builder like d.js GWnanamiRemThink

ruby dust
#

@low rivet about that discord.Embed(timestamp=datetime.datetime.now()), I was trying to make it myself once, but it seemed like it was using some timezone's timestamp instead of showing the client's time, as I can see it works with @gilded plank in #mod-logs, so I just assume it's either some weird bug or I don't know how to make it show the client timestamp

old glade
#

sup' guys. how do i auto send message with discord.py ?
The pattern is the following:
receive event -> send message

#

also I wanna make it user friendly which means the best idea would be the user to opt in to auto receive messages

#

instead of typing the command

spring ember
#

give more context

old glade
#

My bot is going to retrieve data from a json

#

like every 30 min

#

and I want him to auto display the data

spring ember
#

where?

old glade
#

on a discord chat

spring ember
#

first of all don't notify all servers on an event not related to all of them

#

but else just get the id

old glade
#

I think the event will be related to all of them

#

wanna retrieve the latest cryptocurrency listing on coinmarketcap

#

but what would be nice is an option for the server admin to opt in to enable auto send

#

I don't wanna spam you see

vestal cradle
#

lol sorry for yesterday @uncut slate i was making my own stuff harder hope ya forgive meee

spring ember
#

@old glade save the channels you will send in and iterate over the (better be) set

old glade
#

ok

olive drum
#

How do I send a custom emoji in another guild with discord.js?

halcyon torrent
#

get the ID of the emoji

spring ember
#

There is an emoji id

olive drum
#

And?

#

<emojiid>

#

?

halcyon torrent
#

<:x:ID> is enough

olive drum
#

Nothing happens though..

#

I did it with the id.

earnest phoenix
#

Can I ask yet another mongo related question

#

Lul

spring ember
#

You don't have nitro @olive drum

solid cliff
#

you dont need nitro for global bot emotes

earnest phoenix
#

bots have mini nitro lol

spring ember
#

Bots have

vestal cradle
#

Ahm discord.js anyone knows how like hmmmmm dm a user by it's tag no need of a mention?

earnest phoenix
#

why use tags

vestal cradle
#

Well lets say the bot it's in a server that you aren't and you want to dm a user that you aren't friends with

earnest phoenix
#

get user by id

vestal cradle
#

of coourse using the bot

restive silo
#

use Collection#find on the Client#users collection and use .send() on that with the content

#

wait

#

you cannot DM users you aren't sharing servers with

#

👀

vestal cradle
#

but the bot is

restive silo
#

thats a Discord API Limitation

vestal cradle
#

oh..

restive silo
#

nothing you can get a workaround for

earnest phoenix
#

ripsdee

low rivet
#

workaround, get ur bot to every server in discord

earnest phoenix
#

anyway is anyone around experienced with Mongo? i need some help with it

restive silo
low rivet
#

i do mongo in python @earnest phoenix

earnest phoenix
#

wut

vestal cradle
#

@restive silo tho can you give an example of collection#find

#

wihile searching for user tho

#

oh nvm am so dumb

earnest phoenix
#

@low rivet do you use mongodb?

restive silo
#
<client>.users.find(user => user.tag === 'your tag in here')
low rivet
#

yup

earnest phoenix
#

can you help me then

vestal cradle
#

thank you

low rivet
#

ok but what lang are u using? GWcfcThonk

earnest phoenix
#

the shell and node

low rivet
#

i use python

earnest phoenix
#

dont you use the shell

#

?

low rivet
#

yes i do GWcfcThonk

earnest phoenix
#

my "problem" is mongo related

#

not really mongo-node related~

low rivet
#

go ahead GWcfcThonk

earnest phoenix
#

lol sure

vestal cradle
#

❤ @restive silo see yaaa

earnest phoenix
#

so i have this document { "user": "123456789", "data": { "fieldone": { "food": "pizza"}, "fieldtwo": { "food": "rice"} } } and i wanna find all documents with the user "123456789" and their food as pizza or rice for example

#

i know how to find all documents with the user "123456789" but idk how to do the rest

low rivet
#

using node?

#

just run a loop through a .find().to_list(None)

earnest phoenix
#

Idk how to explain this very well

#

Nested docs in mongo are complicated zoomeyes

uncut slate
#

@earnest phoenix you can just use a string path to query it

#

i.e.

earnest phoenix
#

the thing is I want to find all documents where pizza is the food of any of the fields

#

without specifying the fields

#

i think

uncut slate
#

ohh

#

yeah that makes sense

earnest phoenix
#

i hope

#

lol

#

how would i go about it?

uncut slate
#

hmmmm actually not sure, taking a look

earnest phoenix
#

Okay

#

Thx

uncut slate
#

hmm

#

so it looks like the only way you can query that is with $where which kinda performs like shit on large scale

earnest phoenix
#

My bot is small scale lol

#

So no issues there

#

I've heard maybe an index could be a solution

#

I'm not too deep on mongo indexes though

uncut slate
#

same

earnest phoenix
#

All I know is that the default index is _id

uncut slate
#

so if you want to use $where, you would do something like

db.test.find({
  $where: function () {
    return Object.keys(this.data).some(key =>
      this.data[key].food === 'pizza'
    )
  }
})
#

I'm not sure how you would do it with indexes, but that would probably be better

earnest phoenix
#

Well I'm not sure either

#

Also can you use JavaScript functions in the mongo shell?

uncut slate
#

yes, you can

#

the mongo shell is javascript

earnest phoenix
#

Well yeah

#

But can you do complex stuff?

uncut slate
#

depends on how complex I guess, it's pretty much a full js repl

earnest phoenix
#

Ah that's cool

uncut slate
#

without native objects and stuff

#

e.g. no console

earnest phoenix
#

Hm

#

Let me try your code

#

You posted above

uncut slate
#

it would throw if data didn't exist though

earnest phoenix
#

rip got an error

uncut slate
#

what is it

earnest phoenix
#

now its gone lol

#

i think its because i changed my collection

#

the structure i mean

#

k let me try now

#

ye its working

#

thanks

#

now i gotta put it in my node file

vestal cradle
#

@uncut slate i have a question no help and stuff just a question

#

or anyone who knows js

#

or discord.js

quiet bobcat
#

yes

#

ask your question

vestal cradle
#

is there a way to look thru and message a member from a server where bot is added on but you never heard about it

#

@quiet bobcat there

spring ember
#

never heard about it what?

vestal cradle
#

wel i don't even know if it exist

#

just was logically talking

abstract mango
#

as in like what

#

you want to message a member from a server, but you don't know the user

unique solar
#

sometimems nuget is a pain to deal with

vestal cradle
#

no like if you want to mesage a member from a server where your bot is in but you don't have invite for it @abstract mango

trim saddle
#

@vestal cradle ez get the users id

vestal cradle
#

but you can't message that Id with bot since you aren't in same server @trim saddle

#

i thought it was easy too until i came across trying it Xd

trim saddle
#

can't you make your bot generate an invite for the server

vestal cradle
#

Ye well besides that point i was just asking if it's possible to do that

trim saddle
#

it is

vestal cradle
#

not to generate invite

#

the other thingy i asked from beginning XD

#

wait can you actualy make an invite wit ha bot

#

with*

#

coz that would be pretty handy

trim saddle
#

ye but your bot needs the proper permissions

vestal cradle
#

Ye i do know that XD i totally didn't make the invite to ask evvery permission in invites XD

#

actually the only reason i actually did that was because since i have suggestions open if someone suggests something cool

#

and i add it with a permission i don't have it yet

#

that means everyone would have to kick and readd the bot

#

i think i edited the bot page adding that too

earnest phoenix
#

@earnest phoenix where do i put client.guilds.map(g => g.name).join("\n- ")

#

That will generate a list of server names, so typically within an embed or a standard message.

#

ok

#

Make sure you replace client within your client instance variable name though...

#

module.exports.run = async (bot, message, args) => {
let sicon = message.guild.iconURL;
let serverembed = new Discord.RichEmbed()
.setDescription("Server Information")
.setColor("#15f153")
.setThumbnail(sicon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You Joined", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
.addField("Servers client.guilds.map(g => g.name).join("\n- ")")

#

can I use a if statement like this? (LaunchDate - now == (60000x5 || 60000x5 + 1))

#

Okay well @earnest phoenix you'll have to replace your quotes on that field with backticks

spring ember
#

doing it as a json will look so much better tho

earnest phoenix
#

can u do it for me plz im noob

spring ember
#

no

earnest phoenix
#

Yeh sure

spring ember
#

no spoon feeding cmon

earnest phoenix
#

But you should really learn.

spring ember
#

just do ``

earnest phoenix
#

cna you do mebeded in json?

#

(LaunchDate - now == (60000x5 || 60000x5 + 1))

#

@earnest phoenix consider taking a few basic courses on NodeJS and the JS syntax, it'll help you a lot with creating a bot.

#

is that a proper use of if?

#

module.exports.run = async (bot, message, args) => {
let sicon = message.guild.iconURL;
let serverembed = new Discord.RichEmbed()
.setDescription("Server Information")
.setColor("#15f153")
.setThumbnail(sicon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You Joined", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
.addField("Total Members", 'client.guilds.map(g => g.name).join("\n- ")');

#

like that?

#

It doesnt feel like that but it would be awesome if

#

Those don't appear to be backticks, those are single quotes

#

`

#

``

#

.addField("Total Members", client.guilds.map(g => g.name).join("\n- "));

#

To create a template literal within JS, you now need to wrap your code like so "${ **code here **}. In this case you'll put the guild map inside the wrapping.

#

can u fix .addField("Total Members", client.guilds.map(g => g.name).join("\n- "));

#

plz

#

so i can see

spring ember
#

dude you should learn js before developing a bot

earnest phoenix
#

Indeed.

#

i am learning just trying to know why theres 5 active servers on my bot

spring ember
#

and he doesn't need backticks

#

just do .addField("Total Members", client.guilds.map(g => g.name).join("\n- "));

earnest phoenix
#

You're right, I didnt realize that was a field

#

I never use fields in embeds, don't ask why lol

#

?

#

How do you use embeds then+ Xd

#

error

#

I usually just use the description with new lines

#

Your client instance is named bot, not client

#

so replace client with bot in the guild map

#
    let sicon = message.guild.iconURL;
    let serverembed = new Discord.RichEmbed()
    .setDescription("Server Information")
    .setColor("#15f153")
    .setThumbnail(sicon)
    .addField("Server Name", message.guild.name)
    .addField("Created On", message.guild.createdAt)
    .addField("You Joined", message.member.joinedAt)
    .addField("Total Members", message.guild.memberCount);
    .addField("Total Members", bot.guilds.map(g => g.name).join("\n- "));````
#

is that correct?

spring ember
#

dude sorry you should learn js

earnest phoenix
#

Ripsdee

#

error

spring ember
#

the problem is we are doing the job for you

earnest phoenix
#

^

#

^

#

i did what u said but still broken

spring ember
#

I recommend picking up and finishing a js tutorial from websites like codeacademy or sololearn

earnest phoenix
#

Send the error then.

south finch
#

Charlie honestly dont spoonfeed, they need to learn

earnest phoenix
#

Codeacademy is a great way to get familiar with a languages syntax

spring ember
#

or by starting some more beginner friendly projects

earnest phoenix
#

Meh sorry, just tryna help

#

Spoonfeeding zoomeyes

#

You have two semi colons @earnest phoenix

#

o

#

The semi colon ends the embed constructor

#

^

spring ember
#

two semicolons don't do anything @earnest phoenix

earnest phoenix
#

Yes it would

#

its JS

#

not C

spring ember
#

oh really?

earnest phoenix
#

You don't even have to use semi colons to end an embed const.

spring ember
#

umm

#

so yeah I guess

earnest phoenix
#

yes

#

in c its very important

#

in JS

#

who cares looks good

#

but its not that important

#

@spring ember see that - ```js
.addField("Total Members", message.guild.memberCount);
.addField("Total Members", bot.guilds.map(g => g.name).join("\n- "));

#

Btw I have a js related question

spring ember
#

yes?

earnest phoenix
#

client.channels.get("448559746568421398").send({embed})

#

It's probably something ez but im a noob so

#

still error charlie

south finch
#

jfc

spring ember
#

it's just ```

-```

earnest phoenix
#

js don't care

#

^

#

C:\Users\marve\OneDrive\Documents\Discord Bot\commands\info.js:13
.addField("Servers", bot.guilds.map(g => g.name).join("\n- "));
^

SyntaxError: Unexpected token .
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at jsfile.forEach (C:\Users\marve\OneDrive\Documents\Discord Bot\index.js:18:17)
[nodemon] app crashed - waiting for file changes before starting...

#

you could do console.log("asd");;;;

#

nothing would happen

#

It looks good to have ";"

#

I don't use them bloblul

#

caus it makes it all look more professional in my opinoin

south finch
#

^

earnest phoenix
#

That's not what I'm referring to.

#

C:\Users\marve\OneDrive\Documents\Discord Bot\commands\info.js:13
.addField("Servers", bot.guilds.map(g => g.name).join("\n- "));
^

SyntaxError: Unexpected token .
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at jsfile.forEach (C:\Users\marve\OneDrive\Documents\Discord Bot\index.js:18:17)
[nodemon] app crashed - waiting for file changes before starting...

#

stop spam wtf

#

yes the problem is you have a ;

#

where its not supposed to be

#

The embed constructor is ending at the field above, he has a field beneath with another semi colon

#

you're breaking the chain

#

It's ending before he needs it to.

#

removed ;

#

still error

#

maybe you removed the wrong one

#

The token is unexpected because the embed constructor ended on the line previous.

#

I got my question ready

#

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

module.exports.run = async (bot, message, args) => {
let sicon = message.guild.iconURL;
let serverembed = new Discord.RichEmbed()
.setDescription("Server Information")
.setColor("#15f153")
.setThumbnail(sicon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You Joined", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
.addField("Servers", bot.guilds.map(g => g.name).join("\n- "))

message.channel.send(serverembed);

}

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

#

You removed the wrong one.

#

Christ.

#

lmao it was the wrong one XD

#

there are to wasy to fix that

#

you should read up basic js before committing into a bot

#

Lol

spring ember
#

charlie stop spoonfeeding

earnest phoenix
#

remove the ";"

#

WITCH ONE THEM

spring ember
#

Aly says she will mute you

earnest phoenix
#

Can someone help me then

#

THERES NO MORE ;]

#

or defins serverembed again

#

nao go

#

Thx

#

omg

#

kms

#

i see

#

omg

#

kms rn

#

Don't ask us to spoonfeed you @earnest phoenix...ik I was helping you earlier, but chill

#

Or you just go and read a proper tutorial, it will give you more help

#

...

#

Servers
DBL Verification Center

  • Factions Banana
#

WTF

south finch
#

Stop.

#

Honestly.

earnest phoenix
#

Can I?

#

sure

#

go ahead

#

😃

#

yes nao go

#

I'm waiting on you

#

My question will just get buried

south finch
#

I asked you to stop spoonfeeding forever ago Charlie.

#

Read the rules.

earnest phoenix
#

I'm retrieving data from mysql using Node, right now I want to show an embed that will display fields with some values based on the mysql results. So far I have a results.forEach function that will add every row to an array I created but I want to know how do I create like for example an embed that adds fields according to how many results Node fetches from mysql, is it even possible?

#

for loop

#

Wasn't attempting to spoon feed, but I apologize. I have read the rules.

olive drum
#

Create embed instance, add a field using the function in the for loop.

earnest phoenix
#

^

#

Hmm

#

O forgot about for loops

#

I*

#

and then teh foor loop just goes until found the end of array or file

#

Lul

#

XD

#

Lol

#

That's cool though

#

I'll try it

#

since you're doing mysql now btw, sequelize is worth taking a look

#

Thanks

#

saves ton of time

#

Sequelize?

#

d.js has a getting started on it

#

its a db ORM

#

so you do js instead of sql

spring ember
#

postgres ahem ahem

earnest phoenix
#

from the simple to the most advanced stuff

#

That sounds cool

spring ember
#

mysql is just too outdated

#

if you are actually starting a database start with postgres

earnest phoenix
#

Indeed it is.

#

Thanks for the help guys

#

Anyone here ever used SQL Server?

#

Well I use mysql and mongo

#

Mongo is amazing

#

Best NoSQL databse out there imo

#

I'm using mariadb which was a fork of mysql originally

spring ember
#

if you go with NoSQL go with mongo, sql -> postgres

earnest phoenix
#

and I'm happy with it

#

I tried postgres

#

Marias another good one

#

But couldn't get the server started

spring ember
#

what's the problem?

#

weird

#

oh

#

you need to log in with one screen in linux

earnest phoenix
#

So windows users are doomed

#

Basically

spring ember
#

no

#

there is an executable

#

for win users

earnest phoenix
#

I don't have any distros on my hdd rn

spring ember
#

pg has something for anyone mmLol

earnest phoenix
#

I have ubuntu on a usb

#

@spring ember I installed an exe

#

Ew Ubuntu

leaden furnace
#

hello

earnest phoenix
#

The installer from the official website

#

It installed correctly

spring ember
#

exe for linux?

#

pls

earnest phoenix
#

No

#

For windows

#

uhm

#

I just can't start the server through cmd

#

You can technically run exe files on linux if you use wine

spring ember
#

umm

#

is that a windows server?

#

or your pc

earnest phoenix
#

I'm using a localhost setup on windows 8.1

spring ember
#

ok

earnest phoenix
#

I downloaded an installer for it

spring ember
#

so it is a command line interface?

earnest phoenix
#

Assuming it's like mongo and mysql then yes

spring ember
#

no

#

the pc lol

earnest phoenix
#

The pc I'm using isn't a server pc

#

But I use it for testing stuff

#

I'm using regular win 8.1 install

#

I think win8 pro or something

spring ember
#

ok so just use the normal installer lol

earnest phoenix
#

That's the thing, I used the official windows installer zoomeyes

spring ember
#

lol

earnest phoenix
#

But I don't know how to start the server

spring ember
#

have you tried pgAdmin?

#

to log in

earnest phoenix
#

Isn't that a gui

spring ember
#

yes

earnest phoenix
#

I assumed it was so I skipped installing it

#

Because I thought you could access the served through command line

spring ember
#

so install it mmLol

#

you can

#

but pls

earnest phoenix
#

Ehhhhhhhhhhhhhhhhh

#

Alright

spring ember
#

we all like that sweet sweet gui

earnest phoenix
#

I don't mind windows ugly cmd

#

Tbh

spring ember
#

powershell

earnest phoenix
#

Lol powershell

#

Uninstall pls

#

@spring ember btw can you tell me why you prefer postgres over other sql dbs?

spring ember
#

it's more updated with more features

#

like arrays

#

and json

#

but don't use json

earnest phoenix
#

Doesn't mysql support json data types

#

And lol if I want a json db I use Mongo

#

json has arrays?

#

lmao

#

Not sql

#

not natively but you could use blob

#

^

spring ember
#

json always had arrays thonkku

earnest phoenix
#

yea

#

so

#

whats added

#

I picked mariadb because its sql and I was used to mysql for a few years

#

plus its out of the box for the most part

#

and its trusted by some bikk companies

#

Mariadb is a child of mysql

#

Pretty much mmLol

#

no its like the child that run off home

#

Pretty sure mariadb was originally a fork of MySQL if Im correct

#

and become a billionare

#

Lol

#

yes it was a fork of mysql originally

south finch
#

charlie.

earnest phoenix
#

Hm?

south finch
#

don't shitpost in here think

#

thanks

earnest phoenix
#

Sorry zoomeyes

violet wyvern
#

But how do I do a command that enables/disables other commands

earnest phoenix
#

Library?

violet wyvern
#

discord.js

earnest phoenix
#

Any particular command handler you're using?

violet wyvern
#

Hmm

#

No

south finch
#

first question: have u tried googling the problem first?

violet wyvern
#

Yes

olive drum
#

Here's a run down thing

#

Store disabled commands in array, check if in array when run, don't run if in array

earnest phoenix
#

You could, but that seems somewhat annoying, especially if you've got a large amount of commands

olive drum
#

True.

#

Just a way.

violet wyvern
#

What do you think is a
large amount of commands?

olive drum
#

Number-wise? How many do you have?

earnest phoenix
#

100+

#

(not to you Atomik)

olive drum
#

Ik

violet wyvern
#

Hmm I have 43 commands

earnest phoenix
#

How would I go about adding a for loop in a richembed constructor?

olive drum
#

.

earnest phoenix
#

For djs

olive drum
#

Didn't I explain it earlier?

#

Here's just a simple version:

#
create the RichEmbed/MessageEmbed instance
loop through items
add field to embed instance
end loop
earnest phoenix
#

Alright

#

I'll try it

olive drum
#

Not you.

violet wyvern
#

but how do I do a command that enables/disables other commands

#

?

olive drum
#

..

#

I literally just saaaaaiidd.

earnest phoenix
violet wyvern
#

But my bot has a lot of commands

olive drum
#

I can't really think of other ways atm, sorry

earnest phoenix
#

comment out the entire command file

violet wyvern
#

I have separate command files

#

Like exports.run

earnest phoenix
#

Twas a joke, but I'd just try Atomik's method, I'm working on something rn so I can't really think of anything better as of now.

#

You'll just have to make a decent length array if you want to include all of your commands.

spring ember
#

to enable or disable commands you need a database and some kind of check at the start of the command

fickle hawk
#

cough sqlite cough

spring ember
#

to know if to execute or to not

olive drum
#

Well.

#

An empty array,

#

The block command adds the command specified to the array

#

the unblock removes it from the array

#

At the start of the command it checks if the command is in the array, if it is not, it runs

delicate zephyr
earnest phoenix
spring ember
#

umm

earnest phoenix
#

after I tryed to run !invite with if (message.content.startsWith(prefix + "invite"); ...

spring ember
#

I have a feeling that message, is not defined

olive drum
#

Can you show the line where you hook the message event?

spring ember
#

which means there is no such var called message

earnest phoenix
#

what line?

olive drum
#

.

#

Your client.on("message")

violet wyvern
#

:(

#

The command handler isn't working

earnest phoenix
#

var prefix = "." client.on('message', msg => {
if (message.content.startsWith(prefix + "invite"));
message.channel.send(".");
});

olive drum
#

.

spring ember
#

msg is not message

olive drum
#

You defined message as msg.

spring ember
#

lol

olive drum
#

Either change msg to message or your message to msg.

spring ember
#

^

earnest phoenix
#

Okay, thanks.

#

Wait

#

It spammed.

#

It worked now but spammed

olive drum
#

🤷

spring ember
#

multiple instances

#

close them all

#

#ads

olive drum
#

Lol, two secnds.

earnest phoenix
#

close what

olive drum
#

Done.

earnest phoenix
#

I am dumb I know, but what should I close?

olive drum
#

I've known it to just spam randomly.

#

Tbh, not sure.

spring ember
#

close all the instances

#

then start again

tepid laurel
#

@earnest phoenix your code makes it so that whenever any message starts with '.' it replies

#

Your bot also sends '.'

#

Meaning it will also reply on that

earnest phoenix
#

oh

tepid laurel
#

Hence an endless loop

#

If you wanna prevent that

#

Check if the author is a bot before doing anything

#

if(!msg.author.bot) return;

#

Or you could even do it differently

earnest phoenix
#

Okay

tepid laurel
#

But its most efficient to just check if its a bot

earnest phoenix
#

client.on('message', message => { if(!message.author.bot) return; if (message.content.startsWith(prefix + "invite")); message.channel.send("message here"); }); is that right?

#

no

#

you’re closing your if statement

#

it’s if (message.content.startsWith(prefix + "invite")) { code here }

#

learn nodejs

#

im new

olive drum
#

Then learn it..

earnest phoenix
#

learn tho

#

we was all new

#

but we learnt

#

simple as

#

it still spams

#

what

#

btw remove that !

#

on message.author.bot

#

Okay, thanks.

slender thistle
#

Any good sources to learn js and code examples?

tepid laurel
#

Oya lol

#

My bad with the !

#

Soz @earnest phoenix

earnest phoenix
#

No probelm. And the bot replys to every message with the "invite command" it doesn't "cares" about the prefix+invite.

tepid laurel
#

You mean it also replies without the prefix?

#

How did you define prefix

earnest phoenix
#

var prefix = '-'

#

client.on('message', message => {
if (message.content.startsWith(prefix + "invite"));
if (message.author.bot) return;
message.channel.send("msg here");
});
@tepid laurel

unique solar
#

im using the DiscordBotList api in c# and when I use my bots id to get a bot it doesnt return anyhting but when I use another bots it does. my bot is on the webiste but is not approved, is that why?

slender thistle
#

Most likely. thanking

unique solar
#

do you know how long it generally takes for a bot to get approved?

#

like how long it take yours?

topaz fjord
#

1 hour to 1 week

unique solar
#

ok

topaz fjord
unique solar
#

will do

real ginkgo
#

How do you make an exe command that automatically runs your discord bot?
Like Gateway thing.

floral stone
#

huh

real ginkgo
#

I mean exe cmd prompt*

spring ember
#

node x.js?

trim plinth
#

export to an .exe

spring ember
#

pls

real ginkgo
#

I use discord.js

trim plinth
#

oof

spring ember
#

node index.js

#

or npm start if you are cool

knotty steeple
#

make a batch file that runs node <filename>.js

#

xd

floral stone
#

You can't start the bot on discord if it's offline.

spring ember
#

and have a start command in the package.json

trim plinth
#

npm start GWnanamiRankoDisgust

floral stone
#

^

knotty steeple
#

start script is overrated

trim plinth
#

I prefer node over using npm to run

spring ember
#

yeaah

knotty steeple
#

npm start?

#

yesn't it node start

glossy sand
#

i usually write a start.sh that configures env variables then does yarn run

spring ember
#

😩

trim plinth
#

yarn run GWnanamiWakeMeUpInside

glossy sand
#

or is it yarn start

#

idk i haven't worked with js in a while

trim plinth
slim heart
#

Anyone got a guide or something where a form can be submitted on a website and then the bot receives it?

glossy sand
#

er your own website?

#

or do you mean like a google form

floral stone
#

What language as well

#

@slim heart

slim heart
#

js

#

My own website

glossy sand
#

who really cares about the language

#

you should run a web server on your bot

#

then design a form on your website that submits to your bot's ip

#

i don't have a guide but the principle as i've described is pretty simple

slim heart
#

Simple for you lmaoo

glossy sand
#

have you used express before

slim heart
#

no

#

:o

glossy sand
#

or restify or floof etc etc

#

any sort of web service library?

slim heart
#

Erm

#

I dont, think so?

#

Lmao

#

I know html if that counts, maybe mysql idk man

glossy sand
#

uhh ok do you know anything about http requests at all

slim heart
#

a lil bit

trim plinth
#

kek

slim heart
#

not rlly tho

#

I mean i ran some shiz on an arduino before that required http requests

#

but, uh, other then that no not rlly

spring ember
#

lol

#

arduino

slim heart
#

I mean like i've used kinda http requests but tbh i just wanted to see the reaction in console i never actually used it

#

I was gonna make a thing where my website can show server count

#

and I ended up just messing around with localhost stuff

trim plinth
#

use ejs then

glossy sand
#

their website is independent of their bot

#

ejs isn't gonna do shit

trim plinth
#

true

glossy sand
#

i wanna help but i'm on my phone and typing a lot is hard

#

and oh boy is this gonna take a lot of typing

slim heart
#

:o

unique solar
#

how do you put images in embeds? Ive tried thumbnailURL and ImageUrl properties. Im getting the image url from DiscordBotsList api

#

like from a bot

slim heart
trim plinth
#

wot n tarnation

glossy sand
#

are there actually any js microframework libs that aren't as heavy as express

uncut slate
#

koa is nice

#

it's made by the express devs

topaz fjord
#

koa made by express

#

wot

glossy sand
#

it's express with async/await and less bloat i guess

uncut slate
#

ye, little to none, pretty barebones

glossy sand
#

i've never understood why they like the cascading callback chain thing so much

hazy marten
#

yo guys

topaz fjord
#

?

hazy marten
#

so I made a custom emoji

#

and I know you can do the slash emoji name to find the id

#

but I'm trying to find out how to get the id using the bot

#

I'm using python 3

#

btw

floral stone
#

you don't

#

you could get the server emojis

hazy marten
#

but on the api it has a function for Emoji ID's

floral stone
#

yes

hazy marten
#

but I can't find out how to use them

floral stone
#

you would need to get the emoji as a class

#

You'll have to define it first then get the Id

hazy marten
#

wait

#

?

floral stone
#

em = bot.get_emoji(id) #getsemoji

hazy marten
#

or

floral stone
hazy marten
#

oh

#

why doesn't it say that on the api D:<

#

ok thank you

#

I'm going to check it out

floral stone
#

:happy: isn't an id and np

slim heart
#

Hold on would it be possible to request info from dbl api to my website cuz that'd probably be easier

floral stone
#

check the emoji class

hazy marten
#

I meant as an emoji

#

so it finds the id of the emoji

floral stone
#

@slim heart check out dbl api

hazy marten
#

and in id is the method

slim heart
#

Ik but like would it be possible to do it on a website

hazy marten
#

raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'get_emoji'

#

🤔

floral stone
#

oh

#

async or rewrite

hazy marten
#

async.get_emoji ?

floral stone
#

no

#

what version

hazy marten
#

how do i check that

floral stone
#

discord._version_

knotty steeple
#

lmao

hazy marten
#

0.16.12

spring ember
#

async

floral stone
#

^

hazy marten
#

OH you guys mean asyncio

#

ffs

#

my brain

floral stone
#

no

hazy marten
#

is fried

#

okay

#

wheres the gun mom

floral stone
#

First, why do you need to fetch the id for.

hazy marten
#

so I made custom emojis

#

and I want the bot to use them

#

I want it to able to function on multiple servers

#

as well

floral stone
#

you could just store the emoji to a variable

hazy marten
floral stone
#

^ that

#

just save it to a variable

hazy marten
#

yea

#

but how do I get that

#

on the bot

#

I don't want it

#

to ask for the id everytime

floral stone
#

emoji = "<bitcoin385689172179943435>"

hazy marten
#

you use the opposite of /

slim heart
#

right click the emoji u want and hit open link

slender thistle
#

Don't forget about the string.

hazy marten
#

and then <emojiname>

slim heart
#

get the ID

floral stone
#

he wants to get the id

slender thistle
hazy marten
#

the ID is server specific though

slim heart
#

const yes = bot.emojis.get("emojid");

slender thistle
#

That's not Python.

slim heart
#

oh nus

floral stone
#

^

slim heart
#

Well something like that

#

set it to get the emojis id

floral stone
#

async doesn't have get emoji either

hazy marten
#

man :/

#

rip

floral stone
#

emojis = discord.utils.get(message.server.emojis, id=id)

#

I believe that works

#

for getting an emoji from a server

#

I'm going to sleep

#

sry man

hazy marten
#

okay Ill try it

#

ty

earnest phoenix
#

no wait

#

@hazy marten i think bot.get_emoji(ID) works

#

try it?

hazy marten
#

I already did

#

wait

floral stone
#

@earnest phoenix async not rewrite

hazy marten
#

Ill try again

earnest phoenix
#

oof

hazy marten
#

or that

#

ok

#

hm

#

its returning None

coral dock
#

Hi! Just one Question, how to use the new FortniteApi? I can't find the Stats

hazy marten
#

@floral stone I got it. Its message.server.emojis , and it puts it in a list. Thank you so so sooooooo much ❤

earnest phoenix
#
message.react("🇦").then(x => {
          x.react("🇧").then(y => {
            y.react("🇨");
          });
        });
```won't work
spring ember
#

it's not an emote

earnest phoenix
#

yeah it is

#

\🇦 = 🇦

#

🇦

topaz fjord
#

whats wrong

neat falcon
#

also why are you using two .then Thonk

#

when you can merge them

topaz fjord
#

use await™

neat falcon
#

no u

topaz fjord
#

yes

earnest phoenix
#
await Promise.all(["🇦", "🇧", "🇨"].map(emote => message.react(emote)));
#

@earnest phoenix there

uncut slate
#

not quite the same thing

#

yours would run in parallel and might result in an order that isn't ABC, e.g. BAC

#

if the order of your reactions is important, you want to resolve the promises in series, not parallel

earnest phoenix
#

@uncut slate map goes in by order, a, b, c

#

i can prove

uncut slate
#

it will go in order, but it's not resolved in order

earnest phoenix
uncut slate
#

it's not consistent, emphasis on might

earnest phoenix
#

true

#

but then u have a reason to blame discord jk

uncut slate
#

yeah, it'll be worse when DAPI is shitting itself (99% of the time)

earnest phoenix
#
await message.react("🇦");
await message.react("🇧");
await message.react("🇨");
#

kek

uncut slate
#

alternatively

const emojis = ['A', 'B', 'C'];
for (const emoji of emojis) {
  await message.react(emoji);
}
#

if it's under 3 you might aswell just call them individually w/o a loop though

knotty steeple
#

so my eval code wasnt in an async function so i just removed the await and it reacted C, B, A

#

also which is better, pm2 or forever

uncut slate
#

depends on preference, I prefer pm2

knotty steeple
#

a few days ago i was using pm2 with my bot

#

i tried to restart it but pm2 couldn't kill the process

#

same thing with restart

#

but instead when restarting i get Unknown id <id>

earnest phoenix
#

how did you restart

knotty steeple
#

pm2 restart

#

just like you normally would

#

well with the bot name ofc

#

this happened when i crashed my bot with a while loop zoomeyes

earnest phoenix
#

uh xD

#

pm2 list will list running instances under pm2, you can restart individually with their id or pm2 restart all for every instance

#

@uncut slate i mean, ur for loop can be out of order

uncut slate
#

uh no

earnest phoenix
#

yes because for of await is dumb

uncut slate
#

it's awaiting each promise before it goes to the next iteration

earnest phoenix
#

pm2 log is also useful

#

you'd think that but thats not the case

trim plinth
#

GWnanamiRemThink ```js
const emojis = [":joy:", ":ok_hand:", ":100:"];

emojis.forEach(async (uwu) => await message.react(uwu));

earnest phoenix
#

uh it does await indeed

#

no...

uncut slate
#

that would also be out of sync @trim plinth

trim plinth
#

rip

uncut slate
#

.forEach(async returns a promise immediately

earnest phoenix
#

no

#

it returns void

uncut slate
#

an async function returns a promise, I'm referring to the async bit

#

not the output of the forEach call itself

trim plinth
#

this is a heated discussion

#

earnest phoenix
#

yes but, forEach returns void meaning that code would never work even if awaited and, message.react is a promise so making the callback a async function and returning await is silly to say the least

uncut slate
#

it is silly, but you're missing the point

trim plinth
#

interesting

earnest phoenix
#

the for loop that timmy posted would be the way to go

#

await it and it'll be in sync

slim heart
#

How would i turn xml from a xmlHttpRequest into its own variable

#

I want to make server_count into it's own variable

earnest phoenix
#

uh this looks like json

knotty steeple
#

it is

earnest phoenix
#

or I misunderstood your q

slim heart
#

It's from dbl

#

so idk lmao

knotty steeple
#

that is json zoomeyes

slim heart
#

someone told me to use XMLHttpRequest

#

Maybe it's not xml idk

earnest phoenix
#

that doesn't mean its xml

#

parse that response with JSON.parse

slim heart
#

explain dad pls

#

lmao

#

i have no clue what im doing

earnest phoenix
#

const parsed = JSON.parse(response)

#

given response is the thing u showed

slim heart
#

and then server_count should be it's own thing or?

#

idk

earnest phoenix
#

parsed will be an object holding the res

slim heart
#

so parsed.server_count?

earnest phoenix
#

so you could access it like parsed.key aka parsed.server_count

#

ya

slim heart
#

Alright

#

dope thanks

earnest phoenix
#

Is there a way to make awaitresponses work in DMs?

Like I have the command //activate which sends the user a message to which I want them to answer and then send to me in DMs if that makes sense. Discord.js

uncut slate
#

get the DMChannel from the user

#

awaitMessages on that

earnest phoenix
#

how can i push a string to an array in a json file?

grizzled isle
#
const MrFile = require('./JSONFILE.json')
// Lets say MrFile is "Savitar": {"ID": "SOMEBIGID", "prevNames": []}
MrFile.Savitar.prevName.push('Zothuro')
quasi hearth
#

can embeds send local images?

earnest phoenix
#

@grizzled isle i have a json that just looks like this { "knownNames": [ "name1", "name2" ] }

#

in my code i did this

#
let db = require('./stuff.json');
bot.on('playerJoined', player => {
    if (!db.knownNames.includes(player.username)) {
        bot.chat(
            'Welcome to the server, ' +
                player.username +
                '! Type >rules to view the rules.'
        );
    } else {
        return;
    }
});
#

agh

#

the .push line isnt there

grizzled isle
#

Firstly, don't use a json file as a db. Its prune for corruption 100x worse than a regular DB.
Secondly, you'd do db.knownNames.push('NewName')

earnest phoenix
#

i did

#

but it didnt work

#

the .push line was there

grizzled isle
#

After you push it, you'd need to use fs to rewrite the file

quasi hearth
#

^

earnest phoenix
#

oof

#

ok

grizzled isle
#

However, I strongly recommend a database. enmap and enmap-level are fantastic for begginers.

earnest phoenix
#

enmap isnt a db

#

level isnt a proper db

shy verge
#

@grizzled isle only fs has that corruption issue

earnest phoenix
#

eh no

#

thats rare

#

just use fs-nextra and make sure to use atomic methods

#

shrug

uncut slate
#

level is miles ahead of using json with atomic writes imo

#

but I wouldn't recommend either for a largescale bot

earnest phoenix
#

I hast been tagged

worn sparrow
#

i think it looks dumb ;-;

earnest phoenix
#

hmm

earnest phoenix
#

@earnest phoenix whats nekobot api?

#

To nasty to talk about 😛

#

Hmm

#

It's an API i am working on for NekoBot

#

Its cool your bot has an api

ruby dust
#

who could have thought that making a unique single-featured bot will not give me much progress in servers and upvotes

#

wrong channel, but too lazy to go back

halcyon torrent
#

what is the limit of fields in embeds please? 😄 also character limit, if there is any

#

I found out the information in the doc, thanks anyways xD

ruby dust
#

25 field objects, and field description can have 1000 characters

worn sparrow
#

hm

frail kestrel
#

@grizzled isle why are u telling him not to use json but you used it in an example above

worn sparrow
#

pretty sure in some cases a .json can be better than a DB 🤔

verbal night
#

^ Hell i use a .yml file for some things because i store so little and i don't have to put any extra effort into a .json, mysql or sqlite db due to me already having everything required to use yaml 🤷

worn sparrow
#

you can store it

#

on anything

#

i can make a file named database.fuckbitchesgetmoney and store on it 🤷

quasi marsh
#

I have a DB for guild related things and a JSON file for configuration

halcyon torrent
#

I use txt files FeelsAnimeGlassTuningFlashEffect

worn sparrow
#

I use atom so I just have .config and .db

native narwhal
#

Just make a custom config loader

key=value;

mmLol

worn sparrow
#

tries to give me code without even knowing the language im writing in

native narwhal
#

Ew

worn sparrow
#

hm?

native narwhal
#

Looked like dll files 😂

worn sparrow
#

its .db

#

a database file

#

also

#

those are my backups

#

i have a database

zenith sequoia
knotty steeple
#

@zenith sequoia well its pretty obvious

#

you have incorrect login details

#

try getting a new token

zenith sequoia
#

i did it 7 times :

knotty steeple
zenith sequoia
knotty steeple
#

how do you login

zenith sequoia
#

@dire abyss COME