#development
1 messages · Page 550 of 1
Its default...
var conn = r.connect({db: 'storage'}) thats where the error originates from
because. the. database. isn't. running.
is rethinkdb hosted by the website? or you download it?
The server is probably an EXE that you have to run
if you didn't run the rethinkdb executable, it won't work
Connecting to the database doesn't mean the DB is running
did you ctrl + c that?
?
or are you starting the bot from another ssh window
neither?
then how are you running the bot
because running that command will "lock" that ssh window
its using forever...
what
forever is something like pm2 iirc
i'm pretty sure you're killing the rethink process
that's the only way what you're getting can happen
if you do something like
rethinkdb
<hit ctrl c>
run bot.js```
it won't work
The bot just stays running, do I need to keep this running too?
yes
both processes need to be running at the same time
run it as an eg system service
or just open two windows?
using whatever your system has, like systemd
opening two windows will kill the db when you close them
oh ok
vps
good way: use systemd to run the database
average way: tmux/screen
horrible way: nohup
Is there a different db where I wont have to do this?
any embedded database
its free
O
the free plan has limits tho https://firebase.google.com/pricing
lol
don't use firebase/firestore
it's bad
trust me
its not very fast and it's a pain sometimes
you're better off setting up a db on your vps
I've tried 3 different options Im just too dumb to understand them...
learn
I couldnt get a db setup on any of them even with copy pasted code :/
Literally the easy ones are always bad lol
use mongodb
Tried that I had no idea what I was doing after an hour of trying to set it up...
you will killing rethink from the looks of it
yes ill need to re get rethink
you deleted it?
I have limited storage on my vps

Im not keeping things I dont use
rethink is tiny
Still
k reinstall it
I got what I had before
yeah
Alright ladies
Its taking too long to connect... it will give me the error it did last time
lol
Im here, but rethinkdb isnt a folder
Still no
I did rethinkdb
The rethinkdb_data file was created in my bot folder.
Got it
does this have to be named a certain thing?
My conf file
instance1.conf
lsof -i :8080 yields a result now
Still cant connect to it in browser
Now I have a new error
Unhandled rejection ReqlDriverError: First argument to run must be an open connection. /root/petbot/petbot/index.js:45:6 my line 45 doenst have a .run
Nvm its an old error
How can i get the user adding the reaction?
bot.on('messageReactionAdd', reaction => {
let sRole = reaction.message.guild.roles.find(`name`, 'Scambaiting');
if (reaction.message.id == "530616168310898709") {
if (reaction.emoji == "😃") {
}
}
})```
I want to get the member adding the reaction so I can add the role
Fishy could help 
don't emojis fuck code up
Doesnt mess with mine
huh mk
yeah um were not talking about that lmao
Anybody have any experience with typeforms API?
I tried it earlier and I got 401 unauthorized with correct tokens and everything so I was like -_-
Did you 🇷 🇹 🇫 🇲
any opinions on mongodb over mysql
Resource wise?
meaning machine resources to run
i know they aren’t the same but it seems to be less resource heavy
Does anybody know how to delete the bot's msg after a few seconds?(python)
I tried await bot.delete_message(ctx.message) but it did'nt freakin work :|
nah mongo is nosql
@frosty delta read the dpy docs
Ok;_; lol
but mongo caches most recently used data in RAM
mongoose has schemas
yes mongoose does
monmoose
any opinions on mongodb over mysql```
never used mongo but mysql is bad, don't use it as a database for a public bot
What's so bad about it?
Anyone know any good code editing apps for Android? Preferably free. (Ping me)
yeah, vim
lul vim on mobile
No
can anyone help me
i am trying to use quick.db
https://quickdb.js.org/docs.html With that. With the .newtable how would I set the Var to be only a server thing. Any help?
Don't ping moderators
Yes
sorry
We aren't support, We moderate the server, Second you can wait for someone to help you
ohh
i thought moderators were really good at coding thats why they mods
for a coding server
but this is not a coding server
@sturdy delta not a coding server but okay
...
its kinda like a coding server
people on here would know how to code because they are using discord.js
not everyone here uses d.js
most people
well except djs is the most beginner-friendly lib so most of the people using it have only minimal knowledge
if you want help with a lib i'd suggest visiting the lib's support server
D.js has one iirc
He already asked in it
oh
my code and token is out https://gist.github.com/Madmadz16/dd83fbb33f767e634304d11decbff082
okay
@sturdy delta You should ask in plexi
its who made quick.db anyways
whats plexi
plexi dev is a meme, they dont even deserve to be verified (false verification™)
@earnest phoenix
The sexy people who made quick.db

what db does quickdb uses?
better-sqlite3 iirc
files probably
if you think about it all databases use some sort of file type to store data
sqlite3
why my DBL page didn't change the background color?
<style>
background: #473C8B
</style>```
That's not how css works
Hello
0.16 or rewrite?
rewrite
what do I put in the emoji_here bit
If I just copy/paste the emote it throws an error and says Unknown Emoji
What are you putting there?
I tried
":sparkling_heart:"
"💖"
"U+1F496"
and
"❤️"
ok, well thanks anyway i'll try it again
Is is possible to import rewrite and async at the same time?
such an odd question from someone that manages an entire bot list
is discord bot maker any good?
Two folders, different names, different versions
@ruby dust im also an ex python dev so im just wondering
guys i currently use json files to store my user and guild data, however i want to host my bot on heroku, and heroku doesn't let me write data to the json files, so i wanted to ask what online db's would you recommend that are simple to use and have good documentation?
dbs or not, it will not solve your problem if you are hosting on heroku
why not?
because on every bot restart, it reverts the changes to what is on your github, and no you can't just never restart it because heroku restarts their dynos at least every 24 hours
you can write to github lul
but his idea is to use a remote db
you can try google's cloud datastore
or firebase
i tried to use firebase but i cant find good documentation that explains it, do you have any resources that are good?
nope, havent used it myself either
Heroku Postgres has a free tier limited to 10k individual rows of data.
How can I check if my bot has a list of permissions? I tried to check from textchannel > permission overrides by member but how do I check from role
@true moss have you tried this? https://elements.heroku.com/addons/heroku-postgresql
nope
ill check it
out
and do you guys know any cheap vps? like within 5$ or less per month
galaxygate starts at 3$ (1gb ram)
hetzner starts at 2.5 euro (2gb ram) (does not support music/voice)
google has a free forever tier (600mb ram) but charges for traffic above 1gb/mo (discord uses much more than that)
amazon has a 12 month free trial (1gb ram)
i might try the amazon one 🤣
What is this:
(node:97) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
at timeout.client.setTimeout (/rbd/pnpm-volume/e8e383e6-afaa-4af5-bba9-64630e9be140/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/ClientManager.js:40:57)
at Timeout.setTimeout [as _onTimeout] (/rbd/pnpm-volume/e8e383e6-afaa-4af5-bba9-64630e9be140/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/Client.js:433:7)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
(node:97) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)
(node:97) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
And why does it prevent my bot from showing online on discord, even though the server is running?
scaleway starts at 1.99 euro (1gb ram) but runs on atom cpus (about half performance of standard xeon cores)
well, something took too long
unfortunately you cant pin point the reason from that error only, you will need to debug your code
you can start by catching promises
ex: .send().then().catch(console.error)
or try { await .send() } catch(e) { console.log(e) }
What's so bad about it?```
i was asleep, anyways from dapi;
guys
I'm doing something wrong. the application crashes without error
if(cmd === `${Prefix}serverinfo`){
console.log(`ServerInfo Command Used By ${message.author.username} (${message.author.id}) At ${message.guild.name} (${message.guild.id})`)
const name = message.guild.name;
const icon = message.guild.iconURL;
const memberCount = message.guild.memberCount;
const ownerID = message.guild.ownerID;
const region = message.guild.region;
const createdAt = message.guild.createdAt.toDateString();
const vchannels = message.guild.channel.filter(c => c.type === "text");
const tchannels = message.guild.channels.filter(c => c.type === "voice");
const guildEmbed = new Discord.RichEmbed()
.setTitle("Information About " + name)
.setThumbnail(icon)
.setFooter(`Requested By ${message.author.username}`, message.author.icon)
.setColor(`#2196F3`)
.addField("Owner", `<@${ownerID}>`, true)
.addField("Server Region", `${region}`, true)
.addField("Created At", `${createdAt}`, true)
.addField("Member Count", `${memberCount}`, true)
.addField("V-Channels", `${vchannels}`, true)
.addField("T-Channels", `${tchannels}`, true)
.addField("Role Names", `${message.guild.roles.array()}`);
message.channel.send(guildEmbed);
}
I'm trying to filter the channel list, but it's not happening.
you have guild.channel and guild.channels
Hey Tim
What emoji remove code?
@earnest phoenix always say what lib and version
pls remove emoji kthx
And you want to delete an emoji from a server?
someone should make a lib for lolcode
Iirc it's message.reactions.get('id').users.remove('userID')
Might be different in 11 tho so sec
get().remove() i think
Oh yup
when you use .react() your message gets a new reaction
so you have to check message.reactions() to see all reactions in the message
and remove the one you want
you can also filter them
message.react("✅");
copying doesn't always work. try to learn.
Remove?
sigh...
message.reactions.get('emoji').remove.('id') https://djs.advaith.fun/s/MessageReaction.remove
Removes a user from this reaction.
𝗣𝗮𝗿𝗮𝗺𝘀: [user] UserResolvable
The user to remove the reaction of
𝗥𝗲𝘁𝘂𝗿𝗻𝘀: **Promise<[MessageReaction](https://discord.js.org/#/...
should be something like message.reactions.filter(r => r.emoji === "✅").remove()
sorry for
but i just want to move on
Th tim.
can I use this to delete something other than ✅?
message.reactions.filter(r => (!r.emoji === "✅")).remove()
Isn’t .filter returning an array of the other emojis?
So you have to do a for or forEach loop on it no? afaik
@unborn nova
hmmm
this new feature I learned. I guess my English isn't good enough either.
So do something like
message.reactions.filter(r => (!r.emoji === "✅")).forEach(e=> e.remove())
Rights ? :p
Thanks for the explanation
yeah you're right
sure you are right :p
message.reactions.find(r => r.emoji === "✅").remove() should work
.find returns the first value found
thx guys
wasnt there a method to remove all instances of a specific reaction?
oh he wants to remove all except the one his bot reacted?
i just found out there is also .deleteAll()
just reverse the test statement
reactions dont have a delete method
Yea
i think the best way to remove all reactions would be to use the method that removes all reactions, then add the one reaction you want to keep afterwards
.removeAll() 
Idk what his intentions are
So if he wants the users reaction to stay etc.
but i swear i remember seeing a reaction delete method that cleared all instances of a single reaction from a message
was that in v12?
v12 doesnt even have a reaction remove method lol
you might be able to filter the collection in master and then try using the removeAll method
oh its in reactionstore now
But removing all will remove every single emoji
but the docs should at least link the correct datastores
like, the v12 docs dont link them anywhere
They should make it so an option like .removeAll({options: {
except: emoji
}
})
Something like that
it would easily be ratelimited though
clear all removes ALL
you can remove sets but i dont think the API supports it (at least the bot API)
Well on discord iirc they removeAll just removes them all separately on their own end tho?
They might’ve changed that cuz I’ve heard that a while ago
no if they had a removeAll function it wouldn't remove them all seperately
that would essentially just be rate limiting themselves

It was how they used to do it lol
ReactionArr = []
Lol
But I mean couldn’t they just wipe the whole thing and redefine it as the single one the user said except for
but why
a lib developer should never offer functions that make multiple api calls internally, except if absolutely needed
when you could just clear all and add a new reaction
I’m not saying the actual lib I’m saying actual discord
Adds it into the discord api
Not lib side
But then again that’d probably be dumb
such a rare usage
discord's api should have a transactions endpoint
where one could send a list of operations to do sequentially
in one api call
lmao
ok but
that could be dangerous to them as well tho
Then people can abuse from the inside so
that would be the same as being ratelimited bot-side
someone could easily abuse it and if it was a thing they'd probably put real heavy ratelimits on it
i highly doubt they would do anything like that since you could do it yourself via a burst of 3/4 actions
just with a long wait :^)
Or maybe they can focus on the application showing spam messages deleted in a spam fashion and it shows up on the app screen even tho it doesn’t exist
what
what
If you spam like a command that a bot deleted the initial message of right? It keeps deleting until both people are rate-limited and eventually everything is figured out and deleted but sometimes on the visual app screen it just stays there I guess because it was too fast, the message doesn’t even exist and you can’t even hit the delete button
You can only get rid of it by refreshing the application
Yea
although i did abuse the api once
on april fools
i made my bot react on all messages in a specific sever, as an april fools event
But people come to me like all the time saying “tHe BoT dIdNt DeLeTe ThE cUrSe” and I have to explain that it’s a discord problem and half the time they don’t believe me
(╯°□°)╯︵ ┻━┻
because the reactions rate limit is kinda low, people started spamming in order to watch the bot struggle to keep reacting
You got your reactions and shit but what a surprise it is that people invite a bot to censor their message and then spam curse words to see if it “works” 🙄
lmao
I am trying to make my bot delete an emoji, but I am getting this error:
TypeError: Cannot read property 'guild' of undefined
This is my code:
.then(emoji => console.log("Removed the [" + args[1] + "] emoji from the guild."))
.catch(console.error);```
msg isn't defined
but it is
not according to the error
const Discord = require("discord.js");
module.exports.run = async (client, msg, args) => {
if(!args[0]) return msg.channel.send("Please use the correct format:\n!emoji create [link] [name] |\n!emoji create [name] - can only be used if an attachment is sent with the command |\n!emoji remove [name]");
if (args[0] === "create") {
if (!msg.attachment) {
if (!args[0].startsWith("https")) return msg.channel.send("Please provide a valid link.");
msg.guild.createEmoji(args[1], args[2])
.then(emoji => console.log("Created new emoji with name [" + emoji.name + "] in the guild."))
.catch(console.error);
} else {
msg.guild.createEmoji(msg.attachment[0].url, args[2])
.then(emoji => console.log("Created new emoji with name [" + emoji.name + "] in the guild."))
.catch(console.error);
}
} else if(args[0] === "remove") {
msg.guild.deleteEmoji(args[1], "none")
.then(emoji => console.log("Removed the [" + args[1] + "] emoji from the guild."))
.catch(console.error);
}
}
module.exports.help = {
name: "emoji"
}```
where are you running "module.exports.run"
how do you mean
where do you execute the "run" method
index.js?
do you even know how coding works
can you read documentation?
not message reaction

are you doing it right?
Hi ! Can someone help me for the sharding? How do I recover shards information such as status, number of guilds, ...
const shard = new ShardingManager('./main.js', {
token: 'MYTOKEN',
autoSpawn: true
});
Look up a guide or something or use broadcastEval and stuff
I have already looked at the sites ...
Do something like
broadcastEval(‘this.guilds.size’).then(res=>guild-count = res[0] + res[1])
(Concept)
Also why are u sharding at 1k
Not even 1k yet
Oof
I just did not update the site
hello
someone can help me
i get this error
$ python Blue_Walker.py
Traceback (most recent call last):
File "Blue_Walker.py", line 1, in <module>
import discord.py
File "C:\Users\BurNet\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord_init_.py", line 20, in <module>
from .client import Client, AppInfo, ChannelPermissions
File "C:\Users\BurNet\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 38, in <module>
from .state import ConnectionState
File "C:\Users\BurNet\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\state.py", line 36, in <module>
from . import utils, compat
File "C:\Users\BurNet\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\compat.py", line 32
create_task = asyncio.async
^
SyntaxError: invalid syntax
xD
File "C:\Users\BurNet\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\compat.py", line 32
create_task = asyncio.async
SyntaxError: invalid syntax
? how can i fix
@languid dragon
msg.guild.deleteEmoji("532223268376150016")
.then(emoji => console.log("Removed the [" + args[1] + "] emoji from the guild."))
.catch(console.error);```
TypeError: Cannot read property 'guild' of undefined�
not client lol
From client
Did u defined client?
I fixed
Oh

sorry about that lol
but msg doesn't work neither
but msg.guild.emojiCreate does work though
no
Oh
it's for msg
Are you in the message event?
Let me see the start of your client.on
I use a command handler
Then show me the beginning of the export
const Discord = require("discord.js");
module.exports.run = async (client, msg, args) => {```
const Discord = require("discord.js");
module.exports.run = async (client, msg, args) => {
console.log(msg);```
like that?
you shuold also close the {} but ok
JSON of the message @slim heart
oh yeah, thats the message object
yeah
Yea
Hm
Are you sure it’s the error you’re getting?
Take a screenshot of the full error screen when you run the code
@lethal sun u are running that .deleteEmoji() code right after .run, right?
the full code is above
Hmm 
Idk
const Discord = require("discord.js");
module.exports.run = async (client, msg, args) => {
msg.guild.deleteEmoji("SOME_EMOJI_ID", "none")
.then(emoji => console.log("removed"))
.catch(console.error);
}
module.exports.help = {
name: "emoji"
}
try this
that worked @languid dragon
Is it supposed to be deleting a specific emoji lol
yeah
Ok cool
Lmao
I have code like this: js min = 1; max = 10; Math.floor(Math.random() * (max - min + 1)) + min; but the generated number is like -394
tf why
Hmm, is mathjs library messing with something? 
Because there are some fuctions, which are making some things easier for me 
Ok, I'll try it without it
I'm using mathjs library in my bot since I started programming, so I have a lot of commands made with it :D But nvm, I'll change it somehow :D

1 file bot 


@waxen blaze min and max are strings
inferred types btfo 😤
hey i have just made my own bot but need help with it
🆗
tHeN aSk yOur qUesTioN
inb4 "how do i make it online"
Is it possible to put specific servers on a shard
i dont think so
Sad
i want to make a leveling system but the one i have set up it keeps wiping the json file
Google "databases"
where are you hosting your bot?
im hosting it myself atm
json files have to be used very carefully, because if you accidentally supply invalid json data, the entire file will be wiped
thats why using a proper database is recommended, to avoid such issues
but if you prefer using json files, be sure to always check if the data is valid and make sure you're not doing more than one operation at a time on it
also, if your bot crashes during writing, it will also destroy the file
Json files are fine for storing simple data and i have never had any issue with it in C# but i guess it just depends on how you use it
i just did json file to test it
Also that
wanna help me create a leveling system that records to a db?
its a great learning experience if you're new to programming
how do you make it so its like
if i do a message on join, how do i make it custom to the server
!!!message <message>
im struggling here
you want to send a message when someone joins?
how to make if a bot no admin rights the message was sent in private message, and if there is something in the chat?
Check for permissions?
Yes
Look up permissions in a idiot guide
What?
he means https://anidiots.guide
Checking was not for the author, and for bot
Good day, I need help with getting the id that the user voted for. You can more detailed example of how to do this. JS language.
Do you have the webhook listener implemented yet?
@mossy vine a databasE? i dont have one ;-;
then make one
;-;
does the C# api support category perm editing yet?
...
I do not work this creak.
dbl.webhook.on('vote', vote => {
console.log(`${vote.user}`)
});```
Ehmmmm, can I undo things in Visual Studio Code?
Nvm
I can also not save the file
vote.user will return the Id of the user
Anyone know of a bot that can post live information about members that are assigned a certain role e.g. @csgo
The aim of this is to make looking for a group of people to play with in a multi-game environment easier. AND consolidate looking for group text channels to the minimum.
The attached picture shows basic information, but isn't automated. It also doesn't give you a clickable link to the users profile
what do you need to write here?
your webhook password
Is there ever any bot developer looking for a good project?
if so how would I find any?
never seen one
@sage stream you want to pay someone to make a bot for you?
they're all just so already inspired
at most you'll find developers looking for ideas for their own bots
not for someone else's or a new bot
everyone does
where would I start
learn a programming language
ok how do i create a webhook?
and what you need to write in the URL
your bot's url, where your bot can be contacted at
for example, if you're hosting in a vps with a public IP, your url would be http://yourvpsIP:webhookport/dblwebhook
and if I use PC as a hosting?
If my bot is only used on my pc, I'm sure it wont require too much harddrive space right?
you'll need to use your PCs ip address and also set up port forwarding for the webhook port
depends on the language and libraries you chose, but generally you wont need more than a few MB
do you have any experience with programming?
js language d.js library
I've messed around a bit,
in which language?
I've xhtml, css, php, python,
but only the basics
and even then I didn't aquire much of it
xhtml and css aren't languages
you could use python then, if you already have experience with it
they're fakes
they are languages lmao

just not turing complete
deffo languages
Tim, Ik you said that devs are normally looking for ideas on their own bots
but if they make their own, it could still be useful to what I'm looking to develop
it's more like several bots will be needed for what I'm trying to create
so if you know anyone who'd like to continue to develop a bot in the long scheme of things, I'd appreciate it
what kind of thing would need several bots?
the only thing i can think of is server raiding lmao
I look at all the discord RPG simulators out there and it's pretty pathetic, I've got ideas for a grand scale RPG that wouldnt compare to any other discord RPG
this would be very hard to server raid too.
It'd almost be impossible.
then just make a better bot than those other bots? I don't think there's a need to rate them all this way
rpg bots are hard to execute because of the complexity and discord's limited ways to interact with it
I have a lot to explain but I want to explain it to people who might share an interest in building this.
webhooks
I can explain myself and why I need multiple bots if you'd be interested in hearing me rant
you can change the avatar/username per-message for them
its more immersive if you can see the NPCs in discord's user list
yes
and interact with them independently
Tim
you're right on it
bro I'm seriously so ready to make this happen
I've got great ideas.
Immersive is what I'm going after
there's a big stumbling block that I wont be able to get over alone
and it's going to be the inventory and item system
that's my major problem
not to mention it'll need a shop or several.
sounds like you want an rpg system for a server, rather than a public rpg bot
each additional bot makes it more annoying for users and more expensive for you
Not entirely,
if it's public
it'll be very simple only because of one thing
normally the user is overloaded with seeing too much happening at once
they'll need to invite N bots, setup permissions for N bots, etc
the way I'd like to set it up is the same as how you would feel IRl
and your cost is N times higher
i could see it happen for a single server or a specific set of servers, not as a public bot
I'm currently using 2 bots, just let me set these up and I'll show you guys what I mean,
I know you guys are trying to do the math with what I'm saying but the way I've got it in my head, it's fool proof.
The only reason the user's will get overwhelmed is if they see everything at once
its always foolproof in concept, but when you actually try it, suddenly everything is on fire lmfao
The way that this RPG will be set up is to make you feel like you're actually doing something something rather than looking at a list of 10000 channels and too many people in one place.
this server will be very clean and you'll only see what you're using at that in particular moment.
I don't want to explain it because it wont do it justice. I'll show you guys in a few.
hmm
you want to use channel permissions to restrict a user to certain areas and have them navigate that way?
that could be very expensive in terms of API usage
for a big server, yeah
im not sure how's the rate limit for channel permissions
I've got something to deter that aswell.
you can't get around ratelimits
if you have a ton of money to spare
If something like this got big, there is a way to make money from this.
you could probably come up with something
but if its only for a single server, it wont be expensive
a single server with 50k people will use like 200mb ram using nodejs
you'll also need to come up with a way of communicating between different bots
yes
because that's my next step.
Good, this is going to be really immersive
hang on,
can I invite you guys to a server so this is all in one place?
dice.. I'll give you my idea for a big rpg server... webhooks
Webhooks?
the bot will handle commands.. and send out for webhooks to do all the message sending
you can have a custom name and avatar for each message
while only having a single bot account
I dont know anything about this, you'll have to tell me more
or none, for that matter
webhooks can be used to send messages without a bot
and they allow each message to have a different username and avatar
webhooks are just an http post
which is why they work with eg github
I havent had the time to recode my pokemon vote.. but it would prevent your bot from breaking ratelimits
so you basically send requests and discord will post them for you?
yes
yep
test it using Postman.. I spent a lot of time contemplating writing a bot/webhook system to make a sort of rpg game
how do you specify pfp and username? over post as well?
yes
eg curl -X POST $WEBHOOK_URL -H "Content-Type: application/json" -d '{"content": "hello world", "username": "memes"}'
awesome
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
as in, a data uri
data:image/jpeg;base64,BASE64_ENCODED_JPEG_IMAGE_DATA
content-type doesn't matter afaik
on the uri
basically a base64 image
as long as it's jpeg/png/gif
not sure if webhooks support gifs
btw you'll probably want to get a lib to handle webhooks for you
as they also have ratelimits
and implementing those is a pain
I developed for an rsc private server, added webhooks for their ingame market, whenever an item is put up for sale, the webhook posts picture of the item, price and name
dice.. I will send u something in a sec.. if u want it
k I'll be home soon
How can I send a message if a command does not exsist
client.on('message', message => {
if (!message.guild) return;
if (message.content === prefix + ?)
message.channel.send('`That command does not exsist`')
})
You shouldn't
^
Check here :https://github.com/meew0/discord-bot-best-practices (num 6)
anyone know the advantages of eris compared to discord.js?
So weird issue: I have a singular user that is seeing mostly blank rich-embed messages (no text, but can see emojis and footer). They appear fine for everyone else, including myself. Any ideas on what could be the cause?
are they on mobile? Have they restarted discord, if yes have they restarted the device?
Yes to restart (from what I've been told 😉 ), no to mobile
ask them if discord is up to date?
According to them, yes
Is that for all embeds?
Correct, appears to be across multiple bots as well for them, just got a second report now
Tell them to goto their settings and turn on link preview
(According to reddit)
Its in "Text and Images"
Yeah, had them try the same thing before (only thing I could find on the issue, haha)
Though it does seem like clients on the latest discord update are having the issue? Not sure if any other people are receiving similar reports though =/
Personally haven't done today's update yet so would explain why I can still see everything fine
Resolved: Seems like all clients are fine now
Can anyone help me with retrieving messages from the cache in C#? I have it downloadasync when a message is deleted but when i try to retrieve it using context.channel.getcachedmessage(id) it returns null
i have the id stored somewhere so i dont know why it isnt retrieving
and i have the messagecachesize set to 100 in the config
My question went unanswered so I am reposting it
How can I send a message if a command does not exsist
client.on('message', message => {
if (!message.guild) return;
if (message.content === prefix + ?)
message.channel.send('`That command does not exsist`')
})
We did answer it
Just not in the way you want
yea ik
People don't like it, myself included, but if you really want it use .startsWith() and not content ===
If your still confused, look at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
@earnest phoenix ```csharp
client.MessageDeleted += async (msg, channel) =>
{
await msg.GetOrDownloadAsync();
//i also store msg id in a text file
};
var msg = Context.Channel.GetCachedMessage(id)```
msg returns null
How would I fix this error?
'use strict';
module.exports = function (min, max) {
var prev;
return function rand() {
var num = Math.floor(Math.random() * (max - min + 1) + min);
return prev = num === prev && min !== max ? rand() : num;
};
};
the issue is the unique-random module being broken
hmm.. web page is responsive on pc when i shrink browser.. but not on mobile
nevermind had to add viewport meta
@fierce owl
you can do it by using some kind of else function, like if there is no command that matches whatever the user typed then send that
however
I seriously recommend not doing it
its annoying and people will avoid your bot for it
can anybody help me with a code i dont know how i could code this ive been thinking for days
easier if u just ask the question
ok
how do i make when some says anything that isnt a number it deletes the word and says thats a invalid number then that message deletes after 5 seconds
what lib and version
yes, what programming language
thats not the same but ok
i know.. preemptive to.. what is a lib
im confused
what is your bot written in
you are coding a bot correct
yeah
what version?
the latest i think
you can either check Discord.version in your code or run npm ls discord.js in your console/terminal/powershell/command prompt
│ New prerelease version of npm available! 6.5.0-next.0 → 6.5.0 │
│ Changelog: https://github.com/npm/cli/releases/tag/v6.5.0 │
│ Run npm install -g npm to update! ```
└── discord.js@11.4.2
you havent made any commands or anything?
its probably easier to code a bot if you have already learned the language
that was a practice run
ok so do you know how to use client on message
you can use isNaN to check if something is a number or not https://stackoverflow.com/questions/175739/built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number
it will be the opposite because isNaN means "is not a number"
oh
you could just negate it (!isNaN(...)) to find the correct answer
if (message.channel.id === '529508285884399637') {
if (isNaN(message.content)) {
message.delete()
message.author.send('Thats a invalid number!')
}
}```
would message.reply work?
yes
it didnt work
this is what i did
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on(`message`, message => {
// variables
let sender = message.author;
let msg = message.content.toUpperCase();
let prefix = 's.'
// delete anything but numbers
if (message.channel.id === '529508285884399637') {
if (isNaN(message.content)) {
message.delete()
message.author.send('Thats a invalid number!')
}
}
});
bot.on(`ready`, () => {
console.log(`Bot has started, with ${bot.users.size} users, in ${bot.channels.size} channels of ${bot.guilds.size} guilds.`);
});
bot.login('TOKEN');```
when i ran it no error came up but when i went into the channel nothing happened
try logging things at different points to see how far it gets
what do you mean?
console.log('test') will log test to the console
so you can add logs at different points in your code
ok
like one in the if...id and one in the if isNaN
?
what do i put there?
i told you, try logging something with console.log
i did\
and?
where did you put it
the file?
at the bottom
// variables
let sender = message.author;
let msg = message.content.toUpperCase();
let prefix = 's.'
// delete anything but numbers
if (message.channel.id === '529508285884399637') {
if (isNaN(message.content)) {
message.delete()
message.author.send('Thats a invalid number!')
}
}
});
bot.on(`ready`, () => {
console.log(`Test`);
});```
try putting one each where i put those 2 red lines
so we can find the issue with the deleting code
so i put it in between?
yeah
// delete anything but numbers
if (message.channel.id === '529508285884399637') {
console.log(`Test`);
if (isNaN(message.content)) {
message.delete()
message.author.send('Thats a invalid number!')
}
}
});```
yeah and put another one after the isnan
its possible that the channel id is incorrect
i changed the channel
and the "test" console log didnt show
but it works
when i say message.reply the bot tries to delete the message and it deletes but how do i make the bot delete its own message after 5 seconds or something?
and now the bot is telling its self lol
and then it repeats
i cant make it delete
i fixed it now the bot wont repeat itself but it wont delete
setTimeout(function(){message.delete}, 5000);
then what to i do?
you would need to set the new message the bot is sending to a variable
wdym
so like instead of js message.author.send('Thats a invalid number!') you would do js let botMessage = await message.author.send('Thats a invalid number!')
oh
then you can run botMessage.delete()
remember you always need the () for methods/functions
i need add a async but wherE?
where you start the function (js bot.on(`message`, message => {)
oh
so that should be ```js
bot.on(message, async message => {
k

now it works 

is there a way to make your bot online 24/7
what glitch?
its a bad place to host your bot
or you could try to use heroku but it will be complicated
@void mantle small bots are fine but yeah.. not recommended but atleast its free
see https://anidiots.guide/other-guides/hosting-on-glitch @unreal junco
ok
advaith heroku was never focusing on hosting nodejs apps tho
and it doesnt save databases
but it will be complicated
i just want it so my bot make sure no one says anything else but numbers
k
yea then glitch is fine
cause the bot sleeps once my pc switches off
dont turn your pc off
lol
lol
ok
Or buy a raspberry pi starterkit, install the software on it, attach it to your router (ethernet) and host it on there :p
i think the key issue with that is buy lol 
i have a pi b+ and a pi 2 b somewhere
rip




