#development
1 messages · Page 1776 of 1
and also you can't send empty content
It isn't empty?? if I send !say hello
That in itself would lead to an api error
bot will send hello
It doesn't...
At least I don't think it does
It should
message.send isn't a thing
and even if it was sending nothing will cause an api error as well
v12 Discord.js
yea
mk
message.send isn't a thing
but why does it work then?
@earnest phoenix Tim's error catching - or idk how to call it - code includes message.send too
I don't know the entire context
^^
message may not even be what I think
if(command === "say") {
// makes the bot say something and delete the message. As an example, it's open to anyone to use.
// To get the "message" itself we join the `args` back into a string with spaces:
const sayMessage = args.join(" ");
// Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
message.delete().catch(O_o=>{});
// And we get the bot to say the thing:
message.send().catch(console.log)
message.channel.send(sayMessage);
}
yea that shouldn't be working
It starts with this client.on("message", async message => {
message.send doesn't exist
do you have a try catch somewhere ?
uh what?
try/catch block
if not then that should crash the bot
@quartz kindle
are you sure you saved it?
you'd wanna catch the message.channel.send(saymessage)
Not yet
lol
I haven't saved the error catching thingy yet
message.send() will crash your bot
because it doesnt exist
its message.channel.send()
which is what I have been saying cough cough
uhm that already was there since the beginning and it works
!say works for me
Idk why it takes coming from tim to convince them smh
i doubt it
I can show you (screenshot or link in DM)?
I highly doubt that ever worked
It works!!!
Again I doubt
Wait can I send invite link in DM?
message.send legit doesn't work my man
to show you
you have to access the channel first
But why does it work then 
Is there anyone who can help with an issue?
My mate Tim can help with everything
lolz
I call everyone a man until proven otherwise
türkmüsün ismail
WHY DOES EVERYONE THINK I AM TURKISH
How can I make fetch all channels command
Your name is Turkish
UGH GO AWAY TO GENERAL 2
NO IT ISN'T
you wanna get all the channels in a guild? @lavish bramble
Thanks
, when you add my bot to a server, it gives this error, but it seems there is nothing wrong, it still continues to work, there is no problem, but what is the reason for giving this error?
No idea
whatever is before id is null
Can I send an invite to my server in DM?
line 215 of main.js please
Yup and all guild members in which my bot was in
What?
let reklamkoruma = await db.fetch(reklamk_${message.guild.id});
why?
message.guild is undefined
How are you using this @brazen helm
in a message event?
check guild
showing a command working doesnt help, showing code is more helpful
uh okay but I did already... wait Ima send my whole code
(without token duh)
how to fix this error
Are you using that line of code in a message event
cause message.guild is undefined
No Security Command Blocks Ads
just send the code here..
It's big as hell
What?

did you restart your bot and run that code?
Wait I'll do it rn
@quartz kindle Yup it's running
(node:26) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
at async MessageManager.delete (/home/container/node_modules/discord.js/src/managers/MessageManager.js:126:5)
at async Client.<anonymous> (/home/container/index.js:134:36)
(node:26) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26) [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.
container@pterodactyl~ Server marked as stopping...
container@pterodactyl~ Server marked as offline...
``` oops?
you're fetching an inexistent message
either the id is wrong or the message was deleted
Well
which command caused that?
"told ya"
Idk how do I know?
What command did yo uuse

and after a moment
you didnt test the say command?
nope
werent you supposed to test it?
that error appeared
Yeah... but the error appeared already so I just sent it
Did anyone send a message after it started could be something in the message event
that error appeared because you're supposed to catch all promises
Oh yeah maybe my bot's in 124 servers
or it could be what kuuhaku said
@quartz kindle is there a point awaiting a promise like channel.send().catch(() => null);
The bot's running again btw
It's basically void isn't it
yea
I only imagine the chaos that'll ensue when JS codes start to crash because of uncatched promises futurely
imagine the feel...
OOPS the say command doesn't work anymore
It deleted my message
and then doesn't do anything anymore
I wonder why
(node:25) UnhandledPromiseRejectionWarning: TypeError: message.send is not a function
at Client.<anonymous> (/home/container/index.js:60:13)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:834:20)
(node:25) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25) [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.
lmao
cough cough
message.send
lol
message.channel.send
thx
You don't gotta ping me in every message
sorry
But then I have to disable ping every time
:/
or just not reply
brb
and talk like a normal person
but there could be multiple persons talking here about different things
catch ur promises
Doesn't mean you have to spam reply when no one else is talking but us two
It gets annoying I now know how @sage bobcat feels

how
who's that
(I didn't ping this time)
you just use .catch on things that return promises.
.catch(err => /* do something with err */)
example?
What are things that return promises?
The docs can tell you that
but message.channel.send returns a promise
also why hate the docs?
"If you tell me, I will listen. If you show me, I will see. If you let me experience, I will learn~"
they're the only trustworthy reference you have
So I just code and try to fix bugs
that's a bad thing
and that's how I learn to code
Why?
@earnest phoenix Here, I tried to send an empty message:
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
method: 'post',
path: '/channels/682248069294587911/messages',
code: 50006,
httpStatus: 400
}
(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:39:14)
(node:25) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25) [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.
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
method: 'post',
path: '/channels/682248069294587911/messages',
code: 50006,
httpStatus: 400
}
because message.send is not a function
you can't send an empty message
because you'll be going through trial and error
and put error in that
something that could be acomplished in 1 hour will take 1 day
And that's how I will learn? Without errors, I will not know how to avoid/fix the errors?
Well
But how to fix that?
lol
no necessarily, like, programming is not about writing bugless code
lmao
it's about making up the logic to go from A to B
facts
that's what schools lack when teaching CS
Lol
they teach how to write code
This is why im self taught
It may of taken 4 years to get to a decent skill level
lol
but I made it :p
same
Can't I handle that promise? r smth
well i probably have more experience since im older, thats all
ikr
you jsut don't send an empty message
although i havent been coding for that long either
that is the best way to handle it
You cannot send by sending a blank message
Tim is only in his 20s (I refuse to believe he is 30 we must preserve tim)
I learnt the basics in my cs classes, then gone deep in Core Java book
Can't I handle that promise
i am 30 lmao
I refuse to believe it
born in 91
what
We must preserve tim at all costs
mudae is down?
ismailZ
that's old as hell - no offense but I'm just way younger
The error says "Unhandled promise" r smth
One message removed from a suspended account.
One message removed from a suspended account.
"(node:25) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message"
One message removed from a suspended account.
LMAO that's not what I meant
Just dont send
Take care of the codes you have written, you are sending an empty message, look carefully at your codes, my friend.
Okay
or use for empty messages
I killed my bot cus I'm angwy
\u200B
why are you trying to send an empty message lol
I don't know why it took me saying it 10 times for them to understand it
But why does that error say "Unhandled promise"???
One message removed from a suspended account.
Don't worry about that
iirc scandir goes from the root not current file's position
One message removed from a suspended account.
just worry about the actual error message
mk
lmao
I didn't call you a boomer btw
I didn't smh
you need to understand what promises are
because it was indeed an unhandled promise
you didn't handle what it threw
and how to handle it?
isn't there a tag on a bot here about promises or was that a different server
catch
and it threw a "no content message" error
.catch
it'll still error if you don't fix it tho
await getApp().commands.post({
data: {
name: "ping",
description: "sends pong",
},
});
can I just leave this code after I have posted in once which makes people able to see the slash-command?
or do I need to remove it?
THAT'S WHAT I AM ASKING FOR @earnest phoenix
BUT WONT FIX
@lyric mountainso what i need to do?
You can catch it but it won't fix it
you still need to fix the error
One message removed from a suspended account.
by not sending empty content
and the fix is not to send empty messages ikr
One message removed from a suspended account.
and wont make your bot crash
yes
the error size will reduce, but the error will still be there
consider you're coming from root
That's better I think? a smaller error?
no
Lol
an error is an error
why not just use path.join
hm
are you using an empty message to practice error caching?
you can, however send something like An error has ocurred when executing this command to the channel or something
@lyric mountainsolved thx
for future reference, afaik only require() considers the path from the current file
I am getting mad at detritus
all other stuff come from root
Death by getting tortured
&
Death by old age
are just the same huh?
@lyric mountainok
What
technically yes, but those are different stuff
I have a question about the slash commands. If I post the command once so it is visible to everyone, should I just leave that post code there so it will be run everytime the bot restarts, or should I remove the code since the command is already available to be viewed?
gimme a sec, I'll show u what we mean
remove what?
sending an empty message
why are you trying to send an empty message?
just dont do it?
It was an accident tbh
I wanted to test the !say command
excuse me, i want to make a partnership bot, i've to get from a partnership a specific text (server link), and repleace in my message, how can i do?
Hm?
And how do I do that?
with an if statement
if(!saymessage) return message.channel.send("message is empty")
I am learning it
Discord.js
javascript

It would help to learn the basics first
jabbascript
lmao
What basics?
I know you I think
Javascript basics duh
where
On the internet
No @earnest phoenix
ey yo can some one help me
and please stop pinging me so much
Yes I know you from somewhere
Cause i used to ask these kind of questions before like a year back👀
@wide wharf
I swear I know you from somewhere
uncatched VS catched
anyone? 🙂
what app is that?
the ONLY difference is that I did something with the error
nothing more, the error still ocurred
google chrome
Like this?
Inspect element?
yes
well, not inspect element per se, but console
inpect element is in the elements tab
Bcz my bot is in more 40 guild and have 10 users so I used fetchAllMembers: true in client but debug says unable to fetch users before ready
why are you still sending an empty message?
What?
said that because you're fetching before bot logging in
yea you did, message.channel.send()
you can't send empty messages, so remove it
sayMessage isn't empty?
also, you're not supposed to use fetchAllMembers too frequently
it's a costly operation
@wide wharf
hm
it's empty
remove it
oh
See js const client = new discord.Client({ disableMentions: 'everyone', fetchAllMembers: true });
you arleady did it
yes
you need to catch both sends
or just delete one send ✌️
yes
lul
welp, I can't help with that but you 100% don't need to fetch guild channels
but at the catch to (after message.channel.send) ...().catch(err => console.log(err));
maybe tim knows the answer
like this
Ok
?
use `` please
.catch(console.log) is the same as .catch(e => console.log(e))
for catch any type error
yes it is
Like this?
ok, it's good
now can someone help me?
And doesn't .send("message is empty") need a catch thing? @quartz kindle
god I love seeing O_o=>{}, dead giveaway for code people copy pasted from that one youtube video
that's like 4 years old
yea lol
?
you already catched
Oh okay
you still need to fix the issue tho
What issue?
oh
But the solution is (@earnest phoenix said) just not to send empty messages
exactly
So it's fixed?
Cus why not
Stop pinging me
ye, since you're checking if it's blank or not
HOWEVER
you need to return if it's blank
else it'll still execute the bottom part
oh you're returning
nvm then
Aren't they doing that tho?
And how

ye, you're fine
oh okay then
I forget in d.js you can return the actual sending action promise
can now some body help me?
You can basically return anything, because the entire even listener is just a function
example?
also, I hope you're not planning to send stuff in dms
partnership test, join us <discord server link like https ://discord.gg/ >
ok but
what exactly you plan to do
like, concat the url in the message?
also please, assert to me you're NOT GOING TO MAKE A DM ADS BOT
no, in a chat
it's not that kind of bots
send partnership test, join us <invite>?
so yeah, concat the url in the message
concat?
you could do ```js
partnership test, join us ${invite}
since it's an end on line concatting
I explained wrongly I'm sorry, I explain again
yes it does
when a member sends a link of a partnership in a channel the bot has to fetching only the link, as I do
Just check if the necessary perms required are there before sending anything 
so you want to extract the url from a message?
yes
discord timeouts happen
could use regex
I did not know how to explain sorry
maybe?
ye, will have to be regex
i never used it, how does it work?
but can be dead simple since discord uses a fixed format
/https:\/\/discord.gg\/\w+/g
I guess
ok thanks
forgot a + there
Okay like this?
if(!sayMessage) return message.channel.send("Message is empty!").catch(err => console.log(err));
yes
Hi Tim 
hi
This another script of me btw:
/home/container/1index.js:1236
client.channels.get('698983333782093925').send('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: @' + message.member.user.tag + ' \nMessage: ' + message.content)});
^
TypeError: client.channels.get is not a function
at Client.<anonymous> (/home/container/1index.js:1236:18)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:834:20)
Error
when starting up bot
client.channels.cache.get
thx
with v12 everything words under a cache now
when accessing channels, members, guilds, etc
words?
works*
oh
typo from typing fast
np
/home/container/1index.js:1236
client.channels.cache.get('698983333782093925').send('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ \nServer: ' + message.guild.name + ' \nChannel: ' + message.channel.name + ' \nUser: @' + message.member.user.tag + ' \nMessage: ' + message.content)});
^
TypeError: Cannot read property 'send' of undefined
at Client.<anonymous> (/home/container/1index.js:1236:49)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:834:20)
Oof
channel was not found in the cache
Oh
either that or wrong id
ez fix
UGH another error
(node:25) UnhandledPromiseRejectionWarning: TypeError: Discord.RichEmbed is not a constructor
at notActive (/home/container/1index.js:784:34)
at Client.<anonymous> (/home/container/1index.js:782:14)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
(node:25) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25) [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.
oops yes it's an old script
Just one version behind
2 years behind
djs quite slow moving
v12 is rn
v11 is old
yes but thats 2 years
v13 "supposedly" come out this mid-end June. But no guarantee
And I have to rewrite it all over again?
ugh then I'll have to edit my whole code AGAIN
just follow the update guide and change whatever needs to be changed
wait can't I just do v11 in package.json?
and use v11 discord.js
v11 doesnt work anymore
oh
it doesnt support the new discord api requirements
The whole code needs to be changed ig
a part of it maybe
not the entire thing
the bulk of it will likely remain the same
theres already an update guide if you wanna check it out
This the changes from V11 to V12
thx
heres from V12 to V13
Oof
Just changed all "RichEmbed"s to "messageEmbed"
role = client.guilds[ctx.message.guild_id]["roles"].get(role_data["role"]) or \
await shortcuts.edit_role(
handler=handler,
role_id=role_data["role"],
parameters={
"name": name
}
)
what the fuck did I think when I wrote this XDDDDDDDDDDDDDDD
Is it "messageEmbed" or "MessageEmbed"??
the later
^^
the latter
(node:25) UnhandledPromiseRejectionWarning: TypeError: Discord.messageEmbed is not a constructor
at notActive (/home/container/1index.js:784:34)
at Client.<anonymous> (/home/container/1index.js:782:14)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
(node:25) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25) [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.
rip
MessageEmbed
you need learn discord.js
Uh error?
@quartz kindle The biggest part of my code that was in v11 was just "RichEmbed" so I changed it to MessageEmbed and now most commands work
oh ho ho no no
?
no? v11 > v12

yeah ikr
there were MANY versions between those two
also...
v11 . 0 . 0
| | --- WON'T break anything in your code
| --- MIGHT break something in your code
--- WILL break everything in your code
o
everything?
It didn't break everything for me...

only "RichEmbed" > "MessageEmbed" was wrong

there's a reason node refuses to do major updates unless you explicitly tells it to
major = red zone
minor = yellow zone
build = green zone
there was a lot more then just richembed to message embed in v12
there was the introduction of caches so no longer guilds.size it was guilds.cache.size
v12 was basically the "Use Cache™️" update
Yea
oh also the gateway intents
(node:26) UnhandledPromiseRejectionWarning: TypeError: message.guild.roles.find is not a function
at Client.<anonymous> (/home/container/1index.js:530:44)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (/home/container/node_modules/ws/lib/websocket.js:834:20)
(node:26) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26) [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.
find doesn't exist on roles
you gotta go through the cache iirc
since it returns the collection
or whatever
message.guild.roles.cache.find?
Hey i am trying to do a bad word filter, and i want to do the bot say what word is considered bad. I have the badwords in a json file, what should i do?
Good luck
i need discord.py voice but its already installed yet none of my music commands work anyone know how to fix this?
A curse filter is easily bypassable
don't bother
it is hard to make one that will be decent
the only error is RuntimeError: PyNaCl library needed in order to use voice
not hard, impossible
impossible?
Anyone can just bypass your words
and if you succeed you'll have something like genshin's filter
and it renders the filter useless
everyting is a swear if you try hard enough
does anyone have a fix for the error RuntimeError: PyNaCl library needed in order to use voice
i already installed it yet it gives me this error
yes but i want to do something like
Bot: Choose your name
Me: Stick Cock
Bot: Word cock is considered a bad word
like
idk how to explain
Then ig
check if the message sent contains a bad word
but it will be rather pointless
Cause they can bypass it
yes but i want the bot to say the bad word
message.guild.roles.cache.find()
i said learn discord.js dude
Then have it say the word it detected
🤔
yeah but...like...I can say "b*tch" in 255 different langs
how i can do that detection
@lyric mountain but i am doing a simple thing
not to mention the leetspeak
like, you want to detect "cock" ok
yes
cock
c0ck
c()ck
cºck
c@ck
c°ck
c*ck
côck
cõck
cóck
còck
cöck
no
so it's pointless
I already said how
i dont give a f*ck if they use c()ck
what we're saying is that it's literally pointless to make a word filter that'll only detect one variant
people WILL bypass it
you're making a gate without walls
if (command === "dm" && botConfigs.plugins[13].activated == true) {
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if (!rUser) return message.channel.send("Provide a valid Ping or user id");
let reason = args.join(" ").slice(22);
if (!reason) return message.channel.send("Provide a message!")
let dmEmbed = new Discord.MessageEmbed()
.setDescription("DM Message")
.setColor("#15f153")
.setDescription(reason)
.setFooter("This message was sent by: " + `${message.author.username} ` + " 🕒" + `${timestamp('hh:mm:ss')}`, `${message.author.displayAvatarURL}`)
let channel = client.users.get(rUser.id)
if (!channel) {
message.channel.send("Can't find a user.")
return;
} else {
await channel.send(dmEmbed).catch(O_o => console.log({O_o}));
}
}
``` Why doesn't this work?
this is your spellchecker
🇨 🇴 🇨 🇰
Try filter that
Me telling you how
No

anyone?
do you have prefix?
LMFAO
unless you're stripping the prefix out of that, it'll not pass
also please use line breaks
would anyone know if i need to uninstall discord.py and then install discord.py voice in order to get it or can i just use both?
Uhm the prefix is on top of my script
discord.py voice is probably a discord.py plugin
so yeah, you need to have both
im trying to use it but i get an error
saying i dont have it
yet requirement is already satisfied
this will work? @lyric mountain @earnest phoenix
every command works but i get the error RuntimeError: PyNaCl library needed in order to use voice
no, definitely no
😦
probably, but that's still a placebo solution
True
it'd be the other way around btw
cause i want to filter that word and bot say it
make an array of regexes instead
because one space is enough to bypass the filter
you still need to detect it
that's where the issue lies
for a human it's dead simple to detect curse words
but for a bot you need to tell it what are bad words
i think this should work
let badwords = [
/f\s*?[*uc]+\s*?[*uc]*\s*?[k]/i
];
let match = badwords.find(word => word.test(message.content));
match && return message.reply(`Message contains bad word: ${match}`);
note the \s*? if there's a space it will still detect it
if there's any other character there it will fail tho
@stuck dawn the above code should detect the following words:
fuck (bruh)
f*ck
f**k
fu*k
f*ck
f*k
fuk
fck
after effects of reading the entire javascript.info regexp tutorial thrice
you need to add more regexps to the array if you want to detect more words
it wont work on strings tho
𝓯𝓾𝓬𝓴
Fak
there's no faxing way to detect badwords with non qwerty characters
which is why we have human mods
'𝓯𝓾𝓬𝓴'.split('').map(e => replacementObject[e.toLowerCase()] ?? e)```
55k smh
im never gonna get to that
what's replacementObject
{
'𝓯': 'f'
}```
i made the test even better
/f+\s*?[*uca]+\s*?[*uca]*\s*?[kc]/i will match all of this:
["fuck",
"f*ck",
"f*ak",
"f*ac",
"faak",
"f**k",
"fu*k",
"f*ck",
"f*k",
"f*c",
"fuk",
"fck",
"fak"]```
you're wasting your time :c
ikr
I get this error when i try to run npm install and this has never happened before. Could someone help please? This is the error https://starb.in/4KUQxZ.coffeescript
solution: npm uninstall windows --force
?
that error only happens on windows
sqlite3 has extra steps to get installed on windows
@cinder patio how's detritus treating u so far
Haven't used it lol

thank god i dont code bots anymore
i c
erwin wanna see a regexp
try to figure out what this does: /f+\s*?[*uca]+\s*?[*uca]*\s*?[kc]/i
they can just scroll up
So is there a fix for this?
anyways... writing a type system is very difficult
Or how can i fix it
Still the same error
it takes a while to download...
Yup
discord-bugbot?
Pretty sure you have to install it globally and as an admin
yeah you do
How that?
Open powershell as an admin, add the --g flag to the command
remove the extra dash
The term '-g' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
@cinder patio
@novel jetty you have to put -g before the windows-build-tools and after the npm install
you put it the start bro
Like this? npm i -g production windows-build-tools
everything is correct except you removed the double dash from production
npm i -g --production windows-build-tools
Like this
This is still giving error
@earnest phoenix
@sick agateHey! Could you help me?
Lets refrain from pinging random people
just install windows-build-tools as is
I don't think the production flag is needed
hey uh is this fine
maybe its just me, but i wouldnt add a bot that requested every perm like that.
yea ik
but its becoming a pain having to make a new link
to add a new perm
every time i add a new feature
you very likely decreasing the number of users who will use your bot.
its fine, but it will hurt you more than help.
then what perms are required
you should know, you are the dev for your bot.
I wouldnt know what perms your bot needs, because i didnt make it 👀
then make it 5head
Hello!
wrong channel probably
Nope. 😂
oh

!eval message.guild.fetchAuditLogs({ type: 22 }).then(audit => audit.entries.first().reason);
I'm trying to fetch for the reason when a guy gets banned for my guildBanAdd event, did I do it correct?
he probably sent that message on his server for his bot to execute
is js eval different from python eval
hmm
you cant run code from a message without eval
They're the same concept
huh
Nw dude, I'm just asking for help if I did it correctly or not.
Any sort of code evaluation should have the appropriate security measures in place
whts the difference bw these two events?
"voiceServerUpdate"
"voiceStateUpdate"
Some people told me to check if the reason i am getting is from the correct user, so what can I do?
maybe the latter is the generic version of the former
Any help on this when someone is available?
e.g. after you change the guild region
voice state update is different, it's for members that left/joined/moved between VCs
guys small prob ive forgot what u have to install for discord embeds
hmm?
nothing, u just require, MessageEmbed
Ok I code alot in replit but for some reason client.login(With my token in here) doesn't work Any ideas?
please you say you use .env
hm?
Can someone help
this is not something you should use json with.
there are cases which storing data with json isnt super bad, but this is very bad.
you should use a proper database, such as something sql based, or mongo.
id prefer mongo over quick.db, but either would be better.
Ye i still gotta learn a bit with mongo so ill try with quick but everybody tells me to use something different
Im getting sick of it
well, any proper database will do. just not json.
use something different other than json
everyone uses what they know, so they recommend what they know.
And ye i found out when i tested it jt sucked
who know canvas?!?
what do you need help with?
spacé
whatt
node proably not liking Ü
client.on('clickButton', async (button) => {
await button.clicker.fetch();
console.log(button.clicker.member.id)
const yellow = button.guild.roles.cache.get('842790304607109120')
if (button.id === 'yellow') {
if(button.clicker.member.roles.cache.has(yellow)) {
button.clicker.member.roles.remove(yellow)
let e = new Discord.MessageEmbed()
e.setTitle('Role Removed'); e.setDescription(`Successfully removed the ${yellow} role from you.`); e.setColor('GREEN');
button.reply.send({embed: e, ephemeral: true})
}
else {
button.clicker.member.roles.add(yellow)
let e = new Discord.MessageEmbed()
e.setTitle('Role Added'); e.setDescription(`Successfully added the ${yellow} role to you.`); e.setColor('GREEN');
button.reply.send({embed: e, ephemeral: true})
}
}
});```
this does not work. anyone know why?
instead of: adding/removing it just adds
when i restart
remove/remove
restart again
add/add
it should add/remove/add/remove on each click. so one click = remove if have role, add if not another click = remove if have role add if not
API Latency is ${Math.round(client.ping)}ms
``` Why doesn't this work?
client.ws.ping
o thx
Can I just add this to every command?
.catch(err => console.log(err));
you can add it to anything that has a Promise.
Okay thx
you use it to catch an error.
I really need to search up what promises are lmao
Create a function which handels your error in case you wanna change the behavior in the future
(without the need to edit all)
catch((error) => myErrorHandler(error));
?
What's not to understand there?
Create a function to log your error instead of directly adding console.log anywhere.
If you're going to change the behavior in the future you just have to edit the function.
So I'm adding another way to use my bot though more prefixes, however, it stops at the command return function.
Here is what I'm trying to do:
I'm adding more ways to get the bot to interact with its users, however, when I run the mention, along with the command name/alias it stops at my if (!command) return, and I am unsure as to why it does this. I was wondering if anybody could provide insight to the issue.
I'm supposed to get 4 and a response, I only get 3 and nothing else
You're already slicing of your prefix in args
Then shifting the first item of args again, which is not your prefix anymore
log cmd and you will see your issue
And additionally args
Okay.
Buenas tengo una duda tengo este comando para crear un guild pero quisiera que cree 2 rangos al crear el guild ejemplo bot oficial y Ceo/Director y que se de el rol de bot oficial esto es lo que tengo por ahora ```js
const Guild = await client.guilds.create("RafaMaster Proyect", {
channels: [
{"name": "general"},
]
});
const GuildChannel = Guild.channels.cache.find(channel => channel.name == "general");
const Invite = await GuildChannel.createInvite({maxAge: 0, unique: true, reason: "Testing."});
message.channel.send(He Creado El Guild Aqui El Code De Invitacion: ${Invite.url});
you can omit the err part
just do .catch(console.log)
oh okay
@woeful pike , you might know about this, since you might've used it for the filter function for dbl
but do you happen to know a package to clean strings from shitty unicode characters?
examples:
┃♬●♪𝒟𝒥HƗĐŘΔ♩●♬ => HIDRA
┃♬♩●♪𝐏𝐞𝐝𝐢𝐫♪●♩♬ => Pedir
┃𝐵𝒶𝑔𝓊𝓃ç𝒶𝒶𝒶𝒶 => Baguncaaa
something that would clean out strings and replace them for their counterparts
we don't use anything like that and it seems very difficult to implement
it'd need a good chunk of hardcoded unicode characters to replace it properly
not even fuse is picking shit like that
Have you tried https://www.npmjs.com/package/unidecode-plus?
trying to solve the issue of that skid h0nda
there still bots joining but they got those weird ass names now
let me give that a try rq
Oof
close, but not quite there
What about https://www.npmjs.com/package/@aero/sanitizer? No typings though
how i can check if the npm safe or no?
no issue, let me try rq
https://discord.com/developers/docs/interactions/slash-commands#interaction
Does the message field contain the information about the message the bot responded with or to?
Nevermind
I use that for my bot even though I had to use require()
It's the message itself, the one that includes the component
ty
found the brazillian
im not even gonna lie, i just yoinked my friend's bullshit channel names cuz that was the only one i had readily available
but its a dead af server
lul
tbf, I REALLY want something like that for java
now that I know it's possible I'll see if I find something
its awfully rare for me to speak or be in a portuguese server. i only talk in portuguse with irl friends who dont speak english. 99% of my week is english
hey i feel kinda dumb for asking but how do i add an image to vsc?
because missing after argument list dude read the error
idk you should know this
bruh thats stupid lmao
"yeah let me point out the problem for you but... you go ahead and find it"
lol
wouldnt be asking for help if they knew where it was
You may be missing a }) to match with sending the embed
hey lite buddy do you know how to add images to vsc?
for example
i kinda forgot how to do this and need to add one
Just drag the image into the project?
ohhhhh LMAO sorry
np
it wont let me upload my file with my image to github because its apparently empty
any fix to that?
Is there a specific error? I've never had issues uploading images or videos (though I used PyCharm and Xcode at the time)
no errors its just telling me my file is empty
"This file is empty."
yet it has my image
that's interesting
I just tried it out
and it works for me (https://github.com/LiteLT/LiteLT/blob/master/image.jpg)
it says the file is empty for me
trying to upload this
so i can update it with their spotify status and stuff
the code is done just need an image
but i cant upload an image to my assets folder on github
it will let me upload other images but not that one
i cant be crazy
theres a module named dateutil right?
im stupid its python-dateutil
Python has a built-in date, time, and datetime module.
i need help ! what's wrong ?
Whats your error, or the actual problem?
I made a bot over a year ago, but never actually put and code into it. I have the code I want it to use, but I forgot what site to use to actually edit a bot I made.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Any guide on how to use shardmanager with topgg and which bot sent dm when someone votes?
Thank you.
The shardmanager is not related with topgg
Many bots send DMs when you vote
I mean my bot does it
What's your question?
I'm using my bot with ShardingManager and I want that when they vote for it to send a message to the DM but I can't get the client in the app.post
topgg will send you the user id of the voter, with that you can request from your sharding manager (depening on the library you are using) the Discord user object from that user id and you'll be able to DM him
@drowsy crag !!!
nom so fast
How could I do it in discord.js?
If you can’t pass the active client into your webhook script then include djs and create a second instance of your bot temporarily
Fetch the user id and send the message and close the instance again
This is a base for receiving votes, https://github.com/Giuliopime/top.gg-webhook-tutorial/blob/master/index.js, from there you get the user ID, then you will need to fetch that user from Discord, perhaps via https://discord.js.org/#/docs/main/stable/class/UserManager?scrollTo=fetch or it could be better to find a shard where the user is cached and send the message from that shard, unfortunately the discordjs sharding manager isn't the best for that
Thanks I'll take a look when I have time
Hii
Don't Just Say "Hello" in Chat.
Hi Erwin
hi
@earnest phoenix
Hi
Hi

Can anyone help get invite for this discord bot
Or how do I get
@earnest phoenix
To find a bot that you need, please try searching the main feature you need on our website. You may have to refine your search term, but with just a little effort, you can find the bot you need. If you still haven't found a bot that suits your needs, then try searching Google for it.
Yeah you weren’t kidding. It is bad.
Can bots have RPC?
i dont think so
I am having a new issue now that I have done some more logging. Currently, my bot doesn't respond regardless of what I do, and I can not figure out how to switch things around so it will function accordingly.
Prefix function
async function getPrefixFunction(message) {
const db = await botdb.queryPromise(`SELECT * FROM server WHERE serverid = ${message.guild.id}`).then(async function(results) {
return decodeURI(results[0].prefix);
});
const prefixes = [
`<@!${message.client.user.id}> `,
`<@${message.client.user.id}> `,
config.prefix,
db,
];
let thePrefixValue = null;
prefixes.forEach((p) => {
if(message.content.startsWith(p)) {
thePrefixValue = p;
}
});
return thePrefixValue;
}
Args, Cmd, etc.
const args = message.content.slice((typeof prefix === 'string' ? prefix.length : 0)).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
const command = client.commands.has(cmd) ? client.commands.get(cmd) : client.commands.get(client.aliases.get(cmd));
===
Attached are two console errors that I am getting.
Ok, so I want to make a cool little counter that just sits in my Support Server for my bot. I want it to just be an updating status of how many times the bot has been in a server. So currently, every time someone adds my bot to their server, I get a message in the support server via a webhook stating this. I was wondering if I could make a counter, so every time someone added the bot, the number would go up by one? Any ideas?
If you want the counter to be a message, you'd have to have the client get the message and then edit the message on GUILD_CREATE or every so often within an interval.
You should cache that specific message forever.
If your client is sharded/clustered, you should calculate which shard handles that guild and only perform the logic on that shard
Ok, no idea how to do this but I think I have an idea. But, I don't know how to make a public variable, instead of a client one.

