#development
1 messages · Page 423 of 1
Well shouldn't edits be included in bot:msg:channel
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
What is the idea?
i can’t share 
Awe 😂
mainly because i dont know if its possible
I mean if you share I could give my opinion on if it is possible or not >:P
i can tell you in dms i just dont want people stealing my idea
Yeah I get that
Share in DMs plz. 
those rates are not shared between shards, are they ?
I dobut it
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
50 messages per 10s global across mutliple shards doesn't make any sense, makes more sense per shard
Well idk
I am not sure
honestly no one knows xD #discord-internals
Someone get me a Discord employee

even per shards I find this limit really restraining
With a 1k guild pr shard
idk told you it might vary depending on number of guilds etc.
just probably undisclosed xD
especially for bigger bots
Does anyone know someone that works for Discord 
nop
@earnest phoenix can i ask a question
Yea?
how do you check of a user when you don't have mention or id just example Duck#9999
with a bot of course
with what lib
i can give a command example too if you want
What library are you using
Yes
@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
oh thank you @earnest phoenix sorry for super late am working on a game project lalal
I18n
which basically means you make a json (or whatever data structure like it) and make response strings
But the bot is in english and the footer is in Portuguese
you code the footer
It's probably translated client-side
umm send message id
But wouldn't a timestamp look like this?
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
You mean the client-side translated one or the last one I sent?
oh nice
discord.js would be
<RichEmbed>.setTimestamp(Date.now())
Lemme see if it works then
d.js also has {embed:{timestamp: Date.now()}}
that's what I do with Eris, sooo
that's because eris doesn't have the embed builder like d.js 
@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
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
give more context
My bot is going to retrieve data from a json
like every 30 min
and I want him to auto display the data
where?
on a discord chat
first of all don't notify all servers on an event not related to all of them
but else just get the id
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
lol sorry for yesterday @uncut slate i was making my own stuff harder hope ya forgive meee
@old glade save the channels you will send in and iterate over the (better be) set
ok
How do I send a custom emoji in another guild with discord.js?
get the ID of the emoji
There is an emoji id
<:x:ID> is enough
You don't have nitro @olive drum
bots have mini nitro lol
Bots have
Ahm discord.js anyone knows how like hmmmmm dm a user by it's tag no need of a mention?
why use tags
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
get user by id
of coourse using the bot
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
👀
but the bot is
thats a Discord API Limitation
oh..
ripsdee
workaround, get ur bot to every server in discord
anyway is anyone around experienced with Mongo? i need some help with it
no memes in #development kthxbye
i do mongo in python @earnest phoenix
wut
@restive silo tho can you give an example of collection#find
wihile searching for user tho
oh nvm am so dumb
@low rivet do you use mongodb?
<client>.users.find(user => user.tag === 'your tag in here')
yup
can you help me then
thank you
ok but what lang are u using? 
the shell and node
i use python
yes i do 
go ahead 
lol sure
❤ @restive silo see yaaa
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
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
hmmmm actually not sure, taking a look
hmm
so it looks like the only way you can query that is with $where which kinda performs like shit on large scale
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
same
All I know is that the default index is _id
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
Well I'm not sure either
Also can you use JavaScript functions in the mongo shell?
depends on how complex I guess, it's pretty much a full js repl
Ah that's cool
should work just fine https://tweetcord.ratelimited.today/cefaca.png
it would throw if data didn't exist though
rip got an error
what is it
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
@uncut slate i have a question no help and stuff just a question
or anyone who knows js
or discord.js
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
never heard about it what?
as in like what
you want to message a member from a server, but you don't know the user
sometimems nuget is a pain to deal with
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
@vestal cradle ez get the users id
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
can't you make your bot generate an invite for the server
Ye well besides that point i was just asking if it's possible to do that
it is
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
ye but your bot needs the proper permissions
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 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
doing it as a json will look so much better tho
can u do it for me plz im noob
no
Yeh sure
no spoon feeding cmon
But you should really learn.
just do ``
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
dude you should learn js before developing a bot
and he doesn't need backticks
just do .addField("Total Members", client.guilds.map(g => g.name).join("\n- "));
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?
dude sorry you should learn js
the problem is we are doing the job for you
I recommend picking up and finishing a js tutorial from websites like codeacademy or sololearn
Send the error then.
Charlie honestly dont spoonfeed, they need to learn
Codeacademy is a great way to get familiar with a languages syntax
or by starting some more beginner friendly projects
Meh sorry, just tryna help
Spoonfeeding 
You have two semi colons @earnest phoenix
o
The semi colon ends the embed constructor
^
two semicolons don't do anything @earnest phoenix
oh really?
You don't even have to use semi colons to end an embed const.
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
yes?
client.channels.get("448559746568421398").send({embed})
It's probably something ez but im a noob so
still error charlie
jfc
it's just ```
-```
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 
caus it makes it all look more professional in my opinoin
^
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
charlie stop spoonfeeding
Aly says she will mute you
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
Can I?

sure
go ahead
😃
yes nao go
I'm waiting on you

My question will just get buried
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.
Create embed instance, add a field using the function in the for loop.
^
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
postgres ahem ahem
mysql is just too outdated
if you are actually starting a database start with postgres
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
if you go with NoSQL go with mongo, sql -> postgres
and I'm happy with it
I tried postgres
Marias another good one
But couldn't get the server started
I don't have any distros on my hdd rn
pg has something for anyone 
hello
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
I'm using a localhost setup on windows 8.1
ok
I downloaded an installer for it
so it is a command line interface?
Assuming it's like mongo and mysql then yes
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
ok so just use the normal installer lol
That's the thing, I used the official windows installer 
lol
But I don't know how to start the server
Isn't that a gui
yes
I assumed it was so I skipped installing it
Because I thought you could access the served through command line
we all like that sweet sweet gui
powershell
Am I retarded or why wont that work? I send the whole fucking client parameter with it o.o
Lol powershell
Uninstall pls
@spring ember btw can you tell me why you prefer postgres over other sql dbs?
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
^
json always had arrays 
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 
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
charlie.
Hm?
Sorry 
But how do I do a command that enables/disables other commands
Library?
discord.js
Any particular command handler you're using?
first question: have u tried googling the problem first?
Yes
Here's a run down thing
Store disabled commands in array, check if in array when run, don't run if in array
You could, but that seems somewhat annoying, especially if you've got a large amount of commands
What do you think is a
large amount of commands?
Number-wise? How many do you have?
Ik
Hmm I have 43 commands
How would I go about adding a for loop in a richembed constructor?
.
For djs
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
Not you.

But my bot has a lot of commands
I can't really think of other ways atm, sorry
comment out the entire command file
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.
to enable or disable commands you need a database and some kind of check at the start of the command
cough sqlite cough
to know if to execute or to not
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
@violet wyvern https://www.codecademy.com/learn/introduction-to-javascript Go through this and check out this before you try to understand the language, maybe then you can figure out the problems you're running into
umm
after I tryed to run !invite with if (message.content.startsWith(prefix + "invite"); ...
I have a feeling that message, is not defined
Can you show the line where you hook the message event?
which means there is no such var called message
what line?
var prefix = "." client.on('message', msg => {
if (message.content.startsWith(prefix + "invite"));
message.channel.send(".");
});
.
msg is not message
You defined message as msg.
lol
Either change msg to message or your message to msg.
^
🤷
Lol, two secnds.
close what
I am dumb I know, but what should I close?
@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
oh
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
Okay
But its most efficient to just check if its a bot
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
Then learn it..
learn tho
we was all new
but we learnt
simple as
it still spams
what
btw remove that !
on message.author.bot
Okay, thanks.
Any good sources to learn js and code examples?
No probelm. And the bot replys to every message with the "invite command" it doesn't "cares" about the prefix+invite.
var prefix = '-'
client.on('message', message => {
if (message.content.startsWith(prefix + "invite"));
if (message.author.bot) return;
message.channel.send("msg here");
});
@tepid laurel
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?
Most likely. 
do you know how long it generally takes for a bot to get approved?
like how long it take yours?
1 hour to 1 week
ok
will do
How do you make an exe command that automatically runs your discord bot?
Like Gateway thing.
huh
I mean exe cmd prompt*
node x.js?
export to an .exe
I use discord.js
oof
You can't start the bot on discord if it's offline.
and have a start command in the package.json
npm start 
^
start script is overrated
I prefer node over using npm to run
yeaah
i usually write a start.sh that configures env variables then does yarn run
😩
yarn run 

Anyone got a guide or something where a form can be submitted on a website and then the bot receives it?
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
Simple for you lmaoo
have you used express before
uhh ok do you know anything about http requests at all
a lil bit
kek
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
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
use ejs then
true
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
:o
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
i was trying to look up guides and this came up 😂
wot n tarnation
are there actually any js microframework libs that aren't as heavy as express
it's express with async/await and less bloat i guess
ye, little to none, pretty barebones
i've never understood why they like the cascading callback chain thing so much
yo guys
?
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
but on the api it has a function for Emoji ID's
yes
but I can't find out how to use them
you would need to get the emoji as a class
You'll have to define it first then get the Id
em = bot.get_emoji(id) #getsemoji
or
oh
why doesn't it say that on the api D:<
ok thank you
I'm going to check it out
:happy: isn't an id and np
Hold on would it be possible to request info from dbl api to my website cuz that'd probably be easier
check the emoji class
@slim heart check out dbl api
and in id is the method
Ik but like would it be possible to do it on a website
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'
🤔
async.get_emoji ?
how do i check that
discord._version_
lmao
0.16.12
async
^
no
First, why do you need to fetch the id for.
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

you could just store the emoji to a variable
yea
but how do I get that
on the bot
I don't want it
to ask for the id everytime
emoji = "<
385689172179943435>"
you use the opposite of /
right click the emoji u want and hit open link
Don't forget about the string.
and then <emojiname>
get the ID
he wants to get the id
the ID is server specific though
const yes = bot.emojis.get("emojid");
That's not Python.
oh nus
^
async doesn't have get emoji either
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
@earnest phoenix async not rewrite
Ill try again
oof
Hi! Just one Question, how to use the new FortniteApi? I can't find the Stats
@floral stone I got it. Its message.server.emojis , and it puts it in a list. Thank you so so sooooooo much ❤
message.react("🇦").then(x => {
x.react("🇧").then(y => {
y.react("🇨");
});
});
```won't work
it's not an emote
whats wrong
use await™
no u
yes
await Promise.all(["🇦", "🇧", "🇨"].map(emote => message.react(emote)));
@earnest phoenix there
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
it will go in order, but it's not resolved in order
it's not consistent, emphasis on might
yeah, it'll be worse when DAPI is shitting itself (99% of the time)
await message.react("🇦");
await message.react("🇧");
await message.react("🇨");
kek
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
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
depends on preference, I prefer pm2
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>
how did you restart
pm2 restart
just like you normally would
well with the bot name ofc
this happened when i crashed my bot with a while loop 
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
uh no
yes because for of await is dumb
it's awaiting each promise before it goes to the next iteration
```js
const emojis = [":joy:", ":ok_hand:", ":100:"];
emojis.forEach(async (uwu) => await message.react(uwu));
that would also be out of sync @trim plinth
rip
.forEach(async returns a promise immediately
an async function returns a promise, I'm referring to the async bit
not the output of the forEach call itself
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
it is silly, but you're missing the point
interesting
the for loop that timmy posted would be the way to go
await it and it'll be in sync
How would i turn xml from a xmlHttpRequest into its own variable
I want to make server_count into it's own variable
uh this looks like json
it is
or I misunderstood your q
that is json 
parsed will be an object holding the res
so parsed.server_count?
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
how can i push a string to an array in a json file?
const MrFile = require('./JSONFILE.json')
// Lets say MrFile is "Savitar": {"ID": "SOMEBIGID", "prevNames": []}
MrFile.Savitar.prevName.push('Zothuro')
can embeds send local images?
@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
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')
After you push it, you'd need to use fs to rewrite the file
^
However, I strongly recommend a database. enmap and enmap-level are fantastic for begginers.
@grizzled isle only fs has that corruption issue
eh no
thats rare
just use fs-nextra and make sure to use atomic methods
shrug
level is miles ahead of using json with atomic writes imo
but I wouldn't recommend either for a largescale bot
I hast been tagged
Anyone wanna give me some suggestions on this design? https://wolfiri.took-my-blobs-away-from.me/otc1dg.png
i think it looks dumb ;-;
hmm
@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
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
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
25 field objects, and field description can have 1000 characters
@grizzled isle why are u telling him not to use json but you used it in an example above
pretty sure in some cases a .json can be better than a DB 🤔
^ 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 🤷
you can store it
on anything
i can make a file named database.fuckbitchesgetmoney and store on it 🤷
I have a DB for guild related things and a JSON file for configuration
I use txt files 
I use atom so I just have .config and .db
Just make a custom config loader
key=value;

Ew
hm?
Looked like dll files 😂
http://prntscr.com/jogpbj
why is this , if u a anwser ping me :)
@zenith sequoia well its pretty obvious
you have incorrect login details
try getting a new token
i did it 7 times :


how do you login
@dire abyss COME



