#development
1 messages Β· Page 877 of 1
you could just use the event and count
then you don't waste memory
and it works on reset
^
big brains talking omg
use whatever suits you
Thank you for the help, guys ^^... I dunno exactly how am I going to figure it out, but I'll try...
I'll send a message here if I still have doubts π
const emoji = messageReaction.emoji //the reaction emoji
const message = messageReaction.message //the message reacted to
if(!emoji.id === "698687776421445654") return;
const array = db.fetch("message")//unicode emoji (normal emoji) or a custom emoji (id)
if(!db.has("messages", message.id)) return;//checks if it is the message you want
if (message.reactions.cache.filter(r => r.emoji.id ==="698687776421445654").size === 2) return message.channel.send("whatever").catch(e => console.log(e))
});```
So, from where should I delete those tests code lines? :p
from what i'm seeing everything is great except this line
if (message.reactions.cache.filter(r => r.emoji.id ==="698687776421445654").size === 2) return
you already have the reaction object, messageReaction, replace that long ass if statement with messageReaction.count === 2
your current code will send a message as long as the amount of reactions is not 2 im blind
a
why a
it's like the shortest form to say 'ah,' or 'oh,'
or at least i think it haha
oh ok
const emoji = messageReaction.emoji //the reaction emoji
const message = messageReaction.message //the message reacted to
if(!emoji.id === "698687776421445654") return;
const array = db.fetch("message")//unicode emoji (normal emoji) or a custom emoji (id)
if(messageReaction.count === 2) {
message.channel.send(`Hello!`)
}
});```
Something like this could work? @earnest phoenix
yeah, you just have to check if it's the message you want to track
you're missing this
Oook
Guys, How can I make the server invite code a link. In the bottom right of this screenshot:
Are you using discord.js, @clear wraith ?
const emoji = messageReaction.emoji //the reaction emoji
const message = messageReaction.message //the message reacted to
if(!emoji.id === "698687776421445654") return;
const array = db.fetch("message")//unicode emoji (normal emoji) or a custom emoji (id)
if(!db.has("messages", message.id)) return;
if(messageReaction.count === 2) {
message.channel.send(`Hello!`)
}```
Btw, @earnest phoenix, something like this should work fine?
Yes @coarse topaz
I think I have an example in one of my codes, give me a min π
It can't be a clickable link if it's in the footer.
I also thought that ^
But wanted to confirm anyway
[Your clickable text](URL)
@clear wraith This is the example you need to follow π
Just that, try using it in a field
Ok, Thanks
bruh
XD
No problem! ^^
@earnest phoenix Nvm! It worked perfectly! Thank you so much!! ^^
Just wanted to ask something else... that number 2 in this line: if(messageReaction.count === 2) could be an object?
For example, the amount of members that have a role
Ohh... Are you sure there isn't any way?...
whats your end goal here
Ok...
when i run the command, the bot will send a message and react to it.
then when it has reached a specified number, it will send a message.
that specified number, needs to be the half + 1 of the amount of the members of a role.
(I already have that object)
I'm using this:
${(hotw_committee_members.size/2) +1}
can other members which don't have the role react
But I need to use the same object in this line: if(messageReaction.count === 2)
They can, but the bot will not count their reaction
it will
the count property doesn't filter out members, as it's just a number
it doesn't matter
I have another question.
How can I make the bot mention a channel through a code?
so the channel can stand out
in this case... #bot-updates
for example: [#development](/guild/264445053596991498/channel/272764566411149314/) It's the ID of the #development channel.
you just need to put \ before the channel tag to know its ID
for example: \#development
so i would replace the Id of the channel for #bot-updates
if it doesn't matter then you can simply get the role from the guild (https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=roles) (https://discord.js.org/#/docs/main/stable/class/RoleManager?scrollTo=cache) (https://discord.js.org/#/docs/collection/master/class/Collection?scrollTo=get)
once you have the role object, you can get the collection of members that are inside of the role (https://discord.js.org/#/docs/main/stable/class/Role?scrollTo=members), .size property of that will give you the amount of members inside of the role
Yep, And the bot will mention it ^^'
[#development](/guild/264445053596991498/channel/272764566411149314/)
Thank you again!
No problem!
Awesome, It worked!

if it doesn't matter then you can simply get the role from the guild (https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=roles) (https://discord.js.org/#/docs/main/stable/class/RoleManager?scrollTo=cache) (https://discord.js.org/#/docs/collection/master/class/Collection?scrollTo=get)
once you have the role object, you can get the collection of members that are inside of the role (https://discord.js.org/#/docs/main/stable/class/Role?scrollTo=members),
.sizeproperty of that will give you the amount of members inside of the role
@earnest phoenix I already have the amount of members... I just want to make the number the bot needs to reach, the amount of members of that role ^^'
let hotw_committee_members = message.guild.roles.cache.get(hotw_committee_role).members;```
${hotw_committee_members.size}
Ping me if you will answer to this message :p
Ah...
Then...
Is there a way to do what i was thinking in with that collection? π
Also, good night, @earnest phoenix! Thanks for helping me today! ^^
π€ π΄
ok guys so typescript i have a class that contains
public metricsManager: BaseMetricsManager | null;
and this is BaseMetricsManager
export class BaseMetricsManager {
protected readonly prefix: string = "bot";
constructor(prefix: string) {
this.prefix = prefix.toLowerCase();
}
}
so for example if i have another class that extends BaseMetricsManager and assign it to metricsManager, metricsManager will contain all the methods from the extended class
i think it's called a mixin but idk how to use it so if anyone could explain that would be epic
I have a quick question...
ask it
Dont ask to ask, just ask your question π
How can i get cryptic to actually mention itself in this message?
Or is that even possible ^
you can <@id> but that will only work if your bot isn't nicked
<@353782817777385472> = @amber fractal
That slash wasn't supposed to be there
Yeah figured
or (in d.js) you could <Client>.user.toString() I believe
Yes
Oh, Is there a way to remove "your" bot from a server that "you" do not manage?
any where you can run it like eval
i do not use eval
you can't do it via terminal
Well
you can make the request yourself
but it's a little complicated
i ran guild.leave(server id) but nothing happened.
Lol
if its a function for the guild, its probably going to be called from the guild
aka guild.leave(), guild.setName() etc
Lol no
oop
You get the guild from your collection of guilds using id
And you get your collection of guilds from your client object I think
Not too sure since I use Discord.Net xd
What lib do you use?
pretty sure heβs using .js, idk tho
discord.js
check the docs
Ok do you know how to access your client object?
yes
Is there like a .Guilds under it?
this thing
yes there is
You could just do client.user or message.guild.me and it'll mention the user object for the client in a string. No need toString it.
Ahh, Ok
You can always do <@id> and that'll work too.
But, normally casting the object to a string will mention it.
oh everytime i do guild.me i always get a blank message
.me probably gets the entire member object instead of the mention so not sure
lmao you can make a DELETE request to https://discordapp.com/api/users/@me/guilds/the_id with your bots token as the Authorization header as Authorization: Bot your_bots_token 
Huh, maybe the guildmember object doesn't mention but the user object does.
I never checked, I just figured since it returns the client as a guildmember object it would mention.
ok time to check
It works for me.
Are you casting it as a string or trying to send the object?
Sent it above the embed.
casting as string, but whatever im using is not working, and its not an issue that id like to bring up in here
waht
eval(code)
xddd
Does the bot come with a vote command?
what
like: c!vote
uhh
No you have to code it xddd
wrong server?
you have to add commands yourself xd
this is going to be a long night
gl man
or a hyperlink
Jeez, thx. Lol
Np
How to fix this error
wrong server uhhh
My bad
-wrongserver @hushed cosmos
@hushed cosmos
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
oh so THATS what his pfp is suppoused to be....
Ever since the pfp change i thought it was just a bunch of white blobs
Same except I thought it was some cursed blob
#memes-and-media maybe
sorry just wanted to bring it up here since it was relevant
Β―_(γ)_/Β―
channel limit hit tho only 90 channels in server
(message.guild.channels.cache.size)
Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz VPS STARTER HL+ 3 Go de RAM + DDR4 ECC 30 Go SSD 300 Mbps 1 Γ 3.3 Ghz
or
Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz VPS Medium HL+ 6 Go de RAM + DDR4 ECC 50 Go SSD 300 Mbps 2 Γ 3.3 Ghz
for discord bot
@earnest phoenix how many servers does ur bot have
Also try measuring the memory usage
750
The internet speed shouldnt be an issue
In that case id go for the top one
You can still upgrade to the bottom one if your bot gets larger and exhausts all the resources
And vps with 2go ram is good @fading wigeon ?
Well i would suggest you check how much your bot uses currently
And it also depends on ur code and language
11MB RAM
Haha yeah ur good
Yeah 2gb is fine
Okk
Id go evdn lower to save cash
What is your host?
1 CPU E5-2690 3.8GHz
2 Go RAM DDR3
1 IPv4 & 1 IPv6
20 Go NVMe
3.99$ /month
this offer is good?
yea
Hi I am tryna use git push and git pull to push to a private remote repo but I'm not sure how to
Does anyone know why the Discord website says If they (a member) have a nickname there will also be a be a ! after the @. if it's not true? My bot has no nickname (in all guilds) and the mention is still like <@!id>.
yeet
How do I use git push
I have fetched a repo
But I can't push
To ir
And I have put in the credentials
@golden condor you should first do git add . (. = everything) and then git commit -m "reason for committing" before you push
@nocturne grove I did that
Now it says this
cxllm@Cxllm-VirtualBox:~/Bots/Corynth$ git push
fatal: The current branch github.com/cxllm/corynth.git has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin github.com/cxllm/corynth.git```
@nocturne grove then it says this
cxllm@cxllm-VirtualBox:~/Bots/Corynth$ git push --set-upstream origin https:// github.com/cxllm/corynth.git
fatal: remote part of refspec is not a valid name in https://```
hmm sorry but I don't know what to do. Guess it's an easy thing but I am not a github expert
git push -u origin master
Guys, I have a problem. My music bot doesn't work between 2-3 at night. He gives an error online but there is no such song on youtube
what you're doing is saying to push to the remove repo called origin with the branch called https:// github.com/cxllm/corynth.git
@golden condor
which is why you're stuck
all you have to do is clone the repo then push it to the master branch (aka what Rotinxss said)
and then you can do git push because then the upstream is then defined
Yes
who names a branch that?
well it's still not called https://github.com/blabalbalabla
it's just github.com/blablabalal
How do I name it
Guild.findOne({
guildid: message.guild.id
}, async (err, guild) => {
if(err) console.log(err);
async function checkcommand() {
if (guild.banned === "true") return
if (message.content.toLowerCase().startsWith(guild.prefix)) {
const commandName = message.content
.slice(guild.prefix.length)
.toLowerCase()
.split(" ")[0]
.toLowerCase();
const args = message.content
.slice(guild.prefix.length)
.split(" ")
.slice(1);
const command = client.commands.get(commandName);
try {
await command.execute(client, message, args, Discord, config, avatarURL, footer, clientname, NL3Embed, DevEmbed)
} catch (err) {
var owner = await client.users.cache.get(`${config.primaryownerid}`)
console.log(err);
}
}
}
if(!guild){
const newDoc = new Guild({
guildid: message.guild.id,
welcomechannelid: message.channel.id,
loggingchannelid: message.channel.id
})
newDoc.save().catch(err => console.log(err));
checkcommand()
} else {
checkcommand()
}
}
)
```Guys, what did I miss?
Sorry bout the indents
How can i reset a quick.db database for a server?
@earnest phoenix I believe you canβt delete stuff from quick.db
can i maybe set to each user?
What do you mean
if you want to delete the entire database, just delete the json.sqlite file
for a specific server tho
Yo
not everything
Can someone help me
explain the problem
I made a ping command but when I run it, it just says NaN
send the command
One sec
case 'ping':
//message.channel.send('pong!');
//console.log(message.member + ' USED \'ping\' PROMPT')
//break;
ping_msg = message.channel.send(`π Pinging...`)
message.channel.send(`π Pong!\nLatency is ${Math.floor(ping_msg.createdAt - message.createdAt)}ms\nAPI Latency is ${Math.round(bot.ping)}ms`);
break;```
@earnest phoenix are you using tables? if not, you should
i am
Someone plz help me
@earnest phoenix then you can delete the entire table. not sure if quickdb has a method for that, if it doesnt, you can load the sqlite file in a database viewer, and delete the table from there
idk how, im trying to reset the entire specific server coins
for all users in this server
Can someone help me
@high bough that looks like callback hell 
you should promisify some of those callbacks
it's almost impossible to read that code ngl
I changed it to this, but doesn't even recognize it.
Can someone help me
it's almost impossible to read that code ngl
@spare goblet Sorta
Can you stop asking for help @sacred mountain
someone will help you when they can.
please be PATIENT.
you should promisify some of those callbacks
@spare goblet I don't know how to do that well.
const { promisify } = require('utils');
const newFunction = promisify(oldFunction);
i think
idk
Or you can just promisify it the normal way
@sacred mountain use createdTimestamp, not createdAt
timestamp is a number, createdAt is a string, you cant do math on strings
Tim, is there a way to delete the coins from a specific server?
const newFunction = new Promise(resolve, reject){
something(something, (body, error){
if(!error){
resolve(body)
}
}
}
or something like that idk
Umm, okay, lemme see.
then you can just do
const thing = await newFunction(thingy)
@earnest phoenix either edit the file in an sqlite viewer or do what others said, load all entries from the table, edit them all, and save them again one by one
@sacred mountain then you did something wrong
//message.channel.send('pong!');
//console.log(message.member + ' USED \'ping\' PROMPT')
//break;
ping_msg = message.channel.send(`π Pinging...`)
message.channel.send(`π Pong!\nLatency is ${Math.floor(ping_msg.createdTimestamp - message.createdTimestamp)}ms\nAPI Latency is ${Math.round(bot.ping)}ms`);
break;```
kk
@sacred mountain ping_msg = await message.channel.send()
if you're more capable with sql syntax you can also run that
@quartz kindle I thought u can only do that in a certain function
yes you need an async function
How
add the async keyword to your event function
Iβm not very good at this
client.on("message", async message => {
Yeah
It's common to use async message instead of just message
Even if you don't need it, it helps
async is nice to make your code cleaner
<Spoonfeeding is not allowed. π¦>
No probs
if(command === "reset") {
let allusers = await message.guild.fetchMembers()
allusers.forEach(user => coins.set(`${message.guild.id}.${user.id}`, 0))
}```
idek what im doing
Oh no
how does foreach work
you can literally google that
i tried i cant find anything lmao
it executes things for each element of an array
are you serious
first thing is that
wh-
@quartz kindle
@sacred mountain Hold on a sec
you're either blind or you didn't google it
LMAO

This is the right screenshot @high bough @quartz kindle
@sacred mountain if you're using discord.js v12, then its bot.ws.ping
How do I know which version Iβm on
<Spoonfeeding is not allowed. π¦>
do npm ls discord.js in your terminal/command line
K
Itβs working now
Also one other thing
Is there a way to edit the initial message instead of writing a new one
ping_msg.edit()
I tired it
Oh
<Spoonfeeding is not allowed. π¦>
No probs
in sql is it possible to push an element into an existing array, something like this? APPEND arrayTable SET array= "new_element" WHERE id="id"
@high bough I hav another problem
What?
I hav another function which doesnβt work
Which function?
K
This is considered a privacy breach right? ( Top 10 Guilds )
1. 100 Members - Guild Name
2. 99 Members - Guild Name
3. 98 Members - Guild Name
4. 97 Members - Guild Name
5. 96 Members - Guild Name
6. 95 Members - Guild Name
7. 94 Members - Guild Name
8. 93 Members - Guild Name
9. 92 Members - Guild Name
10. 91 Members - Guild Name
yes
yes
@feral fiber Must be opt-in and opt-out, or else it's a privacy breach
@feral fiber add a toggle leaderboard cmd so guilds can turn their ranking on and off
as many servers like it, but on the other hand some do not
as long as they can get out of it whenever, it should be fine.
So if its just that with no settings, privacy breach?
and of course, no hard process to get out of it
violets discord bot terms and services
if it's impossible for them to opt out, it's a privacy breach.
π
was asking someone about it a while ago
i always seems to hear a different answer every time i or someone else ask about π€
if you have a private server
suppose a private school educational server
its name shouldnt be leaked
Exactly
logically yes, but idunno if discord has a tos paragraph that states all servers are seen as public to everyone
like i don't feel like i breached the user "Light"'s privacy by posting that conversation since it happened in a public text channel
Server names should fall under End User Data
Hq quiz
i dont think discord will ban your bot for showing a top 10 list, but morally speaking, the right thing to do is not to have features that expose potentially private information
so if anything, think about the moral/ethic aspect of it and not strictly the TOS aspect
you want your bot users to trust you
how you handle their data is a big part of that trust
would you say it's unmoral for moderation bots to log deleted messages?
if "unmoral" is the correct word
no because that falls within the server's ownership of content posted there, however, the correct thing to do is to state that conversations may be logged for moderation purposes in the server's rules/information, and users should read it and comply to it
the correct word is immoral
if you wanna go further, then the server should also explicitly inform users that any message they post will be considered owned by the server
funny you said that, was about to ask
although all of this is kinda implied by discord's structure, in how the moderation can delete people's content at will, which implies the server owns the content or the rights to display it
"does that mean servers own the messages posted by the users"
so essentially, user owns the content, user wants to post the content in server, user must agree to server rules to have their content posted there, among those rules is that the server may monitor their content for moderation purposes
does that mean users delete the guild's content when they delete " their own" messages
discord gives users the ability to do that, so they do retain some ownership of it
i guess it would be similar to the relationship between a creator and publisher
I mean, i log every single user and server, but limit it to owner only, violation?
do your users know that?
Most of my functions are broken
i think i worked out something
when i run info it then just does the function below it then the one below that
Ok I fixed it
But I have another problem
Apparently I donβt have the permission MANAGE_MESSAGES in my own server
Misspell?
if(!message.member.hasPermission('MANAGE_MESSAGES')){```
anyone have experience with using mysql as a db?
Oh wait @high bough nvm
I just realised I did !
Now I know why anyone without the permission could do it but not me...
Yh
Also I hav another problem with the function
Apparently Iβm not specifying args[1]
else{```
let args = message.content.substring(prefix.length).split(" ")
Hmm...
Also, everyone, can anyone help me what I missed in my sharding? Or is it correct?
Ah, I forgot the spoilers again.
I would help u but I hav no idea
Iβm pretty useless with js
But do u know how I can fix my code?
show full code
me or her?
you
oh
Hey. How can I wait for the code to continue only after the forEach has finished? [discord.js]
if (item.type == 'voice') { var channel = item; }
if (item.type == 'text') { var ctext = item; }
});```
what full code for that function?
yes
if(message.member.hasPermission('MANAGE_MESSAGES')){
if(!args[1]) return message.reply('Please specify how many messages')
else{
message.reply('Are you sure you want to delete ' + args[1] + ' messages? (Y/N)')
bot.on('message', message=>{
if(message.content === 'Y'){
message.channel.bulkDelete(args[1])
console.log(message.member + ' CLEANED ' + args[1] + ' MESSAGES')
message.reply('Successfully deleted ' + args[1] + ' messages!')}
if(message.content == 'N'){
message.reply('The action has been cancelled!')
console.log(message.member + ' CANCELLED AN ACTION OF CLEANING ' + args[1] + ' MESSAGES')}
}
)
}
}
else{
message.reply('You must have the Manage Messages permission in order to use the clean prompt')
console.log(message.member + 'FAILED TO USE CLEAN PROMPT DUE TO PERMISSIONS')}
break; ```
@balmy knoll forEach is sync code, sync code is always done in the same order as you write it, so anything you write below the forEach block will only run after the entire forEach finishes
@sacred mountain are you getting "please specify how many messages"?
then what is the problem?
@quartz kindle Ok, but i got this error: ctext is not defined
ctext will only be defined inside the forEach block
whatever you're trying to do, you're probably doing it wrong and forEach may not be the best solution
This is the updated code for my thing which doesnt work:
if(message.member.hasPermission('MANAGE_MESSAGES')){
if(!command[1]) return message.reply('Please specify how many messages')
else{
message.reply('Are you sure you want to delete ' + command[1] + ' messages? (Y/N)')
bot.on('message', message=>{
if(message.content === 'Y'){
message.channel.bulkDelete(command[1])
console.log(message.member + ' CLEANED ' + command[1] + ' MESSAGES')
message.reply('Successfully deleted ' + command[1] + ' messages!')}
if(message.content == 'N'){
message.reply('The action has been cancelled!')
console.log(message.member + ' CANCELLED AN ACTION OF CLEANING ' + command[1] + ' MESSAGES')}
}
)
}
}
else{
message.reply('You must have the Manage Messages permission in order to use the clean prompt')
console.log(message.member + 'FAILED TO USE CLEAN PROMPT DUE TO PERMISSIONS')}
break; ```
@sacred mountain delete this
thats not how you wait for messages, that will destroy your bot
@quartz kindle In practice, having the id of a category (it includes a textual and a vocal channel), I take all its children channels and save them. I will also need these children channels after the forEach.
@balmy knoll forEach executes a function for each element in the list. if you have a list [1,2,3,4,5] and you do .forEach(item => { var b = item }) then b will become 5 because on every loop it will overwrite the previous value
what do you need them for? what do you want to do to them?
@quartz kindle i deleted the bit saying on 'message' but now i hav 14 errors
show code
if(message.member.hasPermission('MANAGE_MESSAGES')){
if(!command[1]) return message.reply('Please specify how many messages')
else{
message.reply('Are you sure you want to delete ' + command[1] + ' messages? (Y/N)')
if(message.content === 'Y'){
message.channel.bulkDelete(command[1])
console.log(message.member + ' CLEANED ' + command[1] + ' MESSAGES')
message.reply('Successfully deleted ' + command[1] + ' messages!')}
if(message.content == 'N'){
message.reply('The action has been cancelled!')
console.log(message.member + ' CANCELLED AN ACTION OF CLEANING ' + command[1] + ' MESSAGES')}
)
}
else{
message.reply('You must have the Manage Messages permission in order to use the clean prompt')
console.log(message.member + 'FAILED TO USE CLEAN PROMPT DUE TO PERMISSIONS')}
break; ```
Ok, but .. the forEach will find only two items (one voice and one textual), which through the if, I insert in the correct variable
@balmy knoll userCategory.children only contains 1 voice channel and 1 text channel?
@quartz kindle yes, alway in my case
alright then do it like this:
let channel;
let textchannel;
....forEach(item => {
if(item.type === "text") { textchannel = item }
else if(item.type === "voice") { channel = item }
})```
@sacred mountain change this to }
@quartz kindle Thanks, now works
Shouldn't you await the "Y" ?
we'll get there later
But i have another problem π
Like this it would try to bulkDelete every Y
it will never even get there
i messed around with the } and ) and now i hav no errors
Oh soz then mb
i will send code
if(message.member.hasPermission('MANAGE_MESSAGES')){
if(!command[1]) return message.reply('Please specify how many messages')
else{
message.reply('Are you sure you want to delete ' + command[1] + ' messages? (Y/N)')
if(message.content === 'Y'){
message.channel.bulkDelete(command[1])
console.log(message.member + ' CLEANED ' + command[1] + ' MESSAGES')
message.reply('Successfully deleted ' + command[1] + ' messages!')}
if(message.content == 'N'){
message.reply('The action has been cancelled!')
console.log(message.member + ' CANCELLED AN ACTION OF CLEANING ' + command[1] + ' MESSAGES')}
}
}else{
message.reply('You must have the Manage Messages permission in order to use the clean prompt')
console.log(message.member + 'FAILED TO USE CLEAN PROMPT DUE TO PERMISSIONS')}
break; ```
if i cant fix that i would want to make it so that it adds a tick and cross reaction on the message
then u click the one u want
but idk how to do that
In my bot, I'm using a mySQL database. I want to make sure that the bot is always connected to it to avoid having it connected whenever I need it, but I get this error: Connection lost: The server closed the connection. Why?
@sacred mountain delete this
@sacred mountain afterwards please read this
this is how you wait for messages
@balmy knoll it could be because you didn't make any queries and the server ended the connection cuz of it being extensively idle?
@quartz kindle is there any way i could change it to the thing i said above bc it would look nicer
Could be because of the port you used for the connection
Are you using a pool?
"if i cant fix that i would want to make it so that it adds a tick and cross reaction on the message
then u click the one u want
but idk how to do that" @quartz kindle
@sacred mountain
you could be getting an error, then it's getting closed; you should use a pool if that's the case
@quartz kindle i really dont understand that at all
@spare goblet Yes most likely it is due to inactivity. But this depends on the database server, right?
If it's inactive then the connect will close itself
@balmy knoll you can use a connection manager/pooling library
you should use a pool
there are many libraries that do that for mysql
I am inexperienced with these things. It is my first time that I use mySQL. What should I do?
@quartz kindle can we go dm bc this is very confusing
What are you using rn to access your mysql db?
search npm for a library that does what you need
@sacred mountain sorry but im not gonna walk you through it. check https://discordjs.guide/popular-topics/collectors.html#basic-reaction-collector
I could also let you give me this error, since the bot reconnects to the database immediately after the error. But I would like to avoid that in those few seconds of reconnection, some commands may not be executed
@sacred mountain react with the emoji's then create a collector for the emojis and await for user input, that's basically the idea.
awaitReactions passes a function and options as Tim mentioned.
Use it to wait for reactions over a period then use the callback from the function
@sacred mountain and this https://anidiots.guide/examples/miscellaneous-examples#awaitmessages
@spare goblet Do you mean which library I use to access the bot to the database?
yeah
mysql and util
one sec
I personally use mysql2 actually
it just seemed more updated and stuff
but that should work
ok i dont understand that thing Tim sent me at all so i will just give up on that feature
@spare goblet Ok thanks. So should I create a new connection and change all connection.query?
I'm not sure, you should probably check the docs I sent you
You get the connection from the pool, then query it using that
I try it now
On mongoose, is there anyway to tell the database latency?
Idk
performance.now is way more accurate
Is there a way I can get my bot to run continuously, even if I close the terminal
?
library?
PC
oh
no idea then
pm2
Thanks
which also includes having to keep your pc open
how to make that when someone will ping bot it will reply with prefix
@neat mulch if you're using discord.js v11 then this should work
idk about v12
if (message.isMentioned(client.user)) {
message.channel.send("your prefix")
}```
this didnt work for me if (message.isMemberMentioned(_client.user)) { message.reply(`Hi my prefix for this server is **${prefix}**. Try to use **${prefix}help** command`) }
v11 or v12?
"discord.js": "^11.6.2",
and "node": "10.x"
message.reply(`Hi my prefix for this server is **${prefix}**. Try to use **${prefix}help** command`)
}```
try this
worked for me before
and how to make
help menu like this
with reactions
message.reply(`Hi my prefix for this server is **${prefix}**. Try to use **${prefix}help** command`)
}``` didint work for me too
@earnest phoenix
Random question. if I was making a embed how to I have 2 fields next to each other instead of ontop o feach other
discord.js
so like in #mod-logs
They have
User Mod
Reason
I have User
Mod
Reason
@nocturne dagger use the inline field for the first two.
Though you can't do something like this because of the update they did with it: field field field field <-- You could do this before
I just like sending the raw embed object instead of using the messageembed class
can i yoink in here
ill take it as a 'ted was typing something' and now is quiet due to it feels weird to respond to what i was typing
anyhow 
nono i actually have a question
reset_timeout := format('SELECT %I_refresh
FROM users.ratelimits
WHERE user_id = $2'
, $1);
this is the wrong format to do in PostgreSQL 11, however i wonder what would be the correct format to write this kind of statement
just adding EXECUTE in front of the format gives error
i canβt download quick.db on linux
npm ERR! errno 1
npm ERR! integer@3.0.1 install: `prebuild-install || npm run build-release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the integer@3.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-18T14_17_17_755Z-debug.log```
(debian 9)
what's the log in /root/.npm/_logs/2020-04-18T14_17_17_755Z-debug.log ?
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', '$2 info using npm@6.14.4
3 info using node@v13.13.0
4 verbose run-script [ 'prebuild-release', 'build-$5 info lifecycle integer@3.0.1~prebuild-release: i$6 info lifecycle integer@3.0.1~build-release: inte$7 verbose lifecycle integer@3.0.1~build-release: u$8 verbose lifecycle integer@3.0.1~build-release: P$9 verbose lifecycle integer@3.0.1~build-release: C$10 silly lifecycle integer@3.0.1~build-release: Ar$11 silly lifecycle integer@3.0.1~build-release: Re$12 info lifecycle integer@3.0.1~build-release: Fai$13 verbose stack Error: integer@3.0.1 build-releas$13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> ($13 verbose stack at EventEmitter.emit (events.$13 verbose stack at ChildProcess.<anonymous> ($13 verbose stack at ChildProcess.emit (events.$13 verbose stack at maybeClose (internal/child$13 verbose stack at Process.ChildProcess._hand$14 verbose pkgid integer@3.0.1``` @static sable
who can help me?
You will have to wait until a reply from a person with the required knowledge...
Β―_(γ)_/Β―
Vinx may I ask if you're using a host like glitch.com
^ also try npm install <package> --unsafe-perm
@earnest phoenix (since you're offline)
what
Hello guys i have one question at begining
i want to build simple responding bot
im not much into programming but i know how to edit code
is there any solution like database or somethign helpfull to inserts new commands and responds or i must do it in one .js file in notepad
yeah you can use a database but bots like mee6 can also be set up to have autoresponses
What API are you using? @white glade
becouse for few comand its simple to edit my index.js file but i want build 100 respond IF/else in future
???????,,
api api hmm im using node_modules and discrod.js im think
mee6 have limited responder if i remember
Ok...
Then you don't want to make 1000 code lines but want to add 100 responds commands?
yes i understand this need much more code lines
custom responses wouldn't take too many lines of code only if they are text based responses
but i think something about similar to html input forms
that being said its only a few lines of code if you make it dynamic and not hardcoded responses
meybe its about my IDE π€
basic windows notepad isnt convenient for editing
what if i build something like that
in html
and do something magic to put form input to my bot js code
it's more complicated than you think it is
Hi, how can I detect which command using most memory?
that's not how memory works
I mean I have a simple bot but it keep exceeding 256 MB, something must be causing that
What lib are you using?
js
thats a language
what do you mean by lib?
The lib you use to connect to Discord e.g. discord.js
I use discord.js
discord.js tends to hog ram a lot which is the case and if your bot gets into like 1,000 servers you will need more ram
You can disable events and use v12 with gateway intents to solve that though
How effective it'd be?
I don't really use d.js but gateway intents means you have to specify what events your bot gets on startup so that it uses less data/cpu/ram and less objects cached
Okay I'll search for that thank you a lot!
Afaik objects still get cached, just not updated π
Depends what events you use and if you have all members option enabled
In discord.js v11.4.8 - I am trying to give roles or remove roles for staff members from the staff server from getting the roles from the main server.
This is my code https://hasteb.in/isalirex.js
But no errors and no roles are give on the staff server
you need to add them to the target guild member, not the current guild member
Your bot can only give roles that are below the bots current role too
- Admin Role β bot can not give
- Your Bot Role β bot can not give
- Mod Role
bot can give
ie: guildA = main server
guildA.member() = member in guild A
member.addRole = add role to member in guild A
so you need guildB.member() to get the guild B member object
or member = message.guild.member()
wait, what is target?
let target = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[1]));
ah then its correct
console.log(rolesToAdd,rolesToRemove)
[
'700443253404729355',
'700444761118736464',
'700444846074101800',
'700446107393851393',
'700447750805913610',
'700448718414938173'
] [
'700443648503840888',
'700443878796427274',
'700444922209239090',
'700445213520560209',
'700445306147307554',
'700445368084725841',
'700445558170583162',
'700445875377274931',
'700446032378593422',
'700448079647604859',
'700448242315296889',
'700448297374056549'
how to make that when someone will ping bot it will reply with prefix
and you didnt get any error?
nope
try target.addRoles().catch(console.log)
same for removeRoles
@neat mulch check if message starts with the bot mention
mentions look like this <@!BOTID>
I tryed
show code
not enough code
@quartz kindle Ahhh it gave me the roles now
what language/library is that?
Discord.js
But it send the same message 2 times
@neat mulch you named your client as _client?
Ok nvm not it works
Yes
Quick question, how does the AFK system work in a server ?
Who moves the users to the afk channel and if for example I have an afk channel with CONNECT permission denied, can they still be moved there ?
Reason to this is, I don't want normal users to join the AFK channel, just the actual AFK people to be automatically moved.
um if a person joins the afk vc they are muted so I don't see a reason for that
anyone know how to make a error 404 page?
@neat mulch then you're gonna need to show more code
also state your discord.js version
@valid holly
@earnest phoenix what webserver?
express.js?
um.. index.html
@heavy marsh honestly no idea lol
@quartz kindle I use HTML, CSS and JS - host my website on glitch.com
@earnest phoenix it seems like glitch does not support custom error pages by itself, you need a webserver to make them
oof
express.js is a javascript webserver commonly used in glitch projects
wait so
i cant use terminal to let my website host, cuz im on chromebook
so.. should i use github instead?
wdym?
instead of glitch, can i just put my website on github
and..
you know how you use terminal for node bot.js
can i do that with my website
well i cant cuz im on chromebook
oh @quartz kindle
You canβt use a .htaccess file on Glitch. One way to do it is to use Express and set the last route to be one that catches everything that hasnβt already been handled by a route. So in https://glitch.com/edit/#!/simplistic-farmer for example, I have a route for β/β, the homepa...
um idk
How do i make the bot send a custom emoji?
The bot is in the server with the emoji and i have the emoji id and everything
Get the emoji by its id i think
Message.guild.emojis.get("id")
Maybe
I tried <:emoji_name:emoji id>
Just use what i told you
Emoji = await ctx.guild.emoji.get("id")?
Probably
Aha lets try...
emojis is a collection, get() a function for a collection.
guild.emojis.cache.get("ID") if v12
^
.cache returns a collection, simply calling emojis will return null
If he is on v11, he can use what i told him
Well yeah.
so emoji = await ctx.guild.emojis.cache.get("id") awaut ctx.send(f"{emoji}")
?
Imma try dat
Prolly a variable
Prob
Owh wait...
I didn't specify i need python
Ur probably talking about
Js
Right?
ctx = context its the first argument of commands on oython
Python*
Xd
Its alr imma wait someone that understand py to help me
Ty for trying
.
[Q] How do i make the bot send a custom emoji ? (Python) (i have the emoji id) (i tried <:emoji name:emoji id>) but didn't work.
if its animated context is <a:emoji name:emoji id:>
What exactly are you sending (the entire custom emoji string)?
I have a server-info commands and i need that emoji to show the memebrs status
On the server members field
These ^^^
Status emojis
The message is embeded btw
So they'll be inside that embed
I'm creating something with my bot that would require it to keep track of something, but its literally one thing, with my bot being developed for GTAV and RDR2 RP, I'm working on the GTAV side with a BAC commands so I can use a breathalyzer command, where the bot looks to see what said users BAC is that they set and the bot returns after a few seconds with a specific number. I'm not 100% sure how to do this and I would like some help.
just
Yeah so are you sending it exactly how they're displayed (e.g.,
-> !angeryBOYE)
Lemme try
u didn't do it right

Unfortunally didn't...
how r u doing it?
can you show how you're passing it in your code
Sure sec
embed.add_field(name= f"Server members: [{member_count}]", value= f"<\:TM_discord_online:697508180170768454> - {online} \n<\:TM_discord_invisible:697508210889719829> - {offline}")
remove the \
I tried didn't qork
<\:TM_discord_online:697508180170768454> wrong
???.
no u didn't
That was the original thing i tried
Then i asked here
Lemme do it again for u
...
See
This is the results
Without the slash
With the slash the emoji shows how its in the code
embed.add_field(name= f"Server members: [{member_count}]", value= f":TM_discord_online: - {online} \n:TM_discord_invisible: - {offline}")
use that
And yeah my bot is in the server with the emojis
Lol
the id is wrong then
No?
Lemme show u the emote with its id

seriously?
It's formatted as <:emoji_name:emoji_id> for custom emojis iirc. You're doing something wrong there.
Bruh i am doing it correctly i just showed my coee
Code*
i also gave u the code
@digital ibex i litterally did that... and didn't work
I recopied the emojis with their id
And did it all over again
I am litterally doing just like that...
um
well
try storing ur emotes in a json called something like emotes.json
and then
{
"online": ":discord_online:"
}
All thats work for a simple emote...? -_-
and then import it to ur whatever file
and use that
then u can change the emote file
Or just use client.emojis.get('ID')
I ain't doing all that just for a simple emote...
This us getting way to complex...?
Or just use
client.emojis.get('ID')
@earnest phoenix i told him that lik20 mins ago
try that way then
var emoji = client.emojis.get(ID)
message.channel.send(emoji)```
PYTHONNNN
he's using py not js
v a r
Omg i am getting confuzed af
Oh...
Simplest method
Whats the difference
Between let var const
Like why does it matter
do you have an eval command?
no
have you tried sending the emoji in a non-embed message?
https://hasteb.in/huroqaju.js
I am trying to fire some one so that the roles will be removed from the main server
have you tried sending the emoji in a non-embed message?
@quartz kindle imma try that
I got the same problem TIM
@wise quartz does your bot have "use external emojis" permission?
It role has the administrator perms only
Idk in the channel... lemme see
Because its my friend server
That might be it tbh
Waiting my friend to respond rn...
Your bot must be on that server your using the custome emojis from
@wise quartz you can try checking the permission from within the bot
idk whats the syntax for discord.py, but something like channel.permissionsFor(bot).has("USE_EXTERNAL_EMOJIS")
Wait i think i found the prob
Also does your client have access to the emojis ?
Oh my ...
I am an actual moran
I was using my testing bot while my main bot is the one on the server with the emojis
Dude i can't beleive myself rn...
π i am sorry
π
No
you just need a discord library
in case of javascript I recommend discord.js
Check the channels
if the channel is null on oldState, it's a connect
if the channel is null on newState, it's a disconnect
One message removed from a suspended account.
-ask2ask @rough musk
@rough musk
Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
Please read https://dontasktoask.com/ for an explanation on why this is an issue.
I need help trivia quiz game
-wrongserver @vital cove
@vital cove
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
ok
Just ask
reset_timeout := EXECUTE format('(
SELECT %I_refresh
FROM users.ratelimits
WHERE user_id = $2
)', $1);```
this uncompleted query is giving errors
and I wonder
what is the correct way to write this kind of query
If I'm hosting multiple websites on my Linux Ubuntu server, is it better to manually run the server and then reverse proxy the websites using Apache or is it better to use something like Plesk
I have an issue that has recently come up. It was working fine and has recently stopped. It is supposed to catch the n-word and ect from an array of bad words:
for(i = 0; i < badWords.length; i++) {
if(msg.includes(badWords[i])) {
bad = true;
word = badWords[i];
break;
}else {
bad = false;
word = "nullptr";
}
}
if(bad) {
message.delete(100);
if(message.author.id == "535499942970785793") {
console.log("caught " + word);
}else {
console.log(`caught ${word} from ${message.author.username}, ${message.author.id}`)
message.channel.send(`${message.author} BRO! LANGUAGE!`);
}
}
However, now it returns an error that appears to say that something isn't an object? I'm confused because I haven't changed anything.
TypeError [INVALID_TYPE]: Supplied options is not an object.
at Message.delete (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\node_modules\discord.js\src\structures\Message.js:500:44)
at Client.<anonymous> (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\main.js:338:23)
at Client.emit (events.js:209:13)
at MessageCreateAction.handle (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:435:22)
at WebSocketShard.onMessage (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (C:\Users\ezj21\OneDrive\Desktop\Utilities\Coding\PeterBot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:209:13) {
[Symbol(code)]: 'INVALID_TYPE'
}
If someone has any idea what is causing this I could really use the help
It is within the client.on ("message", (message) and msg = message.content.toLowercase()
How do I set a default prefix using node.js?
I'm not sure what you mean by that
Are you using like a JSON to allow different prefixes for different servers
I just did const prefix = 'character here'
For node.js?
Yeah

