#development
1 messages · Page 1669 of 1
log-that-http package seams to work
or if ya a pro 
@modest maple I'M SWEATING 😰
But bro how am I supposed to give my friends Minecraft servers that way ?!
Yo! What's up ya'll?
need help?
More of feedback one something. Care to listen in DMs?
nope
i have this type of command handler and i want to use await but for that you need to have an async somewhere and i just wondered where and how i need to implement the function```js
module.exports = {
name: 't',
description: '...',
execute(message, args) {
}
};
module.exports = {
name: 't',
description: '...',
async execute(message, args) {
}
};
i think
i can try
async execute ()
thanks
How do I know, on the vote tracking, on the object req, which user voted for which bot?
I want to assign it to the category I created here. How do I do all the channels?
I need help!
let clanes_buscados = await clanes.find()
clanes_buscados.map(x => `${clanes_buscados.length} ${x.nombre} | ${x.tema} | ${x.codigo}`).join("\n")
let paginas = []
let cantidad = 2
while(clanes_buscados.length > 0) {
paginas.push(clanes_buscados.splice(0, cantidad))
}
let embed = new Discord.MessageEmbed()
.setDescription(`Clanes disponibles (Pagina ${args[0]} de ${paginas.length})\n\n${paginas[parseInt(args[0]) - 1].join("")}`)
return message.channel.send(embed)
it comes out like this in the DB and not as I specify with the map
thats what I refer
Sounds like you didn't save your file and restart your bot.
jaja que loco
pls
I use glitch, I don't have to save it
ok then it probably means that one of these things isn't what you think it is. Have you tried logging the variables and values and seeing what they are? Because that's probably what I'd do.
Also glitch is not an appropriate place to host bots (develop them yes, hosting them 24/7, absolutely not).
I have no money to host, not everyone is rich
It costs like
you dont need to be rich
$3 a month
1 burger per month
You do'nt need to be rich you just need to chose another free host like repl.it
Glitch.com bans accounts that use ping services to keep alive, so, it's not appropriate.
btw is your code literally what you posted?
await clanes.find()
empty find function
Find the void in my heart 
using string.splice() which is not a function
is to find all mongodb documents
clanes_buscados.map(x => `${clanes_buscados.length} ${x.nombre} | ${x.tema} | ${x.codigo}`).join("\n")
``` what is this doing?
the result is not assigned anywhere
oh yeah that's true, I missed that 
let category = await message.guild.channels.create("bla", { type: "category" })
message.guild.channels.create("kick", { type: "text", parent: category })
thanks bro
I need a bit of help on port forwarding my raspberry pi
Help. how can one overlay png on gif using js? nothing works
does anybody know how to make links show a embed in html
const GifEncoder = require("gifencoder");
const { createCanvas, loadImage } = require("canvas");
const Blob = require("cross-blob");
const gifExtract = require("gif-frames");
const { MessageAttachment } = require("discord.js");
(async () => {
let frames = await gifExtract({
url: "giphy.gif",
outputType: "png",
frames: "all",
}).then((frames1) => frames1.map((frame) => frame.getImage().data));
console.log(frames);
frames = await Promise.all(frames.map((frame) => loadImage(onBinaryMessage(frame)).then((image) => image)));
const gifencoder = new GifEncoder(600, 300);
gifencoder.setDelay(1000);
gifencoder.setRepeat(0);
gifencoder.setQuality(10);
gifencoder.start();
const ctx = createCanvas(600, 300).getContext("2d");
for (const frame of frames) {
gifencoder.addFrame(ctx);
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
}
gifencoder.finish();
const attachment = new MessageAttachment(gifencoder.out.getData(), "profile.png");
message.channel.send(attachment);
function onBinaryMessage(input) {
const blob = new Blob([input], { type: "image/png" });
URL.createObjectURL = function () {};
const img = Image(600, 600);
img.src = URL.createObjectURL(blob);
}```
that's all that happens
I originally tried to split the gif into frames and put it back together
no idea, what's your code for that command?
Umm
It's your bot, right? You're making this bot?
how the hell would we know what your programmed into it?
No coding
Even if you're not writing actual code, you still have... some logic into it, no?
whatever logic you have for that command in terms of roles, is what you need to figure out and fix
can you explain this?
where did URL come from, and why is it an empty function
basically making img.src become undefined

plus you dont need blobs at all
gif-frames can be configured to return canvas objects
I have a namecheap website how do I add a node.js file on there?
I would live to host my bot on the website
I do not know. I searched the internet for solutions to the problem and tried everything
can you tell me how to do this? I'm not very smart.
woop woop
out of curiosity, what are 'queries' in this case?
To a server type?
wut?
mariadb of course
Are you sending those in bulk or one at a time?
as the screenshot shows 100k inserts each time
How do I set the permissions of the channel I created automatically from the bot?
Time's increasing cause of the RAM limit, but ~ 22s atm
100k inserts in 24s is reasonable ish
reading it i thought it was doing 1 bil in 24s which i was gonna call BS on unless you have an entire DC at your call 
limited to disk speed atm
it's that huge bc of it's indexing, reading takes a few ms only of course
hey
That Discord function is called ANSWERING not push my post
url.createobjecturl is a global property, not to mention it is a web-only feature, is something going on?
what sort of data size are you looking at
im surprised Maria can handle that much in a reasonable time if the rows are large
Its not much no
But MySQL has a history for falling over itself with large tables with billions of rows
I naturally assume due to MySQL being Maria's back bone it carries the same flaw
doesnt maria advertise itself as being mysql without all the mysql issues?
The founder created MariaDB after god damn Oracle buyed MySQL and fucked it up
Still no match for my main man Postgres 
man thats a yikes
dealing for 14y now with these db engines
only a few issues so far, nothing I can complain about
i've never used firestore myself, but the few people i've seen using it had lots of complaints
especially about slowness
Its definitely a google product that google dont use
db optimization is an important point of course
I remember trying ot use firestore and it was just a complex mess I didn't quite grasp
I have a namecheap website how do I add a node.js file on there? I would live to host my bot on the website
its very slow unless you're literally ontop of the server's it's running on
its also very expensive
you dont "add a file on there"
you point the domain name to a host
the bigger the DB, the more expensive it gets per row fetched / inserted etc...
isn't namecheap just a domain registrar? It doesn't host anything.
well tbh without a fine tuning db's at that size will always be slowly
nah they offer hosting etc...
the hardware matters ofc, too
if you want to host in your PI, then you need to point the domain to the PI's IP address
probably not VPS hosting though
in namecheap's DNS settings
nah they do that
did you buy only a domain name or also webhosting?
all the way upto dedis
alright
then you can access your cpanel or similar
and also via ftp
but you need to check if they support node.js
many webhosting solutions dont support node
Php strikes again
Ah thanks
On it
I find that Datomic, Cassandra and Scylla all scale very well without optimising, of course you should do that if you know what you're looking for but Scylla does an amazing job at self optimising
Idk what Datomic does but that thing is just mad
I'm missing the context, we're still talking about dbs?
i am
One more question how do I make my raspberry pi project have its own web link so that I can have external people access it?
they're on about hosting
When I start my project using pm2 it gives me a localhost://80sometbjng
I scale my databases myself by a load balancer sharing the load between two clusters
you use your PI's IP address
But not the one I'm generating 4B entries for
Can anybody acccess it using my ip
Does anyone has good mongodb experience/know-how?
Like if I use a vpm and try it would it work?
if your PI's ip address is lets say 142.345.234.34 then you can put that IP in your browser and it should work
I'm managing my whole infrastructre myself anyways, starting by the DNS up to the virtualisation
as long as you did port forward
How do I port forward it?
My question: I save in a specific fields called "rtime:" Date.now/60000 as a string or "false" as a string.
So I want to fetch all documents, which has a valid number as string in the field called "rtime"
Any ideas?
feel free to answer anytime
pls
I just let Scylla handle that for me 😅
That Discord function is called ANSWERING not push your post
scylla gang 🤝
Keep that in mind
Is discord having API issues?
its such an awesome DB its hard to use others 😅 Unless im heavily relational then i go with Postgres
You're speaking about database scale, I'm not
I'm speaking about infrastructure scaling, servers, VMs, DNS requests etc.
And yeah well keeping up with the latest hardware
Which is the reason why I am currently generating a new database
is there an updated version of this?
I mean ours is pretty simple in that regards, new machine, run setup.sh which just installs Docker, setup volumes run cluster
xD
Because I'm moving all the VMs to a new dedicated server and a whole new virtualization method
I think the best couple of Db's to come out of the recent spurge are probably Redis, KeyDB, and Cassandra
use docker if you don't lol
yup same
ur missing cockroachdb
it is super easily scaleable and easy to use
Nah, Cockroach is okay
i mean for the scaleability it has to be up there
But it can get really fucked with higher mem systems
and idk if u can consider keydb its own thing since it is a redis fork
on an attempt to create my own command handler because I couldnt find any for java (javacord), I seem to be stuck on running the file, like how would I go about running the file once I've figured out that that is one of my commands
import java.io.File;
import java.nio.file.FileSystems;
import org.javacord.api.DiscordApi;
import org.javacord.api.event.message.MessageCreateEvent;
public class CommandHandler {
File folder = new File("JADIB/src/main/java/Commands/");
public CommandHandler(MessageCreateEvent event, DiscordApi api) {
// make the argument string[]
String[] args = event.getMessageContent().substring(Util.prefix.length()).split(" ");
if (isFileInFolder(folder, args[1])) {
}
}
private Boolean isFileInFolder(File folder, String command) {
// prevent running superclass
if (command == "command")
return false;
for (File fileEntry : folder.listFiles()) {
if (fileEntry.isDirectory()) {
isFileInFolder(fileEntry, command);
} else {
if (fileEntry.getName().toLowerCase() == command) {
return true;
}
}
}
return false;
}
}
yeah ive heard it can
cuz that Garbage collector doing those interupts™️
hasnt happened to me yet atleast
imagine using GCed language, could not be me
It always creates a different category here. How can I prevent it?
check if the category already exists before creating it
how so
message.guild.channels.cache.find()
C :)
nice
on average how many times do you forget to allocate enough data
and cause a segmentation fault
two times a day
yo @restive furnace remember the issue with tsl::sparse_map
yeah
the author gave me a solution
wowwwww jealoussss
6 times a day :(
u program in C too?
the author gave me solution
nice
oops wrong reply
i meant to tim's
template <class Key, class T, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class Allocator = std::allocator<std::pair<Key, T>>>
using sparse_map = tsl::sparse_map<Key, T, Hash, KeyEqual, Allocator>;
this is exactly what we tried doing, creating an intermediate template
but i couldnt figure out the right way
I never forget to allocate because i use rust 
didnt do anything with it yet lmao
but yeah one less thing to worry about in the future
i've been thinking about learning rust too, but haven't really got motivation
im working on other stuff, like that binary encoder i told you about
oh cool, i hope it will be ✨ blazing fast binary encoder
early testing is looking good
yeah
faster and smaller than JSON.stringify()
nice
not for bots tho because its a bit too low level
well i gtg cya
cya
but anything terminal
more?
Thanks ill try that.
Tim answered your question...
more?
What will I write?
Well that’s up to you, nobody will code for you
There’s a difference between getting help and let others do your job
I have a github project that I would like to host on my webserver
How do I do this?
Guys how to check if a user is banned by it's id?
Good evening,
I am currently using the canvas module but nowhere does it show the available fonts.
Would you know where to find them?
Thank you
Or fetchBan for a single fetch of course
in a properly configured machine, canvas will use your system fonts
otherwise you need to use the registerFont function to make fonts available to it
there is no way to list available fonts
at least not yet, i believe it has been requested before, and there was some talk about it
Ok so i can use my properly tff font so?
yes
ok and where i put the tff file please ? @quartz kindle
Hi (: How could I have 2 environment like, the discord bot in a server, and a development environment where I apply constant changes and I want to only see that bot instead of the production bot?
anywhere
just load it with registerFont
Ok thx u
/app/events/message.js:16
cmd.run(client, message, args);
^
TypeError: cmd.run is not a function
?
make your development bot not respond to any other users beside yourself
one of your commands does not have a run function
a ok
but it should be a new application on discord dev page?
i dont like command handler
no need
how i do the avatar inside of embed command?
actually
i prefer having a different dev bot
if you get a ratelimit on your dev bot it doesnt affect the main one
this is wrong?
let usuario = message.mentions.member.first() || message.member;
If you get a rate limit on your dev bot, there's a BIG issue
unless you're developing a lib
BIG issues can happen in dev
thanks! (: i'll try that
big issues can indeed happen, but that's usually when someone isn't thinking properly in terms of logic and makes a fucky wucky.
@quartz kindle thx uu ☺️☺️
let usuario = message.mentions.member.first() || message.member;
^
TypeError: Cannot read property 'first' of undefined
now what?
message.mentions.users.first()
really?
ye
wait
i hate my life
) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
whats your node.js version?
10.23.0
ok
latest is v15
wow v10 x)
How do I automatically move a category to the top with the bot?
Take a look in here: https://discord.js.org/#/docs/main/stable/class/GuildChannel
Especially the property position
is discord having issues with shards rn?
like a bug or something?
Cos my shards won't spawn properly
Looking at this and it's still occuring i believe
https://github.com/discordjs/discord.js/issues/3956
By checking if the channel type is category and reading its position you can sort them
I couldnt find it :/
I wouldn’t recommend 2012 any longer @midnight blaze
hmm, just for testing
trying to connect my 2 vps
together
one is a DC
one is a vpn
Hmm sure why not
hahaahahah someone explains to me why every time I put a command it appears twice?
Still wonder what the benefit should be
what do you mean?
Of connecting them together to do what?
to learn how to work with networks?
Oh well yeah sure testing is learning
als
Yeah thought they may have a productive purpose
and the terminal is not open
they have for sure
It is indeed yeah
It’s still the most common used system for public agencies and companies
Probably not a bad idea to know and understand how it works
slash commands
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
js
there is PR about slash commands in discord.js https://github.com/discordjs/discord.js/pull/5106
you can use this if you want https://slash-create.js.org/#/
I'm sorry I'm absent, someone who knows could help me?
did you read my answers?
And mine?
Just... gonna pretend we didn't actually have a conversation there after your question?
Can you send the link to the message?
read below your question which you replied to
like... the thread of people talking to you...
?
yes, that was an extremely important question. Let's pick up from there!
Well, what do I do
Do you not understand how variables work?
do you understand what that line of code does?
like, you're not assigning the return of the map() function to anything so it's... doing nothing
inb4 learnjs situation.
Do I remove the variable?
😔 😟
sorry dude, when we help people, we expect them to at least understand their own code, otherwise its hard to help
because we want to help people learn, not do the work for them
I did this code alone, only I didn't like applying the map in this case.
so then you should know a bit what your code is doing right?
you are not assigning result of that line to a variable
.map() creates a copy
it does not modify the original
so clanes_buscados is still the same before and after the map function
it is not affected
I hear everything's fine, the problem is that it gives me the information as it is in the DB
Ok...
.map() creates a copy
it does not modify the original
so clanes_buscados is still the same before and after the map function
it is not affected
@lost wadi the map function affects the whole array. imagine having this array arr = [{id:1; name:"a"},{id:2; name:"b"}] then doing arr = arr.map(x => x.id) would result in arr = [1,2]
i think
Yes, I understand that.
maybe the syntax is wrong, it's been a couple of weeks since i last touched that function
the syntax isn't wrong the fact that he's not actually doing anything with the return of that function is wrong.
literally doing nothing with it
yup
And if "assigning the return of a function to a variable" doesn't immediately and instantly tell someone what the solution is, they need to read this immediately...
#development message
So I'm mis-applying the map?
you're not applying it at all
you are applying it, but you are not using the result
you are using the original again
clanes_buscados = clanes_buscados.map(x => ${clanes_buscados.length} ${x.nombre} | ${x.tema} | ${x.codigo}).join("\n")
you gotta affect it to a variable
you have to send the result to the og array
that can be just chained exactly as it is right now
literally the only problem is not using the return value... that's it....
there's probably nothing else wrong with this code.
ah, well. there you have it @lost wadi
thats not the only issue with the code though
hes still using string.splice() later on
So should I apply the map before the while function?
which will throw not a function
you should give the result of the map to a variable
do you understand what that means?
array = bla;
result = array.map(...)
you dont have a result
it can be the same variable or a new one
tienes que poner el resultado de .map en una nueva variable
no estas ponendo el resultado in nengun lugar
Huh
let clanes_buscados = await clanes.find()
let otros_clan = clanes_buscados.map(x => `${x.nombre} | ${x.tema} | ${x.codigo}`).join("\n")
yes
sep, ahi lo tienes
you can also put it in the same one
Okay, but that's not an arrangement.
Let's see I think...
that's probably the splice thing. i have no idea what are you trying to do there
Ready I got the map, there's only one detail left but I don't know how to fix it
They come separated by commas
let clanes_buscados = await clanes.find()
let otros_clan = clanes_buscados.map(x => `${x.nombre} | ${x.tema} | ${x.codigo}`)
console.log(otros_clan)
let seleccion = parseInt(args[0])
if(!seleccion) seleccion = 1
let paginas = []
let cantidad = 2
while(otros_clan.length > 0) {
paginas.push(otros_clan.splice(0, cantidad))
}
let embed = new Discord.MessageEmbed()
.setDescription(`Clanes disponibles (Pagina ${seleccion} de ${paginas.length})`)
.addField("** **", `${paginas[seleccion - 1]}`)
return message.channel.send(embed)
what are you trying to do there?
I finally finished it, thank you very much
Me tarde mucho con esta pendejada ._.xd
@lost wadi Puedes reemplazar la funcion while esa por esto, si es que te sigue dando problemas
for(let i = 0; i <= maxPaginas; i++) paginas.push(otros_clan.splice(i * cantidad, cantidad))
if(otros_clan.length % cantidad > 0) paginas.push(otros_clan.splice(maxPaginas * cantidad, otros_clan.length - (maxPaginas * cantidad)))```
Gracias, lo tendre en cuenta
Igual esta todo mal eh
Pero es que no me gusta usar funciones while
Son muy lentas
y menos para hacer cosas que no son iteraciones
while isnt slow
Eso no lo entiendo muy bien
from what i've seen in some iterations tests, it is
for loops are 30-40% faster
doing the same thing
nah
more like 1% faster
idk which tests you saw but they were likely wrong
there is a lot of testing and benchmarking out there done wrong
they were done in python, the results may change from language to language tho
in js, for in and for of are much slower than while
i heard about that, yeah
to do something like that
Codigo | Clan | Creador
#27723 Warriors ZCrzas
#76237 The Lions FortY
#48733 Gods Augep
do I need a module?
no
so?
that should be easy to do by using the addField() function for each attribute
right?
Well the code blocks are using monospaced fonts.
You’re just counting the chars of each word to get to know how much tabs (probably unicode tabs) u need.
Or use an embed
Looping through each line
he is already using an embed
That’s not what a wrote
Formatting grids inside a codeblock has nothing to do with embeds
yeah, but he could do that too
Actually that would look terrible on mobile
.addField("Codigo | Clan | Creador", <var>)
?
It ALWAYS does
Embeds on mobile are a tragedy
Are they? I haven't experienced that
Anyways if you wanna create a grid inside a codeblock you will have to loop per line and word, count it’s chars and add tabs after the word based on the char length
That’s it
you can use the built-in pad functions
Or choose a more complicated way 
much complicate wow
You know what is a tragedy? My crappy html code on my bot's page seen through mobile lmao
Oh I can feel that sarcasm
absolutely unplayable
5/7
lmao xD
Lmfao
Never ever heard of nowraping 👀
media-query :^)
lmao
i haven't touched html nor css in years and i wanted to have it done in a couple of hours this morning
it looks cool on pc though
Wew getting a push notification while I’m looking at the message I got mentioned in
At least it's something
Discord mobile... no words needed
My bot page is just stinky markdown
show us
How do I automatically move the channel I created to the top?
👁️👄👁️
Told you already
channels.create has a position option
here's the rest
I'd rather not
my is 200 300 lines
200300 lines or 200-300
imagine 200k lines
would take 2min just to load the page
Is there actually a limit? 
channels.create has a position option
Can you explain this?
channels.create({ position: 2 })```
If I make this 0 does it move to the top,
yes
Wait, if you want to move an already existing channel, I think you have to use channel.edit({position: 0})
Although I'm gonna add a disclaimer that I'm not a js dev so I don't know much about discord.js
slash commands are difficult to me
Uh no, which channel do you want to put at the top? destek ?
Oh, then after type: "category" just add position: 0
you can use the .setPosition() function
how will i use?
category.setPosition(0)
ok
Oh yeah totally missed that one lol
But it's weird that specifying it at creation doesn't work
oh ok thnks it happened
indeed
maybe some typo in the code or something idk
in theory it should work the same way
it forms the same category twice here, how do I prevent it? if you want, let me assign ss
look at the left
yeah, if you run the code twice it has no idea on what the category is from the previous run so it just creates it again
Here's how to prevent it again when you say -dstekaç put it in the same category
if you don't want that to happen you should look into saving those channel ids somewhere
like a cloud database
or a json
no I know it can be done with code but I don't know the code: D
well, you could also "find" the category by its name
how?
category = await guild.channels.cache.find(name)
i think thats it
iirc
then you could do
if (!category) {
(create the category)
}
Should I delete the let category?
paste it inside of this thing
ok
category = await guild.channels.find(name)
this is the correct way to put it
using awaits instead of chaining futures smh
this is not the fault
what the heck are those extra random parenthese?
let category = await guild.channels.cache.find(c => c.name === "name")
if (!category) {
// create category
category = ...
category.setPosition(0)
}
probably some copypasting error
doubtful
@vast garnet do that
category = ... What am I going to write ?
what you have now
you just need to remove the extra parentheses () you put around there for literally no reason
Do you need to triple equals with strings? Idak
i have no idea on what those are used for, eveytime i see them online and i try to use them they don't work. i just stick to ==
=== means exactly equal. 1 === "1" is false. 1 == "1" is true. You should never use == unless you know why you're using it.
And it's rare that you really need it.
yeah I tampered with myself a little and it happened
i dont get it. like, at all.
isn't that the same thing?
so you think "1" and 1 are exactly the same?
JavaScript is a special language where magical things happen
you don't understand the difference between a string and a number?
Weak typing ftw
im on my phone so i can't read shit
this is cursed lmao
what kind of results are those. i would just expect it to crash or return a null/undefined
How to disable my bot Commands for public?
All Commands
The code for the number of bot on the server is not `$ {message.guild.clientCount} '
Just return the message event if the guild isn’t yours.
Nope
Can't form a single COMMAND
you can do that by checking if the member has a certain role
Just for the message event before loading your commands
Ok
client.on("message", (message) => {
if(message.guild.id != yourid) return;
// your commands here
And what’s the issue?
They been called in your message event
Okay👍
@earnest phoenix are you looking to lock the command behind a role or a guild?
@lament ruin umm I need to run it for only 1 server not globally
For testing purposes
the do what fake is telling you
1 line, 1 statement, 1 return, finish
Okay
you could also create a new discord bot token and use that one in the testing server
that's what i usually do
Js doesn’t care about your silly conventions
this is why js gets made fun of
[] + "" / false = async function(){}
you didn't know that one, huh
Whats that 
try adding an array to a string then divide it by a boolean
it gives you an async function

Wouldn’t wonder if JS actually do that
Js is more cursed than i thought
let i = await 1
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'BroadcastEval' of null
Well getting from any "real" program language to JS is like strict, complex coding to absolutely crazy coding (with unexpected behavior)
What to do of this
What do I do when someone wants few API calls but also doesn't want to use caching?
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'BroadcastEval' of null
Tbh I like when a language is permissive, even if it’s more error prone
Well depending on your system more API calls shouldn’t be an issue?!
Although I can’t be trusted with it
yeah, like, my pagination lib works with or without caching
a dude is wanting me to improve this:
for (Guild guild : handler.getGuilds()) {
try {
e = guild.retrieveEmoteById(id).complete();
break;
} catch (ErrorResponseException ignore) {}
}
to make it not iterate over guilds looking where the emote belongs to
TS?
Aw dunno about both 
when running 0 cache mode, how the hell would I get an emote without finding it first? 
Well I’m gonna tell you something
I feel Java slander coming
My bot as well as my web app is calling the Steam API each request to fetch the latest account informations
As well as a lot of different socket connections to get informations from websites following a specific protocol
I was caching all these data at first for 24h just to improve the response time and to lower the API calls
Once a beautiful day I was fetching on account incl. all other infos
By accident later that day I did fetch this guy again bc his ID was still in my clipboard and notice damn, somethings is wrong
Turned off the cache for fun a noticed his ban status has changed and people requesting my API wouldn’t notice
Just disabled all the caching shit, threw anything away and stick to a slightly higher response time
I mean there’s also rate limits
But improved the clients and processes to actually being able to split up requests on multiple processes to increase the response time again
A lot more work but at the end the better result
I know but like, I don't know how to explain that caches solely exist to reduce api calls
not that emote cache is that big in JDA anyway
For sure yeah
That maybe important for Discord bots being in 1000 of servers
Not what I was talking about
can't think of a better solution honestly, all the info the lib receives is the emote ID
APIs should be able to handle a huge amount of calls and scale up with the amount of requests
I mean, what I might do is allow setting "repo" guilds for emote lookup
Even Discord API
imagine not having a big request quota for the major selling point of your business 
I actually think you’re talking about trains and I about cars 
discord is 90% emotes
hey you guys making a new bot?
I mean I’m rate limiting my APIs too but I’m actually being prepared for a greater load and higher limits
That’s what I wanted to say, anyone should be
Guys how a create a welcome comand for my bot??
@marble juniper 24h turn around time go brrrr
Watch some docs and guidelines how to get started.
Team is aware
typo
its broadcastEval
Umm
not BroadcastEval
Don't ask to ask
I need help making a raid protection command for my bot, it is python.
or just raid protection
ok
It is python
like random memes on reddit is there a package for jokes?
yes
for js
randomJokes
There was a lot of errors in my bot jesus
should be
anyone wanna help with a server 
oh nice, what do u use for bots?
what type?
need help dk why it happens this is my first time hosting

const webhook = require("./module/plugin/webhook.js");
``` how can I save variables in something like webhook.cache ?
umm how do i make subcommands in discord.js
what have you tried so far?
if (message.content.toLowerCase().startsWith(config.prefix + "unban")) {
NHIP.setDescription("You must have the `Ban Members` permission to use this command!") //cambio descrizione dell embed dei permessi mancanti con i ban
NHIP2.setDescription("I need the `Ban Members` permission to execute this command!") //cambio descrizione dell embed dei permessi mancanti del bot con i ban
const unbannedID = args[0]
if(!unbannedID) {
return message.channel.send('You must specify who you want to unban!')
}
let unbanDm = new Discord.MessageEmbed()
.setColor(colore)
.setTitle('You got unbanned! :D')
.setDescription(`Unbanned from: ${message.author.username} \n Unbanned in: ${guild.name}`)
let unbanE = new Discord.MessageEmbed()
.setColor(colore)
.setTitle('User Unbanned!')
.setDescription(`I succesfully unbanned ${unbannedID.username}`)
try {
guild.members.unban(unbannedID)
} catch (e) {
message.channel.send('Error: Could not unban the user, correct usage: ?Unban <UserID>')
}
}```
So
This is my unban command, and i think it works, but i need the bot to send an embed in the channel and to the unbanned if the id is valid
what the?
you create the embeds but don't send them
My bot’s prefix is ‘/‘. There are some slash commands in my server from other bots. The problem is I can’t type /help, because of that. Any solutions?
change your prefix
^^
Nah, I can, but... it will be a bad way to go
I have always used “/“ as a prefix
Without a possibility to change it
Then you gotta live with it
All it’s users are used to “/“
switch to slash commands
:/
that doesn't matter
You can't change the behaviour of other bots, so you'll need to change your own
yup
That’s trash :/
slash commands ™️
You could make it so servers can change the default prefix
good idea
I don’t want to. The real reason is: I want all users to be used to one prefix only, so there won’t be any problems using the bot in multiple servers.
but i dont think you can do that
:(
Guess I have to change a prefix then
What are good prefix examples?
Like I need a one letter prefix
Except for “!”, “/“, “?” etc
why one letter
All people love one letter prefixes
Who needs myepicbot! as a prefix
I don’t really understand long prefixes
no bots will respond to prefix
All one letter prefixes are common and the chance of other bots using them is very high
so that doesn't solve your problem
That’s not a problem
For me
Then use !
It’s too common XD
bruh
It’s not as common as / for example
/ is definitely the most common one
I need an uncommon, easy to find on keyboard (on mobile too), one letter prefix
\
No lol, I think ! Is more common
Hard to find on mobile
yup
It’s not hard.. it’s just...
--?
You have to click multiple buttons to access \
A good idea
You have to press multiple keys for almost all of them
your bots name?
Starts with k
:(
You have to press multiple keys for literally all of them except /
] maybe
or [
'
Same... :/
what that's one button press
There are multiple quotes
allow all quotes
It can be ‘ ’ ` “
just use k
Hm
then it doesn't look like you're interacting with a bot
k! or \k
¯_(ツ)_/¯
Two letters unfortunately
who cares if you look like not interacting with bot
k porn
👀
well nvm
but that's 2 characters
I think it’s the only way to go...
Like it’s fast to press
It’s the same letter
Just you have to press it twice
- it’s easy and quick to type on desktop and mobile keyboards
- it’s more unique than / or !
Where are top.gg common prefixes listed. I can’t find the message with this info
I have my bot wanted to add a role, but if it fails, I usually return it, example:
try {
addrole()
} catch (err) {
return;
};
// If it fails to add the role and I don't want it to return but instead continue with the code, should I catch it as false?
.catch(err => false);
Yea, you can just
const add = await addRole(...).catch(() => null);
if (!add) // do something if it fails to add role
...```
or if (!(await addRole(...).catch(() => null))) ...
I wouldn't one line that
anyone know lavalink?
because you suck
someone help :c


so if (client.shard.ids.includes(0)) { // something }
what ever is in this condition should work for all shards right?
lavalink seems to be connecting to only 1 shard
No
only the first shard
Or, more like, only in the client which controls the first shard
shut up
no
any ideas?
why?
bc I want to cache a lot of data in the variable
What's webhook?
thats a file, where functions are saved
ignore it
webhook.cache = new Map() ? is this okay?
Depends on what webook is... that's why I asked you
if it's an object then yes
if it's a primitive value then no
the functions are in a class
Then why don't do webhook.cache in the constructor?
like createWebhook, deleteWebhook
this.cache = new Map()
in a class?!
yes thats what I meant, how do I define it as a static property?
static cache = new Map()
lemme try
in
class test{
static cache = new Map();
static async fetchGuild(guildid) {
cache.set(guildid)
}
}
module.exports = test;
const test = require("./test.js")
the map is empty
also tried with this.cache.set
can you even modify a map thats static?
like an array, it should change its size in memory
so it wouldnt be static anymore

dafuq. so if i put my dbl webhook which listens to votes it only works for the first shard?
I tried but the map is empty
Static not in that sense
cache.set(key, value)
cache.set(guildId, somevalue)
I know how map works lol
xD
this.cache.set(guildid , newguild)
``` did this
but the map does not have a key on fetch
yes, I checked with cache.get, if it has a a value lol
imagine using discord.js
Detritus 

^^


there cannot be a single day whitout erwin talking about detritus

lies, yesterday i was off
its a universal law
how dare you be illegal

Because Erwin needs cash every day... rich kid u know 
100 bucks per day
oiliy got nothing on me with his fancy island
yesterday was not a real day
lol
it was a dream
lmao Tim
Wut?
reverse psychology
I don’t get that
staph!
Starring like look at something?
lol
Oh lmao can’t even see reacts
wut
They been blocked in my network

Yeah just takes useless space
And I’m too old for that shit anyway you know, Tim?
Old ass...
good, none of them were put on starboard
That explains what that channels is for... was always wondering lmao
it needs at least 4 stars to go to starboard
3?
ye
starring me is fine, just dont star people talking mad shit about me or my detritus ads
Oh that’s preparing to a possible ban evade
xD
Let’s ban Tim!
my alt is uvuvwevwevwe onyetenyevwe ugwemubwem ossas
Yeah lmao
talk shit git shit
get rekt
regarding Erwins daily ads, here's mine, Tim
it landed in starboard 
what ads do you do?
its not a full day without this
what do you use as database?
@opal plank do you look at that every day to make your self feel better?
well can't screenshot the whole panel, too much secret stuff you know
in a way, yes
nice

Take a look at X and watch the timestamps lmao








