#development
1 messages Β· Page 1685 of 1
logger? hell no we are a community of developers and gamers
dude that host is protected by a DDoS Coreo smartwall protection, noway that i can do these weird things π
they would instantly remove my package
Discord bots usually don't need much
i dunno what that is (what u said just now barret)
The cheap ones work most of the time
@simple zodiac https://www.corero.com/product/smartwall-ddos-protection/
shivaco do you have any cheapish vps's that you know of that would host my bot good?
i paid good money for that
There are few VPS companies listed in the pins here
ill look at that
SkySilk might have something cheap
Oho, DDoS protection
Just don't leak your IPs 
Which of these listed here do you think would be the best? #development message
yeah π
Err, look around and compare the specs/prices yourself
i was hit not so long ago by an angry script kiddie
dude pressed a SYN attack onto my doorsteps
pfff
I mean, all of them for the starting at seem fine
whats that
I don't even remember
I think you sent it somewhere
Either here or in #general
Hahahaha oh dear
SYN attack ...sort of
i dont know the terms 
Lmao
so i stepped in, made some calls
paid some ppl
and it got fixed
so basically this script kiddie caused me damage π or at least a bill of payment
π€£
if i find him, ill make sure he will never be able to pick up a mouse
lil bastard
but thats not important ^^

not violence, its a federal offense obviously
Aha I see what you mean now
hehehe


see you peeps soon again π
Ooh, ya, don't be like me staying awake until 6 am and waking up in the noon
Have a good sleep o7
3:30 now π
Oh boy someone's gonna have a rough morning
seeya lads
bye bye
so
shiv if you know
how would i actually host the bot?
If i were to buy a VPS
cause i'm looking at vultr.com and from what i saw in the pins it looks good for what i could pay for
Well it's a VPS
yeah i dont know much about em
Connect via SSH to run commands in the terminal, FTP for file sending
ehhhhhhhhhhh i have no idea what that means
well i kinda know what ftp is
i have like filezilla
File transfer protocol
yeah but idk what ssh is really
If linux u can use winscap to ftp
Secure Shell
Or putty^
Yeah, PuTTY is an SSH client
Yeah pretty sure
Yeah most VPS use Linux
How come?
Its simple once u are used to it
i use windows
well yeah
Though most commands are simple tbf
Yeah dw once u have it u will get used to it
Hell, all my Linux experience was gotten from Google
True
just upload the files, install node.js pm2 and some stuff and just pm2 start filename
Yeah its simple trust me
would i need to re do all the npm i stuff i did in my terminal?
like npm i discord.js (and whatever else)
Npm i and it will install all the modules
Yeah but if u have the files just do npm i in the your bots file
oh would i upload like the packages.json
alright thank you
So like just any file in my repl, I would upload to the vps?
If i do end up getting one, would you mind helping me like in dms at some point? I understand if not
Try googling each step you do
Like "vultr connect ssh", "upload files ftp", yada yada
Iβve done like one thing before using filezilla, so I think iβd know how to do that part
But yeah the ssh thing and prolly anything else is what would mess me up
Linux commands are easy
I'm sure you'll figure them out with Google
Can ask in this server in case Google fails you
if you use bitvise it will open a ssh and sftp(filezilla) at the same time, can make things a lot easier.
Do you know how to get the quantity of all the items?
let arreglo = [
["a", "e", "i"],
["o", "u"]
]
console.log(arreglo.length) //2
yes
yeah, reduce is how i would do it
I do not know how to do that
The reduce() method executes a reducer
function (that you provide) on each element of the array, resulting in single output
value.
i am genuinely confused
so i have a currency and item system
and so you can give items to someone
so obviously not to make the command broken
i made it so that if you dont have any of that item you can't give it
but sometimes you can
note: SOMETIMES
like if you have 0 you can give someone and it'll be negative
most of the time it doesnt work
btw i use quick.db
whats your code look like?
one sec im sending it
//defining the item, i dont use db.push because im too lazy to actually use my brain idk
let valoofheads = db.fetch(`valoofhed_${user.id}`)
let uservaloofheads = db.fetch(`valoofhed_${author}`) //author was defined as message.author.id, i did that to not have to type so much
if (valoofheads === null) valoofheads = 0;
//in the command, this specific item is broken, not the others
else if(args[1] === '5'){
if(!args[2]){
if(uservaloofheads === 0) message.channel.send(`uh you don't have any Valentine's Day Oofheads \nget at least one Valentine's Day OofHead`)
else{
db.add(`valoofhed_${user.id}`, 1);
db.subtract(`valoofhed_${author}`, 1);
message.channel.send(`Gave 1 :LIMITEDicon:IMITED Valentine's Day OofHead to ${user.username}`)
db.set(`give_${author}`, Date.now())
}```
it was only discovered today
waait
i just realized
i never said if uservaloofheads === null its equal to 0
that may be the bug
wait
but that's the thing for all of the items
will update that right now
TypeError: 'bool' object does not support item assignment``````py
guild_data = self.gcollection.find({"_id":guild.id})
for gd in guild_data:
gd = gd["in_guild"] = False
gd = gd["delete_timer"] = time() + 259200
self.gcollection.insert_one(gd)```
any ideas?
Help me
.flat() is probably better
oh .flat().length?
yup
cool, thanks for the tip
One message removed from a suspended account.
??
does anyone have a set of card emotes they use?
a zip folder would be wonderful :)
get some friends to test your bot
make it as flexible as possible
for instance
!help
! help
@bot
should all return the help command
(sorry for rando ping)
I just have people go to support server, its easier to manage
I have one, but as now it only me, and my 2 bots. lmao
it will be for a while lol
Though, most ppl that invite my bot know me
but people filter through mine pretty regularly lol
so that;s that
not sure if its a good thing or not ;-;
a question could someone tell me how to make a whebook of votes?
a webhook?
webhooks in a nutshell are basically reverse APIs
so instead of you making a request to top.gg's API
top.gg makes a request to you
so setting up a simple HTTP server
and then giving that url to top.gg (through the bot page settings) is enough
How do I do that?
Is discord on scratch a library?
so setting up a simple HTTP server
and then giving that url to top.gg (through the bot page settings) is enough
read
Anyone with knowledge on VPS's know if this is good for the money? (5/month for this) I wanna host my bot on a vps but idk if this is good enough for it (the 1024 is memory, and the 1tb is bandwidth )
I dont see a problem there
who me?
yeah
oh aite cool thanks
i dont really know geek bench scores. most providers i know give the cpu model used rather than a score. so i cant really say if its a great cpu or performance. 2523 single core seems around normal for the price.
alright thx
const Discord = require('discord.js')
module.exports = {
name: 'send',
run: async (message, args) => {
const channel = message.mentions.channels.first()
const avatar = `${user.displayAvatarURL({dynamic: true})}`
const embed = new Discord.MessageEmbed()
.setTitle("Mod updates")
.setDescription("These are very important messages for moderators")
.setColor("#FF005B")//lime pink
.addField("Modmail", `${sayMessage}`, true)
.setTimestamp()
.setFooter("Modmail", avatar)
channel.send(embed)
}
}
It says error user is undefined so can someone pls help me define user
const user = author or something idk
I did not copy paste anything I swear to god
oh, so you pulled and pushed the code?
Made it from scratch
Ok then
const Discord = require('discord.js')
module.exports = {
name: 'send',
run: async (message, args) => {
const channel = message.mentions.channels.first()
const avatar = message.author.displayAvatarURL({dynamic: true})
const embed = new Discord.MessageEmbed()
.setTitle("Mod updates")
.setDescription("These are very important messages for moderators")
.setColor("#FF005B")//lime pink
.addField("Modmail", `${sayMessage}`, true)
.setTimestamp()
.setFooter("Modmail", avatar)
channel.send(embed)
}
}
wait
wot
?
what are you trying to achieve in this command
and why have you made it so complicated?
It suppose to send my message to.the mentioned channel example +send #chat hello there
const { MessageEmbed } = require('discord.js')
module.exports = {
name: 'send',
run: async (message, args) => {
const channel = message.mentions.channels.first()
const avatar = message.author.displayAvatarURL({dynamic: true})
const embed = new MessageEmbed()
.setTitle("Mod updates")
.setDescription("These are very important messages for moderators")
.setColor("#FF005B")//lime pink
.addField("Modmail", `${sayMessage}`, true)
.setTimestamp()
.setFooter("Modmail", avatar)
channel.send(embed)
}
}
why does it say modmail then
?
Cause im only gona use it for the mod channels in my server
i would rather do (let me type it down real quick)
const { MessageEmbed } = require('discord.js');
module.exports = {
name: "send",
run: async(bot, message, args)=>{
const channel = message.mentions.channels.first();
const text = args.slice(1).join(" ");
const avatar = message.author.displayAvatarURL({dynamic: true});
const embed = new MessageEmbed()
.setAuthor(bot.user.username, bot.user.displayAvatarURL())
.setTitle("Mod updates")
.setDescription("These are very important messages for moderators")
.setColor("#FF005B")//lime pink
.addField("the text:-", text, true)
.setTimestamp()
.setFooter(message.author.username, avatar)
channel.send(embed)
@frigid mountain
what is v?
you haven't declared it anywhere
My command handler is very different from that so it wont work
Fucking hell what's going on here even
i just did what you did just made it clearer
a professional js programmer is making me confusion
Lol
breh, show me your command handler once
the thing which make the difference is the event handler
the MESSAGE event
```database.query(INSERT INTO captcha (guild_id, channel, logs, role) VALUES (${server}, ${verifyChannel}, ${verifyLogs}, ${verifyRole}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: missing ) after argument list```
the command handler is used for posting the commands
How can i do?
what language?
database.query(`INSERT INTO captcha (guild_id, channel, logs, role`) VALUES (`${server}`, `${verifyChannel}`, `${verifyLogs}`, `${verifyRole}`)
now try
oh wait
since last night I have been looking (I am in France) but I cannot find where to place it
database.query(`INSERT INTO captcha (guild_id), channel, logs, role`) VALUES (`${server}`, `${verifyChannel}`, `${verifyLogs}`, `${verifyRole}`)
now it is correct
No lol
ok
It's not correct
what will be correct?
π
database.query(`INSERT INTO captcha (guild_id), channel, logs, role`)
i also did this
Do you see what's wrong with this
wtf
wot
guild_id this is an info that I want to enter
database.query(`INSERT INTO captcha (guild_id, channel, logs, role) VALUES (`${server}`, `${verifyChannel}`, `${verifyLogs}`, `${verifyRole}`)`)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: missing ) after argument list
@slender thistle oi, tell
and what is in parentheses is the columns in which information must be entered
maybe
wait
database.query(`INSERT INTO captcha (guild_id, channel, logs, role`) VALUES (`${server}`, `${verifyChannel}`, `${verifyLogs}`, `${verifyRole}`)`)
now?
oh wait
database.query(`INSERT INTO captcha (guild_id, channel, logs, role`) VALUES (`${server}`, `${verifyChannel}`, `${verifyLogs}`, `${verifyRole}`))
this?
database.query(`INSERT INTO captcha (guild_id, channel, logs, role)` VALUES (`${server}`, `${verifyChannel}`, `${verifyLogs}`, `${verifyRole}`)`)
now?
Fucking blind poking into the dark
unitl ` (latest)
Does your framework support named parameters?
i shall just walk out of it since idk this nicely
me?
Both of you
Answer this
already try, and he say me β¦ is not a function
ye
Then use them
how do i reduce my websocket ping? like what is it depended upon, it used to be 15ms and now its 200ms
so basically you want to have your terminal open for 7 hours, then wait 17 hours, then repeat. tada, now your bot is online 7/24
it is possible to make bots with dart?
yes
how is there any lib available for dart?
there's nyxx
My bot got approved
hi
I bought a server, but up to now it always shows Error
Error [VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds
how to fix it
server ping 39ms
You mean 24/7?

he meant a bot, that runs, exactly 7hrs a day
why limit it
l0l
/s/s/s
^
jokes aside, I wanted to ask
if we can extend a class (with Structures) that is already extended by a command handler (Commando).
I want to structure the CommandoMessage which itself extends the Message.
will locating a vps server closer to discord's server make the websocket ping faster?
Yes of course
because i set one in sydney and now its over 200ms
I donβt care about ping bcz yes
my bot ping 40
so where should i locate it if the options are
My bot ping m pong!
but when i try to play music ping up to 500
and say error connection not established within 15 seconds
What specs do you run on?
Iβve seen that error multiple times
2c 4gb and 25gb ssd
My VPS is located in Silicon Valley and the WS ping is 80ms
So, is it the only bot running on the server?
i hosted it on glitch before and it was 15ms
my vps is located united states
Same here
which one should i pick?
New York I guess
ok
Some say the bot should be given some permission
Lol no
message.guild.channels.exists```
For v12 please ?
channels.cache.has(id)
but it have administration , I do not think that there is a problem with that
I believe thatβs a TPS/CORE error
Lack of cores
I have 10 v cores
And my bot still lags af
if (message.guild.channels.cache.has('name', "partner" || 'name', "partnership"))```
@pale vessel :/
you have to use .find() and provide a function
hi guys do you have any host suggestions for my bot?
That can also be the problem
Contact your host provider to confirm
Because only when I play the music does the ping rise
Vivalnodes In best in my opinion
Itβs cheap and nice
pins
mmmh
Digital ocean is expensive ;-;
My friend runs like 1 BIG BIG BIG Minecraft server+2 BIG BIG BOG bots on a 18gb ram VPS paying 20$
for hardware usually you get what you pay. most cheap VPS use some older Hardware that runs slower, while higher priced Hardware should also run on more recent hardware.
this is atleast my Opinion on it
Is Ryzen c
Old*?
depends on the generation
you ass
bruh
but yea i know hoster who run these Cheap VPS on some older Xeon CPUs from 2009
sure it works, but its inefficent to keep the hardware, but they wont get new one bcs stupid reasons
Intel Xeon E3-1230v3/1650v2
20GB Storage
4vCores
DDoS Protection included
Unmetered bandwith
Virtualization KVM
These kinds?
yea its a 2013 CPU sure still fine but slow
Digitalocean is fine to start with, they have some pretty good Support, some of the best Docs for almost everything. but yea they get relatively expensive if you need stuff like Compute Optimized CPUs (2 Cores , 4GB Ram for 40$/Month lol)
There are hosts who offer free hosting too
CPU Ryzen 7 3700X, 2 vCore
Clock Speed @4.0/4.4 GHz
DDR4 RAM 4 GB
NVMe SSD Storage 60 GB
DDOS Protection 250gbps
Uplink 1gbps
Bandwidth Unmetered
Virtualization KVM
if its free it sucks
Pins
its ok but still only 2 cores
The one i use is good
there are no Good Free Hosts
I use this for 3.50/mo
the only exeption i would say is the 1 year free credit from AWS or google
except using your friend's paid VPS, thats a good free host 
I used to.
or forcing your friend to leave their computers running ur bot 24/7
thats noting that everyone can get
yea i wont pay much more for this
Lol
currently i have my Dedi with a Ryzen 3600 64GB ECC Memory and 2 512GB NVME SSDs in Raid 1
also Gigabit connection and unlimited bandwith usage
hmm
quick Q, what the safe limit for a status to be updated every so often? am guessing that once every min should be fine??
The limit is around once every 5 seconds
okay thanks, I dont have to worry about it then :3
send it again
const Discord = require('discord.js')
modules.exports = {
name: 'warn',
run: async (message, args) => {
const sayMessage = args.join(" ")
const user = message.mentions.users.first()
const avatar = `${user.displayAvatarURL({dynamic: true})}`
const embed2 = new Discord.MessageEmbed()
.setTitle("warned!")
.setDescription(`${user.username} has been warned by ${message.author.username}`)
.setColor("#FF005B")
.addField("Reason:", `${sayMessage}`, true)
.setTimestamp()
.setFooter(`${user.username}`, avatar)
message.channel.send(embed2)
const embed3 = new Discord.MessageEmbed()
.setAuthor(`${user.username}`, avatar)
.setTitle("You have been warned")
.setColor("RANDOM")
.setDescription(`Moderator: ${message.author.username}`)
.addField("Reason", `${sayMessage}`, true)
.setTimestamp()
.setFooter("dm warned")
user.send(embed3)
}
}
Code doesn't work at all idk if I did a mistake or forgot something
yes
const Discord = require('discord.js')
modules.exports = {
name: 'warn',
run: async (bot, message, args) => {
const sayMessage = args.join(" ")
const user = message.mentions.users.first()
const avatar = `${user.displayAvatarURL({dynamic: true})}`
const embed = new Discord.MessageEmbed()
.setTitle("warned!")
.setDescription(`${user.username} has been warned by ${message.author.username}`)
.setColor("#FF005B")
.addField("Reason:", `${sayMessage}`, true)
.setTimestamp()
.setFooter(`${user.username}`, avatar)
message.channel.send(embed)
const embed2 = new Discord.MessageEmbed()
.setAuthor(`${user.username}`, avatar)
.setTitle("You have been warned")
.setColor("RANDOM")
.setDescription(`Moderator: ${message.author.username}`)
.addField("Reason", `${sayMessage}`, true)
.setTimestamp()
.setFooter("dm warned")
user.send(embed2)
}
}
what have you declared the client as
bot or client?
nope, some define it as a bot some define it as a client
yes
its slient
client
K
const Discord = require('discord.js')
modules.exports = {
name: 'warn',
run: async (client, message, args) => {
const sayMessage = args.join(" ")
const user = message.mentions.users.first()
const avatar = `${user.displayAvatarURL({dynamic: true})}`
const embed = new Discord.MessageEmbed()
.setTitle("warned!")
.setDescription(`${user.username} has been warned by ${message.author.username}`)
.setColor("#FF005B")
.addField("Reason:", `${sayMessage}`, true)
.setTimestamp()
.setFooter(`${user.username}`, avatar)
message.channel.send(embed)
const embed2 = new Discord.MessageEmbed()
.setAuthor(`${user.username}`, avatar)
.setTitle("You have been warned")
.setColor("RANDOM")
.setDescription(`Moderator: ${message.author.username}`)
.addField("Reason", `${sayMessage}`, true)
.setTimestamp()
.setFooter("dm warned")
user.send(embed2)
}
}
try now
... what's the fucking difference...
there is
What's the difference exactly
this comes in the event handler
so you need to use whatever there is here
if there is client here
then you need to use client
@livid jackal
if there is bot you need to use bot
Dude the name plays no role
it does, read the discord.js docs
it doesn't if you actually know javascript
If you assign your client object to client and pass it into bot parameter

you use bot
Because that's what it's named
And that's how you refer to the object
There's no damn difference in this case
oh
Sure there can be cases where the parameter name can show a name from an outer scope
which doesn't apply here
Still doesn't work :(
What's the error
It's so bad theres no error code just doesn't work :(
is the bot even reading this file?
whagt did you put there, client or bot
maybe it might make a difference
Client
try bot once
Sounds like either silencing exceptions or the bot doesn't even read the file
And I can't tell which one it is
Still doesn't work
yes
you can also do
process.on('unhandledException', () => {})
this will fix all the errors by itself
and only a few will be shown
very rare
"fix"...
yeah no that fixes fuck all
don't spoil it
it just makes your code completely impossible to debug
Let's not troll here now
ok k
DONT
so much for small voice of reason
wot
this
ur name
and then recommending this

exdi
I mean it fixes the issue since it removes all errors


if i were to put some codes of discord.js on github
i would put that
and many bugs
isn't debugging the process of removing bugs and therefore errors as well?
would love to see the copy mpatsersstruggle
well you can straight skip to the remove error part using the snippet that @river panther showed
forget removing the bug
removing the error is where its at
there will be no bug if you see no error
exdi
bug becomes existen't if error doesn't show
eri is developing an internal hate against us now
use
process.on('unhandledException', () => {})
i simp for detritus
just say this 3 times
lol
and he will start liking you
erwin teach me detritius I don't like discord.js anymore
I need something better than discord.js
π₯Ί
how can I load a env file from terminal?
@opal plank can you do custom caching in detritus.js?
erwin teach me detritius I don't like discord.js anymore
π₯Ί
wowowow, what all can you not cache?
yeah
help me erwin escape the hell of discord.js and allow me to enter the detritus heaven
ok thanks
inghlis
@opal plank can we remove errors in detritus.js using
process.on('unhandledException', () => {})
no
@opal plank can you use detritus with typescript
im too blind to see so tell me
nice
i'll legit hit u if continue with ironic questions
When you enter development channel and the first thing you see is erwin talking about detritus, ecks dee
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 disconnect listeners added to [VoiceConnection]. Use emitter.setMaxListeners() to increase limit
how can i know from which command this is
From?
Clearly one that uses VoiceConnection
Well yh there is not only 1 cmnd for that lmao
You keep adding the exact same event listener
well the hint is that usually this happens if oyu do a client.on("something") within another event, or on a loop
Okayy thanks
bottom of my mute.js isnt working
err
UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
let jsonlogs = JSON.parse(fs.writeFileSync("./txt/mutelogs.json"));
let mentioned = message.mentions.users.first().username
if (!jsonlogs[message.guild.id]){
jsonlogs[message.guild.id] = {
mutedby: `${message.author.tag}`,
user: `${mentioned}`,
reason: `${reason}`
};
}
};
uhhhh
json.parse(fs.***write***FileSync) ???
Also, don't use JSON as a database, that's wrong.
Read: #development message
I have a little problem,
I am currently under MYSQL, for an command I retrieved information from a table (it's a channel id), it retrieves it correctly but when I want to mention the channel, it puts deleted-channel
how can i do?
The ID is probably incorrect or that channel doesn't exist on the guild you're mentioning it
if youre on the phone, discord's phone apps have issues displaying mentions correctly
hello sir, big fan
i tried to fix the errors
is this correct?
Can you stop shitposting about that
Like, remember there's a lot of beginners here and they might thing you're actually serious about this crap.
oh eh, yes, ig
Yes i know, but my friend in on pc and same problem!
ANNOUNCEMENT
beginners please don't do that
the channel exists !
are you 100% certain it does, and you have access to that channel?
Because, this channel exists: #299237603046064128
Β―_(γ)_/Β―
Pls tell me error in this command
Well considering they have like 20 commands, it's whichever they want
as long as it actually is the same.
Can a nodejsprocess_child spawn python script? Curious
How to limit permissions in 1 command to 1 id and 1 perm in discord.js
By using if else check statement
yes im sure
sort of
the child_process module has 4 methods
spawn, fork, exec and execFile
fork can only run node processes
but spawn can run anything
exec can run anything and wait for a response
execFile have async and sync process right
maybe log that channel ID then and see manually if you have the right one, because... well... it's definitely wrong ^_^
yes
Is there any way to take Voice as input in discord.js?
Like taking commands from voice channel?
how can I setup role on vote for my bot?
Server voting or bot voting?
If it's sever voting then idk
If Bot one then go to#topgg-api
bot voting
Not supported by default
You'll have to utilize bot votes with webhooks
So first you need to update discord.js
if you're using v11, that means a big overhaul of your code
but if you're on v12, just update npm i discord.js@latest and you should be fine
+1
oh, I say this as if your screenshot didn't actually say you're on v11
See https://discordjs.guide/additional-info/changes-in-v12.html for details on what you need to change in your code when updating
oh
uhmm how do i fetch all the guilds that my bot is in
they already answered you... twice
Well Then V12 I Knew It Will Come A Day When It Is About Time!
V12 has been out for an entire year
You had plenty of time to update. You procrastinated, now you pay the price. V11 will not be updated to fix this, it's too old. It's time to update, now.
π
client.guilds.cache.forEach(guild => {
console.log(`${guild.name} | ${guild.id}`);
})
How am i supposed to add async in this
forEach doesn't work with async
but the cache should have all your guilds already
so what's the problem?
forEach is slow anyways
i wanna add
await guild.members.fetch(guild.ownerID)
idk why people prefer forEach over for, especially with the recent flexibility for got
because for is newer and people like to read old code
What specifically are you goign to do with the owner, maybe you don't need to await it?
yeah
for await is syntax sugar we never asked for but needed
the owner of the server is currently offline and i have to fetch it, otherwise it turns out null
you could use Machinelearning for it, but if you have no idea in how to make model you probably have a hard time.
you'll be having a hard time regardless
you dont need to preemptively fetch all owners. just fetch them where you need them
Thanks Tim I was writing exactly that π
speech recognition is extremely hard to do by yourself, you're better off using an API (google cloud etc)
xD
yeah but i had the other problem earlier when it couldn't export the data if i used async
"export"?
but the ratelimits suck, this is why having your own model is better, but yea its a pain in the ass to do
function manageguild (g_id){
let guild = bot.guilds.cache.get(g_id)
//const owner = await outsideguild.members.fetch(guild.ownerID)
if(guild){
let memberCount = guild.memberCount
let guildname = guild.name
let iconurl = guild.iconURL()
let owner = guild.owner
console.log(guild.owner)
let id = guild.id
console.log(memberCount, guildname, iconurl, owner, id)
return {memberCount,guildname,iconurl,owner,id}
}
return "You dont share mutual guild with the bot"
}```
i did
uhhh but it's not async here
ik
const {userhit,manageguild,checkguild,modifyguild} = require("../bot/webapi_handler.js");
here is how i import it on the other file
when i add async it doesn't import it on the other file and it turns out undefined
#development message this is the webapi_handler.js file
if you export the function then you need to call the function when you require it
oh
a = require(...);
data = await a()
hmm
let me try
router.get('/:id',(req,res)=>{
if (!req.session.user) return res.redirect("/authorize")
id = req.params["id"]
guildobj = manageguild(id)
res.render("serverpage",{user:req.session.user,count:guildobj.memberCount, pageTitle:"Edit Guild" , name:guildobj.guildname , iconurl:guildobj.iconurl , owner:guildobj.owner, guildid:guildobj.id})
})
``` here is how i use it btw
you cant await in the global scope tho, you have to call it inside an async function
a = require(tim);
data = await a()
a
i think the way you get the Mutual guilds wont work as intented. you use the guilds the bot is in. it will be false if the Guild is not cached. if you want to get mutual guilds i guess you have to do it differently
its the joy of learning stuff, you feel stupid 50% of the time
lmao ikr
also did you get what ive wrote earlyer?
i think that part is fine
but i still have to work on the way i fetch it
i think i gotta await that too
cuz it doesn't seem to log all the guilds
bcs it looks like you get all Guilds the bot is in and just send it to the frontend.
if it works then its fine, but then again i feel stupid that i did it in a way more complex way then
lol
function getMutualGuilds(userGuilds, BotGuilds) {
const validGuilds = userGuilds.filter(
(guild) => (guild.permissions & 0x20) === 0x20
);
const included = [];
const excluded = validGuilds.filter((guild) => {
const findGuild = BotGuilds.find((g) => g.id === guild.id);
if (!findGuild) return guild;
included.push(findGuild);
});
return { excluded, included };
}
``` i just get the Bot guilds from the Discord API and the User guilds from oAuth
function checkguild(member_id, guilds) {
owner_guilds = [];
bot_guilds = [];
invitebot_guilds = [];
guilds.forEach((item, i) => {
if (item.owner == true) {
owner_guilds.push({ name: item.name, id: item.id });
if (bot.guilds.cache.get(item.id)) {
bot_guilds.push({ name: item.name, id: item.id });
}
if (!bot.guilds.cache.get(item.id)) {
invitebot_guilds.push({ name: item.name, id: item.id });
}
}
});
return { bot_guilds, invitebot_guilds };
}
vram is usually located on your GPU so you wont upgrade it unless you know what you do, but then again you probably wont ask this
virtual ram or video ram
virtual ram is basically the gpu init?
I heard , if your pc is support to upgrade vram you can do that from bios
video ram is gpu
For example
oh okay
no
if you have an CPU with integrated GPU you can do it
GT525M have totally 4GB
But it has 1gb vram
Ugh I gotta figure out how to re-do my entire database right now so I can "match" existing songs for karaoke and then bundle them up together in results. I don't wanna do it. I hate database queries 
in firebase if I try to get a doc, which doesn't exist, will it be count a read??
Ok thx guys
if you use Mysql you could link them to associate them to bundles by an unique key
mysql is quite decent in some stuff tbh
stuff that doesn't matter
1gb vram is the true ram your gpu has
up to 4gb total means it will steal up to 3gb of normal ram if available
linking Tables matters
anyways I'm using sqlite right now
Anyone know what this issue could be? Suddenly started appearing overnight causing my shards to restart.
Either way I probably need to do some relational stuff, my problem is just as much the DB as it is "figuring out if a thing is already in there and similar"
update discord.js to the latest version
discord API broke something with their new channel type
I'm kinda confused, how do I compare a string variable value with a string in batch?
something like
if variable=='string'
I did something like this but ain't working
if "%variable%"=="string"
How can i go bios
simple, map users and use some fuzzy string match to check content if its simlar, same for hashes to see if they're posting shit in channels. ontop of that, check how often last message was sent
those 3 checks should make a decent base for you
hey
can anyone help
i have a bot
i want to set his custom status as auto changing custom status
pls give me code
pay me
no spoonfed, read #rules-and-info
why
I mean, do some google searches, try doing it, try to understand it, and if you can't then come here @dry cosmos
if you dont know how to start ask help for the idea like i just did with erwin
i didn't directly ask the code
i could give more info, but you didnt provide a library or language
guys when someone sends a gif, i want my bot to get the link of the gif, but the link is like this h ttps://tenor.com/view/hello-there-private-from-penguins-of-madagascar-hi-wave-hey-there-gif-16043627, how do i get the .gif link of the gif
i am using discord.py
use tenors API / scrape the image url from the website with something like puppeteer
@opal plank do i have t change my whole code if i use detritus?
a lot of it is quite easy to port, most stuff should be the same
its adjustments that are required
i use discord.js, but i think i can already search something on google with that
what exactly you struggling with?
all good, if you need more help let me know
else i will i bc have to change 250 functions
what EXATCLY do you need to change tho?
me ?
k ty
yes
Do you know my Custom Command bot.And there i have functions like $giveroles, $createchannel ... .In this functions are based on discord.js
like i said, legit almost everything has the same function with a different name in detritus
for example
giveroles
here an example
for the channel
thats why im confused why you struggling, since its literally the same
does a array of role works like on djs
should yeah, let me check
struggling,
bc i have to change 250 functions,which is much work
@opal plank or @lament rock do you know batch?
that is the problem.Discord.js only send one request on a array
What do I have to use to check that my bot has permission to send messages? I tried with client.guild.me.hasPermission() and with client.user.hasPermission() is there anything that works for the client itself?
use this
internally they do multiple requests too
I get The syntax of the command is incorrect when executing the batch, but it still does everything as expected.
It's not a problem if it does what I want, but how do I make it say where is the problem instead of throwing that message alone?
client.guild is not a property. You have to have access to a guild, whether it be from a Message object or getting a specific guild from cache
from what im seeing in the docs you can only update one role at a time
Actually they don't
u sure?
D.js does a single request by editing the member object
Oh okay π thanks
tim told:
desktop client receiving multi role add when
gonna spoonfeed you a bit
the fact that discord allows multiple attachments per message but only android utilizes this feature
iOS does as well
oh? that must be recent then
Wait what, discord desktop/web can't send multiple attachments?
every attachment is its own message
yeah it upload per one msg
It's been a thing for a while for iOS. Practically a thing since it came out. Unless it's a TestFlight exclusive (iOS beta software)
Well not surprised, discord backend is really a clusterfuck
All different than each other
@earnest phoenix this should do the trick
they delayed enforce v8 because official clients couldn't update in time
Of course Discord is a cluster fuck
okay thx.
Is there custom caching?
yeah, its in the commandClient options
I literally added JS syntax highlighting for discord mobile and it was an absolute pain, man
Imagine fixing all that mess
isn't the android client react native as well
@earnest phoenix
I have no idea, it runs on Java and Kotlin so
lol i need every without presences
Gross
do you tho?
emojis caches
messages cached
presences cached
cached is not the same as intents btw
it just means they wont be saved
but you still recieve them
yes there is a function $isemoji[] or $findemoji ...
fair enough
You don't need cache to determine if something is an emoji
that is for custom command
Sa
The only thing you stand to gain from caching emojis is getting what guild it's from and who created it
I need everything,Else i would spam the discord api
You also need the manage emojis permission to know who created it
yeah
true
petition: replace all nullable instances of User with data of System
yeah like dbd.js aka BDFD
Seems like bdfd style parser
Called it
You're using BDFD or DBD? Or you made that parser yourself?
Don't tell me you're using those bot makers
nope selfmade
based on dbd.js
put hardcore edited functions are selfmade to bc of cooldowns
So you took the parser from dbd.js and edited it?

nah i just saw how the made their if loop
bruh
Stinky
lol.There is a type of credits on the page
and my parser is quite broken :C
hot take: coding is just chaining conditionals
@earnest phoenix since you are the expert here. Would a normal parser work. That executes from top to bottom?
That's what most parsers do
Most of them start from the first character to last and create tokens for each char, well
Lexer -> tokens -> parser -> evaluate -> output
ah okay.Is there any guide or docs ?
coding is just writing computer instructions in a human readable language to be later translated to computer readable instructions to be then executed
Well depends on what programming language you want to use really, well you can look at the engine I sometimes contribute to, which is the v8 engine @earnest phoenix
Maybe there is a tutorial to create a simple parser, but that's mostly up to your own logical thinking. interpreting can be done many ways with micro optimizations that can be made along the way such as JS' JIT compiler
Just like a normal message
.send('\`\`\`js\ntext\n\`\`\`')
``` for example
Thanks
"Holy JIT compiler"
True emoji
lol
oof
I just want a better parser for my bot. The parser is only need so User cannot evaluate own things like while(true){}
Well you gotta detect those by simple tokens that was given by the lexer if you ever make one, our v8 engine does this by detecting those hot spots and passes it to the crankshaft, or well TurboFan
You can even use regex to detect those but I wouldn't recommend that
That's where tokenization comes into play. You can build a tree of recognized key words and construct a string to evaluate later
regex is pain
I saw a regex in an emoji parser package
the regex was longer than 10 lines

the parser evaluates nothing it just pass params
twemoji is a long regex
The best thing to do in this case to build a simple abstract tree by lexers and tokens in your parser and then evaluate
you could just make a timeout and check if the code runs too long
can i make sat without js functions
aeon has it
Lemme build an instruction tree for you
Input -> lexer -> tokens -> parser -> AST -> detect for/while loops -> check the iteration count -> stop
That's for sandboxed arbitrary code execution. Not parsed input
yea i faced this problem. Then i changed to method parsing params
You can even use LLVM for this
but there is much weird things in js like import require ....
This would not be user-friendly since only a dev knows what async is :C,since most of Discord request with returned valuse is async or with promise
Node's flavor of JS doesn't support import. At least, not unless you have es6 mode turned on
Import and export are only supported in .mjs files
Is arbitrary code supposed to be user friendly? Once you understand the concept of logic, you're pretty much a developer
That is for a bot "so bot users "and not for a dev
I'm aware. However, you are essentially creating your own interpreted language which just happens to be high level
not unlike JS
How do I make a code that checks how many times a command has been used to a user?
Save them in a database and increment it upon usage
or text files

Cause I want to check how many times my warn command has been used by a user
file based data storage 
Read what I said
isn't all data storage file based
since you have at least 1 file to keep it all
No. There are in memory relational databases, databases like Redis, etc
redis reminds me of reddit for some reason
MySQL also holds a lot of data in memory before writing to chunked files
lol
Databases which are rewritten in buffer forms like files are dangerous, they could easily be corrupted unless they're using atomic operations
use enmap lowdb scriptdb enmap if you have know idea with database
Actual databases that store the documents in a cloud based storage are always recommend
Yea
Such as mongodb 
Voltrex no
Or postgres
π₯ DB
yea mongodb π₯
I wanted to write my own in memory K, V db similar to redis, but also supporting native filtering, but quickly gave up on it
I still have to logically understand btrees

what if thier bot is just a few hundred servers
lol
What if they plan to expand beyond "just a few hundred"
ik somebody who stores 70000 in mdb for his bot
You can't assume that. You should just give them an objectively better solution to their alternatives
I just store about 2k documents
besides, knowing SQL is essential in professional environments
did you know that mongodb is faster then sql?
For filtering operations, yes. Relational databases have their own uses, though and are generally more powerful with SQL statements as it's essentially arbitrary code execution
lol
this is a meaningless graph, SQL is not a database
Also keep in mind that databases can buffer inserts because I/O ops suck. Some DBs also shard stored data into chunks
insert speed is also not an end all performance metric
yes mongodb has sharding but it is complicated
What point are you trying to make
what if they are just regular people who are not trying to make a business out of thier bot
If it's not for their bot, then it's for their future
do they really need something like a dedicated server and then maria db and docker
lol
I never suggested docker
this
That would have been my go to suggestion anyways
Lol ditch ur json db and go to enterprise level databases for your 100 server bot lol
Used MariaDB the whole time
just use whatever
The difference is that I actually listened to my senior dev and having a database remote to the clusters has paid off so that I didn't have to migrate the data


