#development
1 messages · Page 2041 of 1
speedyos is kinda broken rn
optimised too many things at once without testing them
havent worked on it recently
speedymail is going good
i have worked on it 2 hours ago
almost done
just need to set up mail transferring, incoming mail, some buttons and settings pages
it uses my database which is the best part
when i need to use something i just add it to my database on the go
0 is a number
we love void******************************************************************************************
that's a lot of pointers
dereference them one by one to see what treasures lie
probably just garbage memory
pointer roulette
when will it reference Mozart 😉
with pointer defererencing garbage
This event doesn't send the message on leave.
Event:
@client.event
async def on_member_remove(user):
channel = client.get_channel(702285223634927626)
await channel.send("Oh no! Eggman convinced" + user + " to quit! We'll make him pay!")
Error:
File "main.py", line 35, in on_member_remove
await channel.send("Oh no! Eggman convinced" + user + " to quit! We'll make him pay!")
TypeError: can only concatenate str (not "Member") to str
Can someone explain how to fix it?
user is a Member object, the error says you cannot concatenate a string and a Member object
Python doesn't know that people actually want to see [Object object]
so how would i fix this?
USE F-STRINGS PLEASE
If you str() a User object, you get their username#discriminator representation
ok
any database recomendations?
it depends on your goals.
ty
is there a library that has the fromNow function like moment.js has, but just that function?
I mean if that’s all you want is that specific function then why not copy pasta it and make a function of your own?
i just made that
now it's this
i copied from this website
https://gomakethings.com/a-vanilla-js-alternative-to-the-moment.js-timefromnow-method/
use number === 1 ? "" : "s" instead since 0 should be plural
wait 1 is truthy so your code doesn't even work as intended
nvm
was looking at seconds lul
this is what i have now
I'd do this cause it's cleaner
let time;
if ((time = diff / ...) > 1) {
const ... = Math.floor(time);
}
for some reason eslint doesn't like variable assignment inside if statements
But that makes it a lot cleaner IMO
In groovy u can just do 1.day.from.now 
i'll get a java applet setup to do this
java applet run warnings aren't too bad
the internet has no location
Sometimes I wish someone made a react-like framework for groovy, it'd be a perfect language for making sites
Can benefit from java beefiness while being as dynamic as js (sometimes more)
someone has probably made something that transpiles to groovy to js at least
maybe someday
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Response>".] {
code: 'ERR_UNHANDLED_REJECTION'
}```
Catch ur promises
Other than that, that error doesn't say much besides "you're not handling your requests"
👉👈

embed.add_field(name="OTHER INFO", value=f"Channel: {message.channel.name} (`{message.channel.id}`)\nInvite link: {inv}\nGuild owner: {message.guild.owner} (`{message.guild.owner.id}`) [[Avatar]({message.guild.owner.avatar_url})]\n\n[Jump to this report!]({message.jump_url})", inline=False)
AttributeError: 'NoneType' object has no attribute 'id'```
python moment
Focus on one topic, too many general purpose bots exist already
Ik, its used as a moderation bot, It has majority mod commands with report, and suggestion and welcome being an extra as well as a who is command. But I feel as it needs to be better but dont know what to add
a dm command where a user can dm the bot with a channel id and a member id, and the bot will send in that channel hello @user, someone asked me to tell you to fuck off
I already have that
I can send a photo of my help command one sec
Im trying to figure out why my mute commands arent working
They dont errorbut they dont do anything
💀
I doubt it and I haven't seen it before, but is it possibly for the bot to edit it's own description? Not status, description.
if you do dark magic probably
I don't know how topgg changes the bots avatar automatically but my theory is that it's a self bot
Bot pfp is easy to change with just d.js but I have not seen desvription
o
desvription
USE MULTILINE STRINGS MA'AM
yeah i got rid of that and it worked
Poggers
i use djs now as i prefer it lots
so much faster
this is a bot i'm staff on and i'm the primary dev atm
because the other devs have exams (i mean so do i but i still dev)
f"{f'Guild owner: {message.guild.owner} (`({message.guild.owner.id})`)' if message.guild.owner else ''}"
Because fuck you
Ah I see
Smh procrastinator
lmao
does anyone know if there's a way to get the bitrate of an audio file without probing the metadata
ultimately using this data to approximate the track length and probing the metadata of the file can take a bit of chunks until it reaches the data I'm looking for
I'm trying to download a base64 image using axios, but whenever I send a request it returns null. I'm hosting a web server using ExpressJS, and getting the image base64 is fine. However, sending a request to download the image from base64 results in an error. The error I get is getaddrinfo ENOTFOUND image, with the url starting with data:image/jpeg;base64 since the image I'm sending a request to is in base64.
EDIT:
Fixed:
let data = file.split(",")[1];
let buffer = Buffer.from(data, 'base64');
fs.writeFileSync(path, buffer);
return;
<Guild>.me.permissions.has iirc
message.guild.me.permissions?
yep
alr thanks
how do i check if the bot has permissions to send message in a channel?
guild.me is global permissions right?
There is a permissionIn method iirc look it up on the docs I don't remember how it's used
thanks
can anyone suggest some alternatives to electron which dont use chromium ?
someone help
my bot is being rate limited. i have a lot of users..
does djs provide some monitoring tool to see all the outgoing and incoming request response from discord?
429 responses are avoided by inspecting the rate limit headers documented above and by not making requests on exhausted buckets until after they have reset. 429 errors returned with X-RateLimit-Scope: shared are not counted against you.
also can someone explain what this means
you can check out https://ultralig.ht/
it's not as feature rich as electron though
how do i check if i can send a dm to a user?
is there a method? similar to "editable" "deletable"
I don’t think so
You don’t know the user’s privacy settings before trying to send a message to him
So.. try/catch is your only option here
If I want to start learn web hosting, should I start with Apache or Nginx? (excluding difficulty)
so um, does djs not handle rate limit? like does it not prevent the bot from hitting ratel imit?
i read that discord.py has this implemented within the library
djs should handle rate limitations itself
Once you’re getting rate limited requests should be cached and sent when the rate limit is over
Correct me if I'm wrong, but djs won't cover all scenarios for ratelimits.
On a sharded bot some things may slip through and a ratelimit may occur.
For example, fetching users on two seperate shards may result in hitting the ratelimit.
,
,
,
well here's the thing
Global : true
Method : patch
Path : /channels/938065409368784896/messages/977925891843850240
Route : /channels/938065409368784896/messages/:id
Limit : Infinity
Timeout : 2000ms
Sublimit: None
Hit a 429 while executing a request.
Global : true
Method : patch
Path : /channels/660050649324453889/messages/977925873107861534
Route : /channels/660050649324453889/messages/:id
Limit : Infinity
Timeout : 2000ms
Sublimit: None
Hit a 429 while executing a request.
Global : true
Method : patch
Path : /channels/761762086619447357/messages/977925870129930292
Route : /channels/761762086619447357/messages/:id
Limit : Infinity
Timeout : 2000ms
Sublimit: None```
Im seeing this message in the debug event. im not sure what do i do with this
this is not even dms. let sending messages to channels..
how do i handle thousands of users 
oo, global ratelimits 👀
so.... whats going on? 
im completely lost
is it because too many users are using the bot?
I dont think so, do you automatically do something per channel?
ie sending a message or something automatically every few seconds?
yeah
i edit a message after 1 sec
or 1.5 sec
its like, i show a game then edit the status every 1 - 1.2 sec
thats very likely what's giving you the rate limit.
multiple users can invoke this game
you can send 50 requests per second, if you are doing something every 1 second automatically then 50 users is a global ratelimit
what do you recommend i do in that case, increase the patch delay?
i see
well how do i regulate in that case
what do i do

is there a way i can get discord to increase this limit?
there are atleast 1k traffic coming in
well, bots with millions of users dont hit this limit.
If your under 500k active users I doubt discord will increase it.
but thats an opinion.
The docs cover requesting an increase in global ratelimit.
https://discord.com/developers/docs/topics/rate-limits#global-rate-limit
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
i mean 50 req at the same time is very unlikely
well, if you are doing 1 edit per second per game.
and you have 50 games, thats the ratelimit
this is mostly the case
but how do i solve this

hi
its hard to say, I dont know how the bot works.
editing a message every second is generally a bad idea, even for one off things.
how about i edit them every 1.5sec or 2sec? cause i know a bot that does this and they seem to not have issues. well they in 300k servers tho actually even more probably
1.5 seconds or 2 seconds will give you more room to prevent ratelimits, but it still will get ratelimited pretty fast.
1.5 seconds will give you 75 active games before ratelimiting.
2 seconds will give 100 games before ratelimiting.
How about I tweak them some bts 1.5 some 2
That way I can squeeze in 175games
That’s still too less
Cause daily I see at least 1k activity
More than 1k
How much does the rate limit reduce by? If I contact discord support.
its fine for a temporary fix, but I'd look at alternatives.
what kind of data is in the message you are editing?
if the data is the exact same between two edits, are you not editing(wasted api requests)?
If its a minor change in stats maybe wait to edit until its more major?
Its probably going to be case by case.
I’m sending an embed and then editing the description
The description is updated every 1.2sec with the new status
lets say I'm playing the game, and no one interacts with the game for 7+ seconds. are you still editing every 1.2 seconds/
does it make sense to edit during that time?
Well the delay is added to give the player the effect that it’s an ongoing battle. If the status just updated instantly and the game ends it wouldn’t be a good experience
Yes
What about a more dynamic system?
I’ll send a video hang on
update less when no players are interacting for a bit.
every 5-10 seconds of no interactions slow down the rate of edits
A lot of this honestly could just be replaced with dynamic gifs.
all of this could be done with zero edits
yeah
But when the game ends the gif will still be playing no
gifs can have loops disabled
I had the same idea. It’s just that technical thing I have to over come now cause I’ve never worked with gifs before XD
I see
Can I put a canvas in a gif
Well the battle will mostly last for like 30seconds
Max
Hopefully
nodejs?
Just be aware, youll need to be very efficient with your canvases to do this at any kind of scale.
How do I create discord emotes inside gif

Yeah I’ve optimised my canvas so far
It loads 10x fast and consumes 100x cpu less now
all discord emotes can be fetched from discord and added to a canvas
Share links?
for what? emoji's?
Will the nitro thing not affect tho? If I can fetch all emotes from discord
Yeah
So I have like upload emotes to a private server
The used the “/“ to get its id
And rendering it in the embed
Adding it in description
And discord automatically resets the right emote
https://cdn.discordapp.com/emojis/969844935434059797.webp?size=48&quality=lossless
^ url for an emoji
just increasing the time between edits will solve the issue for awhile.

Aight thanks.
I need to figure out how to efficiently use canvas with text and image damn
Creating huge canvas is an issue
One of the most important things is making the base layer, and using that base layer as much as possible.
Understood.
Thanks a bunch. I’ll give it a try.
I was gonna move the entire battle system into website cause i already have the computational power
But hey atleast now I know what path to follow to fix the problem. Thanks a bunch. Cheers
I still wonder how the other bot does it tho 
They also edit every 1 - 1.5sec
maybe using webhooks?
webhooks are functionally the same, but dont use your bots token.
will that not cause rate limit?
I'm not sure how editing ratelimits works though when editing through an application.
Webhooks generally speaking have their own ratelimits
so messages sent my webhooks can be edited
a webhook created by an application can be edited by that application
i see. also another thing. so when multiple users even initiate the game. there also more than 50+ requests are made no?
well, each webhook is on its own ratelimit bucket
not taling about webhook here
normal requests
there will be more than 50+ POST req in this case
if you're editing 50+ times there will be 50+ post/patch requests yeah
no no, just sending 1 embed. i wont edit at all
then its just one
even then i would be hit with rate limits, cause there are 1k users requesting for the game embed?
eventually no matter what youll hit the ratelimit when using prefix commands.
if you use interactions and only respond to that interaction youll never hit it
so if i do interaction.channel.sendmessage. i'll still the limit?
yeah, much further down the line than you are now though
Its one of those issues you wont face for a very long time
i'd still run into the same problem with interactions, cause then if im editing the embed sent via interactions. it would still be 1.2sec per patch. more users req for game more edits etc.
are we not talking about this anymore? 👀
i mean, that's one part of the solution.
im just looking if there's another way to stall this until i fix the problem
if using slash commands will slow this down then its only 1 line away for me to enable them
slash commands only prevent the ratelimit if this is true
but if the edits are still gonna hit rate limits. no point in doing this. rather i'd just send 1 embed with all battle status as temporary fix
gotcha
the only ideas for temporary fixes I have is
1: increase the time between edits, increase the damage done in a single hit to make the games last the same length but dramatically decrease the number of requests.
2: show all info in one message.
3: queues, have a cap of 40 active games. if 40 games are active and someone runs the command put them at the end of the queue.
hey again. um so here's the thing. when i send gifs in embeds. they stop loading when scrolled away
and the second thing is. im supposed to send a victory message after the gif reaches the last round or if the player loses
etc
The victory/loss message should be something you can include in the gif if you really wanted to.
well its more of a dependency
there are rewards etc if the player wins etc. i know i can handle this internally cause i already have th result
but what if the player abandons the battle
by deleting the embed
its a forfeit
need to propagate these as well
🤔 can bots detect deleting of embeds?
or do you mean the message itself
yes they can
i think messageDelete event or something
if its deleted you should be able to send a message just like normal.
that part really shouldnt change
so back to the original question then. if i scroll down the gif stops
which means the battle would stop
the players will have to look at the gif for it to complete which isnt a good experience
lmao
so the concern is that users have to watch the fight?
also using queues wont work. imagine there are 40 battles on going and a lot of other players will have to wait. and the queu size might increase to a lot. and cause there lot of players. many players might not even get a chance to battle
^ better than it not functioning at all
yeah thats part of the experience. an important part actually
zero people playing vs 40 people is better right?
not really cause that'll make others not play at all
you know
imagine im the 50th guy and i have to wait for 1 bt to end which is about 30 secs.
it creates a butterfly effect
from 50th guy to a guy who's queueing at 100th or 1000th
i know i'll add a cap to the queue
but just doesnt seem ideal
vs everyones game stop working randomly while using it
yep, i get that.
i'll probably show battle rounds temporarily
and move to my own website
no rate limits there
do you need to show every frame of the battle? you could skip frames
sadly yes, cause it contains info like what round the opponent was stunned etc.
it helps them identify a strategy
for example instead of
move 1, move 2, move 3, move 4, move 5
you could do
move 1, move 2, move 3+4, move 5
when it rate limits
you skip sending one, and send two at once on the next frame
ah that. yeah sometimes i do move 4 + 5
That seems like itll become an issue though, dealing with a global ratelimit like that while sharding.
yep
i guess getting more requests will atleast help keep the rate limit to a minimal
cause the other bot that has similar functionailty works flawlessly
its not a problem if you hit the global rate limit every once in a while
well they do have limitations like 1 battle per channel
djs will stop sending requests when it hits it
you just need to handle the backpressure
yeah. well until djs starts dropping the connection after too many global rate limit hits
thats when i see "connection reset" to discord api in my error logs
because of the backpressure
the delay that djs adds causes a build up of queued requests that is never cleared
so you need a mechanism to stop or merge requests when you hit a delay
hmm
how do i do that? right now im logging requests from the apiResponse and debug event
well debug event just returns the string
one way is to monitor your outgoing promises
for example have a global queue of promises and do something if it gets too big
another way is to use the rate limit event to add a global pause thingy
how would i do that
thingy, the best technical term.
let pause = false;
client.on("rateLimit", data => {
if(data.global) {
pause = true;
setTimeout(() => pause = false, 2500);
}
});
// command code
moves = [];
interval(() => {
const move = calculateMove()
moves.push(move)
if(!pause) {
data = createRequest(moves);
moves = [];
send(data)
}
})
``` something like that for example (very pseudocode)
the rateLimit event controls a global pause switch
and depending on this swich, the battles will either immediately send the next state, or add the next state to a list and send them all at once later
ah well. this can cause the battles to skip rounds.
no, the rounds are not skipped
what is skipped how the round is shown to the player
instead of the player seeing every move as a separate edit, they will sometimes see 2 or more moves in a single edit
well i can still do that by pushing 3 rounds and making the edit call
that way. they'll see round 1 + 2, 3 + 4 and so on
yes
thinking from user experience it'll take away the element of surprise 
cause they already see whats gonna happen next round
basically its a way to do that dynamically, ie when the bot is not active, you can afford to show all moves separately, but when you have a lot of activity, you cant afford that
I really dont think a perfect solution exists.
mostly
mmmm
its like a lag mitigation system
ig. i can play around with this
for example imagine you have a game with a fixed frame rate of 1 frame per second
but then the game lags
so i track how many requests i have in a global variable
hope it doesnt cause overflows

the player will see a 2-3 seconds pause, but the next frame will still contain all the previous updates
so the actual game wont lag, only the display will
mhm. yeah lets see .. thinking..
essentially, discord is your screen, and it has a very bad frame rate
so your game still runs at full speed, but will have to chose to only show specific frames
it cant show all frames because the display is not fast enough to show them
whats the character limit on embed description
2k i believe
2000
6000 if you use multiple fields
hey
I need help on smth
is there a way to get the module.name directly from the module itself?
I mean
example:
module.exports = {
name: "hello",
run: async(...) {
const name = someHowGetModuleName;
console.log(name);
}
}
using nodejs. Do any of you know how I can request from a specific ipv6 if I have an ipv6 block
nvm. Seems like I just need to supply the family: 6 and localAddress options to http
people, is it posible to get label content on the buttons in djs, this is code i currently have: ```js
const { SlashCommandBuilder } = require('@discordjs/builders')
const { MessageActionRow, MessageButton, Message } = require('discord.js')
const { quiz } = require('../json/quiz.json')
const { prefix } = require('../json/config.json')
module.exports = {
data: new SlashCommandBuilder()
.setName('quiz')
.setDescription('Displays general informations about the quiz.')
.addSubcommand(subcommand =>
subcommand
.setName('programming')
.setDescription('Start programming quiz')
)
.addSubcommand(subcommand =>
subcommand
.setName('math')
.setDescription('Start math quiz')
),
async execute(interaction, client) {
try {
if(interaction.commandName === 'quiz') {
if(interaction.options.getSubcommand() === 'programming') {
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('secondary')
.setLabel('A')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('secondary2')
.setLabel('B')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('secondary3')
.setLabel('C')
.setStyle('SECONDARY'),
)
interaction.reply({content: `
What will be output of the following code:
Code:
```js
let divSelector = document.querySelector('div')
divSelector.classList = 'myDiv'
divSelector.innerHTML = 'Hello World'
```
A) JS will add class name myDiv to the selected div and add 'Hello World' inside it.
B) JS will add class name myDiv and throw error
C) JS will Throw error
`, components: [row]})
const filter = i => i.customId === 'secondary';
const collector = interaction.channel.createMessageComponentCollector({ filter, time: 15000 })
collector.on('collect', async i => {
if (i.customId === 'secondary') {
await i.reply({ content: `Your choice was: **${i.label}**\nCorrect!`, components: [] })
}
})
collector.on('end', collected => console.log(`Collected ${collected.size} items`))
}
}
}
catch(err) {
console.log(err)
}
}
}
is there some way to conditionally define fields in an object literal without mutation?
No
sad times
a key can be anything weirdly enough
for WeakMap
dunno why types say string | number | symbol
Why are u using WeakMap
just playing around with it
i want something that can do this if possible though
You can set the value to undefined instead of the key
it's still there but it's undefined so it shouldn't really bother you
this is kinda what i'm thinking. i'll put everything i dont want into undefined and then stringify it so it's gone
{
...(true ? { y: use } : {})
}
but like don't do that lol
any1 have idea why this error occured?
what nodejs version are you running
18.0
but thing is that i dont even use it
and it dropes error on place where it shouldnt
sapphire uses it in their code
Honestly as a rule of thumb (at least for myself) I never use an unstable version of nodejs
yea, unless they changed it in 18>
they didn't
I didn't think so
languages never remove operators
true
ahh thats ym friends error, I told him to try to update onode or downgrade to 16.15 if error continue... but i have diferent question. How can I send message to selected channel with using slash commands?
something like message.channel.send()this is what i have for now
"interaction.channel.send()"
channel not msgChannel, read the documentation.
yea, but i want to send msg to selected channel, with using channel u send message to current one
As you're getting the channel from the options, the msgChannel variable should already be a channel, so just call the send() method on it, such as msgChannel.send()
ah yea that worked, tnx a lot man
ello to the python devs
how do I create a dictionary that is static, but still being able to add values to it?
What my current plan is: Start a session for something, add specific values (such as an object) to that dictionary to then later access that dictionary again to find said object
yes I'm somewhat-ish new to python so I'm likely not aware of any other ways to do that that doesn't involve a database (remote or local) or a json file for that
been a while since i've used by properly, but i believe its ```py
somedictionary = {}
#to add data
somedictionary["somekey"] = "something"
#to access
somedictionary["somekey"]```
i think i might be misunderstanding but yeah
You just create a dictionary somewhere and then use it
Yeah, though issue is:
The object I'm trying to store is both using the dictionary and has the actual class in it, so I'm basically just facing circular imports, unless I'm doing something wrong
So I'd basically have 2 files:
data.py: Includes the dictionary, imports class (the Verification.py) that is used for the object, dictionary will include said object/class
Verification.py: Has the class structure, has a method that accesses the dictionary within the data.py to add/modify/delete sessions
which then results in the circular imports
pfp me related
If I'd have the dictionary within the Verification.py, it would just reinitialize everything that was in the dictionary and essentially clear it
you lost me at "So I'd basically have 2 files:"
i am shit at python so 1 file everything lmao
I'm 🤏 close to actually doing that
like, in Java I basically had "static", whats the equivalent of that in python?
in js its const right? or nah?
actually slowly figuring out what I'm stupid at
initializing a new class object also initializes the variable i set, if I only reference the class, it should stay apparently?
basically with just verification_list = [] to create an empty dictionary
assuming thats probably wrong since that would also reinitialize on each reference
omfg nevermind
Yup that did the trick
am literally pfp
lol it's fine
#relevant
istg yes
cant relate, my code always works on first try
@lyric mountain wanna see my bad java code?
Message msg = ((MessageReceivedEvent) event).getMessage();
String content = ((MessageReceivedEvent) event).getMessage().getContentDisplay();
if(!content.startsWith("!")) return;
String[] args = content.substring(1).split(" ");
String commandName = args[0];
HashMap<String, BaseCommand> commands = new HashMap<>();
TestCommand testCommand = new TestCommand();
commands.put(testCommand.getName(), testCommand);
BaseCommand cmd = commands.get(commandName);
if(cmd != null) cmd.run(msg, args);
This is how i handle executing commands
If you or anyone knows a better way please do tell I wanna learn
so much hype around undici and i keep running into issues with it >.>
i should just stick with http then
What issues have you ran into?
I see
https://github.com/nodejs/undici/issues/1412 this is the only thing I found about undici throwing that erorr
yeah ive already read that
in my case its happening randomly, the above issue is not random, its an https issue
yea
NO STOP
DONT FUCKING USE JAVA WHEN U DONT KNOW

I am trying to learn
FOR A DISCORD BOT NO
5head
Do not learn Java with a discord bot
DO SMALLER PROJECTS UNTIL YOU UNDERSTAND JAVA
LIKE WHAT 5HEAD

I have no idea what to do so I can use the things java offers to accomplish my goal
a discord bot seemed obv to me as I can learn more about inheritence, interfaces and maps and shit
JUST EARLIER U WERE TRYING TO MAKE ARRAYS AS Array<String>
NO
Well designed discord bots in Java use a lot of magic to work
A lot of reflection
Reflection is something to stay far away from until you actually understand Java
Ok then instead of yelling at me give me something you've done to learn java
ok then nerd
Literally any basic project
Think of something, make a school, make a hotel, something simple until you understand the basics
But oh does it feel satisfying when u finally understand it
A discord bot in Java is quite complex
Indeed it does
It's almost black magic
Fine ima make a School Grading system thingy
Like what we were going to do in asp
but instead it will be in the console
Yes
GUI in Java is kinda pain, I can only speak from experience with swing though
It got better when lambda became a thing, nowadays it ain't THAT bad anymore
I assume when making a 'char' type i just use char right?
Even for 1 letter should I use string?
17
How would you enable that
Thanks
(Not gonna be too important for beginner projects though, dw)
I went ahead and did it anyway
Btw, ur using intellij right?
yeah he is
He started right then
After 15 iirc
It is the sucessor of ShenandoahGC
It does improve stuttering a LOT on mc, especially with many mods
Since zgc was created for environments where gc pauses are unacceptable
ayy yo
what language is the best for windows
best to design a app ig
C# forms seem way to complicated
is there anything like swiftui but for windows
cs was made for windows and if you know TypeScript syntax, you can get really familiar with C#
but the c# form designing this seems like a pain in the butt
Aren't all languages until you get used to them
i mean ion like the drag n drop designing thingy i like to code my design html swift ui n stuff
I managed to make a Unity game in a week with no prior experience with C#
damn was it a 2d game or 3d
you don't have to use the designer
in fact it's highly recommended that you DONT use the designer
write the XAML by hand, it's basically HTML but better
damn im thinking of using rust lang or electron rn
after finding out alot of professional companies use electron
C# is literally built for windows but choose what you're comfortable with
C# is made by microsoft for microsoft lol
ik but i gotta have to learn XAML n stuff
n do you need something like css for XAML
like is XAML just a structural lang or design too?
both
resource dictionaries are essentially XAML's CSS
which are also made in XAML
just don't use winforms
outdated asf
i was using winform it looked ugly n then yuh
use a framework like avalonia or xamarin forms or MAUI
I think those are the most modern choices
are the paid ?
i heard sum C# framworks are paid
I have never heard that anywhere
is there a reason for that
uhh there no (.NET core)
.NET Framework is old
in the entire list
doesn't support higher versions of C#
usually only used by legacy projects or companies with stupid framework requirements
so its this one ?
yes
you can use WPF
there's also other options out there, might be useful to ask discord.gg/csharp
should i used latest or long term support
i just installed visual studio tho..?
just sdk or do i need runtime too
it didnt show up :/ i think i might have to restart imma just use 5.0 its prolly gonna be supported for a year ig
^
np
I'm trying to remove certain scripts from HTML using Cheerio. However, when returning the processed HTML, certain scripts are still there.
let html = await this.getHTML(arr[0]);
let $ = cheerio.load(html);
const linkObjects = $('script');
const links = [];
linkObjects.each((index, element) => {
if ($(element).html().includes("https://some_script/tag.min.js")) {
$(element).remove();
} else if ($(element).attr("src") != undefined && $(element).attr("src").includes("https://some_script/tag.min.js")) {
$(element).remove();
} else if ($(element).attr("src") != undefined && $(element).attr("src").includes("https://google_site.com/")) {
$(element).remove();
}
});
return $.html();
Ex.
<html>
<body>
<h1>My site</h1>
<script src="https://google_site.com/">
</script>
<script>
(document.createElement('script'), 'https://some_script/tag.min.js', 5093079, document.body || document.documentElement)
</script>
</body>
</html>
edit: fixed im dumb i messed up some basic stuff.
$("script").each((index, e) => {
if ($(e).html().includes("...")) {
$(e).remove();
} else if ($(e).attr("src") != undefined && $(e).attr("src").includes("...")) {
$(e).remove();
} else if ($(e).attr("src") != undefined && $(e).attr("src").includes("...")) {
$(e).remove();
}
})
are NSFW commands are allowed ?
in top.gg?
not on in server on bot
yea its allowed but refer to the message above
then why serveral bots get denied when they have NSFW commands ?
they either:
- dont lock them behind nsfw channel
- nsfw of minors, etc.
- mention nsfw cmds and stuff on their bot page
kk
means we can apply if the bot has NSFW commands ?
but we have to show in bot page
you cannot show or mention any nsfw commands on your bot page
no as an alert that this bot has NSFW command
cmiiw but iirc i dont think you can mention it aswell, just hide the nsfw commands on the normal channel and then unhide them if they are used on nsfw channels
Hey Tim, woo ping me when you guys are here please. So like I’m not sending the battles at all just showing the end result. But even then I’m hitting rate limits which cause the bot to not respond in some channels for a while not 1 hour rate limits. @quartz kindle @solemn latch sorry for pings 
Any solution for this
There’s no more edits per second. I’m hoping slash commands will resolve this?
how can add this?
Show code as well please
Ping me pls
it supports html css
ping me pls
no
that is weird
I need help I donated on wrong account
I'm trying to regex match to detect domains
but its only returning the root domain, not any paths
returning discord.gg instead of discord(dot)gg/pizzas
(censoring as its a malicious guild)
Simple solution ban any person who has sent pizzas in their messages 
Mmm I was going to say just censor all invites unless they have perms to post em but then you'd have the issue of discord.com/invite
yeha
and you say you can't get the full path so hm
i'm specifically blocking malicious guilds
it works for scam domains
but because this is a path i'm looking for its harder
Could you just check if the messages include discord.com/invite or discord.gg
without a regex
i store known domains in a json
have you tried looking at a website called regex101.com?
they have a lot of regex patterns
I found this one specifically
It might work for ya
Mmmm that is where my brain stops working
lmao
I have no idea how you'd even attempt to detect that
My only suggestion here is to block all links that match a simple link regex
check for common tlds https/http, etc
my regex works for detecting regular urls
Is this project open source?
Well do you realistically need the path?
well yeah
What for?
I tried making a regex and failed so ye not sure ima be much help lest I mislead ya

Sweet
Hi,
client.user.setActivity({
name: "🔴 Live Music",
type: "LISTENING",
});
this is my code for a bot. the bot doesn't display this status for some reason. I've never experienced an issue like this. someone help ty
Sweet
client.on('message', async message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if(!message.member.hasPermissions(`MANAGE_ROLES`))return message.lineReply(`**You Don't Have \`manageroles\` Permission** :haahha:`);
if(!message.guild.me.hasPermissions(`MANAGE_ROLES`))return message.lineReply(`**I Don't Have \`manageroles\` Permission** :haahha:`)
if(command === 'mute') {
let mute = message.guild.roles.cache.find(role => role.name === 'Muted');
let user = message.mentions.members.first() || message.guild.members.cache.get(args[0])
let member = message.guild.member(user);
if(!user) return await message.lineReply(new MessageEmbed().setColor('RED').setTitle(`Error:`).setThumbnail(client.user.avatarURL()).setTimestamp().setFooter(message.author.tag,message.author.avatarURL()).setDescription(`**Warning:** Pls Mention an user To Mute.`));
if(!mute){
await message.guild.roles.create({
data: {
name: "Muted",
color: [],
permissions:[]
}
})
await message.lineReply(`**Making Muted Role ....**`).then(msg => {
msg.edit(`**SuccesFully Created Muted Role Please retry** `, 1000)
})
}
const embed = new MessageEmbed()
.setColor("#28FC03")
.setDescription(`** ${user} has been Muted from the guild ** :white_check_mark: `)
const embed2 = new MessageEmbed()
.setColor("RED")
.setDescription(`**Failed To Mute ${user} :x:** `)
try {
await member.roles.add(mute)
await message.lineReply(embed)
}catch (err) {
console.log(err)
}
}
});```
is there an error here ?
it says
(node:3404) UnhandledPromiseRejectionWarning: TypeError: message.member.hasPermissions is not a function
The <GuildMember>.hasPermission() method was removed on discord.js v13, it's now <GuildMember>.permissions.has()
this discord.js v12 not v13
Then why don't you upgrade?
don't need now
Discord.js v12 will stop working eventually, so I'd recommend updating
when it stop i will update
That's a bad practice to not prepare and update just when it stops working but okay, you do you
The method is called hasPermission() not hasPermissions()
i did it
oh alright it worked
ty @earnest phoenix
“Why are you not giving your car coolant when it says it needs it?”
“when my engine blows up, I’ll give it more coolant”
so if u get the choice between spending a few minutes over many days, or forcefully spending many hours in a single day u choose the latter?
I sense another ADHD fella here
bump
are u using shared hosting?
nop
i mean there are lot of users
im thinking it doesnt work in some channels cause of this.
which is causing rate limit
how do i contact discord for this
i contacted discord support
you can't bypass rate limite, discord rate limit are per server ig so u can limit the amount of battles in a server
this what they replied
i mean, im not even doing the battles anymore
im directly sending the end result
everything is post request now.
except for the buttons which have paginations
but those are slow anyway
No edits?
when many peeps keep typing the commands its being rate limited ig.
yeah 1 edit per 1 second thing
i removed that
before i used edit something every second until it ended
thats not the case anymore
U should try to limit the battles then, like 1 battle in a server at a time
dude the battle literaly ends in 1 sec
there is no more battles
for example. if i type prefix attack it doesnt show the battle. it sends the end result
so only 1 api call is made
Mostly people add cooldown thing in commands
And for premium no cooldown
Like u cant spam the same command in same server like that
per channel, not per server
ye
Hello i get a BITFIELD_INVALID Error. Does anyone has a fix for me?
const Discord = require('discord.js');
const client = new Discord.Client({ intents: ["GUILDS", "GUILDS_MESSAGES"] });
const auth = require('./auth.json');
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.content === 'hello') {
msg.reply('hi!');
}
});
client.login(auth.token);
GUILD_MESSAGES not GUILDS_MESSAGES
Ah thank you very much!
how big is your bot? how many commands do you get per second? add a way to measure the number of commands per second your bot executes
well there’s like 50 commands but the most company used are few like 5 or so.
And the bot is pretty big. 22k users but there like 17k active users
well I’m logging the api request and response and checked the time stamp. There’s quite a lot requests in a second
When there’s influx ofc
It varies
Has to be resubmitted, just editing the invite link is not allowed
wew
some of them could be a troll that purposely spams the api
Do you have cooldown to use commands?
flutter forces usage of 2-space indent
I'm utterly disgusted and my day is ruined
per player or per channel?
Per player
you need to implement both per player and per channel cooldowns
Hmm
No more globals no more 1 hour soft ban. Just hitting rate limit which locks the channel for fee seconds
ah then its fine
Few*
just implement a per-channel cooldown
no like it’s happening too often
Mmm
Ig I’ll try that
1 second should be enough tho right?
Per channel
its 5 per 5 per channel
Yeah 5 request in 5 seconds
I send a req in 1 channel. Set a cool-down for 1 sec before sending the next command
i would do it differently, but that works as well, as long as you have a mechanism to reject commands so they dont build up forever
on command, get channel id, check if cooldown exists for that channel id, if it doesnt create it and set it to auto delete after 5-6 seconds
increment the counter for that channel id, if it reaches 4/5 send an error message telling people to wait x seconds before trying again
Gotcha, thanks
how can I make that image on top of the image blur
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://capy-cdn.xyz/tailwind.css"></link>
<style>
body {
background-color: black;
margin: 0;
overflow: hidden;
}
.songImage{
z-index: 5;
opacity: 1;
filter: blur(0px);
-webkit-filter: blur(0px);
-moz-filter: blur(0px);
-o-filter: blur(0px);
-ms-filter: blur(0px);
margin: -5px -10px -10px -5px;
}
.bgBlur {
background-image: url("https://picsum.photos/1920/1080");
opacity: 0.5;
filter: blur(8px);
-webkit-filter: blur(8px);
-moz-filter: blur(8px);
-o-filter: blur(8px);
-ms-filter: blur(8px);
margin: -5px -10px -10px -5px;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
z-index: 10;
}
</style>
</head>
<body>
<div class="bgBlur">
<div class="flex justify-center items-center h-screen text-center">
<img src="https://evidence.blacklister.xyz/no-evidence.png" class="songImage">
</div>
</div>
</body>
</html>
ignore the random ass image url, its just a placeholder
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: \\?\E:\Users\Bravish\Downloads\ReeF-V-Ultra\node_modules\canvas\build\Release\canvas.node is not a valid Win32 application.
\\?\E:\Users\Bravish\Downloads\ReeF-V-Ultra\node_modules\canvas\build\Release\canvas.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (E:\Users\Bravish\Downloads\ReeF-V-Ultra\node_modules\canvas\lib\bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'ERR_DLOPEN_FAILED'
}
reinstall canvas
Did you copy your node_modules folder from somewhere?
idk it's my friends error but
Tell him to delete his node modules folder and run npm i
package lock.json too right ?
If all the packages he needs are in his package.json, then it should work
No don’t delete that I don’t think
Node modules folder should be enough
ok
Wouldn’t hurt I don’t think though
gods of programming, please forgive me for I have sinned
lmfao
(it's either comma-ended lines or having everything in the same line)
stupid google formatting standard
Staircase to hell
ah that's cuz I'm doing front-end, this is the layout
what I meant is that now I started using comma to end lines
cuz google enforces a fixed flutter formatting
bump
with comma after each line I can force it to break line
else I get everything in an awful semi-inline format
btw I just noticed, the problem isn't swing at all, it's doing front-end
holy fck making layouts is messy af
Yeah
Frontend is kinda pain, especially when coming from backend
It seems like a lot of redundancies
someone needs to make a framework which integrates the backend and front end PERFECTLY
every framework i've used feels like they're both detached from each other even when thats the frameworks aim
Why are you using a ternary operator in it
because I don't want to nest statements again
you could just use ||
also how do I prevent, say an moderator muting the owner
I have to check for role hierarchy
damn I forgot that existed
Check if the person's id that is being muted and compare it with the server owner's
no I mean generally a person of lower hierarchy trying to mute a person higher than them
say a mod should not be able to mute an admin
can u how do you check for the hierarchy? I know there is a way to because I remember doing that in discord.js v11
Check role positions
how?
compare the person's highest role's permission against the person being muted highest role postion
na I would compare the authors highest role to the person being muted
but how do I get the number in the first place?
By reading the docs of the lib you use
can you just tell me what it is please
If you know what you need to access the look it up in the docs, people really need to learn how to read documentation 😔
I use discord.js
😔

I just found something
I can just do
member.manageable
does that work?
I mean sure
but that won't work for the person using the command
that only checks if the bot has the ability
Just a tip, if you are using manageable and something related to the person using the command and returning an error message, it might be helpful to put you or the bot is lower
@sharp geyser the check if the person has the role still doesn't work
that's how I fetch them
the mute command itself works fine so not sure why it doesn't work
which position vars?
the position check works, the role check doesn't
it always returns true
if (member.roles.cache.some(role => role.id === roleToMute || role.name === roleToMute)) {
return message.channel.send("The member is already muted.");
}
``` this line is what doesn't work
Oh I misinterpreted my bad
so any idea why it might not work?
I have never seen as much regex used in a discord bot as you’ve used
I do and always will complain about that :c
I'm sorry I just can't help it
it's just so useful sometimes
but more importantly WHY DOES IT NOT WORK 😭
Perhaps it would help if you tried logging things and giving more context than “it doesn’t work”
Hint: it’s hard to read regex all the time in every inch of your code, personally I don’t want to help debug constant regex use
Comments are your INTENDED effect, it might not be working like your comments say
Otherwise it would work perfectly
And you can fix it by thinking of actual solutions to problems and not just defaulting to some obscure regex for everything 
if (member.roles.cache.find(role => (role.id === roleToMute || role.name === roleToMute))) {
return message.channel.send("The member is already muted.");
} else {
const authorHighestRole = message.member.roles.highest;
const memberHighestRole = member.roles.highest;
if (member.manageable && authorHighestRole > memberHighestRole) {
member.roles.add(roleToMute);
} else {
return message.channel.send("Could not mute the person, because you're lower in the hierarchy than the muter.");
}
}
``` this entire line doesn't work, there is no regex there
why does it not work
it doesn't check for the highest role properly, always allows muting, and doesn't check if the person is muted even though the code is already there
every variable I deliver there is working so no need to check any code that has regex in it
can you please tell me why this doesn't work now?
https://cdn.myprojects.lol/🍲🤔🦠🦑😱.png how can i get the text either side
tailwind html <div> <h1 class="text-white">00:00</h1> <div class="h-3 relative max-w-xl rounded-full overflow-hidden"> <div class="w-full h-full bg-gray-200 absolute"></div> <div class="h-full bg-green-500 absolute" style="width:10%"></div> </div> <h1 class="text-white">03:59</h1> </div>
using CSS @spark flint
style="left: 100%;"
or something along those lines
prolly better to do it with element align
document.getElementByClassName("text-white").style = "left: 100%;";
``` here is JS if you need
What text are you wanting to move?
the two timestamps
I haven't used much css but couldn't you use a flex and or grid system here?
I'll try now
This is for NodeJS. Does anyone know how to overwrite a specific line for a function and then have it compile inside of a scope outside of the current scope? Example would be monkey patching a function of a module I do not control
you have to replace the entire function
damn okay
thats what i did with djs lol
for djs lite?
ye
depending on the situation, you can override the function and then call the original function from inside your override
but in some cases you have to replace the entire thing
Yeah nah. I'm replacing all of the http calls necessary to add ipv6 support and conform to my api
so I'll just override entire functions and not worry about calling base function
ye
One message removed from a suspended account.
One message removed from a suspended account.
c# shrimp
sharp shrimp
any good async mariadb python package?
if you didnt receive a dm about it, you might have dms disabled, in which case you can search in #mod-logs for your mention or user id
hey
i wanna ask if i made a bot like milrato and modified it a lot and gave the real developer credits in the top.gg description , about me of bot , botinfo command, etc
will it work?
or will the bot get declined
it will be accepted if any copy you make is undetectable, ie if you copy code from another source, it has to be modified enough so that nobody can guess you used said source
hmmm
but the credit is given to real developer
like
you your bot cant be a blatant copy of another bot, in terms of features
you can have the same features, but the commands cant be exactly the same down to word by word
the entire feature, command name plus response, plus credits, etc
basically, there kinda is a list of well known open source bots that people commonly copy from
ik
and the reviewers usually check if your bot looks like an exact copy of one of them



my doubts are cleared

