#development
1 messages Ā· Page 51 of 1
yeah
did you guys know this was possible
like dammmmm
š©š©š©
you can now split screen between two apps
ye, been using that since I bought my xiaomi
tho I use mostly the poppable view feature
yeah I saw that too, it's also pretty cool
my moto e4 can do that too
yup
makes sense
but that's also why android > apple
There's no way includes or any other built-in method which accepts a string builds a regex from that string
It does not build a regex from the string
https://chromium.googlesource.com/v8/v8.git/+/refs/heads/main/src/builtins/string-includes.tq
uh
i have enjoyed multitasking on my iPad for years
Technically it already had since Android 7
It just got improved with Android 10 or 11 I believe
I do agree it's pretty nice, just never used it
Same with the "one hand" mode
That thing, Discord doesn't really support it well
the one I had on my samsung the mUI one handed mode worked well
can't figure out how to turn it on on my new phone tho
I suppose it's because of the React-Native rewrite, it's not polished yet
It used to work well with the Java version
Yeah it's a pretty bis hassle to enable it lmao
Literally takes me minutes to get it enabled
for me it simply shrinks the phone by about 33%
tho for me it's kinda useless since my fingers are big
I just use normal mode with one hand
but I can see why it exists lmao
Not hard to use when you've been doing it for years
I've met some people whose thumb does not reach the other side of the screen
and no, they weren't kids
lmao
I can use the whole keyboard with one hand without using the one-handed mode š
I was able to control the size of the previous one handed mode
ye, u can adjust it
Yeah it's not that hard
goes all the way down to 50%
but idk how to enable it, I used to do it on my old phone by holding down the middle button and sliding to the bottom left corner
a feature I find quite neat is the dual-phone mode
it doesn't work with my new one
I can set two patterns, one for each "phone"
and neither can see the other side
tho I don't see myself ever using it, but it's neat if someone gets stolen frequently
or if you have *ahem*, relationship issues
you just reminded me of the video I saw
š
I wish I didn't see it
Can anyone help? I'm getting this error
node --no-warnings index.js
0=======================0
| Events | Stats |
|===============|=======|
| guildmember | ā
|
| ready | ā
|
| slashcommands | ā
|
0=======================0
0========================0
| Slash Commands | Stats |
|================|=======|
| help | ā
|
| invite | ā
|
| ping | ā
|
| role | ā
|
0========================0
/home/runner/HellStorm/events/ready.js:29
client.channels.cache.get(config.mcplayChannel).setName(playersChannelName)
^
TypeError: Cannot read properties of undefined (reading 'setName')
at updateChannel (/home/runner/HellStorm/events/ready.js:29:50)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
exit status 1
and this is my code
I think I saw that console output somewhere else
did you clone "your" code from somewhere?
No
Do you know of a way to fix the output?
Iām trying to use the channels edit feature and it isnāt really working
Channels are not guaranteed to be cached
client.channels.cache.get(config.mcplayChannel) returns undefined, you should always check if a channel exists before using it
Not only once
Fetch the channel
I assume the var in the config isnot set or wrongly set
Either that, or the channel is not cached
also the fact most stuff is using a config file (not much reason to have one if it's for a private bot) and the step-by-step comments
Well fake got a config file, too 
Fake is a pro though
Bae comments WAY too much
Granted sometimes itās helpful to understand what his 5 billion character regex does
Regex is like math
You either understand it and can use it or not
But yeah reading absurdly long regex is like reading an alien language
I can see the usefulness of regex
But when it becomes too complex, I feel like it might be easier to parse at least part of whatever youāre matching before doing a regex tbh
Yeah pretty much
Flashbacks to Discord mobile using a regex-based parser for their markdown and syntax highlighting
Took me weeks to implement the JavaScript and TypeScript highlighters for it because of how scuffed it was
I hate when people use regex for the wrong reasons
I can see how incredibly useful it is for matching basic things and validating forms for frontend and such, but once you start getting into HTML regex parsers I think itās being used for the wrong reason
Although regex is very very very useful for describing the syntax of languages, not necessarily parsing them though
Awh hell nah
āSimpleASTā meanwhile the worldās most complex regex is being compiled for 43 minutes and 22 seconds
Discord's regex-based parser also prevented me from highlighting template literals inside template strings, since it needs outer and inner global checks which is basically impossible with regex alone
Regex isnāt meant for non context free grammars afaik
Thatās why itās difficult
Because you need lookahead and context to parse things sometimes
And regex just isnāt the proper tool for that
Indeed, but Discord went with it anyway
They should've used vendors/grammar-based parsers
I can see why they went with regex
Each language would require a different parser to be written for it and those take quite a bit of time
Especially with the complexity of certain languages
Just like GitHub's language detector, which is also used for the syntax highlighting
https://github.com/github/linguist
But honestly discord shouldāve just used a lib maintained by someone else
So that the masses can contribute to syntax highlighting
There are a lot of vendors who already provide grammars for those parsers, so they wouldn't even have to write it themselves
Good concept at its core but people tend to use it for the wrong purposes
Honestly that concept applies for all programming languages 
Yeah thatās fair
I kinda want to write some code but Iām a bit burnt out
And I donāt know what to work on
I donāt wanna work on my lang rn cus I want to keep motivation for it
Maybe Iāll just play terraria
The good ol' Terraria
Nice
@wheat mesa I bought terraria like youve been telling me to
lol
Damnit
I was telling you to call me daddy but you didnāt
Wouldnāt have cost you anything

Copy from where
But didn't u say u forked it?
Ahh
I forked my code from replit
In windows we copy and in replit fork means make anew project with this code
@lyric mountain wanna test bot?
No
nice
css jail?
css jail
yeah whats up with that?
Could I get any suggestions as to what replace Pug with? Plain html is terrible + pug seems very buggy
@civic scroll since you are angular nerd
<li class="mr-6 my-2 md:my-0">
<a routerLinkActive="text-primary-fg-color border-primary-fg-color" [routerLinkActiveOptions]="{exact: true}" routerLink="/logs" class="block py-1 md:py-3 pl-1 align-middle text-gray-500 no-underline hover:text-gray-100 border-b-2 border-gray-900 hover:border-gray-100">
<i class="mr-3 text-primary-fg-color"><fa-icon [icon]="faFolderOpen"></fa-icon></i><span class="pb-1 md:pb-0 text-sm">Logs</span>
</a>
</li>
Why doesn't the routerLinkActive values get marked as !important or whatever is needed to overwrite the styling when it's not on the route.
Used to work 12 months ago when I was working on the project, yesterday updated packages and now it doesn't work. The classes are applied but they don't overwrite the default. (Using Tailwind)
there's something else marked as ! important then
no
It simply doesn't apply because the other one is not getting removed
text-gray-500 is the styling when not on route and text-primary-fg-color is when on route
Should look like that
Instead of the current
i could add custom css with like .active and use !important but what's annoying me is that it worked before and using custom css is not convenient
Sounds like a peculiar problem
isn't it [routerLinkActive] since you are binding class names to attributes
or am i missing something
Hello everyone silly question about js
I have const array = [1,2,3,4,5]
I know 3 is in the array now how can I find the index of it?
array.indexOf(3)
findIndex accepts a function
ok tnx
nah that doesn't change
the classes are applied
they just don't overwrite the default ones
<a routerLink="/user/bob" routerLinkActive="class1 class2">Bob</a>
Other projects also use that
your first issue is that ur using Angular
my webhook dont working.
Im hosting bot on localhost (windos 11 rdp machine)
bot don't want to post when someone vote
"Doesn't work" is not really helpful. Please share the structure of your code and try to explain what you tried to do
Okay
Wait a sec
dm?
or here?
Here, as others may want to help too
this doesnt working
where problem can be
someone told me its because im hosting on localhost
ah this happens due to selector priority
idk what affected those tho
normally i would use a custom class for that
and any way to use tailwind classes in custom css?
like make an active class in custom css that is text-primary-fg-color border-primary-fg-color
because
.active {
--tw-border-opacity: 1;
--tw-text-opacity: 1;
border-color: rgb(159 177 176 / var(--tw-border-opacity));
color: rgb(159 177 176 / var(--tw-text-opacity));
}
works but it's kind of annoying, specifically when changing colors in tailwind config
because you host in on localhost with local ip, not public ip
based on ur statement
Found a workaround
probably shit but it works
Basically just did
colors: {
"primary-fg-color": "var(--primary-fg-color)",
"primary-fg-color-dark": "var(--primary-fg-color-dark)",
"primary-fg-color-light": "var(--primary-fg-color-light)",
"accent-fg-color": "var(--accent-fg-color)",
"accent-fg-color-light": "var(--accent-fg-color-light)",
"bg-color": "var(--bg-color)",
}
and added
.root,
:root,
#root,
#docs-root {
--primary-fg-color: #9fb1b0;
--primary-fg-color-dark: #434848;
--primary-fg-color-light: #5b6262;
--accent-fg-color: #c1d8d8;
--accent-fg-color-light: #daf1f1;
--bg-color: #2e303e;
}
to the global css file 
use @apply
ah true that exists completely forgot it
Jh
Id link an opinion, I made a bot in V13 (d.js) Should I update it all to V14 or just keep 13 till it dies
no way I actually did a switch statement with a random number
And case (e.g 40)
case (e.g 39)
case (e.g 38)
case (e.g 37)
Documentation
im using firebase as database but it's limited
please can someone tell me a good and unlimited datadabase
for free š
any + hosted locally
?!
or if u can't use service-based databases, use file-based options
databases can be hosted in ur own server
server of my bots?!
yes
ok
hey guys
in c++ i have this enum: Month easter_month
where easter_month is a certain month like January etc, that starts at count = 1;
How would i go forth one month? So ideally something like easter_month++?
I don't think u should start January at 1
So it would for example go from January -> February
My teachers pre-defined it
But well, simply make a reverse method to get by value
a reverse method?
Put that ain't enum, that's a magic constant
getMonth(int)
Then iterate over the fields and get the one with that value
you have an enum of strings? or what?
is getMonth a thing?? Owh i didn't even know that
No it isn't
he probably meant for you to create it
You'll be the one making it
can you show the actual code?
Also what tim pointed is a thing, why do u need to even get the variable?
This is the enum:
enum Month
{
January = 1,
February,
March,
April,
May,
June,
July,
August,
September,
October,
November,
December
};
Month.values()
i was thinking can't i just use the static_cast
so basically thats an enum to get the month number using the month name
for example Month.May === 5
like: static_cast<Month>(value++)
Ah i see
enums are already auto incrementing off of the previous value cast
so basically Month.January === 1
I need to manually change the month
as i want to add 7 weeks to a certain day-month value,
Uh oh
Then you can just set the month you want as a specific number like for instance, May = 7 (which is incorrect, but just an example)
So yk months might not always have 30 or 31 days right?
7 weeks is about 2 months
I did it using this: js int carnival = 49; int counter = 0; int daysinmonth = number_of_days_in_month(year, easter_month); while(counter != carnival){ counter++; if(easter_day != 0){ easter_day--; }else{ easter_month = static_cast<Month>(easter_month + 1); daysinmonth = number_of_days_in_month(year, easter_month); easter_day = daysinmonth; } }
and this is my whole function
Yeah i already calculated that
using switch cases, accounted for leap years as well
perhaps I misunderstand the situation
I basically have to code a function that will calculate when carnival is
based off the easter day and month
carnival is always 49 days before easter.
That's... Okay then
So I made this function. It would keep on removing days (and if the day is 0, remove 1 month count and redefine the new month and it's day)
is it bad coded?
well, the math approach is always faster
For sure
ie, subtract number of days in the current month from 49
instead of looping one by one
if easter day is 15, just subtract that amount, 49 - 15 = 34
then subtract 1 month
no you're at day 34 of the previous month
now subtract the number of days in that month
if the month has 30 days, go back one more month, and subtract the remaining 4 days
basically you do 3 steps instead of 49 steps
using math and a couple ifs
string show_carnival(int easter_day, Month easter_month, int year)
{
int carnival = 49;
int counter = 0;
int daysinmonth = number_of_days_in_month(year, easter_month);
while(counter != carnival){
if(easter_day != 0){
easter_day--;
}else{
easter_month = static_cast<Month>(easter_month + 1);
daysinmonth = number_of_days_in_month(year, easter_month);
easter_day = daysinmonth;
}
}
string date = easter_day + " " + easter_month;
return date;
}```why is this function not returning anything?
infinite loop
#ifndef TESTING
int main()
{
cout << show_carnival(6, January, 2000);
}
#endif
owh fuck i forgot to ad the counter increment
thanks kuu you rock
Lies he doesnāt
yw
One issue tho, it says that construct null is not valid?
string date = easter_day + " " + easter_month;
return date;```this is what i am returning
show the error
return easter_day + " ";``` i used this for testing
M_construct null not valid
easter_day is an int here
and this is the function atm
what is easter_day
oh
you can't add an int to a string in C++
it's not like in dynamic languages like JavaScript
use std::to_string to convert the integer to a string

request for member error?
no
omg
so it should be inside the ()
awesome i love you rust

string show_carnival(int easter_day, Month easter_month, int year)
{
int carnival = 49;
int counter = 0;
int daysinmonth = number_of_days_in_month(year, easter_month);
while(counter != carnival){
if(easter_day != 0){
easter_day--;
}else{
easter_month = static_cast<Month>(easter_month - 1);
daysinmonth = number_of_days_in_month(year, easter_month);
easter_day = daysinmonth;
}
counter++;
}
return "Day:" + to_string(easter_day) + "Month: " + to_string(static_cast<Month>(easter_month));
}
```hey guys, i think that i am almost done but i have a critical issue
if i input show_carnival(8, April, 2023); it returns me Day: 20Month:2
while the correct date should be 18:2
so it's off by 2 days
How do I join guilds for a user when they're authorized with my application with the guilds.join scope?
day 0 is overlapping with the last day of the month
day goes 2, 1, 0, 31
so make it easter_day != 1
I see i changed this
it's still returning me crazy results
wait let me get you an example
it seems to be working lol
tim i would honestly hug you
thanks
easter_month = static_cast<Month>(easter_month -1);
daysinmonth = number_of_days_in_month(year, easter_month);
easter_day = daysinmonth;
}
}
return "Day:" + to_string(easter_day) + "Month: " + to_string(static_cast<Month>(easter_month));```i am having one last thing. I now get returned an actual number of easter_month, but shouldn't the static cast already convert that int to a Month?
So January for value 1 for example
I want the bot to change its nickname on the server when the name is changed on the dashboard how could i make it do that?
you want to print the name of the month?
i dont think you can do that with an enum
would i use .setNickname?
what language and library
ok, I got this button; how do I edit the text in js?
JS
looks like it yes
ok but would i do bot.setNickname?
you want to edit the html text from js?
yes, in a <script></script>
I basically want to check if the user is already logged in
you need to find the element using selector functions like getElementById or getElementByClassName or querySelector
then edit the innerText property
you'd probably have to get a reference to the bot user, so it'd probably be bot.user.setNickname
This is what i have typed in for the settings
thanks
@astral path
actually, you'd have to get it as a guildmember, which i'm not sure exactly how you'd do, probably get the guild from the id or whatever then get the bot's user through the guild object, then call setNickname on that
yeah
bot.guilds.cache.get(server.id).members.fetch(bot.user.id).then(member => member.setNickname)
for example
have i wrote this wrong?
you can probably skip the fetch there as the bot member is usually cached
What is that for specifically? What does that do? How does that interact with the bot object?
is that how your dashboard interacts with the bot?
it defines the part of the setting for the name part of the dashboard and it logs it to the data
yes
I'm trying to make a reaction role system, and I'm not sure what I'm doing wrong. I keep getting the error "Please Provide me with a valid message ID"
if (Object.prototype.hasOwnProperty.call(data, "send")) {
//channel
let channelValid = await guild.channels.cache.find(
(ch) => `#${ch.name}` === data.sendChannel
);
let channel;
if (channelValid) {
channel = channelValid.id;
} else {
renderTemplate(res, req, "./new/mainreactionroles.ejs", {
guild: guild,
alert: `Please Provide me with a valid Channel`,
emojiArray: EmojiArray,
settings: storedSettings,
});
return;
}
let message;
if (data.messageID) {
try {
const emojimessage = await channel.messages.fetch(data.messageID);
message = emojimessage;
} catch {
renderTemplate(res, req, "./new/mainreactionroles.ejs", {
guild: guild,
alert: `Please Provide me with a valid message ID`,
emojiArray: EmojiArray,
settings: storedSettings,
});
return;
}
} else {
renderTemplate(res, req, "./new/mainreactionroles.ejs", {
guild: guild,
alert: `Please Provide me with a valid message ID`,
emojiArray: EmojiArray,
settings: storedSettings,
});
return;
}
so, you're trying to write the req.client.settings.set function for the given guild id and newname?
yes
channel names don't actually start with a hashtag
it's just a visual thing in the client
So it should be:
(ch) => `${ch.name}` === data.sendChannel
instead of:
(ch) => `#${ch.name}` === data.sendChannel
@hidden gorge this should do pretty much exacctly what you're looking for, with some slight modification depending on how the rest of the set function works.
ok
if (Object.prototype.hasOwnProperty.call(data, "send")) {
//channel
let channelValid = await guild.channels.cache.find(
(ch) => `${ch.name}` === data.sendChannel
);
let channel;
if (channelValid) {
channel = channelValid.id;
} else {
renderTemplate(res, req, "./new/mainreactionroles.ejs", {
guild: guild,
alert: `Please Provide me with a valid Channel`,
emojiArray: EmojiArray,
settings: storedSettings,
});
return;
}
I'm not sure what I'm doing wrong.
I'm trying to make a reaction role system.
tring show_whitsuntide(int easter_day, Month easter_month, int year)
{
int carnival = 50;
int counter = 0;
int daysinmonth = number_of_days_in_month(year, easter_month);
while(counter != carnival){
counter++;
if(easter_day != daysinmonth){
easter_day++;
}else{
easter_month = static_cast<Month>(easter_month + 1);
daysinmonth = number_of_days_in_month(year, easter_month);
easter_day = daysinmonth;
}
}
return "Day: " + to_string(easter_day) + " Month: " + to_string(static_cast<Month>(easter_month));
}```now i need to calculate 50 days after a given date for example 18 september. Right now it's returning me day 34: month 34.
Why?
are you still trying to manually parse times?
new Date().toLocaleString("en-GB", { timeZone: "Europe/London" })``` is returning `28/09/2022, 19:23:34`, which doesn't have PM at the end so its returning Invalid Date when trying to get timestamp
but js new Date().toLocaleString("en-US", { timeZone: "America/New_York" })
returns 9/28/2022, 2:23:54 PM, which works
š¤ why do it like that?
you can add 50 days to any date object just by adding the current date(day of the month) + 50.
how can I center this?
for some reason the text is now weird
I how I can prevent animation started before page fully loaded
cause I checking the event by checking if it is in the view port
and when my page load, the component was loaded in the view port
I am not allowed to use any packages. And itās c++ btw
Still got this issue after trying to fix it for 2 hours already
For some reason it displays me 34:34 or 64:64 etc etc
Only thing I did was get the code of previous functions and instead of incrementing it we are decreasing the days and months
easter_day should be set to 1 next month
not daysinmonth
How can I switch to slash commands so I don't need intent privileges?
I coded in Python and I am using the discord library.
Hi..?
It depends. Take a look at examples in python about slash commands and try to adapt it to your use case
What is a common cause for Unknown Interaction even tho the interaction was a command?
I can do that but how to get rid off intents?
I believe trying to respond to an interaction that wasnāt deferred after 3 seconds gives an unknown interaction response
could this happen when a command is spammed? for say /server-info then /ping etc
I donāt see why it would no
in your client where you pass the intents you need, just supply what intents you need and don't include the ones you don't need anymore.
If you mean what intent is tied to getting interaction create, there is none. You get interaction events even with no intents
Other than your bot being overwhelmed with requests and not responding within 3 seconds of the original interaction
But that shouldnāt happen usually
ok, @lucid tapir tried my bot and it didnt work and my error was Unknown Interaction he states that he did all the commands
Unknown interaction can happen if you don't respond to one in time
But if I turn off the intents from developer portal will my bot still be able to read messages from guild? Does slash command have capability to read message from guild without intent privilege?
Well, without seeing any code itās difficult to diagnose the exact problem. The most likely option is this ^
The first thing you should do when receiving an interaction is defer it in 99% of cases
ok, whats an easy way to automaticly restart the bot and/or prevent this?
not responding in time can especially happen if your bot is getting interactions through the gateway and is forced to reconnect and unfortunately as an interaction comes through
defer it
The most sure-fire way to get interactions on time is through the http route method instead of through the ws connection
I have a feeling heās not deferring is the issue
and then from there, it's all down to how quick you can route that message to your bot and properly respond to interactions
should the process to respond need to take some time due to async tasks, defer it and then edit the original response later
how would I do this
realistically, what you could do is use worker threads to handle the tasks on the website end so that the HTTP response can be the result, otherwise, you'd need to use a rest wrapper to respond which is fine and is what I do along with getting messages over the gateway on a per cluster basis
I just wish Discord didn't tell me to resume so often because the process of resuming sometimes take more time than how long I'm allotted to respond to an interaction
what language and library are you using?
@deft rock ^
Discord.js and Javascript

what?
no, slash commands have the content of the slash command only
you cant read other messages
ima be honest, I followed a guild https://discordjs.guide/#before-you-begin and readded commands (converted) from my v12 bot
so id assume gateway
Then what's the solution?
client.on("interactionCreate"⦠?
what do you use the messages for
To read the command
yes
why do you need to read messages?
ok so Discord tells your websocket to reconnect quite frequently. If you're using the most up to date discord.js, it should happen less often because Discord is awesomeā¢ļø and the times where you literally can do nothing to ensure the interaction is responded to is lessened
you don need to read other messages to read the command
the slash command has the command
if you know how to do http routing and such, then go for that for sure, otherwise, suppress the errors and live happy and in blissful ignorance
14.1.2
its 14.3.0 rn right?
person types /command abc you can read that
person types abc in chat, you cannot read that
idk I don't use discord.js. I use libs I make myself
yeah but if im not watching it and they check the commands and it gives that error its gonna be declined as its offline lol
that's the drawback of doing interactions over the gateway
the upside is automatic clustering/sharding of handlers
how would I go about doing it http?
first of all you need a domain with ssl
ok, bout how do I route it
lmao
ever since they changed it none of my apps etc work anymore š¦
skill issue
just too lazy to update them
I generally suggest looking into http based networking first before directly going for http only bots
then you need a library to handle discord's security stuff, for example you have to validate pings, invalid messages, security headers, signature verification
unless you wanna do that yourself like i did lel, feel free to use mine
pain and suffering
Im gonna continue to have them piped over the socket because it doesn't happen often enough for my users to complain and they usually just try again and it works
most of my logs are just unknown interaction
huh wdym
in some cases, it's my own fault like trying to edit the original response without deferring
oh also tim, do you know any good wrappers for node 18 around libmp3lame
work time

save me from the kids screaming in my ears for 6h straight
in the last code you posted you said youre now going forward in time, meaning days should go 30, 31, 1, 2, ...
but when the day is equal to the number of days in the month, you advance it but set the current day to be equal to the number of days in the next month
meaning it will go 30, 31, 30, 31, 30, 31
Yup i saw that already and fixed it, at first i didn't really understand but after all it makes sense
How would i check if a certain cin variable is an int?
void show_holy_days(int year)
{
while(// the cin isnt an int){
cout << "Welcome User! Please input a year to calculate all Christian Events: \n"<<endl;
cin >> year;
}```
So I still need message intents privileges?
slash commands do not need message intents
hey guys i use discord.py, i use the "on_message" event, i get the too many requests error even though trhere are barely new messsages in the server
Does slash command require administration permission?
@client.event
async def on_message(message):
if message.author.id == someid:
await message.channel.send('message')
await message.channel.send('message2')
the bot responds to itself
If you mean the bot, no it does not
@spiral crag make sure that the author is not the bot
the variable someid is the id of one of the users
so it cant be the bot
I'd still suggest to catch it
i will send it
yeah
that would make more sense
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): <!DOCTYPE html>```
otherwise someone could use luca for example to trigger the bot 
wait how do i catch it
then it's too late if you're getting that directly, try it again later
but to catch it, just check if the author is the bot itself
It requires application.commands access in auth2 right?
This is by default, and those are scopes not permissions
Slash commands requires that scope right?
It is given by default iirc
scope = a definition of your bots purpose, such as "bot" being a bot on the server, "bot.commands" being commands on that bot on the server
permissions = something that grants your bot to do certain things, this mainly applies to bots
I understand thanks Aurel
Your bot is missing access to guild with corresponding id 659240658548162581! Adding commands will not be possible until it is invited with application.commands scope!
I am getting this error. I don't think the scope was given when it was added to the servers.
Add the commands globally to the bot
And yeah, the scope is enabled by default as said by Discord engineers
Basically #discord-news message
What's that?
There are guild slash commands and global slash commands
It worked. Thank you.
Awesome 
ok, I got an array with values of a user, I know how to parse it and all but how do I make a div for every of the Values? I know how to loop, but how do I create the divs in js?
what would the best way to automate timezone changes be
I;m making a timezones command to get timezones from the format CST, BST etc, how can I easily convert with Node.js?
hey guys
bool is_leap_year(int year)
{
cout << year % 4 << endl;
cout << year % 100 << endl;
cout << year % 400 << endl;
return ((year % 4 == 0) && (year % 100 != 0) && (year % 400 == 0)) ? true : false;
}
```how can 2020 output false while it should infact be a leap year
i logged every part of the conditional and got:
0
20
20
i see the issue! I must change it to c++ return ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0)) ? true : false; right
ok, got that but how do I assign a function with an argument to the button? I use this and it assigns but data[times].appname stays, it doesnt change to its actual value before applying
wdym appname stays?
you mean the value of appname changes by the time the function is run?
instead of dogo(data[times].appname) is should be dogo('OMMC') in this case
well you can try stringifying it
button.onclick = `function() { dogo(${data[times].appname}) }`
oh yeah, I dont know why that didnt work before, but it does
š
ah, nvm. just removed that whole function() { part
General question.
What javascript backend frameworks do you guys use or recommend? I love ExpressJS and it's hard to choose something different xD but the thing is that ExpressJS hasn't gotten any updates since years I guess..
I mean it still does his job but maybe something newer and actively maintained would be better.
I also used NextJS alot and I really love it but I chose to separate backend & frontend this time. (Maybe also thoughts about that?)
also nice job on getting locked out of your account lol
why separate if you're going to be using React
https://hatebin.com/kfkwpngzfs
could anyone help me. I am trying to print a calendar into my terminal,. I chose September as initial month, but instead of starting at thursday it starts at wednesday as you can see and it also prints all numbers below each other instead of next to each other
React? You mean NextJS
True
No I'm saying if you'll be using React on the front-end Next.js is your best choice
WAIT WHAT
FINALLY amazon delivered the right cable
not to say it has been the third attempt
and FakE can finally use the product he bought weeks ago
some sort of irony
let path = `https://${url}/${data.path}`
let mp3 = fs.createWriteStream(data.slug + ".mp3")
request
.get(path)
.on('error', function(err) {
console.log(err)
})
.pipe(mp3)
i want to save this mo3 file in a directory
Then create the write stream in the directory you want instead
nestjs, fastify, koajs 
oki
restana, 0http
rayo
if you want stupid performance check out sifrr
but sifrr uses a cpp server, so its not pure nodejs
thanks, already took a look at them but none of them really appealed to me..
oh wow never heard of them but 0http looks pretty cool and similar to express, thanks for the suggestion
Yes I already worked with NextJS frontend / backend but I wanted to maybe separate them.
but literally why next.js does so much for you
SSR and numerous optimizations
built-in router
Ye I absolutely love NextJS, still I want to experience something new and learn new things. Like always everything has pros and cons xD. I really appreciate your heavy suggestion to NextJS and it's hard to resist lmao
Have you ever worked with them? 0http?
i used restana in the past, which is made by the same developer
now i just use raw node http without any framework
How was your experience with restana? Recommendable?
yeah it was good
and why now just raw node http?
gives me more control over everything
does anyone know the best way to get the current zone in different timezones with Javascript?
The timezone format is like BST, GMT etc
you mean current time?
accronyms like GMT BST etc ate not official and not unique either
there are multiple timezones which use the same acronym
CST
central european standard time and also china standard time
hmm
Hey is there anyone who could hlep me fix the spacing in this calendar? Also the 7 must be under sunday, not sure why it isn't!
int days_in_month = calculate_days_in_month(month, year);
int day = 0;
int counter = 0;
string month_begins_at = "";
string weekdays = "Mon Tue Wed Thu Fri Sat Sun";
string calendar = "";
int begindate = dayNumber(days_in_month, month, year);
cout << begindate << endl;
switch( begindate )
{
etcmetc
case 5:
month_begins_at = "Wed";
calendar = "";
counter = 5;
break;
case 6:
month_begins_at = "Thu";
calendar = "";
counter = 4;
break;
case 7:
month_begins_at = "Fri";
calendar = "";
counter = 3;
break;
}
cout << weekdays + "\n";
bool starter = true;
while (day != days_in_month){
if(day == counter){
starter = false;
}
if(day % 7 == 0){
cout << "\n";
}
if(starter){
cout << " ";
}else{
cout << day << " ";
}
day++;
}
node-canvas There are white lines behind the black lines. I want to cut where the black lines and white lines intersect so the black lines will act as a kind of eraser and will not be visible. Any ideas how I can do this?
the drawn line may also be black in color
i think this somehow has to do with the spacing, that the 7 is not in its right place. Still debugging tho to find it out \0/
if i can give an id to a line I can find the line with that id and have it deleted
because there may be black places in the background and the line drawn by the user may also be black
canvas does not have such things
That's the part I'm having trouble with.
everything that is drawn is forgotten, there is no way to remember it
unless you use multiple layers
with multiple canvases
How do I transfer database from MongoDB to JSON
I'll try to take the drawing I made on the web as a data:image and send it like that, maybe that's how it works
Replit
sounds like counter should be 0-6 but youre assigning it 1-7 in your switch
hiring bot dev
the drawn line shouldn't exist in the same layer as the clip mask
use 2 canvases
either that or set a clip color
but that will result in that color being always removed
Can I have the eraser and drawing erased after drawing them on separate layers?
Hi
yes, simply iterate over both canvases
I suppose both would be the same dimensions
I will try
@earnest phoenix -needdev
wha
man
brevs cant do commands ig
no its down
a
-needdev
@viscid rose
You seem to be asking for something you don't have experience for or something that hasn't been done yet, but really need for your bot/server.
You can hire developers from Fiverr or Freelancer to code the things you need for your bot/server.
Can't I just draw them on separate layers and crop them? without using separate canvas, just using separate path
canvas only has a single layer
it's not like gimp/photoshop where a single image can have many layers
I can delete it as you can see above (web-canvas)
you have to start from the bottom (now we here)
actually if u were to make gimp/photoshop using js, you'd use many canvases
one for each layer
once you draw a pixel, the previous pixel gets ovewritten
I drew it with red color so that the erasers are visible on the bottom one.
it's either 1 or 0, there are no in-betweens
either black or red
if u use black for eraser, it'll not know what's "below" because there's no below
I am using globalCompositeOperation - destination-out for the above
sigh
but I don't have such option in node-canvas
you're missing the point
a canvas is an image, period
images only have a single layer (although they can have many channels)
once something is drawn, whatever was in that space is overwritten
there are no below or above
š
I used ptctx.globalCompositeOperation = 'destination-out'; while opening a new path for the eraser and printing the lines
this result
compositing isn't multi-layer or anything like that
it just tells the canvas what to do when changing pixels
destination-out means the newer pixels will remove the current pixels (iirc)
that wont erase, it'll just set the pixels to background color
I mean, it is technically erasing
anyone who knows how i can fix these spacing errors
use padding
this is a terminal program in c++
how would i use padding
1 instead of 1
it's the other way around actually, padding was made for terminal programs basically
I am just literally using day++ in a while loop
so how would i go with using that 1 you told me?
nope, it works
see above
That would do the same with for example 18. This would still give the spacing problems
yes that's what i was trying to do
thank you very much for your help
note how it stays '23' for the first 2 images, but becomes ' 23' for the third
because I reserved 3 characters (it was 1 and 2 for the first images, but 2 chars >= 1 | 2)
i am using c++ tho, isn't printf for c?
funny because C++ is still C but with incremented value
idk if that's an intended pun
++C would be D
Yeah this method totally fucked my output tho
The spaces before thu are intentional as the month starts at thy
thursday*
ik
u need to adjust ur leading space
and use %3s for each day
since weekdays have 3 chars
i can't. This will give me errors that it expects characters
we are printing ints
then use %3d
ah i understand it now. So d stands for double? I for ints?
d for decimal actually
digit
I forgot format string doesn't care abt doubles or ints
use d for any number, s for any string
oowh i see
if(day == counter && initialze){
starter = false;
day = 1;
initialze = false;
daycounter = 1;
}
if(day == counter+1){
cout << "\n";
daycounter = 0;
}
if(daycounter % 7 == 0){
cout << "\n";
}
if(starter){
cout << " ";
}else{
printf("%3d", day);
}
day++;
daycounter++;
}```whatever i try to do, the format is still fucked
had to zoom out
C library function - printf(), The C library function int printf(const char *format, ...) sends formatted output to stdout.
apparently, it has both
because ur cout << " "
ur forgetting to also include the margin
so u need to do printf("%3i ", day)
note the trailing space
and use cout << " "
ah i see
awesome, it finally works!
it only emits one big space after the 4
i assume there's padding for the space as well?
the 4?
the "\n" i mean
that's because it'll include the margin for the last item too
u can put a conditional for the last day of the week to not include it, but it doesn't matter much
you'll miss printf when u return to js btw
it's an amazing tool, especially when u need to print colors or other hexadecimal values
printf("#%60X", color)
done, color printed in #FF1122 format
So i changed the month names to 2 characters only. Thus i also changed the day outputs to %2i.
However, now it seemds to go out of bound like this
u need to adjust the leading
Python?
no by far
simply use printf("%Ns ", "") for the leading spaces
N being ur leading
u can even make it dynamic
leading spaces? You mean the "'\n"?
whatever %N you use, you have to use the same one in your week names
no, the spaces before the first the first day
ah
also for the weekday names
since although u changed the name size, u still kept the same total width (2 spaces now)
use printf for all of them, it'll result in a responsive calendar
Yeah the width is really strange
2 spaces (total 4 chars per day)
1 space (total 3 chars per day)
4 != 3, so it does not align
use printf for everything
printf("%" + padding + "s", weekday)
printf("%" + padding + "i", day)
so printf("%2s", day") etc etc?
or hardcode the padding if u dont want to change it dynamically
š wtf
yeah ima hardcode it
then do it
so replace all the couts with printf("%2s", var)?
"%2s "
remember the margin
and u need to use i for days
unless u do toString()
I've changed them all
still same output
if(day == counter && initialze){
starter = false;
day = 1;
initialze = false;
daycounter = 1;
}
if(day == counter+1){
printf("%2s ", "\n");
daycounter = 0;
}
if(daycounter % 7 == 0){
printf("%2s ", "\n");
}
if(starter){
printf("%2s ", "");
}else{
printf("%2i ", day); // i have used this for padding. It otherwise will look ugly due to the change from 1 to 2 digits, so we are making it compacter and basically boxed
// in 3 characters.
}
day++;
daycounter++;
}```
yeah that code is above this snippet
just thought that it didn't really matter for the padding
I somehow fixed it
by changing the padding size to 3
however the 1, 2, 3, 4 are still fucked up and there's some sort of strange "\n" in the code extra
after 4
mine works
also with offset adjustment
tho I cannot give u the code else it'd be spoonfeeding
but u can do all of it with an array of weekday names and 2 for loops
perhaps even with a single loop
basically what u want to do is loop between -offset and maxDays, printing all positive values + 1
the negative values should be printed as a whitespace
when (i + offset) % 7 == 0, print \n
@eternal osprey read
I'm curious about licenses.. If I have e.g. a software I want to make Open-Source so the people can see into the code but I don't want them to just use it (legally) without getting a software license for example. Just so the code is not private and secret but can't get copied (legally) and used for unlicensed commercial use etc.
You know what I mean? š
u cant have something open-source and prevent people from using it (privately)
So you want a license that requires people who want to run your project commercially to ask you first
AGPL may be close to that.
Sure I know I want them to see the code and maybe use some parts of it for themselves no problem with that. Just my idea was like I have it open source but if you want to use it you need to get e.g. a license key
yeah exactly. Thanks I will look into AGPL
there's just a thing tho
you mean GNU AGPLv3 ?
ye
agpl (and all gpl licenses) is contagious
you might want to look into less contagious licenses
you'll need to read them to know
but for gpl-based licenses, they require the user to expose the source code
tho I dont remember if agpl removes that clause
well it is open source or what do you mean? Like in the sense of give it to people?
Non-judgmental guidance on choosing a license for your open source project
in the sense that you cannot use the lib without making your own project open-source
ah yes
yes, agpl kept that clause
you want a license without that clause
also, all of the licenses listed there allow commercial usage
maybe I should think about making it closed source.. I can still open source it later.
Yeah I saw that too
u can write ur own license
You could also just use a non-open source license
True but that's quite complicated isn't it? Like what do I want and how do I write it
Aka make the code public but explicitly deny certain uses of the software, which is what I do
Do you have an example?
yes
dude licenses are pretty tolerant on how u write it
cooperative software license
true
xD
and yes, that is a valid license
iirc there's a big linux lib that uses that (WTFPL)
If you go out writing your own license though it's at best a scare tactic
and something to refer to should u ever need to sue someone
(and should u ever get sued too)
xD alright thanks guys I will think abou tthat
since they protect u from liability (if u state it)
like no large company will ever use this since it defines no terms
ye
have you heard about the other GPL?
sadly their website was removed
Other gpl?
A

I have the HPL
Huge pretzel license?
Hugh Mongus
this is why we keep #development people in their own habitat
You would likely harass us kids
so shush
in which mods have to intervene
@sharp geyser keep it sfw kthx
Wow only i got warned
This is sexist
jk love ou aurel
have a nice day

I want to make a timeout slash command would i use this in it ```js
member.timeout(5 * 60 * 1000)
.then(() => console.log("Timed out member"))
.catch(console.log);```
cuz u r the only one cappin
Did u try it?
Iām trying to
Did u check the docs?
Yes! You kids need upbringing
Call me daddy I will do the job 
Kinky
anyone know how to fetch all users in every guild?
discord.js v14
I don't really advise this
api spam is a common occurance
The solution is to have the presence and members intent
Hey guys I am trying to create a test about vsc. What 5 different categories should I have? Rn I used 1. Basics, 2. Code optimization, 3. Code debugging, and what other 2 should I include?
alternatively, reconsider what you're doing because you're doing it wrong
if you need every user in a guild then what you're doing better be worth it
Otherwise, you're wasting memory
Code formatting/standardization should be something
e.g eslint
awesome!
- Basics (theorem), 2. Code Debugging, 3. Code/file optimizing , 4. VSC user interface/ settings / workplace, 5. Code formatting/standardization.
I think this will do I think
Would you be testing for a specific language? If it's JS, I'd also recommend ensuring the code base is typed strongly
It covers the most important parts I think
Its purely about how to use the ide and encounter issues with it, work with it etc
yeah eaxsctly!
some languages have way more strict syntax though and code optimization applies to any editor
yeah thatās true, but we could just cover basic things in that topic like defining the variables on top of the file, not having double code, code being as simple as possible, having your file organized etc
it will be challenging to find questions but I hope that it will work out
what does code optimization mean in this case? Editors don't optimize your code
int days_in_month = calculate_days_in_month(month, year);
int day = 0;
int daycounter = 0;
int counter = 0;
string month_begins_at = "";
string weekdays = " Mo Tu We Th Fr Sa Su";
string calendar = "";
int begindate = dayNumber(days_in_month, month, year);
cout << begindate<<endl;
switch( begindate )
{
case 6:
month_begins_at = "Sat";
calendar = "";
counter = 6;
break;
case 0:
month_begins_at = "Sun";
calendar = "";
counter = 0;
break;
case 1:
month_begins_at = "Mon";
calendar = "";
counter = 1;
break;
case 2:
month_begins_at = "Tue";
calendar = "";
counter = 2;
break;
case 3:
month_begins_at = "Wed";
calendar = "";
counter = 3;
break;
case 4:
month_begins_at = "Thu";
calendar = "";
counter = 4;
break;
case 5:
month_begins_at = "Fri";
calendar = "";
counter = 5;
break;
}
cout << weekdays + "\n";
bool starter = true;
bool initialze = true;
bool maka = true;
while (day != days_in_month + 1){
if(day == (counter) && initialze){
starter = false;
day = 1;
initialze = false;
daycounter = 1;
}
if(day == counter){
cout << "\n";
daycounter = 0;
}
if(daycounter % 7 == 0 && daycounter !=0){
cout << "\n";
}
if(starter){
printf("%3s", "");
}else{
printf("%3i ", day);
}
day++;
daycounter++;
}
hey guys, why is this code returning such crooked calendars?
how can I execute javascript as soon as a specified div loads?
what is easier for a firewall to block, a reverse or direct(bind) shell access?
told ya already, u don't need more than an array and a loop
fetching all users will easily crash your bot due to OOM or at the very least, result in a temporary freeze
put a <script> tag inside it
like defining the variables on top of the file
this is pretty much a myth for most languages nowadays
I fixed it already
this is the direct right as it filters a ton ?
firewall only blocks ports
it's like a literal wall, you remove bricks (ports) from the wall to allow specific accesses
Ah i see!
And how could a server be protected against a DoS attack?
Like, limit the incoming network requests from one static ip?
not really, DDoS happens when your server acknowledges the connection
like, if it manages to reach any kind of processing, it already succeeded
use cloudflare, it'll prevent the attack from even reaching your server
or if u wanna do it yourself, have a second server to act as a middleman and tank the attack should it happen
if that server gets ddossed your main server will be safe from it
obviously this also requires fallback servers to act as alternative routes, so your server is still accessible
but tbh, don't worry about it too much, just put your server under cloudflare and call it a day, nobody will try to ddos a nobody's server
read what I wrote
the same as everything else
cloudflare doesn't magically change how accessing it works
it just adds a middleman to act as a safety layer
like, instead of yourdomain.com -> serverip:port you'll have yourdomain.com -> cloudflare -> serverip:port
its for security š
my class security
a certain question inquires to name 2 different methods to secure your server with against a DoS attack.
What i thought as well, was a firewall inclusion that would block too many packets coming in from one certain ip
or wouldn't that work?
i found it !
WAF: Web Application Firewall
⢠CAPTCHA: Solve a challenge
43
how does a captcha prevent dos, it mostly prevents bruteforce
if you spam the login page without doing any login, you can still dos the website
and if the captcha challenge is not coming from a relay, for example, cloudflare it makes no sense because loading the captcha can also lead to dos
very skeptical about "Using a captcha will prevent dos"
that does look cool
in CF case it works because it doesn't allow the attacker to reach your server
usually the captcha is hosted by an anti-ddos server like cf
but yeah a self hosted captcha would be useless
yeah that's basically what i meant
if you selfhost your own captcha, absolutely useless
and if the captcha challenge is not coming from a relay, for example, cloudflare it makes no sense because loading the captcha can also lead to dos
ah, I mistook that comma placement
Hello, I want to know if it is possible to somehow display the number of servers on which my bot is on my site?
The bot is written in discordjs
it is, simply make an api that runs alongside your bot to retrieve info from it
Is your bot already listed?
no
Then it won't work
You can already "pre"-implement it, but it will only work once ur bot is listed and you got your top.gg token
I think they want to list the count on their site, not on topgg specifically
Yeah i wasn't quite sure there
@earnest phoenix is that the case?
yes
do this then
The only problem is that I don't know how to do api
if your server does "expensive" operations to route a request, then you're most likely doing something horribly wrong and should rethink your design.
Beyond that, if your handlers for the routes take time and more resources, then you can protect those routes with csrf tokens or something similar.
wait more than 13 seconds before bumping something
Did you read the error
it's working fine in my pc



