#development
1 messages ยท Page 92 of 1
deflate is compression
thats pretty unintuitive
well
deflate makes it smaller
pushes the air out of it
inflate makes it bigger
ah
Me when enums exist:
why would I wanna use an enum for that, that just seems annoying
Union types with strings are annoying
They both perform the same function in this case but if it were me Iโd prefer an enum there
hello can somebody help me with the last step of my afk command i need to make it that when someone mentions a person who triggered the >afk command it sends a embed with "this person is afk, reason: reason here" but my exactly problem is that i dont know how what to put in a messageCreate event to react when somebody got mentioned
the message object contains a mentions field
uhhh yes how can i make that
okay thank you
Yes
Yeah that's what I thought but I'm not getting that, I get everything else but that
weird, works fine for me
try testing it in a webhook tester website
and try changing your auth and saving again
to refresh the value
this is what i get in the headers from the webhook
// "headers":{
// "accept":"application/json, text/plain, /",
// "content-type":"application/json",
// "user-agent":"Top.gg Webhook/1.0.0",
// "content-length":"101",
// "host":"*************",
// "connection":"close",
// "geoip-addr":"***********",
// "geoip-continent-code":"NA",
// "geoip-country-code":"US",
// "geoip-country-name":"United States"
// },
how would I check if a button is disabled in d.js?
have you set the auth value on the top.gg website

Oddly enough i got it when i sent to https://webhook.site/ but change it to my site then the authentication header is gone again
Instantly generate a free, unique URL and email address to test, inspect, and automate (with a visual workflow editor and scripts) incoming HTTP requests and emails
do you use any proxy/reverse proxy?
like nginx, or cloudflare
no i think its the apache setup for authorisation security stripping the header from the request,
need to talk to host maybe to see if they can allow it to pass through
be easier if they used X-Authorisation as a header key as this will get passed and not counted as a http auth request
like the same code works with patreon webhook they use x-patreon-signature and this passes through fine same as all other headers
hey has anyone worked with pytube?
how do i download only 1 minute of a YT audio stream from a 10min video
Sus tos question
@client.command()
@client.has_permissions(administrator=True)
async def setprefix(ctx, *, newprefix: str):
with open("prefixes.json", "r") as f:
prefix = json.load(f)
prefix[str(ctx.guild.id)] = newprefix
with open("prefixes.json", "w") as f:
json.dump(prefix, f, indent=4)
How can I make it so only Admins can use this command
I keep getting this error
AttributeError: 'Bot' object has no attribute 'has_permissions'
I just wanna know if it's even possible (Python)
Can someone tell me a way to replace all characters of string in English, if they are in some other language??
If there is any way so.
I want it for slash command string option. (I use javascript)
im working on a project haha XD AI related
Do you want your bot to be supported in two languages?
Nah, leave it I figured it out
Hey someone suggest me fun commands for my bot plz! I'm out of ideas.
(Not so advanced because I'm still learning)
save yourself the trouble and dont make a bot
or at least dont make a public bot
I've been doing this shit for 5-6 years and I should have stopped while I was ahead because had I known the day of reckoning for music bots was upon us, I would have stopped.
Help json
code of check if user has premium
def check_if_user_has_premium(ctx):
with open("premium_users.json") as f:
premium_users_list = json.load(f)
if ctx.author.id not in premium_users_list:
return False
return True
file premium_users.json
{"908097297177526323"}
error
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1394, in on_message
await self.process_commands(message)
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1391, in process_commands
await self.invoke(ctx) # type: ignore
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1349, in invoke
await ctx.command.invoke(ctx)
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1015, in invoke
await self.prepare(ctx)
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 919, in prepare
if not await self.can_run(ctx):
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1280, in can_run
return await discord.utils.async_all(predicate(ctx) for predicate in predicates)
File "/home/container/.local/lib/python3.10/site-packages/discord/utils.py", line 672, in async_all
for elem in gen:
File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1280, in <genexpr>
return await discord.utils.async_all(predicate(ctx) for predicate in predicates)
File "/home/container/bot.py", line 35, in check_if_user_has_premium
premium_users_list = json.load(f)
File "/usr/local/lib/python3.10/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
It's true, unfortunately, it's sad to see how after time it turns out that all your work and probably a lot of money invested will be lost forever. Of course, knowledge, connections and so on stay, but you are somehow forced to make a new bot practically from scratch
you're trying to use a json file that is improperly formatted
if you wanna compare a list, do
"premium_users": [
"user1",
"user2"
]
or
[
"user1",
"user2"
]
dont think the second one is correct either
but the first one is for sure
i tryed 2 way
now there is a new problem
There are no errors but the response to the command does not respond
add debug lines lol
what it is?
remember that you're still trying to compare a integer with a list of strings
add print statements that allow you to see the flow of your code
hello guys how to start
Start what exactly?
how come that even after all these setbackground colors it is still white: java frame.setBackground(our_black); panel.setBackground(our_black); label.setBackground(our_black);
our_black is a valid color, i assured that
Guys I think there is no more scope on discord
No more future on discord for bots
Discord implementing the bot ideas in discord
Which is killing the bots future in discord slowly slowly
My guy what are you even talking about?
Maybe he means /ban and /kick commands although I'm not entirely sure what it could be about
nah
/ban and /kick have existed since slash commands first introduced
theyre not new at all
nah, I'm safe
I'm using fastify/middie but it's giving an error: "TypeError: reply.send is not a function"
(async () =>
const app = fastify();
await app.register(require('@fastify/middie'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use('/', (request, reply) => {
reply.send("teste")
})
app.listen({ port: process.env.API_PORT })
})()
After adding the hook: // Add hook to perform JWT verification fastify.addHook("onRequest", async (request, reply) => { try { await request.jwtVerify() } catch (err) { repl...
fastify 2?
looks like it. never used it
100%%
Pain this message
It will be coming soon
Nah it wont
Unless discord wants to implement this one specific carding game into their UI and allow users to earn money on their platform and be able to generate images using their own UI and allow built-in musicbots
See
They will implement easier use of some non-specific features such as moderation into their site
But they wont add 95% of your remaining multi-purpose features of your bot into it
Because
Its actually unnecessary
if anyone knows py-cord dm me i have a quick paid job (one command)
how can I pass an external function my class context in a object ({ context: this, otherstuff: 'yes' })? nodejs
well for some reason it doesnt, this is considered any when passing, probably because this is now referring to the object
can you show more of your code
what does hovering over this say
fixed it, worked when defining the key manually; context: this - not just this
@drowsy crag
smh why ping again
Was going to say the same.
Because people might not want to be pinged unless its for a good reason. My ping was for a reason that has since been delt with.
@covert gale
well, that's not how it works
You have to wait until they accept your bot
i've just sent my useless bot for the review
i don't want to scrape the website
it is for my master's thesis
Now wait and hope they accept it
topgg only opens the api to approved bots, no other way around
if you stop to think, the api wouldn't even work since your bot would never receive votes
useless is a matter of view
how did they get accepted
Normally, they meet the requirements
this wouldn't work nowadays since the site includes bot protection
also, even with the api you'd not be able to achieve that
yes?
can you retrieve the bots attributes with searching their category?
if it doesn't mention seaching for specific tags, then u cant
yeah i saw it that's why i asked here
alright then
i need to have that access to the apis
i hope they accept
looks fairly interesting
poor mudae mao
How to create a vote required command?
You'll ideally use webhooks and store the votes in a database
Or lazily make an api call on the command (don't recommend)
https://top.gg/api/bots/:bot_id/check
Ratelimits will get you very quick with that.
Yup ๐
Periodically call the api for the get all votes endpoint and save it ๐
And take advantage of the webhook to get when people vote to then keep your saved version updated
Good day everyone
Uhm. Would like to develop a discord bot
Where can I start reading, im zero knowledge
Or any developer for partnership on my idea. DM me
Just asking guys...
Start by learning the basics of a programming language, I recommend Python personally. JavaScript is also a good choice I believe.
Once you've got the basics of the language covered you can look at libraries such as discord.py. These make the process of creating a bot as well as commands etc much easier.
I recommend neither python nor javascript as a first language (but if you insist on one of the two, javascript is the way to go), but something more like Java
Then move to a language like javascript after you understand types and such, then you can learn to make bots
Python is a sugary trap for beginners
Javascript > Python if you just starting
You can make bots in java,,?
ye
You can make bots in pretty much any lang
You need to handle it yourself
You should join discord api. Literally all the goodies are there
Some bots get fair amounts of patreon supporters, but thats rare and after you gain good growth.
Can someone explain how the actual FUCK this produces 395 ```java
int va = 99;
va = 3 + 3 * --va+va++;
System.out.println(va);
this was a competition question I had
(java)
the bytecode breaks all of the precedence order???????????
the fuck???
3 * --va gets evaluated first
In theory the order should be
va++,
--va
3 * (result of --va)
3 + (result of 3 * --va)
(result of the above) + (result of va++)
va produces 98
But that's wrong
then the rest is evaluated left to right
I understand what the bytecode means, but the precedence does not follow the order it should
this is the order it should follow
The post increment should be first, then pre decrement, then basic pemdas
Yes it would
no it wouldn't
va++ changes the value of va but returns the un-incremented value of va
No
That should be the first one to be evaluated
Which is why I'm so confused
post increment has the highest precedence in that entire expression
then pre decrement, then multiplication, then addition
their precedence is clearly the same in the diagram
oh there are two places
this is bizarre behavior
surely there's a reason but still it's so weird
yeah it's definitely not a compiler bug, js has the same behavior
new theory
my idea is it has to do with semantics, as you can't use pre and post ++/-- in the same expression (i.e. you can't do --n++)
which means it goes back to left-right evaluation with the other orders
hence what I said before
that would be super weird and not make much sense
it may just be a niche only for specification, but I don't know
me personally, I think order of operations / precedence is a bad system that shouldn't exist in any language
idk, I can't find anything about this sort of thing being disallowed
I meant my version of it
You can't do --n++ because n++ evaluates to a number and not a reference-able variable
But you can do --n+n++ because n++ evaluates to a number which is allowed in a binary expression obviously
yes
even so it makes no sense as to why they would disallow precedence to be used like that
I'll ask my CS teacher tomorrow
Maybe it's some obscure dogshit left in compilers for some tiny optimization reason of some sort
Precedence is actually put aside here because --va + va++ is unsequenced [1], in which the behavior is undefined [3] and it is unknown which of the operations will first take place as they have side effects [2]
[1] What are sequence points?
At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place
For example, at the end of the evaluation of full expressions (a full expression is an expression that is not a subexpression of another expression):
int foo = 5; // ; is a sequence point
In other words:
Sequence point is a point in time at which the dust has settled and all side effects which have been seen so far are guaranteed to be complete
[2] What are side effects?
Evaluation of an expression produces something and if in addition there is a change in the state of the execution environment it is said that the expression (its evaluation) has some side effect(s)
For example:
int foo = bar++; // where `bar` is also an int
In addition to the initialization operation, the value bar gets changed due to the side effects of the post-increment operator (++)
[3] What is undefined behavior?
Behaviors that may arise upon use of erroneous program constructs or erroneous data, in which the standards impose no requirements for the implementers, so they can decide the behavior
Between the previous and next sequence point a scalar object shall have its stored value modified at most once by the evaluation of an expression, what this means is that between two sequence points a variable must not be modified more than once
Here are examples of undefined behavior caused by unsequenced points:
i++ * ++i; // UB, `i` is modified more than once between two sequence points
i = ++i; // UB, same as above
i = ++i + 1; // UB, same as above
Here's a simplified explanation:
int va = 99;
va = --va + va++; // You'll get `196` because `--va` is evaluated first due to unsequenced points, because of undefined behavior
int va_ = 99;
// Going by our own perception of operator precedence, which is basically like this:
// Unary post-increment/decrement operators have higher precedence (temporary variable to store the original value because of the post-increment operator)
int temp = va_++;
// Unary pre-increment/decrement operators have lower precedence
--va_;
va_ = va_ + temp; // We'll get `198` because we did the operations with our own perception of operator precedence, as we're not affected by unsequenced points
holy shit
Compilers are smart enough to tell you about that behavior I just explained, for example, doing exactly what you're doing in C++ (compiling with Clang++), you'll get a warning as what you're doing is unsequenced
literal ๐ค
Yes, I love being a nerd 
very interesting read
also found another nice explanation specifically for js, but may also be applicable to other langs
Groovy allows it lmao, and yes, it's as useless as you'd think
Which allows u to do some whacky stuff
client = commands.Bot(command_prefix='!', intents=intents)
statusChange = True
guilds = str(len(client.guilds))
@client.event # Code to run on bot start
async def on_ready():
print('ModzBott is running!')
print('----------------------------------')
await asyncio.sleep(0.5)
print('Loading cogs:')
while statusChange == True:
await asyncio.sleep(5)
await client.change_presence(activity=nextcord.Game(name=f'/help | {guilds} servers!'))
await asyncio.sleep(5)
await client.change_presence(activity=nextcord.Game(name=f'/invite | {guilds} servers!'))```
I am rather confused as to why this code snippet is not working on my bot, the bot is in 20 servers however the bot status states 0. The bot token is correct and it is also connected to the correct bot. Any ideas as to why it is not showing the actual server count?
Where did you get this code from?
This is my own
Whats your intents
I'm referring to your code
intents = discord.Intents.default()```
It is possible that the problem is guilds which is defined before the bot has started?
yes it was, ive moved it into the on_ready function and it seems to be operating normally, thanks for the help!
For a monorepo, should I put the licence field in packagejson to the root file or in all of my apps?
How to make Nginx listen to any port?
Like, I want the ipv6 and ipv4 listen ports to be anything as long it's from server_name
๐ณ

can i make different backgrounds that change from user to user
Reverse proxy with one of my VPS' and my home server
but why all ports lol, there are many ports that are system reserved and stuff like that
right
you can set a range of ports like this listen 9000-9999
ah thanks
but dont make it 0-64k lol
lmfao
How do I make UDP reverse proxies work?
the stream { server { aint work for me
listen 9999 udp should work
When I add a class to an element using js, does it only change for the user entering from that computer or is everyone affected?
no i want to show the same <div> as red to one user and green to another
i get this color from localStorage
I will change the color of the div according to the data from localstorage with js
localStorages are linked to a website domain so yes, it would change the color for any user logged into that specific browser where the localStorage is set
that data of course stays after creating new browser sessions
do you want to destroy your server? because that's how you destroy your server
still dont get the thought-process behind it
the default port for http (80) is good enough
thanks
Can I read messages sent to my bot in direct messages?
messageCreate event doesnt seem to trigger when its a direct message
ensure you have the correct intents
Hello, I submitted the bot 2 weeks back. I haven't heard anything back from top.gg
How can I check the status?
im trying to make my bot connect to a VC channel, its saying TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents' not sure what it means by this, heres the code:
import random
client = discord.Client()
@Client.event
async def on_ready():
#information
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
channel = Client.get_channel('1066410957074616433')
await Client.join_voice_channel(channel)
print('Bot joined the channel.')
client.run('removed token to post here')```
I'm struggling to get my bot to work in bigger servers (100k+ members), but it's working in smaller servers. The bot is possible to add, but command is not working in bigger servers. What could I be doing wrong? My bot is https://memix.lol
Thank you so much!
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
What exactly isn't working?
That's kinda advertising no?
Hi miyu

No, not advertising, sorry
didn't mean it to be at least
I'm not sure why it's not working
that's my problem
It works in "smaller" servers, but it's non-working in bigger servers for some reason
could it be something with permissions?
do you need more permissions in bigger servers that has more advanced roles, etc?
You need to specify what "not working" means
WHAT command?
Wrap the command in a try catch and print the error catch throws assuming it's attempting to run
What does it do?
the command generates a meme that you can change the text of
here's a gif
of how it works basically
Mind sharing the code here?
Only code relevant to the command btw
How it works on the server is one thing, but how it works from the code level is a completely different thing
ah ok
Yes, that
thank you so much for this guys btw
really helpful, although I'm still kinda lost lol
but thank you for real
Don't worry, but to help you we'll need to see the code
Else it'll be just guessing
The possible issues could be lack of embed permission, unable to talk in channel, faulty api or getting user through cache
Yes, the console will usually show what happenwd
oh
Do you use a vps?
Or is the bot hosted in stuff like pterodactyl?
i dont see anything in own API logs
The screen u use to start the bot, does it show any error?
no, nothing there either
also it confirms auth and adds properly through the bot page as well
just big servers that's affected
it becomes non-working
Then it kind of goes back to the first thing Kuu asked for which was, can you share the code so we can help debug it.
the command
but it still shows the previous working commands sends
because SOMETIMES it works
^^
they already said they were not getting an error.
ah ok
sorry then
my bad
code it is
the command
the more related to the command probably the better.
i need help with my discord bot
With what exactly?
i cant launch it
And what language do you use?
JavaScript
So what exactly is not going your way? Bot won't log in or what?
it cant launch
this is code fragment
if (msg.content.startsWith('/ban')) {
there is missing ","
But the bot is active, it just doesn't respond to commands, right?
Active I mean it's online
You havenโt given us an error or anything to work with. The information you have provided is extremely vague and weโre basically just guessing what your problem is. Please be more specific
That has nothing to do with the code you posted
in problems in VSCode there is this error
That is somehow more vague than all of the other info you gave us
i can send you full code and node.js errors that appear when starting bot
For some reason you have "{" in front of "client.on()"
๐ your code editor should give warnings for that
It gave him a warning, but I don't think he knows how to read it
these are node.js errors
Uncaught SyntaxError E:\bot.js:74
}
^
SyntaxError: missing ) after argument list
at internalCompileFunction (internal/vm:73:18)
at wrapSafe (internal/modules/cjs/loader:1149:20)
at Module._compile (internal/modules/cjs/loader:1190:27)
at Module._extensions..js (internal/modules/cjs/loader:1280:10)
at Module.load (internal/modules/cjs/loader:1089:32)
at Module._load (internal/modules/cjs/loader:930:12)
at executeUserEntryPoint (internal/modules/run_main:81:12)
at <anonymous> (internal/main/run_main_module:23:47)
Nynu seems to already have answered a problem in your code.
^ here
Do you want me to send you the corrected version or tell you where the error is?
dont teach them bad habits lol
please send me corrected version beacuse when i removed { it created more problems in VSCode
Because the whole part responsible for the ban command is completely outside the messageCreate event
for every { there must be a } to close it. if your code has one extra { or one extra } somewhere it will not work. this types of issues are easy to detect if your code is properly indented, you can use some auto formatter/beautifier to help you
Also, I'm not entirely sure what the for(let index) part is supposed to do, which apparently doesn't do anything in this file
@hazy jewel
this is the error
Uncaught Error Error: Cannot find module 'request'
Require stack:
- C:\Users\User\Downloads\message.js
at Module._resolveFilename (internal/modules/cjs/loader:1047:15)
at Module._load (internal/modules/cjs/loader:893:27)
at Module.require (internal/modules/cjs/loader:1113:19)
at require (internal/modules/cjs/helpers:103:18)
at <anonymous> (c:\Users\Igor\Downloads\message.js:2:17)
at Module._compile (internal/modules/cjs/loader:1226:14)
at Module._extensions..js (internal/modules/cjs/loader:1280:10)
at Module.load (internal/modules/cjs/loader:1089:32)
at Module._load (internal/modules/cjs/loader:930:12)
at executeUserEntryPoint (internal/modules/run_main:81:12)
at <anonymous> (internal/main/run_main_module:23:47)
You don't have request installed
this is another error
Uncaught DiscordjsError TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
at _validateOptions (c:\Users\User\node_modules\discord.js\src\client\Client.js:489:13)
at Client (c:\Users\User\node_modules\discord.js\src\client\Client.js:78:10)
at <anonymous> (c:\Users\Igor\Downloads\message.js:3:16)
at Module._compile (internal/modules/cjs/loader:1226:14)
at Module._extensions..js (internal/modules/cjs/loader:1280:10)
at Module.load (internal/modules/cjs/loader:1089:32)
at Module._load (internal/modules/cjs/loader:930:12)
at executeUserEntryPoint (internal/modules/run_main:81:12)
at <anonymous> (internal/main/run_main_module:23:47)
You have no intents listed in your client
It's explained very nicely here
Also if you are using discord.js v14 then you will need to change event message to messageCreate
there is TypeError [ClientMissingIntents]
Now you need to go to https://discord.dev and enable the intents you need
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
You click "Applications", select your application that you use, go to the "Bot" tab and scroll down a bit
I can't, but you should be able to use those toggles normally
i enabled everythiiiing and the error iiis the same
Okay, what intents did you add to the client?
I mean what you added to your new Discord.Client()
Please learn your programming language before you make a discord bot
lmao
given the code is being ran by a single file named message.js inside Downloads folder, I BET it's a "no code required" badge unlocker
also fuck, discord utterly destroyed the image viewer
well you canโt get the badge from prefix commands
that's true too, but I don't think they're the one writing the bot at least
probably just copied and pasted code and assumed it would work ๐
A year ago it might have worked
GUILD_CREATE and MESSAGE_CREATE
I mean what you have in this part of the code, because GUILD_CREATE and MESSAGE_CREATE are not really intents
You need the Guilds and Guild Messages intent to receive messages from the servers
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
When you go to this website, it contains a list of intents and events that are subject to this intent
im creating a dashboard for my bot and need to ensure the user has manage_guild before allowing them to make changes to the guild settings. Am i going to need to apply for the GUILD_MEMBERS intent?
no
you only need it if you want to list all members in your dashboard
you dont need it to get information about a single guild member
the only issue i can see is ensuring they are in the cache when fetching the member. If they arent in the cache, wouldnt the bot need to fetch all members to find them?
You'll already know the ID of the user that accessed the dashboard
All u need to do is fetch that specific member
And fetch works independently of cache
Hey does anyone know why my gif is not playing in the frame using java swing?
closeWindow(registerFrame);
Color our_orange = Color.decode("#ff8c00");
URL imgUrl2 = this.getClass().getResource("cool-loading-animation-gif-4.gif");
Icon icon = new ImageIcon(imgUrl2);
JLabel label = new JLabel(icon);
JFrame f = new JFrame("Animation");
f.getContentPane().add(label);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
loadingFrame = f;```
I only get a white frame instead of an actual gif playing
How can you run a bash command outside a Node process?
My goal is to fire a shell script
Wait one second
And run a command (which would restart the node process)
I don't want node to attach to that shell script
No awaiting responses or anything
because for gifs u need to do a few tricks
Please tell me the tricks
java technically supports gif, but it moshes it all together when converting to bufferedimage
whats a regex to match if the first and last letter of a string are for example b?
so you need not to convert to bufferedimage
^b.*b$
If i knew what to google i would
"how to play gif in label java"
i already searched up java swing not showing gif
thanks!
Icon icon = new ImageIcon("cool-loading-animation-gif-4.gif");
JLabel label = new JLabel(icon);
JFrame f = new JFrame("Animation");
f.getContentPane().add(label);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
f.setSize(800,600);
loadingFrame = f;```okay so i have searched how to display a gif
only thing showing up is a black screen with nothing
dont do JFrame.getContentPane().add()
just add it directly
also u need to set that frame as the window's content pane
if im correct, fetching returns the user not the member. from what i know you can only get the permissions from the member
I'm not too familiar with AOuth, but isn't it that when user log in, you can check what servers this person is on and read their permissions?
I'm referring to that - https://stackoverflow.com/a/69529260
I am using discord OAuth2 for chrome extension authentication. I get user access_token and would like to use it to get roles of actual user on my server. I tried to use https://discordapp.com/api/v6/
There are two endpoints for fetching, users and guild members, the guild members one is GET /guilds/:id/members so either use the method the Discord API library you're using provides for that, or make a GET request to that endpoint if you're not using any Discord API libraries
Does this look good? https://pastes.dev/MDixxpzF6f
omg i swear sometimes the gif loads in, other times it just doesn't
Welcome to swing ๐ง
public void guiLoader() {
closeWindow(registerFrame);
URL img = this.getClass().getResource("ezgif.com-resize.gif");
//Make it to an Icon
Icon icon = new ImageIcon(img);
//Make a new JLabel that shows "icon"
JLabel Gif = new JLabel(icon);
//Make a new Window
JFrame main = new JFrame("Zorgzaam | Planning & Administratie");
loadingFrame = main;
//adds the JLabel to the Window
main.getContentPane().add(Gif);
//Shows where and how big the Window is
main.setBounds(800,800, 800, 800);
//set the Default Close Operation to Exit everything on Close
main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Open the Window
main.setVisible(true);
```like honestly what the fuck am i doing wrong
i questioned myself so i copied a random guy's code from stackoverflow to test, i resized the gif, i downscaled the gif, i format it
brev tf
You can do that within Node.js itself, no need for additional shell scripts:
// Import the `spawn()` method to spawn a child process which'll be the Node.js process in this case
import { spawn } from 'node:child_process';
import { setTimeout as setPromisedTimeout } from 'node:timers/promises';
async function restartProcess() {
// Check if the process is restarting, note that we're setting the `PROCESS_RESTARTING` environment variable ourselves
if (process.env.PROCESS_RESTARTING === '1') {
process.env.PROCESS_RESTARTING = '0';
// Give 1 second for the previous process to fully shut down and exit just in case
await setPromisedTimeout(1_000);
}
// Spawn a child process with the command line arguments of the current process
spawn(process.argv[0], process.argv.slice(1), {
// Set the environment variables
env: { ...process.env, PROCESS_RESTARTING: '1' },
// Prepare the child process to run independently of it's parent process
detached: true,
// Inherit the current standard input/output
stdio: 'inherit'
})
// Unreference the child process from the parent process so the parent process doesn't wait for the said child process to exit
.unref();
// Exit the process
process.exit(0);
}
But I would recommend using a process manager for this use case instead
fetch guild -> fetch member
So my gif is actually being interrupted from loading by my thread.sleep
would there be any way to make sure that gif is loaded? I was thinking about wrapping it in a new thread
- Use a formatter like Prettier
- Use a database to store cooldowns and such, because otherwise they'll be reset upon restart
- Avoid setting properties to the
globalobject to be used globally, as this can cause unexpected issues or cause libraries to fail, and since libraries can also access this property, this can be a security vulnerability as well, instead, export the value and import it where you want to use it - Instead of using the
rjutils-collectionlibrary to get a random number between ranges, use the built-inrandomInt()method from thenode:cryptomodule, for example:randomInt(30, 50)
Ok thanks
Hey
hi im keep getting this error and i dont know what to do with it i tried so much im trying to make a help command with buttons i already handled it in my index so that cant be the problem ig
const Discord = require("discord.js");
exports.run = async (bot, message) => {
const hp = new Discord.ActionRowBuilder()
.addComponents(
new Discord.ButtonBuilder()
.setCustomId(`mo-${message.id}`)
.setLabel('moderation')
.setStyle(Discord.ButtonStyle.Primary);
new Discord.ButtonBuilder()
.setCustomId(`fun-${message.id}`)
.setLabel('fun')
.setStyle(Discord.ButtonStyle.Primary);
new Discord.ButtonBuilder()
.setCustomId(`fun-${message.id}`)
.setLabel('logging')
.setStyle(Discord.ButtonStyle.Primary)
new Discord.ButtonBuilder()
.setCustomId(`wandl-${message.id}`)
.setLabel('wandl')
.setStyle(Discord.ButtonStyle.Primary)
)
let embed = new Discord.EmbedBuilder()
.setDescription(`**SHARK Help Menu**
press the buttons to control the help menu
[**SUPPORT SERVER**](https://discord.gg/fytWuaA2bH)
`)
embed.setColor("#B468FF")
message.reply({ embeds: [embed], components: [hp] });
}
exports.help = {
name: 'help',
aliases: []
}
You're putting semicolons in expressions, you're passing arguments to a function there, and to pass other arguments you need to use colons to separate them
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions
Functions are one of the fundamental building blocks in JavaScript. A function in JavaScript is similar to a procedureโa set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the outp...
Learn JavaScript fundamentals
These are where the colons are supposed to go (remove the semicolons that I'm pointing out here as well)
guys, how can i use Environment Variables with LUA?
long startTime = System.currentTimeMillis();
long elapsed = System.currentTimeMillis()-startTime;
while(elapsed<10000) {
elapsed = System.currentTimeMillis()-startTime;
}```this still stops my fucking gif
you're doing a while loop
which halts your whole thread, including your gif one
either do it in a thread or dont even use while at all
@earnest phoenix Thank you
You're welcome
Create a new thread
This is where the java is separared from the script
CompletableFuture.runAsync(() -> {
// Async code here
...
});
what would be the most efficient approach to wrap text with canvas
Calculate text offset
"how?"
y + text.height * line
"how do I get line?"
Calculate text width, when it pass given boundary, do line++
damn kuuhaku looking into the future
thank you
managed to get something working 
Hello, I am facing some issues with redis, our redis setup is clusterized.
Redis version: 7.x
Client: ioredis (nodejs)
Setup: 3 master redis and 3 slaves
Error log: https://hastebin.com/share/umumujunoj.bash
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
redis...clusterized?
redis?
like, it's supposed to be used as a cache layer, not as an actual database
it can be one, but it'll be subpar compared to dedicate databases
Well we are using it for cache, we have postgre for db
why is it clusterized then?
Its microservice, every cache is on redis.
Not sure if I understand, but anyway
I think ur getting that due to a deadlock
Like, many processes trying to get the file's lock
I kinda get the error now it's like redis is loading all the data and before it finished processing that you just made bunch of requests to redis do "things"
Can't u wait it?
does anyone know if changing status (client.change_presence) with the AutoShardedBot on discord.py carries over to all shards?
Yeah just, thinking what would be the best approach to handle it, make a queue or what.
Nono, just prevent the runtime from advancing before it finished loading
It'll delay the startup a bit, but it'll guarantee u don't have cache mismatch
I see.
Hello everyone, I try to create a bot for play music on youtube and hosting on Heroku. It's works well on my computer but too lag on the host. What should I do 
Buy a VPS
Free hosting sites are not suitable for hosting music bots
Music bots require a lot more resources than a regular text command bot
Heroku pricing is 7$ for a month. Not free anymore but I have use Heroku for a long time and dont want to change another provider. 
A VPS will fixed this problem, right? 
From what I see, for $5 on Heroku you get 512mb of ram
It's probably not enough for a music bot, unfortunately
holy shit thats overpriced
Thank you very much. I will try to by a VPS to host my bot now 
I mean, I'm just writing that for this price you would probably get a VPS twice, if not 3 times better
I checked the prices on OVH and for less than $7 you get 1 vCore and 2GB of ram
I personally have 4GB of ram and 2 vCore which is enough for me for less than $7 but I buy servers on Polish hosting so these prices will never be comparable
How about Orcale, I heard they're have a free tier plan. I think this will be useful for a newbie like me
How do you feel about their VPS
It should be good especially since it has a free trial period so you can decide if you want to stay with it or go back to Heroku
owh wow i will have a look in that, thank you.
btw thanks to everyone helping me out with understanding java and its scopes. Thanks to yall i got a 91% on my assignment!
i can't logged
I hope this token doesn't work
And besides, you need to define in your client what intents it should use
This should help you
thank you so much
Hello, I'm trying to use EC2 Instance of Amazon Web Services to run the bot. Seem like it's works!
Is your code from the internet or did you write it yourself?
I'm curious because if it was from the Internet, I could try to run it on my VPS and check if it's the fault of the code or AWS
I'm writing it my self using a library on github. But it's works on my computer, when i run it on else where, the lag occurs

what kind of lag? commands take too long to respond?
Audio playback lag
audio takes a lot of resources, especially if you're transcoding in real time
the free trial one might not be strong enough
1 GB Ram, 2 vCPU
very low for audio
How can I upgrade it
How much is enough for playback audio
probably no trial / free thing is gonna be sufficient for it
Do you run a music bot, what specs did you used on it 
I dont know how much are enough
I do not, I run multiple private applications that have something to do with audio though
I use a minimum of 4gbs of ram to run a bot that only does music and other smaller tasks.
How about CPU cores, does it important to the bot

Too many differnt cpu selection
I actually run a 1 core Intel cpu w/o any lagging.
Thank you very much. Theses information are very helpful to me
Thank you everyone for the help

Hope you go deeper into it even after your assignments, there's so much to still uncover
Is this a correct logical circuit of xnor?
I just thought about implementing the principles of the xor and then complementing it
Write the XNOR truth table
I mean i know it would be true, but rather the implementation of the components of logical circuits
Yes, write the truth table
When implementing a gate u need a truth table
Makes it much easier to write the code later
That said, java already has xnor anyway
I see thank you! I had created a truth table already and it was correct just was a bit insecure about whether the logical circuit was valid.
Yeah, this is not for the Java course but processors ๐
Ah yes
I'm just curious, for this logic gate class, do you guys actually get to build these circuits?
I have a similar course that we get to actually build the circuits in, 10/10 would recommend trying it sometime if you haven't
no sadly not, only abstract circuits.
Damn
It would help a lot but we only got 7 weeks for the course ๐ฆ
It's much more intuitive when you get to actually breadboard them
Yeah indeed i am a bit of a visual learner so i find it pretty hard without being practical indee
I honestly almost understand the whole lecture so far, but one thing that fucked my mind was this:
I honestly have no fucking clue what this means. I have looked at wikipedia etc but i can't find anything about ALU flags. Like, where do i look? Must i compare the MOST left bits of 2 bitstrings (this is about bit additions)
For a number of reasons, it can be important to export a number of status codes from the ALU, for detecting errors, and for making decisions.
This is something you generally look at when you're programming in assembly
ooowh
so we must actually look at ALL the bits of the bitstrings that we are adding?
not only the MSB
It's look like the library I'm using need more resources than others. I'm try to run 2 vcpu and 4 gb ram and the low quality audio can works well but high quality still laggy. Thank you for your knowledge have help me to learn a lot today. 
The overflow bit is important for checking for errors
The carry out bit flag is something I don't know about, I've heard the term but I haven't actually looked into it
ah okay that's pretty simple
The thing is, what do they mean with "result"
Adding two numbers
Must you look at each bit and compare them? Must you look at the resulted bitstring after adding them?
Ooowh okay so adding them and then "looping" over each bit
Well, it's not as simple as just ORing the bits together
The logic gates used for it are more complex than that, but I'm assuming the ZERO flag is a fast way to compare two numbers since it only requires 1 gate operation per bit of the two numbers you're adding
yeah it's just a quick way to compare two numbers essentially
so if i understand it correctly, a zero flag is when all bits are 0 in the result?
Essentially yes
I'm not quite sure if that's a perfect explanation of it, as I'm not an expert on the topic
but I would assume that's basically how it works
i see, and eventually last question (honestly sorry for my dumbness) if we have overflow we also have carry right?
so in this example, BEQ would likely be checking the ZERO flag on the CPU instead of worrying about the result
I mean, a bit is a mod 2 calculation, so if it's for example 1+1 = 2 = 0 and 1 gets carried away
owhh i see
I believe so? I'm not fully versed in half-adders and things of the sort
Okay, thank you very much for all the help waffle!
np C:
Btw @eternal osprey if you want to get better at logic gates and such, there's a game on steam called Turing Complete. It's great for creating low level circuit simulations and it's quite fun to progress through the levels
Owhh really? That's really cool. I will definitely have a look at it
The flags are pretty clear to me thanks to you, thanks bro!
Would these flags be the same when working with two-cmplement? @wheat mesa
two complement binary system*
I'm not entirely sure of the low level implementation details surrounding two's compliment
I just know how to convert to and from it lol
As the abstraction gets higher level, the low level logic starts to become incredibly complex
Owh my bad i indeed serached it up, if the msb is 1 it accounts for negative
else its positive
I see
is the userId from discord an integer or string
discord.js
though you can just cast it to/from a string
i am getting it from an interaction
yeah the discord.js one is string based
iirc kicked back in like, 2017-18
nevermind your bot was deleted before so it wouldnt have been here to begin with
ye it was deleted cuz the page for him broke cuz i put the owner of the bot as a team and then deleted the team
yeah
also ratelimits ofc
yeah thats no worries, i aint doing smth with everyone
its a verfication system for nfts ๐
any idea why i am getting this error?
nvm
const members = await guild.members.fetch();```
fixed it like that
and used members.forEach()
yeah just have to remember that .fetch() fetches all the members
which can cause ratelimits and/or cause delays processing things on your end
since that fetch actively requests the members from discord
depending on what ur doing, I'd highly recommend against
isnt it considered 1 request?
what should i do then if i have to loop over the users every 2 min
keep in note, its just 1 server ๐
its to verify if their wallets hold an nft or not ser
Is this better than the other code? https://pastes.dev/4vCgm4v4Ce
how can i go over them then?
i do have a database but what if someone is new and not in the database
@lyric mountain
idk
if they're new then they wont have nft
or whatever ur doing
you should refrain from doing api operations whenever possible
i will show u the code to see what i mean cuz i have to do it that way
verifyservers.find().then(async function (b) {
for (const server of b) {
const address_to_track = server.track_address;
const guildid = server.server_id;
const roles = server.roles;
const guild = client.guilds.cache.get(guildid);
const members = await guild.members.fetch();
members.forEach(async (member) => {
const account = await profiles.find({ discord_id: member.id });
let count = 0;
if (account.length > 0) {
//check linked wallets, if they hold any nfts give role if not do nothing
} else {
//remove related roles cuz he didnt have his wallets linked yet
}
});
}
});
};```
@lyric mountain
u ping a lot dont u
anyways, its all good lol, 2 requests every 2 mins wont hurt much
just once, others was a reply lol sorry
twice just noticed lmao
replying pings aswell ๐
iterate over database users
instead of guild members
yeah i am turning it off now
i could but like that role can be assigned to someone by a mod and the role will never be removed
also, i can have a timeout every time it gives a role, that way i am not going over the limit
this isnt necessarily about programming but does anyone know how to fix this? Lets say 3 players join my Minecraft Server; the first two have a normal ping and the other one always, always a bad one. Once a fourth player joins he just gets kicked because his connection reset. what? I have full access to the vps so help me here, I already searched for resets in tshark (wireshark) and found this:
its currently only 1 server so ig that should do the work now, once i have a more servers using that feature i can have a timeout between each server
like that
await new Promise(resolve => setTimeout(resolve, 1000));
the problem is updating user database wont be an option on the long run, it will probably cause more problems
i am pretty sure its cause of the specs your vps have
whats your specs anyways?
it isnt im quite certain
sigh, why do people always settle at "enough for now"?
it only makes harder to fix later on
ah well not sure then sorry, i remember it happened to be back in the day when i used to play
cause the enough for now might be better then adding each user that joins to the database
for now its just 1 server, later on its gonna be much more
having timeouts wont hurt
didn't tell u to add 'em
I told u to update their status when events happen
having timeouts WILL hurt
if you settle at "good enough" it'll create the bad habit of leaving technical debts unpaid
i want it to be automated bro... once a user links his wallet on the dashboard he just waits and gets the role
why
and they'll end up forcing u to rewrite the entire thing again
yeah ik it happened to me before lol thats why i am trying to have the best option right now
but really man, i cant just update their status on events
1)i can 100% update once they link wallets, but what if they sold the nft, what if they bought more and need a higher role
2)i can add a database of users, but this database could be huge and could cause problems on the long run lets say i had to shut down the server for 5mins and like 500 users joined servers and i dont have them in my database
3)tracking real time data for my scenario is better cause as i said it depends if they hold nfts or not
True i agree with that, but 2-5 requests per second wont hurt, limit is 50
not really, i am looping over servers in series
i can have a 1s timeout between each server and boom that issue is solved
i will have the interval set to the number of servers i have +30 s
I wont argue because 99% of the time they end up ignoring
but the way ur doing it, expect to be contantly hitting the ratelimit
i understand what u are saying i swear but currently its the best option to have it like that
it's the worst option
like, really
databases are made for huge amounts of transactions per second
and by huge I mean millions
while apis expect low amount of calls
the way ur doing it will require rewriting very soon
suggest another way to make it automated, i cant track member joins of all the servers i got, it will be a hard and adding all the current members could hit rate limit
why would i hit the rate limit if i am sure its a max of 2-5 requests per second
already did
also, events do not hit the api
so you'll never hit ratelimit for listening to events
the only thing that can happen is crashing ur bot if u create too many listeners
because it wont be only 2-5 requests
also, there's another little detail
fetching all members WILL crash your bot due to OOM
ah great then but again, what if my bot went offline for 5mins and those 5 users that joined i didnt add to the database
they will be left stranded (i know they wont be holding any nfts and they are useless but they could be given the role by a mod and i will not be able to remove it cause sometimes roles in this space are given just to test stuff)
when they talk add them
there are way too many events u can use for tracking it
if a member never talks u might as well not worry abt them
i have a strong server thats no worries
no server is strong enough
you could even use a join channel and check for joins that happened during your bots downtime
if the server provides one that is
ah well i could apply listeners to lots of servers normally?
listeners are global, not server-specific
but yes, u can listen to all events if u want
discord wont complain
ah thats nice, i could do that. i will check what i could do and let you know ๐ค
thanks alot ๐
just make sure whatever u do, consider as if u were working with 1000 guilds
that way u ensure it'll grow smoothly over time
yeah thats exactly what i ma trying to do cause before i had to rewrite lots of pieces of code to fix stuff
now i make it in chunks as functions , if something is wrong i just fix the function / rewrite it
Another way to ensure messages reach you is to separate your Discord gateway connection to another process and then send dispatch events to an aqmp instance and have your main bot or cache worker listen to amqp. The messages stay in a queue until they're consumed
So say I had a camera and I wanted to view it on my pc/phone. How would I stream what the camera is viewing to my device of choice
I'd assume I would need smth to process these video streams of some sort to actually display it
you'd have to encode it to something like h.264 or av1 and then have a client on the target device to decode the stream
Yes, h.264 is also known as .mp4
Some people use avi or other encodings, their size and speed is difference, you can search online for comparison between those encodings
Can I read messages sent to my bot in direct messages?
messageCreate event doesnt seem to trigger when its a direct message
It triggers fine on the server
Is there any special intents for direct messages?
Yes
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
You're specifically interested in one, "DIRECT_MESSAGES", unless you want to receive reactions as well
I'm actually recognized the problem of laggy in my discord bot. As you know, I have tried to host on Heroku and AWS and the problem still there. But today, I have tried to host on Google Cloud and the suprise is it no more lags when playback. The specs on AWS: 2vCPU - 8 GB Ram ( I have try on differences specs, this is the maximum) and Google Cloud is: 1vCPU, 1GB Ram. So, seem like google are limiting the traffic from AWS to their server (?). I dont know

one of my bots get really high ping "out of nowhere" sometimes (it suddenly starts being slow), this is /ping command using message listener method
(too slow for interaction)
Gets fixed by a bot restart
(the lower ping one is another one of my bots on the same machine so yall know its not some internet issue)
Ram usage: 0.3 GB
Either sudden spikes by your host
Or performance issues caused by overloading/not enough power
Keep an eye on both your server traffic nonetheless, aswell as your bots cache size and ram usage
Hello, im using discord.js v14.7 on a bot with close to 100 shards.
Suddenly the bots started to go offline in some servers seemingly random. Other servers on the same shard are working just fine, and the shard, where the affected server is on, is still showing as online with uptime of multiple days.
Any ideas why the bot shows as offline and is not responding on some servers?
Hey guys, i have created a multiplexor, how can i output 1 if there's parity?
if the shard where the server is, is online and responding, then the server might be unavailable, which happens due to discord outages or server bugs
in any case you can try restarting that specific shard and see if the guild works again
if it still doesnt work even after restarting then its a discord issue most likely
thanks ill try that!
I'm attempting to host an Umami application, and I was able to setup everything correctly. However, when it comes to logging in, the moment I click 'login', I get the following error of:
Segmentation fault (core dumped)
error Command failed with exit code 139.
I'm not sure, however, what's causing this issue. I've setup everything right, and the application starts, oh well. Although, it's the logging in that is the issue.
segmentation fault commonly occurs when referencing a null pointer, so the code is at fault (no pun intended)
I mean the code is from the GitHub the documentation lead me to download, so I'm not sure.
I heard Umami was a good one, that's why I decided to use it.
Are they paid? If so, that's the great thing about Umami, it's free.
so I let users make reverse proxies with nginx and also upload ssl certs (!)
if they are invalid in most cases I tell the user but I cant detect everything and in worst case scenario nginx wont reload because its invalid; how can I make nginx ignore all ssl cert errors and just use a default one if it fails?
you mean this? https://github.com/umami-software/umami
Yeah unfortunately segfaults are difficult to debug especially if theyโre not coming from your end of the code
So thatโs uhโฆ good luck
Yes.
Wait this is written in js
Yes.
How the hell did they fuck up so badly they got a segfault
In js
I would understand causing a segfault if it were written in C, C++, C#, or rust, but javascript??
probably a native dependency for some reason
Hey anyone know how to change an image to circular using canvacord npm package
I'mma trying to do with an avatar url (discord)
Plz tell
hi, i am using discord.js v14 and trying to restart a shard.
I am receiving the ids of the shards that are queued for a restart from my db into my shardingmanager process. There i will search for the shard and trigger its respawn function.
const shard = manager.shards.find(shard => shard.id == shardId);
if (shard) await shard.respawn();
however, it seems like the shard is not properly shut down, the shard process seems to run multiple times, for each respawn i did. All the shard's cronjobs run multiple times and when triggering a command i get "Interaction has already been acknowleged" multiple times.
Any idea why the shard is not shutting down properly and restarting, so only one instance of it is running at all times?
would need to see more code
how did you run the respawn code?
eval command?
no i just did .respawn on the shard object
do you just set restartQueued in your db and wait for the cron to pick it up?
yes
the commented-out code will do it (before even respawning)
just not doing it now before its working
Will this work??
const { Canvas } = require('canvacord');
// slash command code...
let user = interaction.options.getUser('user');
let circlePfp = await Canvas.circle(user.displayAvatarURL({ format: 'png' }));
let a = new AttachmentBuilder(circlePfp, { name: 'circle.png' });
await interaction.reply({ files: [a] });```
I don't have my pc rn so I'm confused
remove this, or add a process.exit() here
in bot.js
'SIGTERM' and 'SIGINT' have default handlers on non-Windows platforms that reset the terminal mode before exiting with code 128 + signal number. If one of these signals has a listener installed, its default behavior will be removed (Node.js will no longer exit).
The subprocess.kill() method sends a signal to the child process. If no argument is given, the process will be sent the 'SIGTERM' signal.
youre a genius
thank you so much
should work, try it and see
why this filter doesnt work
const filter = (interaction) => interaction.user.id === message.author.id && !interaction.user.bot
const tradeCollector = tradeRequestMsg.createMessageComponentCollector({filter, time: 90000 })
define "doesn't work"
the second part u can freely remove btw
interaction user will never be a bot
regarding the first part, anyone BUT the author can interact?
if so, did u try logging what each part is returning?
then the issue can't be in that code u sent
show more code
more specifically, show how you define message
how can I disable the update available message for pnpm? This doesnt work
pnpm install --fix-lockfile --registry=https://registry.npmjs.cf --update-notifier=false "${args[@]}"
u mean message that have message.author and etc?
yes
i am just taking message from messageCreate event
and pass it to command.run() method
nothing more
problem not in message cuz it works in other commands
the thing is
on which message are the buttons you are waiting for?
here filter doesnt work
but here for example works fine
hmm strange, i dont see anything wrong
Hopefully someone can help me here.
My bot in the last 2 days has randomly gone offline around the same time. It's in around 200 servers. Errors do not show anything crazy, but today I did see a few disnake errors around "Interaction took more than 3 seconds to be responded to.". I assume these happened just before it started to die.
When I try to rerun to start it up it just hangs and shows nothing... yesterday after a few attempts 20mins it starts working again. I have nothing to work with here and its frustrating.
Any ideas?
Try seeing if anything you're using supports debugging (e.g. an env var DEBUG=true or logging levels)
Have you tried deferring interactions?
Depending on what your code is doing it can take more than 3 seconds to respond and deferring the interaction allows you to edit the response later
do you have any cron jobs or scheduled tasks that run on a specific time every day?
No cron jobs, just another docker container that automatically backs up the volume to s3 around midnight. That's been running for months fine.
will look but not sure
could look at doing this
does the issue also happen around midnight?
When I try to rerun to start it up it just hangs and shows nothing... yesterday after a few attempts 20mins it starts working again.
this gives me the impression that either your network had issues or discord had an outage
where is your bot hosted?
could be an issue with aws
i do currently have no internet and tethering off my mobile but im not sure how that could interferee with anything, im ssh to my instance and trying from there
do you have any info about cpu/memory usage on the machine?
yea its been the usual, just 1-2% lmao
i have 2 bots on 1 instance, the other is compltely fine and has the same code
only difference between the main one actually is that i have the top.gg api posting bot stats so i can see how many servers my bot is in
i added that in 4-5 days ago... thats the only difference between the too, apart from one being in 200 servers, and the only only in 2
do you have the presences intent?
i dont actually, only server and message
wasnt approved for presense
dont think i needed it
hmm, im mostly guessing here, but i can only think of aws network issues
no
i just asked because the presences intent causes a huge influx of data from discord
its almost like discord is ddosing you, thats how horrible presences are
would make sense, and i actually would be happy if both bots went down it would make sense
what about memory usage?
cant check my grafana dashboard cuz ive had no internet last 2 days
would be on there
fml
MemTotal: 1984212 kB
MemFree: 301820 kB
MemAvailable: 1135176 kB
Lol
i forget the difference between Free and Available
is that bad?
wh...what does your bot do?
im running a few things on there tbh
ah ok, so that aint you bot's mem usage
it depends on what the actual metric is, those terms are a bit vague
this was in /proc/meminfo on my ubuntu server
MemTotal: total usable RAM
MemFree: free RAM, the memory which is not used for anything at all
MemAvailable: available RAM, the amount of memory available for allocation to any process
anyway those look like normal values, nothing wrong there
for your issue it would be more helpful to get the memory used by the bot process
what does your bot run on?
are both bots in the same container or in separate containers?
separate
using my phones 4g is messing with something - i just shut down my test bot thats on an entirely different server in another region, tried to spin it back up and nothing...
same with the clone bot on the main server
hmm
Crashes often appear on the log, no way ur getting nothing on it
how do read a specific txt file and then find a string in that file and then remove the completely?
Load the file into a string, replace the word and overwrite the file
how do i overwrite the file?
Just save it
well i have tried this js let allWords = fs.readFileSync("./wordleWords.txt", "utf8"); let words = allWords.split("\r\n") const solution = words[Math.floor(Math.random() * words.length)]; //console.log(allWords) allWords.replace(solution, "") it didn't work.
oh, how do i save it?
do i just liek await allWords.save();
oh ok
Of course not
oh
how do i remove the completely?
Save the output of replace
this is what it look like in the txt file.
Idk how ur planning to use that dictionary, but you'll need some way to cache or index it
hmm, how do i cache it
That's a question for another day
i don't understand what you are talking about.
let string = string.replace(...)
Just google it, should pop as tge first result
Yep
so i would just to fs.writeFileSync("path/to/file", newString)?
Yep
oh
Just remember that'll overwrite the file content
what do u mean overwrite? it will replace everything with the new thing?
Yes
Just replace the entire thing
By "entire thing" I mean you'll overwrite the previous content with the new content
The new content being the string minus the word u removed
let text = readfile
Lorem ipsum sit amet dolor
text = text.replace("sit", "")
Lorem ipsum amet dolor
writefile
oh
Does anyone know how to get a c++ project to compile to a standalone exe file in CLion? Can't seem to get it to work
The hardest part is actually making c++ compile


