#development
1 messages · Page 693 of 1
essentially yes
How would I handle specific permissions errors in my command handler?
check for permissions before attempting to do it
I know
but like
how would I catch a permissions error and then send a message to the channel saying something like
I need ${permissionserror} permissions to be able to do that!
All of the modules I just installed onto my debian (node.js) VPS but no modules's commands are working. Anyone know how to fix this? -bash: screen: command not found
it is installed.
reboot
okay
restart the hardware or software?
i really have no clue what the difference is lol
do it
you shouldn't need to reboot after installing stuff
https://vinniehat.is-inside.me/ZZqonxHe.png What do you guys all think?
I would work on a project with you and do that if you want
I would love to collab in general with someone
I dont even know React and Express oof
Do you know JS?
No lmao
oof
https://vinniehat.is-inside.me/mFZP1dBj.png React and my Dashboard for ya
lol
Messy af
But I like colors so I have plugins for that
that looks kinda easy but I cba to learn
lol
I mean it isn't hard. For me it is just tricky as I am still learning React, but you just gotta think outside of the box 🙂
I got confused learning js
wut
so 😩
I learned that a year ago when I was 12
python doesnt have the {
Yeah
yeet
https://vinniehat.is-inside.me/Ilc6hVWp.png I like the glow effect. Just trying to get rid of the border without the actual picture moving
make it glow on hover
I made all of the icons move up on hover
But the VIP glow
bad gif but it is the same on both
the first hover just got cut off lol
epic
python is a good language to program a discord bot?
i already learn a bit of Java and a lot of JS
Python is probably one of the easier languages to learn as a beginner.
Python is by far the easiest to learn
It's syntax is yuxky
js > py
Let's not start a language war
Keep things civil and back up your claims with real, valid arguments lmao
Don’t use JSON as a database
It can break from constant writing data into it
But really, as long as you know how to prevent that, it's ok
does anyone want to address the actual problem or no
you didnt define it :^)
the id
I swear no one understands the errors for some reason
You're trying to set a property of an object which is not defined
idek where it's erroring at because we dont have a full trace back
it should say the line
(node:3603) UnhandledPromiseRejectionWarning: TypeError: Cannot set property '460935884666044427' of undefined
at Object.exports.run (/app/commands/mute.js:46:26)
at Client.bot.on (/app/index.js:235:37)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at MessageCreateHandler.handle (/rbd/pnpm-volume/6db9c604-aacf-48f2-8d74-f4b97a1b4a80/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/rbd/pnpm-volume/6db9c604-aacf-48f2-8d74-f4b97a1b4a80/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/rbd/pnpm-volume/6db9c604-aacf-48f2-8d74-f4b97a1b4a80/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/rbd/pnpm-volume/6db9c604-aacf-48f2-8d74-f4b97a1b4a80/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/rbd/pnpm-volume/6db9c604-aacf-48f2-8d74-f4b97a1b4a80/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/event-target.js:120:16)
at emitOne (events.js:116:13)
(node:3603) 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: 1)
(node:3603) [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.
ok
bot.mutes is undefined
basically what natan said, but i was just gonna have you figure it out yourself 
also I feel like that's css markdown
yeah it was
- he needs spoonfeeding
wrong paste
don't use css for js errors
ok
exactly
it's just more colored
but ya know
it literally doesn't matter
im not gonan argue
^
¯_(ツ)_/¯
Also, make a check in your code so if bot.mutes isnt defined, make it
instead of getting triggered over the color, it would've been better to suggest to use a paste service to not clutter the chat with long error messages
or in your index file (or whatever you call it) define it where it wont be ran more than once
like right after you define bot
@meager goblet I know it’s not returning it I haven’t gotten that far yet kek 😂
Oof wrong person my bad
@late hill ^
Is there a way I can change the background and buttons, etc on the bot page?
find the css class that's being used on the website and overwrite it
Mk but like how? I’m not used to internal css don’t even know how to do it for one
inspect element
yes, in your bot's description
<style></style>
Mk
Now I gotta find out how to find out what css class I want to change
iirc someone made a repo of all classes dbl uses so you can overwrite them
i'll go hunt for it
Oh thanks I’ll look for it as well
there's a few examples here https://github.com/advaith1/dbl-css/tree/master/dark
CSS for customizing bot pages on discordbots.org. Contribute to advaith1/dbl-css development by creating an account on GitHub.
Oh thanks!
hellow
byew
Lmfao
While trying to set up a eval command, all responses comes out as undefined What did I do wrong?
EDIT - I fixed it with a bit of fiddling with the code.
What you’re trying to eval is probably undefined
oh.
some statements return nothing so pretty much
hmm ok
or clean() returns undefined
Anyone use coc and the kotlin language server
hellohellohello
If you’re not here to ask for help or talk about development #memes-and-media @tight forum
Please and thank you
no im asking w8 pls
Then just get straight to the point....
I did a custom command for my server, I just added this code so I want it to run on my own server. but it is also working on other servers. how do I prevent it in another way?
if(!message.guild.id === '495725015418011658') return;
Yea.
like?
like what
Look at the image lol
Is it that hard to understand
yea it really is

It’s like a web socket or smth idk and it allows you to test the bot in the server
From the botpage
Oh
I saw a video
Let me find it
Click To Subscribe! ► http://bit.ly/SubMaverick ✯Community Forum✯ ► http://awesomecs.syntrwave.com Recently I was searching for a new replacement for my old ...
@lusty dew
But idk how to import it on the DBL page
you could make that easily with some webhooks

OkY thanks
Np
Seems pretty easy to use
So I need it to state wich permission it needs, It done that:
@cmd.has_permission(administrator=true)
@cmd.bot_has_permissions(Manage_messages=true)
(python)
I need it to have multiple permissions tho
not just manage_messages
how can I define multiple?
I need "Mange webhook" and "Manage channels" and "Manage messages and "Manage reactions" for it to fully function
ok I think i worked a solution.... just keep stacking it 😂, I mean its not the cleanest way but, whatever lol
okay i need some help
I've been trying for 30 minutes to get my font to change to a sans-serif but I can't for the life of me get it to work
here's my html
<!DOCTYPE html>
<html>
<head>
<title>iab command reference</title>
</head>
<body bgcolor="#93A5FF" style="font-family: 'Arial';">
<h1>iab Command Reference</h1>
<p>(as written by an html noob)</p>
</body>
</html>
that doesn't work, neither does importing stylesheets, or using <style> tags. The <head> tag isn't even populated in browser.
like please just let it be that I have a microscopic brain
The file I was editing wasn't where I thought it was
I was looking at and editing different files
Lol
Do you need help? @earnest phoenix
👀
I may not be the best at html but ya know
I’m not the worst either
const { Guild } = require('../library/seq_db.js')
const Discord = require('discord.js')
module.exports.load = (client) => {
client.on('messageUpdate', messageUpdate)
}
module.exports.unload = (client) => {
client.removeListener('messageUpdate', messageUpdate)
}
async function messageUpdate(oldMsg, newMsg){
if(oldMsg.author.bot) return;
const res = await Guild.findOne({where: {id: oldMsg.guild.id}})
let log_channel = res.get('messageUpdate')
const msgUpEmbed = new Discord.MessageEmbed()
.setAuthor(newMsg.author.tag, newMsg.author.displayAvatarURL())
.setDescription(`Message updated in: <#${oldMsg.channel.id}>`)
.addField('Old message: ', oldMsg.cleanContent)
.addField('New message: ', newMsg.cleanContent)
.addField('ID: ', `\`\`\`User ${oldMsg.author.id}\nMessage ${oldMsg.id}\`\`\``)
.addField('Date: ', new Date().toDateString())
.setColor('BLURPLE')
.setTimestamp()
.setFooter(client.user.tag, client.user.displayAvatarURL())
if(log_channel === null){
return;
}else {
client.channels.get(log_channel).send(msgUpEmbed)
}
}
I’m having trouble with my messageUpdate event
It’s not firing
But the other events do
I was going to say no but I actually do have a pretty annoying problem
How can I lower the amount of space between these lines without using the line-height css tag
I don't want to use line-height because it makes it unreadable on mobile
Iirc that’s a margin thing @earnest phoenix
Yeah you were right
Yea
Forgot lol
I get margin and padding mixed up
Also that example is kinda confusing to me @earnest phoenix
basically it gets the last 100 messages
and in those 100 messages
deletes all of iab's messages
but it doesn't just keep going until it deletes 100 of iab's messages
But it says it does not delete iabs messages
Am I missing something
perhaps
Np and if ya ever need help just ping me or dm I’ll try my best
Does anyone know the command to repeat a command
]]moreinfo @earnest phoenix
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
I mean make a say command and allow your bot to respond to itself
Then do prefixsay prefixsay
;)
Do not ever let your bot respond to itself
Hehe shhhh
I’m kidding though don’t do that
It’d be in a continuous non stop loop until you turn your bot off
Its a great idea @lusty dew
Don’t ping me....
ok...
Is there an easy way to translate all text outputted by my bot to a language chosen by the server owner/admin
I was originally trying to make my own class extended onto TextChannel and make my own send function that’d translate the text for me but pretty sure that’d only translate text inside the send function and not text in the embed it’s sending
You could do something like make a function which checks what language the server is set to, then pick from a collection of responses based on the lang.
good job
Ty
Hm
But I only wanna support certain languages like Russian, English, Spanish, French, German, etc
@lime bough "simple app" that's not a good job
Will my bot get declined if for online it shows !?!? Because my bots online
If your bots online it won’t be declined unless there is another reason.
@copper cradle Don’t be rude.
He/she accomplished something
I am rude
Yes but it doesent show my bot as online it shows it as not knowing
I'm always rude
Ok
Mine took 3-4 days to get accepted but it could take longer or it could take less time
const { Guild } = require('../library/seq_db.js')
const Discord = require('discord.js')
module.exports.load = (client) => {
client.on('messageUpdate', messageUpdate)
}
module.exports.unload = (client) => {
client.removeListener('messageUpdate', messageUpdate)
}
async function messageUpdate(oldMsg, newMsg){
if(oldMsg.author.bot) return;
const res = await Guild.findOne({where: {id: oldMsg.guild.id}})
let log_channel = res.get('messageUpdate')
const msgUpEmbed = new Discord.MessageEmbed()
.setAuthor(newMsg.author.tag, newMsg.author.displayAvatarURL())
.setDescription(`Message updated in: <#${oldMsg.channel.id}>`)
.addField('Old message: ', oldMsg.cleanContent)
.addField('New message: ', newMsg.cleanContent)
.addField('ID: ', `\`\`\`User ${oldMsg.author.id}\nMessage ${oldMsg.id}\`\`\``)
.addField('Date: ', new Date().toDateString())
.setColor('BLURPLE')
.setTimestamp()
.setFooter(client.user.tag, client.user.displayAvatarURL())
if(log_channel === null){
return;
}else {
client.channels.get(log_channel).send(msgUpEmbed)
}
}
My messageUpdate event isn’t firing.
I get no errors at all but all the other events fire with no problems
Discord.js
How would I remove all reactions from a message? I've tried multiple things, but can't seem to get it right.
Ping with response, please.
@floral bloom message.clearReactions on stable
Thanks.

Hello.
who knows discord.net here?
ask your question
i need know how to use a channel name instead of the channel id
await user.Guild.GetTextChannel(561572026486095902).SendMessageAsync($"User: {user.Mention} joined the official **{user.Guild.Name}** discord server!");
thats what i have right now.
Guild.TextChannels and use System.Linq's FirstOrDefault method
FirstOrDefault takes a lambda expression so you can pass in your condition there
What does this error mean (knowing that I do not know where and from which command it comes)
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:106:9)
at process._tickCallback (internal / process / next_tick.js: 68: 7)
(node: 14) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated from the inside of the outside world, but it was not handled by .catch (). (rejection id: 6)```
@earnest phoenix it means a http request to the discord api server failed
help
const role = member.guilds.find("618406843303067649").roles.find(ro => ro.name === 'Members');
can't get it to work
.find("618406843303067649")
Use .get
Also
If you already have the member
Why get the guild
Did you need to mention me for that tho? And also
.guilds isnt a property on user or member
i chave question to canvas: how can i load a image from url there?
i kinda need it and I d K how to
In the canvas module for node, you can use loadImage, then use drawImage
.addField("Roles:", message.guild.member(user).roles.map(s => s).filter(r => r.id !== message.guild.id).join(" • ") )
how can i say "None" if he has no role 🤔
|| "none"
but where i need to put it
i was faster ^^ but thanks
Thing is @amber fractal
the drawImage thing
isnt existant on my script for some reason
One message removed from a suspended account.
try to learn python?
Rust uwu
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Anyone got any experience with this? https://prnt.sc/p3t805
One message removed from a suspended account.
Could someone point me towards a tutorial that teaches me how to make a Welcome and goodbye command? For more then one server?
Please ping me when you can help me please
What language?
@sage bobcat it's not too hard once you get used to it, and it should be easier if you have any experience with other low level langs
you must chose a language and a library first, before you can find a tutorial, as tutorials are specifically made for a given language and library
yes, python is one of the most popular ones around
In Britain it's most popular so I think I'd be good with sticking to that
hello
i was looking on discord docs at clientStatus
i have no clue what to do
xD
neither do i (what you wanna do that is)
Properties
.clientStatus
The devices this presence is on
PARAMETER TYPE DESCRIPTION
web PresenceStatus
Documentation missing.
mobile PresenceStatus
Documentation missing.
desktop PresenceStatus
Documentation missing.
is there a way to set a bot to mobile status?
i seen a bot have this
i was just thinking of that
i dont see it listed in the discord gateway api, so i dont think its possible
where did you see that?
im using quick.db
idk how to get users from 11-20 on leaderboard
my code :
for (var i in resp) {
resp.length > 11 && resp.length < 20
i tried that didnt wok
resp.length = 20 resp.slice(11,21)
that didnt work
@topaz fjord
hello?
it shows 20
top 20
not 10 , 20
Yikus
Well. Theres no more error. But my bots (premium. Not normal bot) on, no status, and no commsnds are responding
@slow crypt it started when i added ur 8ball command
WDYM
Yea
But that in other section tho
But it started
It has nothing to do with that
When i added 8ball command
Uhhhhhhh
Nvm. Ignore everything i said about it not working. Only status wont work
I just reset bots data
F
say if i was NUMBER 1 on leaderboard how do i make myself not appear on leaderboard?
are you asking about a certain bot or your own bot
filter yourself out by id
they didnt, but it doesnt matter because when you pass extra arguments in js they are just ignored unless you use the arguments object. However there is no point in passing it so may as well remove it
me?
anyways what https://discordapp.com/channels/264445053596991498/272764566411149314/620709905430609940 said is your answer
Does anybody have any tips about deving a bot.
what?
dont reivent the wheel, and if you do, dont try to make it better than the wheel
@knotty steeple honestly thats shit advice for a beginner
no
d.js is perfect for newbies, at the cost of performance
is JDA a good thing to use?
eris isnt different from d.js smh
yes
@mossy vine were u talking to me when u said 'Yes'
yes
yes
k
also try to be a bit original with ur bot
wdym by 'Original' ?
original
come up with a unique idea of what your bot is going to be
so basically dont make another multipurpose bot
mine is to watch my RP server
so u want like a custom mod bot
ye
ye
wdym? @knotty steeple
how to I get emoji ID in discord js?
in code
cant really do that can u 
get emoji id from what?
oh
do you know how to get the
emoji
if you do you can just use <Emoji>.id
i dont do d.js so i dont even know how you would get the emoji
ok so how would i go by making command line arguments
i know how i can take arguments but how do i basically parse it
@knotty steeple do you just have the command as a string?
because the easiest way would be to make flags
-r -f etc
but
that's like
shit
cuz then you wanna -rf
yeeeeeee
well i wanted to do like
--welcome hello there
because it wouldnt be hard to do what you are referring to like --r
If I wasnt in a game I'd help more :(
smh
make a prefix for the arguments and split on it
"!command -argument -argument2 -argument3".split("-").slice(1).map(t => t.trim()) // ["argument","argument2","argument3"]```
@west raptor i switched to suckless since vim was being gay in urxvt
specifically xst
oh fuck
wrong channel
"prefixSomecommand --option value --option2 value 2"
.split("--").slice(1) will give you ["option value","option2 value 2"]
then you can .map(t => {t.split(" ")[0]:t.split(" ")[1]})
and you get [{option:value},{option2:value}]
or instead of split(" ")[1] you can .split(" ").slice(1).join(" ") to keep spaces as well if you need several arguments with spaces
im tired and icba to use code blocks and explain better rn
lul
i love how the context is a bot command but im using it for a node app

i get how it works
i run part of the code and i get [ '' ], [ 'rating', 'saef', '' ], [ 'wow' ] ]
the first part really shouldnt be there
const args = process.argv.slice(2).join(" ").split("--").map(t => t.split(" "))
console.log(args)```

y this
is happening
const { Guild } = require('../library/seq_db.js')
const Discord = require('discord.js')
module.exports.load = (client) => {
client.on('messageUpdate', messageUpdate)
}
module.exports.unload = (client) => {
client.removeListener('messageUpdate', messageUpdate)
}
async function messageUpdate(oldMsg, newMsg){
if(oldMsg.author.bot) return;
const res = await Guild.findOne({where: {id: oldMsg.guild.id}})
let log_channel = res.get('messageUpdate')
const msgUpEmbed = new Discord.MessageEmbed()
.setAuthor(newMsg.author.tag, newMsg.author.displayAvatarURL())
.setDescription(`Message updated in: <#${oldMsg.channel.id}>`)
.addField('Old message: ', oldMsg.cleanContent)
.addField('New message: ', newMsg.cleanContent)
.addField('ID: ', `\`\`\`User ${oldMsg.author.id}\nMessage ${oldMsg.id}\`\`\``)
.addField('Date: ', new Date().toDateString())
.setColor('BLURPLE')
.setTimestamp()
.setFooter(client.user.tag, client.user.displayAvatarURL())
if(log_channel === null){
return;
}else {
client.channels.get(log_channel).send(msgUpEmbed)
}
}
The only event not firing is this one
I get 0 errors and I don’t know why
Please enter at least 300 characters excluding special characters in your detailed description. Add your commands. Spaces or empty spaces are not counted.
?
someone help me?
just make a decent description saying the types of commands your bot has
there isnt really much to explain
it literally says what to do
OK
Yea...
Surprised that’s an option still
Isn’t discordia lua?
Actually discordia still offers support @knotty steeple
I will tell the truth I don't even know what my library is
oh its the lua lib

there is a js lib that has a similar name
Then how did you even make a bot
Either Eris or d.js
He’s using either Eris or d.js
thats d.js
doing more I'm kind of dumb in information
How do you know
events/message.js
It could be Eris
eris' message event is messageCreate
if you want modular events u kinda have to
I renamed my index.js to NarutoNoTopo
Also please don’t tell me you are using Json as a database
json.sqlite
I am Brazilian I always forget things just understand that works much more very well indeed
Yea but it’s still a bad practice imo
I remember when I lost 50k people’s info in a Json db
Kek
This is when I made my first bot 
As much as my source is all poorly made I know how to use it very well

wtf
?
@lusty dew this is why i gave up on storing user data
How did my bot invite this server?
we need a #502193464054644737 for how to read a #502193464054644737
rename development to read-faq then fixed
Discord.js
How would I add every message in a channel to a string? I know it probably needs fetchMessages but I can't seem to get the message content, author, or any other info.
~~Would this work?
let string = "";
message.channel.messages.forEach(function (msg) {
string += `${msg.author.id} - ${msg.content}`;
})
Ping with response, please.~~
Never mind, I got it.
anyone know if you can give somone a group in your discord based off a invite link?
@floral bloom Its ez xd
You mean depending on which invite they use?
I created a bot but it got declined cuz i was using botghost do i really need to code?
Coding is preferable
I just looked at the website
You just flip a button and then you get the code without doing nothing?
woah
@quartz kindle bro I am like you Number 1 fan can I have you signature?
lol wut
omg
Well i got bored doing codes and getting some technical issues with my bot
Thats coding for you
✓
that botghost thingy looks pretty amazing actually, its quite new as well
apparently its owned by some unknown dude on twitter with only 100 followers
lets see how it goes
Hello everyone!
I have a small problem for a few days.
My bot makes use of shards and I have a presence that is updated from time to time, with a new random activity. My problem is that two of these activities are: the total number of users and the total number of servers, and they are not updated with the change of presence, that is, after 3 days it continues to dial the same number of users and same servers (despite having a larger number).
I use discord.js and I hope you can help me with this.
Thanks in advance.
show your updating code
setTimeout(function(){
const promises = [
client.shard.fetchClientValues('guilds.size'),
client.shard.broadcastEval('this.guilds.reduce((prev, guild) => prev + guild.memberCount, 0)'),
];
Promise.all(promises)
.then(results => {
const totalGuilds = results[0].reduce((prev, guildCount) => prev + guildCount, 0);
const totalMembers = results[1].reduce((prev, memberCount) => prev + memberCount, 0);
setInterval(() => {
let actividad = [
"nada :(",
`${totalMembers.toLocaleString()}` + " users",
"Shards " + `${client.shard.id}/${client.shard.count}`,
`${totalGuilds.toLocaleString()}` + " servers"
],
index = Math.floor(Math.random() * (actividad.length - 1) + 1);
client.user.setActivity(actividad[index], { type: "STREAMING"})
}, 15000);
})
}, 20000);```
yes, you are caching the values
you get the values once and save them into promises then every time the interval runs, you reuse the saved value in promises
you have to fetch values and broadcast eval again on every interval
Okay, I'll try
i've noticed my bot once a day restartin mby up to 5 times about 4pm to 3am (can be any time inbetween) but no logs of what caused the restart in first place (e.g. crash and etc) is it safe to assume the issue isn't on my side?
it probably is on your side
@quartz kindle botghost?
ye look it up
well pm2 doesn't technically say the bot restarted, however I get messages sent in the logging channel when it has ran the on "ready" event
Some free hosts restarts the server daily
no i use my rasp pi to host my bot
oh
the ready event is run again when the bot disconnects and reconnects
maybe network issues?
@hollow prawn language?
or is your rpi disconnecting and reconnecting
the same tim is moderator for discord.js
Oh a bot maker
wut
It works, thank you very much! ^^
if its node.js, do you know how to handle promises properly?
well not moderator but profecient or w/e the role is xd
ig i'll have to see and get something to extend the wifi signal
because it can be not your internet but the code
you can enable discord.js's debugger to see if its really disconnecting
client.on("debug", m => console.log(m))
eh the code is on github u can check it if u want (can send link here if it ok)
alright i'll enable that too but not a console log, would send it to a channel for debugging
should be fine
btw the code should be relatively the same as the one i use, just some small changes here n there
also, you said you send all logging to your logging channel, so have you actually checked the logs in the rpi? because when crashes happen, errors will not be sent to discord
oh boi
this can crash anytime without logs lmao
your commands is async
so it means execute is a promise
i have, thing is for the most cases no logging has been done, i run 2 bots on my rpi, later on one has had econnreset
all promises should be resolved properly i think
if that command errors, that will crash with no stack trace
I always test commands before I upload them to the rpi files
yes its not awaited
yes but no code is bug free
hey man i like my spaghetti with some bugs in it 
i'd recommend making it all async so it would be fluent tbh
shouldn't I use async only when necessary tho
you can mix sync with async by using Promise.resolve()
yes just make sure your command handler execute is awaited
oh yeah I am
and thats the same of making all your commands an async function
so its your choice
except for some which are "fire and forget" promises as i've been told in d.js server
for fire and forget instead of await, just put .catch()
you dont fire and forget promisses without catching them
.catch(() => null) is what I do for those
I'm adding catch wherever possible
hmm why not ?
you can accidentally not know an error that causes you not knowing what to debug
oh so it'd be better to have it on necessary parts of the code
generally you would probably want .catch(console.log), if errors happen you can see them, but it wont stop the rest of your code
yes for example cmd.execute would be better awaited so try catch can deal with error
instead of .catch
well so far no crashes done because of the code itself and as i said I test everything by running the bot instance on my pc before I upload it to the rpi
and do as much as possible testing to deal with any issues that may occur
dont expect the public is same on private
not because it dont on private, it will dont on pu lic as well
not because it works on you, it will work on everyone
other people will try to break your bot
if they do i'll find out what's the issue from and solve it asap
my experience on developing, and my own view on it is always expect the unexpected
but they can't break my bot if I try to break it myself 
also I already mentioned one of your issues
your promises are so and so
handle it all
that p much stands for everything, yee i'll run over the promises again and try to handle em all
quick tip, async functions automatically returns a promise
they do ? that something I didn't knew
async function owo() { console.log('owo') };
console.log(owo())
that will return promise pending
owo
same on const stuff = async () => {}
ah ic alrighty thanks
that's weird tho, it send the message "hi" but also promise pending
because js is single thread
on that event loop, that promise is pending
then on next loop it will be resolved
or next next
or next x3
Mucho logic
ah i think i get it, well anyway thanks i'll be headin to the store atm then will check the promises
hi, have you any way to give rewards when user vote on the website ?
(i use discord.js)
you can mention me 🙂
I know some bots rewards are currency for their economy and they made some commands vote-locked
can i detect vote on discordbot.org ?
there is documentation on setting up webhook listener for JS
help should I be worried about this?
about what
actually this might be the issue why my bot was restarting
the console output u see above in the image
am i missing something? I don't see something wrong
well for example, before it wasn't doing that but nvm I got why it's happening its because what @quartz kindle told me to do
https://discordapp.com/channels/264445053596991498/272764566411149314/620946293614706709
so nvm
erm
i kinda forgot I added that part
and ended up panicking for nothing thinking I may be doing discord api abuse lol
@quartz kindle also the code returns undefined
which code?
thats the normal debug log, if anything goes wrong with the connection, it will show there
like disconnects/reconnects/etc
heartbeats are normal
if you're confident the issue is not network-related, you can disable the debugger
process.argv.slice(2).join(" ").split("--").map(t => {t.split(" ").filter(Boolean)})
E
is boolean defined?
i mean
if you're using that on node args
since they are already an array
why not just use them?
node args split on spaces, do you need arguments that contain spaces in them?
yes
so like ``node file.js --arg some value here --otherarg`
yes
split("--") still requires a slice, else the first item is an empty string
so .split("--").slice(1)
then inside the map you have to again slice the first item
.map(t => t.split(" ").slice(1))
that should give you ["some value here ",""]
since the second arg doesnt have any value
to remove the trailing space you can add .trim() to t before splitting
and to get the key, take the first item before you slice it
t.split(" ")[0]
@hollow prawn that has nothing to do with crashes as far as I can see
yee i got it, its the debugging so i'll let it run and see where the issue comes from
if its improper unhandled.promise 100% chances you wont see anything on that
your choice tho
well it seems good so far tbh none of the issues/crashes were caused by running a command or a event
🎉 thx discord 🎉
@peak quail 🎉
xd
How do you even get that kinda thing
unicode border chars
Any ideea how I can create backups of discord server in a mysql db?
or just pipe the output from the shell to a code block
Backups of a discord server
God damn

backup a whole discord
you could save the permissions for each channel and the channel structure, etc, into an obj, that you could save in a db
Was there recently any changes to discord.js that changed guild icon class? Just wondering since I had it in a embed but now it gives incalid url format error, worked fine before
it shouldnt have
Ok
usuario.splice(usuario.indexOf(posicion), 1);
} ```
Why it doesn't work?
Im spanish so the variables are in spanish
Pass the variable to the function and return result of usurio.splice.
Ok ty its working now
Alright.
Which is the difference of parseFloat and parseInt? i always forgot it xD
I guess mainly that parseInt does integers meaning that it'll ignore decimals
2.9 for example would just become 2
Ty @late hill
const m = await channel.messages.find({ around: message, limit: 1 }).then(res => res.first());
(where channel is a textchannel and message is a snowflake)
this causes d.js to return TypeError: fn is not a function (because commando) but not leave behind a stack
and i don't understand why
If you comment that out does it work?
Because that doesnt describe the error you gave us, unless it's something internally in d.js
Which is a possibility
well it's a
necessity for the command to work
this is why i use eris because you don't get vague errors like this and you always get stacks
Yeah, but that might not bethe cause of the error
A stack trace isnt something given out by d.js
it's js
Oh
Well that makes more sense
makes d.js a bit more bearable
ok ive just
changed it
await channel.messages.find(message) makes it shorter code
and does exactly what i want
it is most certainly that line that causes the error
figured it out
i was using find instead of fetch
and because commando eats stacktraces for breakfast i had to manually log it
to realise it was using map and not messagestore
eats stacktraces for breakfast
lol
Commando uses d.js stable ye

Was looking through commando code trying to find the error
Does anyone know of a way to make it so that caps don't matter. Basically I have a prefix that's "yo " but if someone does "Yo " it won't work any way to just remove the whole caps issue? Discord.js
tolowercase or touppercase the original string
In case of commando, it handles it itself
let Text = (`
Command Run:
User: ${msg.author.tag} (${msg.author.id})
Server: ${msg.guild.name} (${msg.guild.id})
Channel: ${msg.channel.name} (${msg.channel.id})
Command: ${msg}`)
fs.appendFile("../../Logs/Commands/Command.txt", Text,function(err){
if(err) throw err;
});
Error: ENOENT: no such file or directory, open 'C:\Users\Administrator\Logs\Commands\Command.txt'

well is it in the administrator/logs folder
because from what i'm seeing it isn't
unless your files are in the administrator folder
i have my own shitty command handler
Does anyone know how I can send console to a channel ID? I'm running discordjs on node.
Is it possible to use chart.js with a discord bot?
@wooden lance I just wrote my own logger that does some stuff like that.
1 Determines log level (Error, warning, info, etc)
2 Sends it to graylog
3 Sends it to discord log channels based on level
4 Prints to console based on level
Then just make one for each class and use it for all of your logging needs. Works pretty well
Oh, okay! Thanks!
@scarlet phoenix came up with a good idea, using webhooks now. Here's the code if you want to use it.
const util = require('util');
const consoleHook = new Discord.WebhookClient("<webhook-id>", "<webhook-secret>");
console.log = function(d) {
consoleHook.send(`${util.format(d)}`);
};
Hello, I'm trying to register a bot on the bot list, but I'm encountering the following error:
Unable to fetch application. Make sure you've provided the correct Client ID and that the application has a bot account.
What should I do?
Double check that your clientId Is your bots id
so how would i go by turning an array into an object
i tried searching for solutions but its not really want i want
Completely depends on language, and what you even mean by that. A lot of languages treat arrays similarly to objects already
[["thing", "thingie"], ["think", "thonk", "omegathonk"]]
into
{
"thing": "thingie",
"think": "thonk omegathonk"
}```
js btw
Ok
So you want an array of arrays -> Json?
Hi guys, I'm having some weird indentation issue.
from .roleplay import Actions
File "/home/olly/bot/cogs/roleplay.py", line 171
return error
^
IndentationError: unindent does not match any outer indentation level```
Double checked my client ID, both from the Discord dev panel and by right clicking the bot > copy ID, still not working
@heady salmon dont use [tab] fill it In with spaces
I hate it, but python is a jerk about indents
@knotty steeple you can use a for loop, or you can use reduce
There may be some other ways but that's what I know
This took too long to type, is this what you want?
With a loop, you just make an empty object, loop the array and set obj[arr[i][0]] = arr[i][1] where i is your index
@west spoke I just used a check for NSFW channels in the end
That above example uses reduce
I literally facepalmed when I found it in the discord.py docs
Make the call yourself 
install discord.js alongside and make a complex api to check nsfw channels for you

or move to rewrite
@knotty steeple did you need any other help or did you get it?
im looking at how array.reduce works
Ah
so just doing this works ```js
let a = [["walk", "it"], ["like", "i"], ["talk", "it"]]
let obj = {}
for(let i = 0; i < a.length; i++) {
obj[a[i][0]] = a[i][1]
}
console.log(obj)
Yes
Which was the other thing I meant with loops
im doing this for a very specific reason
ok so i applied this to my cli
works perfectly
😩 👌
👌
Ok. Basically everythinf is good just bot desnt respond so im guessing its not good
This is just a test command bye
Btw*
Ping me on responses
what does that mean
So im trying to do the tolowercase how would it work in this
@earnest phoenix what?
hold on
so basicly
i have a message.startswith
if (!message.startsWith.toLowerCase(prefix, prefix2)) return;
and Were do I put the toLowerCase
its not wrking
Uh
message is an object unless you redefined it
message.content is a string
Or null
So is your message a <Message>.content?
It's a function
ik
Dont forget the ()
wdym
toLowerCase()
can you edit this line
if (!message.content.toLowerCase.startsWith(prefix)) return;
like were it is
👌
dlpercent(gotten, r.headers._headers["content-length"])
^
TypeError: Cannot read property 'content-length' of undefined
i dont get why this is happening because it was working mostly
async function download(url, path) {
const res = await fetch(url);
let r = await fetch(url, {
method: "HEAD"
})
const fileStream = fs.createWriteStream(path);
await new Promise((resolve, reject) => {
let gotten = 0
res.body.pipe(fileStream);
res.body.on("error", (err) => {
reject(err);
});
res.body.on("data", (chunk) => {
gotten += chunk.length
dlpercent(gotten, r.headers._headers["content-length"])
})
fileStream.on("finish", function() {
resolve();
});
});
}
function dlpercent(gotten, size) {
const progress = (gotten * 100) / size;
console.log(progress);
}
this is a function that is supposed to download a file from the url to a path
or did e6 api change
the function to download itself works but r.headers._headers
is just undefined
for some reason
am i dum
is headers an object
yes
Maybe try r.headers['content-length']
undefined
if i log r.headers i get
Headers {
[Symbol(map)]:
[Object: null prototype] {
server: [ 'nginx' ],
date: [ 'Wed, 11 Sep 2019 01:32:09 GMT' ],
'content-type': [ 'image/jpeg' ],
'content-length': [ '469553' ],
'last-modified': [ 'Mon, 09 Sep 2019 16:45:43 GMT' ],
connection: [ 'close' ],
etag: [ '"5d7681b7-72a31"' ],
expires: [ 'Sat, 12 Oct 2019 01:32:09 GMT' ],
'cache-control': [ 'max-age=2678400' ],
'accept-ranges': [ 'bytes' ] } }
@vital lark
bruh
yes


