#development
1 messages · Page 123 of 1
You replace that code that replies to the interaction with my example
Example:
If(command){
let msg = await interaction.reply("text")
msg.edit("text123")
}
You need to fetchReply() right?
I spent a lot of time on "what the font" and similar sites but couldn't find it.
Me? No, I'm basically making a card game with canvas, but if a button is clicked its using a collector to grab that event and re-draw a new canvas and update the existing message.
but that could happen as many times as it takes for the hand to be over.
hence the multiple edits
Yes, but in order to work on the message that the bot sends, you have to fetch it
I even entered the letters that are different from the normal fonts one by one, but the result did not change.
Not if you defined it like in my example
look at 7
I'll give that a shot and see how it works out. Thanks!
if you have time (and patience), you could create your own font file
like, just the 36 chars (A-Z and 0-9)
you just need one sample of each char
it'll likely be faster than trying to make the OCR work without the source font
convert the pictures to vectors (easily done on inkscape)
then use a font maker tool to assemble a font file
this really need a patience
Learn how to make your own font using Adobe Illustrator. Follow these 6 steps to design a typeface that’s totally original and ready to use.
the "export as svg files" is the easiest part, as inkscape can automatically extract vectors from images
thanks for your help you really helped a lot
yw
Is there any way to indicate how big a streamed file is to a browser so it can display a proper progress bar? like I know how to do it with uncompressed files but what if they are compressed? Is that even possible?
you will need to keep track of uncompressed sizes yourself
const fs = require('fs');
const Discord = require('discord.js');
const xp = require('/home/container/Src/data/xp.json');
module.exports = {
name: "xp",
run: async (client, message) => {
if (!xp[message.author.id]) {
xp[message.author.id] = {
xp: 0,
level: 1
};
}
// Calculate the amount of XP the user should get for this message
const xpToAdd = Math.floor(Math.random() * 10) + 1; // Random amount between 1 and 10
xp[message.author.id].xp += xpToAdd;
// Check if the user should level up
const currentLevel = xp[message.author.id].level;
const xpNeeded = currentLevel * 100; // Amount of XP needed to level up
if (xp[message.author.id].xp >= xpNeeded) {
xp[message.author.id].level++;
xp[message.author.id].xp = 0;
message.channel.send(`Congratulations ${message.author.username}! You've leveled up to level ${xp[message.author.id].level}!`);
}
// Save the user's XP data back to our database
fs.writeFile('/home/container/Src/data/xp.json', JSON.stringify(xp), (err) => {
if (err) console.log(err);
});
}
};
not working or showing anything in console
i did
const fs = require('fs');
const Discord = require('discord.js');
const xp = require('/home/container/Src/data/xp.json');
module.exports = {
name: "xp",
run: async (client, message) => {
console.log('XP command triggered'); // Debug statement
if (!xp[message.author.id]) {
xp[message.author.id] = {
xp: 0,
level: 1
};
}
const xpToAdd = Math.floor(Math.random() * 10) + 1; // Random amount between 1 and 10
xp[message.author.id].xp += xpToAdd;
console.log(`${message.author.username} gained ${xpToAdd} XP`); // Debug statement
const currentLevel = xp[message.author.id].level;
const xpNeeded = currentLevel * 100; // Amount of XP needed to level up
if (xp[message.author.id].xp >= xpNeeded) {
xp[message.author.id].level++;
xp[message.author.id].xp = 0;
message.channel.send(`Congratulations ${message.author.username}! You've leveled up to level ${xp[message.author.id].level}!`);
}
console.log(`Current XP for ${message.author.username}: ${xp[message.author.id].xp}`); // Debug statement
fs.writeFile('/home/container/Src/data/xp.json', JSON.stringify(xp), (err) => {
if (err) {
console.log(err);
} else {
console.log('XP data saved successfully'); // Debug statement
}
});
}
};
my bad for not providing that
nvm i forgot to add
customEvent: true,

Avoid using JSON files as a database, they're prone to corruption, use an actual database
Like PostgreSQL, MongoDB, ScyllaDB, CassandraDB, etc etc
thanks for the advice I will note that down
why no sqlite
sadge
XP command triggered
/home/container
undefined
~
console.log('XP command triggered'); // Debug statement
console.log(message); // Debug statement
console.log(message.author); // Debug statement
console.log(message.author.id); // Debug statement
is that right or it's just me?
message logs as /home/container? that doesnt look right
SQLite when you have to run in production: 
i run sqlite in production
well i dont handle millions of queries of course
but for small stuff sqlite best
do you know what's wrong with it?
show the code that does command.run()
it's a event
thus runs event code
const { statSync } = require("node:fs");
const directorySearch = require("node-recursive-directory");
module.exports = async(client, rootPath) => {
const clientEventsFiles = await directorySearch(`${rootPath}/Src/Events`);
clientEventsFiles.forEach(eventFile => {
if (statSync(eventFile).isDirectory()) return;
const clientEvent = require(eventFile);
if (clientEvent.ignore || !clientEvent.name || !clientEvent.run) return;
client.events.set(clientEvent.name, clientEvent);
if (clientEvent.customEvent) return clientEvent.run(client, rootPath);
if (clientEvent.runOnce) client.once(clientEvent.name, (...args) => clientEvent.run(...args, client, rootPath));
else client.on(clientEvent.name, (...args) => clientEvent.run(...args, client, rootPath));
});
};
this -> ...args, client, rootPath
is what goes here -> run: async (client, message)
and the way it works is based on the order
it need to be in the correct order
your orders are wrong
on the event you have args first, client second
on the run function you have client first, message second
Also not mentioning MariaDB... can't take Voltrex serious anymore
i also use sqlite in multiprocess projects
multiple threads accessing the same db
in production
:)

Get back once you write a fully standard-compliant C++ compiler in your favorite language, PHP...
Eww why would I want to do that
"One blocked message"

I suffer enough pain I didn't deserve already
So no, not goin to happen
<ref *1> Client {
_events: [Object: null prototype] {
shardDisconnect: [Function (anonymous)],
interactionCreate: [Function (anonymous)],
messageCreate: [Function (anonymous)],
ready: [Function: bound onceWrapper] { listener: [Function (anonymous)] }
}...
is this right for message to outinput
Nerdtrex
That's because you use PHP 🗣️💯🔥
lol, no it has always been good to me
that is a client
it says Client right at the top
i cant read 😭
smell it then
Don't worry most people can't do that here either :^)
i just want it to work
Or eating it... yam yam, tastes like Mobby Dick
i wouldnt even know where to start
Just tell your imaginary friends to read you the books
Ez 😎
lol
genius
you cant read but your imaginary friend can
so you open the book and start reading it
also, that sounds like something a wh40k ork would do
except they dont wanna read, just fight
Tim is high
I feel like someone's gonna take that message and add 's to Mobby 
yes
trolling on discord while participating in a java class online
You and you dirty mind, nobody would ever do that 
Based Tim
Surely 
Even worse than php
im learnign that java is hell and impossible to understand anything, so overcomplicated and overly abstracted
thank god i dont actually need to learn it
im learning about the teaching process (im basically an assistant teacher), not the language itself
indeed
students are learning about unit testing and integrated testing
using java + spring
Fuck Java honestly. Coffee cup looking ass language.
🦀🦀 Use Rust instead 🦀🦀
https://doc.rust-lang.org/stable/book/
Thank you for 100 subscribers (see my sub special):
https://youtu.be/ggSPd8DHeMc
seen many times, gonna watch again
Tf is this lol
btw from watching these classes
this is so true
everything they do is split into entitiy, controller, service, domain and what not
Ngl I would try to defend Java’s honor but I can’t even find a reasonable defense to these statements…
Is it slander if it’s true
like these are beginner students, learning a language for the first time, they started like 6 months ago
and already having to deal with all that abstraction crap, like mvc, hexagonal, tdd, bdd, architecture designs, etc (they are pretty much not understanding most of it, but pretending they do)
also whats up with java lib names
cucumber, spring with their beans, lombok, and other weird names
Rust is Inevitable
To be fair, Java is a great language for building fundamentals. You don’t usually start off by teaching beginners complex frameworks, but I admit that the Java frameworks that exist are very pattern-based and can sometimes be very difficult to work with
Java is easy to understand because it’s minimal, but that’s what also makes it more difficult to work with in larger codebases
what im seeing in this particular class is that stuff like decorators are heavily used, and those decorators are not very well explained
well maybe they were explained in other classes before that i didnt see
but i have a feeling that a big part of it feels like magic for the students
Decorators are definitely not a beginner topic
But the idea is that it’s just mostly syntactic sugar for interface implementation
ye
I’m sure the college process is a lot different than high school, but for our classes in high school they definitely built a very good foundation
Also we’re forced on to Java 8 so we don’t have fancy features like decorators lol
the students are being tasked with building simple webservers, and they are doing everything with @autowired and @AllArgsConstructor and a lot of other stuff from Lombok
also, using docker for everyting
Ouch
One message removed from a suspended account.
use dictionary instead of looping over a list each time (I think you know this)
i have this url
blob:http://localhost:3000/a5df9e7b-1557-4cb3-aa1b-d6c690225dfe
which i got from req
how can i save this in public folder in nodejs
i just want to make a client-side web app in peace 
can anyone help me where i did mistake in thsi code coz its not working
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates,GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessageReactions] });
const { token } = require("./config.js");
// const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const roleName = 'muterole1';
client.once('ready', () => {
console.log('Bot is online!');
addRoleToChannels();
});
async function addRoleToChannels() {
const guildId = 'SERVER_ID';
const guild = await client.guilds.fetch(guildId);
const role = await guild.roles.create({
name: roleName,
color: '#630909',
permissions: []
});
guild.channels.cache.forEach(async (channel) => {
try {
if (channel.isTextBased() || channel.isVoiceBased()) {
await channel.permissionOverwrites.create(role, {
SEND_MESSAGES: false,
VIEW_CHANNEL: false,
SPEAK: false,
CONNECT: false,
});
console.log(`Role added to channel: ${channel.name}`);
}
} catch (error) {
console.error(`Failed to add role to channel: ${channel.name}\n${error}`);
}
});
}
client.login(token);
add debug lines
@rustic nova i was just curious about how does top.gg store the images ?
images like bot logos and other stuffs?
by using discords cdn
all images used in your bot page are fetched from discord and hosted by discord
oo
i thought were storing it on any server
like i am actually searching for a way so i could just store images and then use them for a site any idea for the build?
use cdns such as akamai
or cloudflare provides cdns too
content delivery networks, allowing you to store and cache images
so in this case i would use the images not by base64 string but by cdns right?
unsure how cdns actually handle the data itself, but images would probably be stored in base64 for easier delivery and database use
might suggest not re-inventing the wheel about cdns but rather use an existing ones
thats the problem if i store images in base64 i would need a tons of gbs to store it
cause 1 image if approx = 5mb the base64 strings would go high and would cause delays
so you'd do with the files itself
It uses next/image
wont the server start again and again on chnages?
using Next.js image optimization
it means faster loading and caching server side
i use it myself and its great
also allows for fallback options, like they do
ya i got to know about that b/w thanks
import Image from 'next/image'
<Image
src={bot.icon}
width={128}
height={128}
fallback={/*idk something here */}
/>```
its like that
they also use Chakra's avatar component
which works well together
i actually wanna store image
like :
user would upload image >> get it stored in my db >>> get it used on server back
problem : dont wanna do in base64 storage
, cant use multer cause it would start the server again on every upload due to the chnages and the next app also wont recognise it
dont store image in DB
use something like Cloudflare R2
cheap, virtually free unless you store a lot of stuff (like 50gb+)
iirc its 10gb free anyways
i have an image host (pretty much dead) storing 10k images and videos for just under 4gb
you can store in DB the location of the image
ahh do i need to pay them to use it or i do get some free trials?
nope no payment needed
cheap as fuck
10gb free then $0.01 per gb after
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
10gb free holy
guess I found the alternative to using github as a cdn
what do these class A/B ops mean?
Can someone suggest a good site to host my bot at
Bot isn't staying on idk why
No errors..
afaik they are requests
it's not staying on because it's a software like any other - once you close the console, it's over
yeah but like, what do "mutate state" and "read existing state" mean?
like edits?
see there
it's basically read/write ops then
welp, at least the limit is big enough, and I do caching anyway
Bro?
We can host bots
On websites
no, but you can on virtual servers
How does bots like dank,carl stays on forever
by hosting on virtual servers
like hetzner, contabo, oracle, digital ocean, galaxygate, etc
make a guess
No ig
Ok then what does websites like uptimerobot does
and being oracle, they can cease the services at any moment
Or betteruptime
they used to keep glitch/replit hosts always online, but it's now a ToS violation on glitch
replit might still work, but the performance aint very good
yep they stopped all my servers 
my API that handles over 1.5m requests a month was deemed inactive 
lmao
luckily i have 3 api nodes, the load balancer auto migrated to the other 2 servers
I use replit..
Why not give it a try
I can't afford any payments for now to host
I mean, by "payments" we're talking about like $7 per month
but replit will suffice if your bot is small enough
One message removed from a suspended account.
One message removed from a suspended account.
i dont i have a pterodactyl panel xd
@north cairn
ah yes
lemme just compromise my bots integrity by giving someone else access to my bot
Do you even know what Pterodactyl is?
yes I do
One message removed from a suspended account.
well you arent giving him alot more access than he would have with just knowing the ip
because ptero containers dont run as root so you cant escape
bro what
i zipped something up with winrar
and its like
4-5x bigger than the original size
unless u bought winrar for some reason
added a file
i cut a video
in parts of 10 mins
and i put the original video with the zip
😃
video cant be compressed (it already is)
no
packing it togetha
ah ok
highly recommend 7zip then
it's faster, smaller, better and doesn't break the law
It doesn’t break the law to use winrar past it’s “free trial”. It was a marketing strategy, there isn’t any repercussions for using it past the expiration date
it does, they just don't bother with small users
fuck discord, gimme the inline urls back
this line specifically
tbh the entire license is talking about purchasing it
man... just download and insert the fucking rar.key file and that's it
djs try not to have 15 major breaking version changes in 2.3 nanoseconds challenge (difficulty impossible)
they even made breaking changes to their website and docs lnao
bro i think i really did it 😃
I guess I shouldn't have made it white 💀
but i don't think it will be a problem
It won't, as fonts are vectors
tho I can't see a thing in that image lmao
Nevermind 😃 i just need to convert to ttf file
first I took it apart from photoshop and put it in illustratore as transparent png, I think this creating a problem
any ftp extension for vsc?
i use this one
thx
Help do bot
What do you need help with?
-pins
@still thunder
the bot
Help create bot pls
not specific enough
Almost nobody here is going to be able to help you with a bot designer program, they're pretty bad and restricting
What bad ?
Not to mention you have not asked a specific question, we can't do much with "Help create bot"
Are you broke af? If yes then look at app store or Google play for a coding platform if not then download visual studio code for mobile
yes, they are allowed
just make sure you don't set a video thumbnail as an image inside an embed
Yes they are
Why is that?
it would get rejected for showing nsfw images in a non-nsfw channel
oddly enough, if you put the image as the embed thumbnail, it should be okay
but it's safer to just not include any image in the embed
Alright good to know thnx xD
Does anyone here have experience with discord-hybrid-sharding? It's an amazing tool but with TopGG it seems to report incorrect numbers (1k members when there's about 36k). Had to revert back to discordjs sharding manager for the mean time but hoping someone has some ideas
isn't that @tired panther's package?
How are you posting the stats?
Why is in <code> ?
Code:
<body>
<style>
@keyframes textAnimation {
0% {
background-position: 0% 50%;
}
100% {
background-position: 100% 50%;
}
}
.h1-gradient {
background: linear-gradient(
to right,
#738adb 20%,
#ffffff 30%,
#738adb 70%,
#ffffff 80%
);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
background-size: 500% auto;
animation: textAnimation 5s ease-in-out infinite alternate;
}
</style>
<center>
<div class="part1">
<h1><span>👋 Hello, </span><span class="h1-gradient">there!</span></h1>
<span>Welcome to the GuildManager page. Find out more about how it works and how useful it is</span>
</div>
<div class="part2">
<h2>🤖 What is GuildManager?</h2>
<span>GuildManager is a system offering you to get your own Discord bot completely free of charge.</span>
<span>It offers continuous hosting and has multiple commands that you can embed into your bot because yes, you and only you choose which commands you want your bot to have!</span>
</div>
<div class="part3">
<h2>❓ How does it work exactly?</h2>
<span>It's simple. If you want to set up your bot with our system, just run the command <b>/setup new</b> and include your bot's identifier and token.</span>
<span>We then install your bot and once that is done, you will have access to the monitoring and management commands for your bot.</span>
</div>
<div class="part4">
<h2>💽 Are my data protected?</h2>
<span>Yes, it is a requirement.</span>
<span>All the data of your bot that you transmit to us or that the bot transmits itself are 100% secure in a database where only the sole developer has access.</span>
<span>In addition, the data is end-to-end encrypted, which further secures your use and the behavior of your bot within Discord servers.</span>
</div>
<div class="part5">
<h2>Can I access the files that my bot runs? Can I access the files that my bot runs?</h2>
<span>No it's impossible.</span>
<span>We can't afford to give you access rights to the files your bot is running.</span>
<span>On the one hand since they are our property and on the other hand, this will represent a major risk for all the bots that we propel since all the data of all the instances that we host are common but not accessible.</span>
</div>
</center>
</body>```
I don't have <code> key here
@earnest phoenix do you host the website somewhere
yeah so the thing is you are using md
iirc center tag can only be used with text and imgs and not divs
or not
hang on
just remove the spaces
<body>
<style>
@keyframes textAnimation {
0% {
background-position: 0% 50%;
}
100% {
background-position: 100% 50%;
}
}
.h1-gradient {
background: linear-gradient(
to right,
#738adb 20%,
#ffffff 30%,
#738adb 70%,
#ffffff 80%
);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
color: transparent;
background-size: 500% auto;
animation: textAnimation 5s ease-in-out infinite alternate;
}
</style>
<center>
<div class="part1">
<h1><span>👋 Hello, </span><span class="h1-gradient">there!</span></h1>
<span>Welcome to the GuildManager page. Find out more about how it works and how useful it is</span>
</div>
<div class="part2">
<h2>🤖 What is GuildManager?</h2>
<span>GuildManager is a system offering you to get your own Discord bot completely free of charge.</span>
<span>It offers continuous hosting and has multiple commands that you can embed into your bot because yes, you and only you choose which commands you want your bot to have!</span>
</div>
<div class="part3">
<h2>❓ How does it work exactly?</h2>
<span>It's simple. If you want to set up your bot with our system, just run the command <b>/setup new</b> and include your bot's identifier and token.</span>
<span>We then install your bot and once that is done, you will have access to the monitoring and management commands for your bot.</span>
</div>
<div class="part4">
<h2>💽 Are my data protected?</h2>
<span>Yes, it is a requirement.</span>
<span>All the data of your bot that you transmit to us or that the bot transmits itself are 100% secure in a database where only the sole developer has access.</span>
<span>In addition, the data is end-to-end encrypted, which further secures your use and the behavior of your bot within Discord servers.</span>
</div>
<div class="part5">
<h2>Can I access the files that my bot runs? Can I access the files that my bot runs?</h2>
<span>No it's impossible.</span>
<span>We can't afford to give you access rights to the files your bot is running.</span>
<span>On the one hand since they are our property and on the other hand, this will represent a major risk for all the bots that we propel since all the data of all the instances that we host are common but not accessible.</span>
</div>
</center>
</body>
❤️
Yes
suppose i copy a channel and delete the original channel
would this new channel have the same id as the oc one
No
O
How add bot?
i see
"same id" will never a case regardless of what you're referring to
ids are unique, so "same" doesn't exist
this should correctly parse the accept-encoding header into the best choice, right?
https://pastes.dev/Vqy61MWGmY
Hello
using the autoposter, doesnt let me use the cluster manager as a param though
could you send the link of the package
Auto-Poster for Top.gg. Latest version: 2.0.1, last published: a year ago. Start using topgg-autoposter in your project by running npm i topgg-autoposter. There are 2 other projects in the npm registry using topgg-autoposter.
Top.gg Auto-Posting made easy. Contribute to jpbberry/topgg-autoposter development by creating an account on GitHub.
overwrite the code with:
const poster = AutoPoster('topggtoken', sharder)
const { getStats } = poster;
poster.getStats = async () => {
const stats = await getStats();
stats.shardCount = sharder.totalShards;
return stats;
}
Wrote the code from top of my head, no guarantee it will work
there are plenty of free code editor apps iirc
but for you to properly do code you will need your phone set up
you will at least need a terminal
but out of all that i'd recommend having a compooter
whats that
that's likely to result in an infinite loop
Thnx I’ll try it later xD I’ll let you know if it worked xD
clan?
it is
With 700 people 😈

token grab?
clan for what 
what
Yes
that sounds sussy
@rustic nova sussy topic here
bruh
never thought trolls would be in #development

Lol
🧑🌾
nope, getStats is a local reference it theoretically should not be overwritten. But let me test it 
ah ok
will this make sure everything it outputs is at max 64kb?
class PassThrough64K extends Duplex {
constructor() {
super({
read() {},
write(chunk: ArrayBuffer) {
let chunkCount = Math.ceil(chunk.byteLength / size(64).kb()), index = 0
while (chunkCount) {
this.push(chunk.slice(index, index + size(64).kb()))
index += size(64).kb()
chunkCount--
}
}
})
}
}```
(when passing in ArrayBuffers)
did you mean this for me? ;o
yes 
- The
forEach()method doesn't wait for promises to resolve, use aforloop, unless you don't care about that - In this case that
filevariable will be initialized in every iteration, so it'll always be0regardless of you incrementing it, put it outside theforEach()call
(Also incrementing inline inside of a function call can be difficult to read, but you do you)
I need help with making a bot
I want to make and add this to my server but I have no idea on how to do it
Have you tried reading https://github.com/xAlamaos/ChatGPT_Discord-Bot#setup ?
Okay, im gonna check it
-upto
@runic junco
When will my bot be reviewed?
Currently our average bot reviewal time is around one week or more.
Because of this — and because some bots take longer to review than others due to their features — we can't guarantee your bot will be reviewed as quickly as someone else's in the past and we also can't guarantee your bot will be reviewed within that timeframe. There is no exact time for how long bot approval can take. There is no way to check your bot's position in our reviewal queue, but remember you're not first and you're not last!
You may edit your bot's page as much as you like both before and after it's reviewed and this will have no impact on its place in queue.
You can read more about our bot reviewal process in this support article: How the Bot Reviewal Process Works.
In the meantime, please make sure your bot follows all of our Bot Guidelines for a quick and smooth approval!
I'm completely new to this.
does anyone know a good button style, color, etc for java?
that will match my background cuz i am lost
javafx
Sure, have you tried following the steps? If so what step are you stuck at?
No, like I have no idea where to start. I've never touched github, and I don't know how to code. I'm under the assumption that it's already there, and all I have to do is somehow make it into a bot.
That bot's code is already there, all you have to do is create a Discord bot application, get it's token, and store it, and also create an OpenAI platform account, create a new secret, and store it, and finally run the bot
It doesn't require any knowledge of GitHub nor coding, just follow the steps, it's very straightforward
So the first thing I have to do is fork it and just add everything on that, right?
and the rest is what you've just explained
You can choose to fork it but that's not necessary, you can just directly clone the repository using Git
Though if you want to fork it then make sure to make it private, or else others would be able to see your credentials
You're welcome
sure, used them for 3 years, worked pretty good
Did u see the new ARM cloud servers?
Incredible performance at a much lower cost like I heard
on galaxygate?
Nope
where
ah lol
pretty nice
2 cpus and 4gb for the same price as 1 cpu 2gb
no US locations yet tho
Not yet but soon
Sooner or later a lot of stuff will probably port to ARM
Or literally rewritten
I mean the efficiency of this architecture is a lot better
Dunno much applications that require a high single core Glock other than gameservers
It will most likely become the future technology for the next few years
One message removed from a suspended account.
Ah lol
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Didn't even notice but auto correct is doing fun stuff sometimes
does someone know why after compressing data on the server the uncompressed result that firefox gives me is like totally different? im using zlib in node
https://www.diffchecker.com/AEe7gQrX/
mostly letters are flipped or completely different
My chrome suddenly started using 100% of the CPU for a couple of days now and has been laggy, any reasons as to why?
press shift+esc
lmao
Alright, I've pressed such so.
so look for which tabs are using a lot of cpu and ram
maybe theres a leak in one of them
I have to monitor, right?
or an infinite loop, or a crypto script idk
if you order tabs by cpu should be pretty obvious
all tabs that are not active should use 0%
Hmm, I'll see what stats show next time I lag.
Yeah, it lagged once again and even the Task Manager for Google Chrome lagged. 😂
It updated once and got this.
And it crashed, chrome just closed its process. I re-installed Chrome, hopefully it's fixed now.
GPU process is for graphics rendering, often used by video players
it should not be running on its own, there is usually always something else using it
Yeah, however, it keeps going like this then crashes:
Browser increases in memory footprint then closes the entire chrome process.
I know there’s some webpages that have memory leaks somehow and cause my browser to fill up on memory until I eventually crash, it could be a tab you have open
Browsers also use gpu for acceleration
There's a setting to disable that tho
But it becomes sluggish, esp on windows
yeah sometimes there are weird bugs about it
ive seen both "fix this by enabling hardware acceleration" and "fix this by disabling hardware acceleration"
Help… with what?
In discord.js v14 you need to add const { channelType } = require("discord.js") then you can do canalTexto.type == channelType.guildText
If I remember correctly
@wet wedge
is discord v13
Then it should work xD
I don't think it works it is discord v13 and what that function does is to get where the slash command was sent and send the embed message where the command was launched.
But your vanTexto won’t return true
No I’ll give you an example hang on
You can send the embed like this interaction.reply({ embeds: [embed]})
If you already replied to the interaction you can send it like this interaction.channel.send({ embeds: [embed]})
Remove the if statement
You don’t need to check if it exist or if it’s a text channel because in order to execute a slash command those are required you can’t send a slash command in a voice channel and you can’t send a slash command in a channel that doesn’t exist
I didn't understand but I'll show you the complete code
I have been having this problem for 4 hours 
but what's the error
Remove this if (canalTexto && canalTexto === 'GUILD_TEXT') {}
they must log something in the console
It probably doesn’t run because the statement isn’t true
nah don't do the "probably"
Alright your choice xD it doesn’t run because if it
first, click on the line of the statement to assert breakpoints
then hit F5 to enter debug mode
run the command again
You don’t need to check if interaction.channel exist because it needs to exist to run the slash command xD
@peak drum could you connect and see my screen on the voice channel?
Why?
did you understand the code you wrote
Im not sure about interaction.guild.me
again, try debugging first
that returns the bot user in the guild that the interaction originated from

what are you waiting for? test it
prove what?
that's not debugging
stop the instance, hit F5 in VSC
now we are talking
XD
now revert the code to original
okay see that line 16 in editor?
hover on the line number to reveal red dot, click on it
Yea goodluck xD
????????
hover on this thing
I don't understand
do you see the line numbers????
you lost me at the part of removing the if
Did you write the bot yourself?
ah
the point of the debugger is to inspect runtime behaviour
the line numbers are on the left
i want you to hit a breakpoint at line 16, where the if statement lied
Who uses debuggers? Just know every possible way your code can error
@wet wedge not debug console, the code editor
@wet wedge
see the gray "16" on the left??
hover on it
those are line numbers
YES
but I don't understand what I have to do
click on that red dot to insert a breakpoint
hover on the line number
and click
DAMNIT
look at my stream again
xD or debug it with console logs 😂 that's what i do lol
yeah good
now, run the bot again
and then do the same thing that lead to your problems earlier
by running a command idk
then the program will hang (it's fine because the breakpoint has been hit)
yeah now redo what's causing your problem
instead of showing me the logs
okay
wait
hover on the variables
like canalTexto
And now?
HOVER ON IT
see its value
this thing
hover on the variables
do you get what i say
hover on this exact thing
so the channel is present
now hover on this
or scroll down to see the type field
hover on "type"
for me
thanks
yeah you see
try defining the canalTexto like this ```js
const canalTexto = interaction.guild.channels.cache.find(c => c.id == interaction.channelId)
the value is GUILD_VOICE and you were comparing equality with GUILD_TEXT
so the comparison failed and the block never ran
who the hell uses ==
also don't use that
xD
the cache is already a Collection
you can use .get
@wet wedge don't do anything
at this moment
module.exports.run = async (client, interaction) => {
const player = client.poru.players.get(interaction.guild.id);
if (!player) return;
if (!interaction.guild.me.voice.channel) {
player.destroy();
} else if (interaction.guild.me.voice.channel.members.size === 1) {
// Si solo hay un miembro en el canal (el bot), detener la música y desconectarse
player.stop();
player.destroy();
const canalTexto = interaction.guild.channels.cache.get(interaction.channelId);
if (canalTexto && canalTexto.type === 'GUILD_TEXT') {
const embed = new Discord.MessageEmbed()
.setTitle('Música Detenida')
.setDescription('No hay nadie en el canal de voz. La reproducción de música se ha detenido.')
.setColor('#ff0000')
.setTimestamp();
await canalTexto.send({ embeds: [embed] })
.catch(error => console.error('Error:', error));
}
}
};```
canalTexto.type is GUILD_VOICE
and it's not GUILD_TEXT so the condition canalTexto.type === 'GUILD_TEXT' failed thus the block did not execute
that could happens because voice channel has its own text channel inside it
you might want to change the condition
do not hit me 
i assume you can write that code means you have some familiarity with coding itself and the ide you are using
smh
I still don't know what to remove or put in the code. 
big question.
did you write all this by yourself
no, I had 3 friends who helped me but they left the project and I am the only one trying to keep it afloat.
did you actively participate in the bot's coding
if not, you should learn now
what you were using are old js
I only did the headler and the commands, to each his own
module.exports was for CJS legacy
time to learn js
I do know how to use js but I use this one because it is easier for me.
learning something new for me is very difficult and even more difficult to put it into practice.
you were struggling to use a code editor
is question?
What should I put? 
canalTexto.type === "GUILD_VOICE"

cloned bot lol
aurel smelling cloned bots from a mile away lmao
what do you mean
Bot cloned from github
with code do you mean translations
When changing to v14, you will have to rewrite even more code yourself
no
several functions of the code such as skip and play did not work and we had to rebuild the code.
and almost all the code was obsolete
we also added embedded messages and adapted the code to make it work.
we only use the event structure
😂
There's nothing NSFW on YouTube 
human anatomy educational videos: my time to shine has come
SORRY
we modified the whole code as well as how it works, not just translated it and put embeds in it.
this havent figured this out, anything over like 500 (?)kb randomly gets content-encoding errors
thats weird some of the letters get changed and its not in a predictable order
can you give a bit of detail and steps on what you do to go from compressing to decompressing and seeing the result?
well decompressing is just typical browser stuff, nothing special, for the server it worked fine until I started respecting backpressure of streams, so Im pausing when I hit the backpressure of my writestream (not actually one but the same rules apply) and once I wrote my data I resume it: https://pastes.dev/U7RDKLiiPQ
so everything works fine when you dont pause/resume the compression?
yeah, I suppose the 500kb limit is just when backpressure starts being too much
can anyone help me?
If you don't tell us what we're supposed to help you with, how are we supposed to help you?
is about this
for some strange reason it does not send the message of the new video uploaded
sorry
hey man we don't allow code screenshots here
It's against our morals
forgive me, but I'm not a man hahahah, and secondly I didn't know
Put a few logs in your code to see if it works and how far it goes before it stops unexpectedly
that's why he said strangely it doesn't stop
Huh?
she is prolly not calling the function
shows a quota exceeded error
oh
There's an interval at the bottom, so it should
that's on the api u are using
just seen it
How do I avoid the quota overrun?
which api is throwing that?
it's basically against their rules to do so, there is a reason for the quota
That's coming from the YouTube API you're using, it means that you've reached the maximum amount of times you can make a request to it for today or for whatever duration it has set
you might try to set the limitators for your users tho
Youtube Data API V3
Oh, and how do I get the last video uploaded?
Projects that enable the YouTube Data API have a default quota allocation of 10,000 units per day, an amount sufficient for the majority of our API users
here is a listing of their quota "cost"
so you can sort of manage
is there another way to get it but without the api?
unsure
:c
@fallen talon you're making a request to their API every 10 minutes, I would recommend making a request every 30 minutes to avoid exceeding the quota as the YouTube Data API is pretty strict about usages
Or you can request for a higher quota
https://support.google.com/youtube/contact/yt_api_form
mmmmmmmm
but I need it to update and send the message when it is uploaded.
:c
That's a bit of a though luck then, the YouTube Data API gives you 10,000 quota points to spend on API requests, each time you make a request to the search.list endpoint, it costs 100 points, basically you can only make 100 requests
:c
The only thing you can do to avoid that issue is to scrape data from YouTube but that goes against their ToS
What if I don't use the api?
How can I train a font in tesseract.js
That's what I meant by scraping
mmmm, and what can I do? I need that function in my bot
What can I do?
Well there are things like https://www.npmjs.com/package/scrape-youtube and https://www.npmjs.com/package/youtubei that you can use but I can't really help further as it goes against YouTube ToS
i have a font file and i want to train tesseractjs
can I use axios and cheerio?
To train Tesseract.js with a custom font, you'll need to follow a series of steps. Here's an overview of the process:
Prepare Training Data:
Create training images for each character in the font. You can use software like Adobe Photoshop or GIMP to generate images with the desired font.
Generate corresponding ground truth files (GT files) for each training image. GT files contain the text that Tesseract should recognize from the training images.
Generate Box Files:
Use the Tesseract training tools to generate box files from your training images and GT files. Box files contain information about the location and size of each character in the training images.
You can use the tesseract command-line tool provided with Tesseract OCR to generate box files.
Create Training Data:
Combine the training images and box files to create the training data required by Tesseract.
Use the tesseract tool to create the training data by running a command similar to the following:
tesseract [image].tif [output-base] nobatch box.train
Generate Traineddata:
Use the training tools to generate the traineddata file, which contains the trained model.
Run the following command:
unicharset_extractor [output-base].box
mftraining -F font_properties -U unicharset -O [output-base].unicharset [output-base].tr
cntraining [output-base].tr
combine_tessdata [output-base].
Train Tesseract.js:
Now that you have the traineddata file, you can use it with Tesseract.js.
Include the traineddata file in your Tesseract.js project and use it for OCR recognition with your custom font.
Please note that training Tesseract is a complex and time-consuming process that requires a good understanding of the tool and the training data preparation. It may require multiple iterations and adjustments to achieve satisfactory results. For more detailed instructions and examples, you can refer to the Tesseract documentation and training guides available online.
i completly replaced those with fetch that comes from the node it self rn
we like to not be google here, try to explain with your own words as much as possible ;)
What?
or chatgpt
what node version are you using
the truth I asked bard
18
I asked bard if I can use something else instead of the api and those liberias came up.
I don't understand this fetch thing
I also know how to google, if I understood, I wouldnt have asked you anyway
I know but first you search in forums and if you don't find something that gives you an idea now you can ask for help.
I learned it the hard way
Yes though avoid using Axios, use the global built-in Fetch API, for example:
import { load } from 'cheerio';
const html = await fetch('https://youtube.com/@xQcOW/videos')
.then((response) => response.text());
const $ = load(html);
// Scrape
(@xQcOW being the channel username)
I will ask bard to make the structure for me.
I guess I put the channel ID here, right?
const YouTubeURL = 'https://www.youtube.com/c/TU_CANAL/videos';```
Correct, replace TU_CANAL with the channel ID
it seems to work

imagine watching xqc vids
One message removed from a suspended account.
god this is so annoying
why the hell does this request returns 400 in Flask
POST /webhook HTTP/1.1
Authorization: Bearer asdf
Connection: close
Content-Type: application/json
Host: someurl.repl.co
User-Agent: topgg (https://github.com/top-gg/rust-sdk) Rust/
{"server_count":3000,"shard_count":null,"shards":null,"shard_id":null}
/webhook source:
@app.route('/webhook', methods=['POST'])
def webhook():
print(request.headers['Authorization'])
print(request.is_json) # True
data = request.get_json() # fails here
print(data)
return 'OK'
request.get_data() yields b'' 
wth is wrong with Flask
You’re doing something wrong
yeah but idk why
what's wrong with this json string
{"server_count":3000,"shard_count":null,"shards":null,"shard_id":null}
But nah seriously let me take a look real quick
Nothing inherently looks wrong with that
Where is this data coming from?
It might be that the api itself isn’t getting sent valid json
damn i must be blind
Ask chatgpt sometimes it truly helps
Just ask what could be wrong with your code and it gives some reasons as of why and provides you with an example of how to fix it
It doesn’t always work but it’s worth a try
have you ever tried... debugging?
Yes I did xD but to lazy
But most of the time it does
your code might reference other parts outside of it
use debuggers
you never know if llm introduce another vulnerability to your code
even so, having a wrong direction to aim into is also wrong
circle down, inspect values
atop being lazy
i did a million times
with print() statements
still didn't work
Lmao that is how I debug 😂
like literally halt the program's execution to inspect
how do you assert breakpoints
with print it just continue running
click on line number
and make sure you have a debugger installed
i'm not using vscode
Where can I share code??
i'm on the replit editor here
even replit has debug
click on line number
use a pastebin website
I'm asking for this server
huh
then send a pastebin link
duh
if your code's short you can send here
depends on what
there is also #topgg-api if you have problems about it
for other stuffs then this channel
again
back to the problem
request.get_data() yields a b''
despite the request content being ```
POST /webhook HTTP/1.1
Authorization: Bearer asdf
Connection: close
Content-Type: application/json
Host: theurl.user.repl.co
User-Agent: topgg (https://github.com/top-gg/rust-sdk) Rust/
{"server_count":3000,"shard_count":null,"shards":null,"shard_id":null}
I posted in that channel
that's response returned by the server
have you tried on other clients (like postman / insomnia... etc)?
HTTP 400 (Bad Request)
maybe get_data doesn't parse the entire body
it does parse the entire body
that's the point of request bodies
here's the request body as a rust string literal ```rs
"POST /webhook HTTP/1.1\r\nAuthorization: Bearer asdf\r\nConnection: close\r\nContent-Type: application/json\r\nHost: theurl.repl.co\r\nUser-Agent: topgg (https://github.com/top-gg/rust-sdk) Rust/\r\n\r\n{"server_count":3000,"shard_count":null,"shards":null,"shard_id":null}"
XD
What's wrong with xQc?
nothing
that's not a helpful question at all
send error stack trace and the code that you think is problematic
const { plural } = require('../Structures/Utils');
const { Client, Intents } = require('discord.js');
const { AutoPoster } = require('topgg-autoposter');
module.exports = {
event: 'ready',
async run(bot) {
// Set initial presence
let totalUsers = 0;
bot.guilds.cache.forEach((guild) => {
totalUsers += guild.memberCount;
});
bot.user.setPresence({
activities: [
{
name: `${totalUsers.toLocaleString()}`,
type: 'WATCHING',
},
],
});
bot.logger.success(`${bot.user.tag} is now logged in!`);
bot.logger.info(
`Loaded ${bot.commands.size} commands for ${bot.guilds.cache.size} guild${plural(bot.guilds.cache.size)}.`
);
// Update presence every hour
setInterval(() => {
totalUsers = 0;
bot.guilds.cache.forEach((guild) => {
totalUsers += guild.memberCount;
});
bot.user.setPresence({
activities: [
{
name: `${totalUsers.toLocaleString()}`,
type: 'WATCHING',
},
],
});
bot.logger.info(`Updated presence with ${totalUsers.toLocaleString()}.`);
}, 60 * 60 * 1000); // 1 hour in milliseconds
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const ap = AutoPoster('key', client);
ap.on('posted', () => {
console.log('Posted stats to Top.gg!');
});
ap.start();
},
};
Error: Missing Server Count
at Api.postStats (/workspace/FWbot/node_modules/@top-gg/sdk/dist/structs/Api.js:84:19)
at DJSPoster.post (/workspace/FWbot/node_modules/topgg-autoposter/dist/structs/BasePoster.js:64:18)
This is the code and the error
"discord.js": "^13.12.0",
line 84 of file Api.js
idk i guess it just works?
but then on top.gg website
it doesnt update
So what was the point of your initial message then?
sorry, i sent that when i just woke up

It's alright
Show your new code
I mean it works now
But the server count on top.gg isnt changing
does it take time?
That's literally why I'm telling you to show your new code, and it shouldn't log that twice at the same time
It shouldn't take that long to update I'm sure
then what does this do
Seome know where to advertise my bot?

Auctions on topgg
does anyone know if nginx respects proxy-authenticate headers in any way?
according to MDN, proxy-authenticate is a response header, not a request header
its only ever used when returning a 407 error
idk if nginx automatically adds it when returning a 407, but possibly not because the header is used to specify which authentication method is needed, which has to be configured
Runs the bot
- wrong
Oh
What happens when you reach 100 votes? I forgot.
$15 credit
guys whats the best tool for web scraping in javascript

what
Me when web scraping is against 99% of websites’ TOS’s
Well then tell us what website you’re scraping
a website
but i'm not anymore
because it's made so badly
too hard to scrape

cheerio
it's really good
it's basically jquery
pov: you write code with trial and error without learning
for (let key in data.tags.customizedTags) {
const pictureUrl = data.tags.customizedTags[key][Object.keys(data.tags.customizedTags[key])];
const pictureKey = key;
cursed
huh
messy as it looks, does what I want it to
looks fine to me
I think I made it too complicated
🧐
const pictureUrl = data.tags.customizedTags[key][key];
🗿
😱
guys can i ask a question
thank you
If it's made so badly that scrapping is too hard, then perhaps it's not made so badly
🧐
it is
it's just badly made
l website tbh
But it did succeed against a scrapping attempt
If you want to be a scrapper you need to understand that you're in the grey zone
Scrapping isn't illegal, but they'll do everything they can to prevent you from doing it
It might also be generated by some framework
this is not a corporate website the website is made with one of them website builders
React for example generates utterly ugly html
squarespace i think it's called
There's your answer then
It's ugly because it's generated
Html will only be readable if the site was written with html
how can i make it less ugly
You don't
As I said, if u wanna scrap you'll need to fight the environment
Nobody will make it easier for scrappers
^
so
give up
whats that
👿
what do you even want to scrap?
if its in the actual source, then its easy
it doesnt matter how ugly the code is, its just a matter of finding a substring in a string
if what you want isnt in th source, then its gonna be much harder
wym the source
what is the source
this does not help
In this full course, we learn how to build websites with HTML and CSS, and get started as a software engineer.
Exercise solutions: https://supersimple.dev/courses/html-css-course#exercises
Copy of the code: https://supersimple.dev/courses/html-css-course#code
HTML and CSS reference: https://supersimple.dev/html
Lessons:
0:00 Intro
1:02 1. HTML ...
Just 6h 🍿
Hey someone, plz help me.
So I created an add emoji command which adds an external emoji to the server, the code works perfectly with a non-animated emoji, but as I try this with an animated emoji, I get the error message (that I put in the catch err statement).
Please help me fix it.
My bot just respond with the reply that i put in catch err statement. I can't log error in the console since I am out of my city so I can't use PC
If anyone don't mind, then please try running this code with an animated emoji and tell me how to fix, please!
remember html classes?
yeah they are random (depends on UI library they are using)
either that or the class are gonna be extremely generic









