#development
1 messages · Page 20 of 1
Still, unnecessary and slower for literally no reason
worse*
but I finally realized my issue xd
like why it was not working from the very beginning
Chaining together random array methods and expecting magic results is not going to help you
:[
Tomorrow I will have to use Java again for the first time in a couple months
yay
I think it’ll feel fresh after having to worry about borrowing and ownership for a while
check: (message, member = undefined) => {
// Lets check if we filled the optional member property,
// if not let's get the member property from the *message* variable
if (!member) {
member = message.member;
}; const modRole = message.settings.modRole, mentionedRoleRegex = /^<@&(\d+)>$/;
// Try fetching the role by either name ID or mention.
let finalCheck, roleID; if (mentionedRoleRegex.test(modRole)) {
finalCheck = message.guild.roles.cache.get(modRole.replace(/<@&(\d+)>/, "$1"));
} else if ((roleID = modRole.match(mentionedRoleRegex)) !== null) {
finalCheck = message.guild.roles.cache.get(roleID[1]);
} else {
finalCheck = message.guild.roles.cache.find(_role => _role.name.toLowerCase() === modRole.toLowerCase());
}; return (
message.member.roles.cache.has(
finalCheck?.id || message.member.roles.cache.find(role => role.name === finalCheck)?.id || finalCheck
)
).catch((err) => {
return false;
})
}
I believe this is going to fix it
whoops
one more issue
yeah wtf is that formatting
saving space
why, is that not something you'd do
that makes literally no difference
space != performance
you'll save like 6 bytes per file while making your code infinitely more unreadable
"Always write for humans to read, computers only see in binary anyway"
that's not a coding style, that's satanic
just use a linter and save yourself and everyone helping you a headache
having your own coding style is fine (like newlile brackets or different casings), but there's a line where it becomes just bad habit
trust me, no sane dev would want to read this
ahh yes!!that fixed it
okay can u guys give me pointers on what I should stop doing
no my code actually breaks most indexers 🤣
I tried formatting it like that on 2 different programs
The only code that “breaks” linters is invalid code :p
no it actually does
I can show you what it does with my code when I try formatting it
I'll try formatting this and show you what it returns
nvm it just didn't change at all
but it does on some snippets I tried formatting before
and they worked fine
of course something would be wrong
TypeError: member.roles.cache.has(...).catch is not a function
has returns a boolean
doesn't really explain why catch wouldn't work on it but oh well
fixed 👍
prettier is not a linter
i think its a formatter
how would i make a vote cooldown show up when someone votes
let receivedDataAsJSON = JSON.parse(data);
console.log(receivedDataAsJSON.events[0].subcalendar_ids)
console.log(receivedDataAsJSON.events[0].subcalendar_ids.includes('11101805'))```how is this returning false?
\📆
Because it's an array of numbers not an array of strings
huh
i am running on djs v13.9
is the addField method deprecated?
It wasn't deprecated in 13.9 right?
even the docs have this feature
this
Track in ur database
how would i make it update tho
or whats a good way to track
Save the timestamp for that users whenever they vote
Then simply get the difference between currentTime and voteTime + 12
oh alr but how would i make it so they could check when they can vote again
do i just do like current time and timestamp
and compare them
^
how do i save time
What database are u using?
sql
Store as TIMESTAMP
um ok
INT works as well of course
hey, how do i get the bot to ping a certain role?
i have the role ID and im using <@&id> there no notification
what permissions do i need to give the bot?
As message content or inside an embed?
Also make sure the role can be mentioned by others
Is it just me or that Discord.js v13 doesn't have ActionRowBuilder for TypeScript?
Yep fixed it
Thanks
????
Add option receive a SelectMenuOption[] which should work in this circumstance
Am I missing something here?
I feel like I am having sleeping issue that i forgot to do something here but I don't remember which
Nvm, I remember now, I need to spread it
does .getImageData() read the image left to right, or up to down?
What
Left to right
https://github.com/Automattic/node-canvas/blob/master/src/CanvasRenderingContext2d.cc#L992-L1160
Thanks! Finally stopped my pacman from phasing through walls. Though it sometimes phases, but I guess it has to do with quantum mechanics.
How can I blacklist a server from adding my bot?
Not really but you can store the guild ID and leave the guild immediately when joining it
any idea on why its not sending the image even tho base64 is correct and has image on it
const SendToChannel = (imgBuffer, ctx) => new Promise(async (resolve, reject) => {
const image = imageBuffer((await imgBuffer.arrayBuffer()),'png')
const attachment = new Discord.AttachmentBuilder(image);
ctx.send({content: 's base:\n', files: [
{ attachment: [attachment] }
]}).then(() => {
resolve();
})
.catch(reject);
})
its passing text but not the attachment
did u try logging image?
yea
its a base64 format
the encoding is correct
i can copy that and try it on online website and it shows me correct image
is the attachment expecting base64?
technically
it support buffers
but didn't u say image is a base64 string?
yes i was trying to encode to image format and see how it goes
but here a orginal code with buffer
const SendToChannel = (imgBuffer, ctx) => new Promise(async (resolve, reject) => {
const attachment = new Discord.AttachmentBuilder(Buffer.from((await imgBuffer.arrayBuffer()), "base64"));
console.log(attachment);
ctx.send({content: 's base:\n', files: [
{ attachment: [attachment] }
]}).then(() => {
resolve();
})
.catch(reject);
})```
i can see that attachment is showing correct info but it's not sending
ctx.send({
content: 's base:\n',
files: [{ attachment: [attachment] }]
})
.then(() => resolve())
.catch(reject);
just so I can read it
is attachment supposed be be inside an array?
The option is supposed to be attachments not attachment
still same
const SendToChannel = (imgBuffer, ctx) => new Promise(async (resolve, reject) => {
const attachment = new Discord.AttachmentBuilder(Buffer.from((await imgBuffer.arrayBuffer())));
console.log(attachment);
ctx.send({
content: 's base:\n', files: [
{
attachments: attachment,
}
]
}).then(() => {
resolve();
})
.catch(reject);
})```
still same it just send content only
attachment: <Buffer 47 49 46 38 37 61 7b 00 28 00 e7 00 00 1c 12 24 5c 86 a4 84 c2 ec 84 66 8c 44 4a 44 bc ba b4 dc 82 cc bc da 94 2c 2e 2c 5c 66 6c bc ba c4 84 82 7c 9c ... 2520 more bytes>,
name: 'image.png',
description: undefined
}```
how i use custom font in canvas ?
import { registerFont } from 'canvas';
// register font
registerFont('path/to/font', {
fontFamily: 'font name',
// ...fontConfig
});
// @define <context> type Canvas2DContext
// @define <x>, <y> type int | float
// use it
<context>.font = '<size-px> font name';
<context>.fillText('text', <x>, <y>);
Is there any other way?
no its like
anywho what was the problem
pissing me off
just await
nah i havent fixed it
flask + discordpy: Shit
literally:
Have a dashboard on flask, want to send messages through it. The method that sends the message is async
9 thousand fucking stackoverflows later
still not fucking fixed
back to java
wait
you can't await?
I can
or you just can't verify that the message is sent
Thing is, literally the flask view (aka the one that handles the request) is async
but like
fuckin async still cries
it pisses me the fuck off

i can finally relate to your pfp
Nah im gonna change it to a clown in a bit
💀
Literally
I'd prefer java rn, if it wasnt for the shitty way how to do the same stuff as flask
ik Springboot exists
u can use groovy
but that stuff looks cringly overcomplicated
same java power, more convenience stuff
I can use a waterbucket too
tf is waterbucket
java
not really, it's actually the opposite if u use only for api
spring itself is what's complicated
me when async Result<?> RequestFactory.PrepareRequest awaitRequest(String url, ...? response)
can anyone help me with this because my brain can't function properly atm
let's say i have this array
[
{ a: 2, b: 4 },
{ a: 3, b: 1 },
{ a: 7, b: 10 },
{ a: 9, b: 5 },
{ a: 10, b: 5 },
{ a: 11, b: 5 },
{ a: 12, b: 6 },
{ a: 15, b: 23 },
{ a: 16, b: 24 },
{ a: 17, b: 25 }
]
how do i find sorted a values all with the same b values, in a way that it would yield
[
{ a: 9, b: 5 },
{ a: 10, b: 5 },
{ a: 11, b: 5 }
]
``` ?
feel free to send me pseudocode or on how the algorithm would work
filter by b
ah wait, u want only entries where b repeats at least once?
regardless of the value
we can sort by b
then later on filter to get array with 2 or more entries
reduce method works
also all as must be in an order and they have to be like 9, 10, 11, ...
yeah order guaranteed
then what is the way of finding [2, 3], [9, 10, 11, 12], and [15, 16, 17] from an array like [2, 3, 7, 9, 10, 11, 12, 15, 16, 17]
continuos ranges?
yeah that's what i meant
i remember i did something similar to this in codewars a few months ago
function solution(list){
let out = [];
const modArray = (array) => {
array.toList = function () {
return this.length > 2 ? `${this[0]}-${this.slice(-1)}` : this.join(',');
}
return array;
}
let streak = modArray([]);
for (const x of list)
{
if (!streak.length || streak.slice(-1)[0] + 1 === x)
streak.push(x);
else
{
out.push(streak.toList());
streak = modArray([x]);
}
}
out.push(streak.toList());
return out.join(',');
}
yum thanks for the spoonfeed
> sayuri extract algo -i number[] -o number[][]
RuntimeError: Timeout context manager should be used inside a task

also most depressing moment
One message removed from a suspended account.
so ```js
function range(list: number[]) {
let out = [], streak = [];
for (const x of list) {
if (!streak.length || streak.slice(-1)[0] + 1 === x)
streak.push(x);
else
{
out.push(streak);
streak = [x];
}
}
if (streak.length > 1)
out.push(streak);
return out;
}
@radiant kraken
i know
i can implement it myself by looking at the code
i'm not the average #development asker
One message removed from a suspended account.
i wanna clean up the code to make it easier for you to read
is what I did
i already can read it
yet python cries with
RuntimeError: Timeout context manager should be used inside a task
this might surprise y'all but
One message removed from a suspended account.
i have the ability to read
async flask
import task
One message removed from a suspended account.
I'm starting to hate it
i personally will have to use python
One message removed from a suspended account.
fuck Python
because computer science
Cobra is better
One message removed from a suspended account.
now write
use groovy if u dont like java verbosiness
ik you all are jealous 😎
i literally started to fuckin figure out bootstrap
then python gives me the middlefinger
I love it
import react
also whatever this fucking site managed to fuck up
what the fuck
Did you figure this out already? Sorry I'm late
yes
you're late
i'm ashamed of you

Not hard to swallow, python is stinky
TRUE!
I'm so fuckin down bad, am literally about to just start 2 sockets, have one be the bot and the other one the website and have them exchange the messages
im storing as datetime.datetime.utcnow() but how can i store it as a format like HH:MM:SS
simply format it when showing to the user
i need to compare it but idk how
how would i show the timeleft if they are on cooldown
in this format
HH:MM:SS
how would i format datetime.datetime.utcnow()
what language are u using?
That's python
ah, idk python enough to answer then
but there's this https://pynative.com/python-difference-between-two-dates/#:~:text=Use the strptime(date_str%2C%20format,as%20per%20the%20corresponding%20format%20.&text=To%20get%20the%20difference%20between,result%20is%20a%20timedelta%20object.
Find difference between two dates in Python. Calculate the number of days between two dates and datetime objects.
literally the first result
anyone has experience with systemctl? when i run script manually, it loads all my language models correctly but when i run the same script with systemctl its not loading all the models. noob w systemctl
it loads like half
If I want to do that the bots do not save their information or any things in the database or no one can see what they have?
you simply don't save
I'm starting to think there's no "friend" at all given how much stuff ur trying to implement
Hello everyone who does Python, I am once again asking for your support:
I'm currently working on the following setup:
- a discord bot using pycord
- a flask server, running a dashboard
My goal is to send a message into a channel using said dashboard for testing.
But oh no.. I am facing the following issue:
Timeout context manager should be used inside a task
This error seems to happen on the coroutine to the send method from where I'd send a message on
Flask is using the asyncio extra so that I can execute coroutines within flask views
Stackoverflow has not helped me either
Java is easy
python too
javascript
async is annoying
go groovy if u dont like java syntax
Java futures are annoying imo but it’s still a good language
pending doom
fun NotFun() {}
sometimes I wonder if Promises are based on Futures
there's just too much similarity to be coincidence
i was like, literally at the point of just removing the Runtime error line from the helper.py of aiohttp
Either way promises are much better than futures
out of frustration
for example?
Async await syntax is much better
I just don’t like the way futures work in Java, it feels like a clunky workaround to adding async to it
it has 90% chance of being downvoted to oblivion and marked as duplicate
but sometimes it works
If there is, what is the benefit? I think that I am working on a special project for myself and I do not want it, so I can not tell him, but he really does not exist now
Ask on SO, then go on an alternate account and answer something wildly incorrect. People hate helping but love correcting others 😉
lmao
nah
too close to the system for me
did try rust in my internship
but not my thing really
It’s fun if you’re into it
nah
Some of the web frameworks abstract a lot of the low level stuff away from you
To a certain extent you’ll always be dealing with it though
oh
my
fucking
god
i did it
Literally
5th
fucking google page
Issue My code is is similar to this example: import discord import tweepy import asyncio...
Lmfao
hot take, but imo async/await is unnecessary syntax that doesn't really benefit programs
I don't know how I feel about Java Futures though
It’s just syntactic sugar to make it easy to use. It’s not necessary syntax, but I certainly much prefer it over the alternative
Yeah, but that's what I don't like about it. The syntactic sugar actually makes it harder to use!
mmm yes, chained promise callback hell
it's just similar to return a promise object and promise resolve then
in case of js
and actually in js i would prefer the syntactic sugar
Is there an API Limit on how many roles you may create per day? 😅 Either i Broke my code or reached it when debugging on a test server
The issue I have with it is that same similarity which makes you to write asynchronous code as if it's synchronous
There was some article I read a while ago that shared many of the same issues I had with it but I can't find it
No, not really.
Someone tell me what does this calculation do?
{return 5 * (Math.pow(level, 2)) + 50 * level + 100;}}
I mean, what is required of the user to reach the next level?
Turn that code into a function and try calling it with different levels.
expression results in 5 * level ^ 2 + 50 * level + 100
or assume level is x here is a more concise version
5x² + 50x + 100
It’s a quadratic function
You can use Desmos to graph this expression (or your graphing calculator of choice) and see the amount it takes to reach a certain level
(The x axis will be the level, and the y axis will represent the amount of xp required to reach that level)
that formula is brutal depending on how much xp u earn
Yeah quadratic is exponential so it’s not an amazing leveling formula at higher levels
I use level² * 100, has a good curve tbh (15 xp per message)
also I use cumulative xp so there's that
mee6 leveling system leaked
I heard so many jokes abt mee6 levelling that I'm afraid to ask if it's THAT bad
in a scale of CD Projekt <---------------> EA, how bad?
EA surprise mechanics bad
zamn
hey guys, how would i convert this so, that it only would get the current time? js end_dt:'2022-08-10T12:15:00-04:00'
Instead of that date, and 04:00 behind it (04:00 is the current timezone)
yeah, js!
You have two options:
- Convert it into a Date object and
use the(don't know if this would result in the behavior intended, but thetoLocaleDateStringmethodDateobject should still have methods for getting the pieces you want). - Convert it into Unix time and have Discord format it for you (https://discord.com/developers/docs/reference#message-formatting).
Awesome, thank you!
Say I have to transfer some data in form of Objects to the interaction event after an user interact with a select menu. How would I should go with it.
Currently thinking of storing the object in a Collection<string, Object> and then use message id as a reference (put it in menu id, parse it later in interaction event)
FYI: This is Javascript/Typescript btw
yo
got a question, i just upgraded from v12.5.1 to v13.3.1
whats the equivalent of message.guild.me.hasPermission("EMBED_LINKS") in this version
message.member.guild.permissions.has
thanks miss/sir
Why Object? There’s almost always a better way to represent data than that
But if you’re handling that part fine, Collections are just fancy maps
didnt work
Let just say it's more like a Type
I don't want to mean Object in a literal way
anyone?
Ah okay
Collections are just extended maps, with O(1) access. They’re very efficient for storing data where you have a set of unique keys like IDs. If it works for you, it’s a good solution most likely
Welp, guess that's the way then.
message.member.permissions.has
Feels like updating to v14 might be nicer for handling permission and stuff
After all, stuff like ChannelType or Permission are now on Enum
Esp on TS
maps/collections are better if you have lots of keys, like thousands
objects are always better for small stuff
I thought maps/collections were just basically objects
Then what are objects
objects are many things depending on context
they can be structs, can be linked lists, can be hash tables
I see
maps have a much bigger instance overhead
both memory and performance
so they are not good for creating and deleting instances lots of times
A good hashing algorithm will be very fast, but yeah it does require a lot of memory overhead/allocations
Or at least that’s what I’ve learned from my individual experience and CS classes
ERROR Unhandled rejection: TypeError: Cannot read properties of null (reading 'has')
if (message.guild && !message.channel.permissionsFor(message.guild.me).has(
[
Permissions.FLAGS.VIEW_CHANNEL,
Permissions.FLAGS.SEND_MESSAGES,
Permissions.FLAGS.EMBED_LINKS
]
)) return;
why?
I check if it's in a guild first, so it cannot be because someone DMs the bot
I should probably add that it only happens sometimes, not quite sure when but when it happens it spams the console at least 1000 times before stopping
ok so i’m wondering this in py our bot has a command and when you run it you have to put a message that has 100 characters is there a way to send a message saying that the message is under 100 characters?
obviously
check for string length and do the more than operator
if (string.length >= 100)
return message.reply({
content: "You cannot have a string longer than 100 letters"
});
inb4 he tries to use this js code in python
No no, let it happen
happens when guild.me is not cached
I have money on this
that requires cache?
guild.me is a getter/shortcut for guild.members.cache.get(client.user.id)
ah then should I just do
message.guild.me || guild.members.cache.get(client.user.id)?
That would get you the same result
cause my temporary fix was kinda lazy xd
no thats doing the same thing twice
what?
^
how do you actually fetch it then?
Fetch yourself
guild.members.fetch
This sounded like a threat
goan fetch yourself
xd
didn’t even use the code
did discord move the deadline for the message content intent again? i swear it was end of september, not beginning
that means i have 20 days now to rework my bot
i didnt even start yet
lol
Make a permissions handler and stop using that inline “style” it hurts my eyes 
I mean I will need the message content for my chat filter and anti fish features so I guess I can keep using message commands either way
I will add slash at some point tho
const me = await message.guild.members.fetch(client.user.id);
...permissionsFor(me)...
it's pointless to fetch if it's already cached
besides it would be dangerous kinda, it would fetch each time the messageCreate event is called
fetch already accounts for that
all djs fetch functions check the cache before fetching
unless you use force:true
really?
yes, you can always check the source code for fetch
afaik it has always been like that
huh then why did the people always tell me not to use fetch when I can check cache?
better?
No
wdym no
The return bothers the hell out of me
stuff like channels and guilds usually dont need fetching because they are always cached by default
why tho?
You have the biggest if statement known to man
ive had bigger ones lol
Personally I would just assign that to a variable and then do if(variable) return;
same lol
I’m sure it’s all inlined by v8 at some point or another so this probably doesn’t affect performance either ^
does this bother you, Waffle?
It bothers me that you’re still using strings for booleans, yes
Other than that it’s perfectly fine
someone else proved that it won't matter whether I use strings or bools a couple weeks ago
I just don’t like looking at the giant multiple line if statement and then the tiny inline return
And who was that may I ask
either Voltrex or Tim
I’m pretty sure Tim said it wouldn’t matter on a small scale
pretty much ^
yeah something like that
But that if it scales up it will chew up memory
my bot already uses almost 400mb
Not to mention your poor database will be eating bytes for breakfast
noob
ok here are some fucked things about your code:
- WTF DON'T USE BOOLEANS AS STRINGS?!??!? 💀
- WHAT IS THIS IF STATEMENT ON THE SAME LINE AS THE END OF THE OTHER IF STATEMENT 💀💀💀
- PLEASE JESUS MAKE A FRICKING VARIABLE FOR THAT IF STATEMENT 💀💀💀💀💀
thanks for reading my message ❤️
once i rework my bot, it will use 30mb ram
😳
I wish you would rewrite mine 😩
also igor with a 6gb vps for his bot with 90 servers
😭
webhook interactions, no gateway
Ah okay I was about to say…
basically a glorified webserver
Since gateway connections are relatively expensive to maintain
so that's why discord is trying to get rid of them?
webhook interactions really were god given
What
no?
no more receiving 848828834 irrelevant events
You can simply choose to have interactions sent to a webserver instead for your own reasons if you don’t require a gateway connection
it seems like discord is going to focus more and more on slash until having a gateway connection won't ne necessary
what?
indeed, currently webhooks can only be used for 1 out of 40+ events
Slash commands aren’t a replacement for a gateway connection, you can just choose to use them instead if your application does not need anything related to gateway
who knows if they will enable webhooks for more events
Some events just happen far too often for discord to send a POST request for each one
ye
I feel like getting messageCreate events through POST would suck 
Lmfao

One bot would bring down the whole DAPI from presence updates
precense updates via webhook is basically a dos attack
That’s why they got rid of the banlist endpoint or whatever it was, some bot had like 500k+ bans and was nearly bringing down the whole API every time it fetched it 
fun
xD
💀
i mean
I have a banlist command
filters by date or by username
Yeah
@quartz kindle could using fetch ever be slow?
Yes
would using fetch in my case be slow?
No
whats the single most expensive rest api call today?
After you fetch it once it’ll be cached
Then when you call to fetch it again, instead of fetching it’ll return it from the cache
Uhhhhh idk
fetching for the first time will be slow and the next will be fast?
list guild channels can have up to 500 channels
Fetching the first time will just be slower than the cache
Since that’s what cache is designed for
I just restarted my bot and it responded with a 1-2 second delay for the first few command executions
even now it feels slightly slower
Sounds like a major skill issue and not a fetch issue
might be my imagination though
Although I don’t know what all you’re fetching
my skills are good enough
I always use cache for most things
almost never do .fetch
Unless you’re fetching like 20000000000 people you’re not gonna really notice a difference unless the API response time is slow for whatever reason
the api response for me is 100mb
If you ever notice your bot being slow, check it’s rest api ping
100mb
Then check the DAPI server status for any issues
But if your bot is consistently slow then it’s probably your code
my ping is 130mb
I have 650ns of ram
small
mine is 32ms
usually about 25
dang
mine is 90 bpm
My gateway ping is like 60-85ms, rest is about 150-250 depending on the day
rss is below 90mb 😎
my rrs is 100mb after a clean reboot
around 200 after a couple hours
and after a couple days it can reach up to 300
memory leak
(Doesn’t mean it’s actually only using 20mb though!)
Sounds like a memory leak to me, considering your bot is under 100 servers
Especially if it grows over time
then do you have any ideas where it might be coming from?
those things grow over ti.e
Yes but I have those caches enabled and I don’t grow over 120mb usually
ye
great
I mean it still isn't great that it's using over 300mb but it's great that it's not a mem leak
I don’t see how cached messages/members at his bot’s size would account for up to 200mb of ram though
js moment
djs moment
everybody be hating on js
Nobody hating on js but insane devs
Or C devs still living their glory days in the 90s
im insane and i like js
js is so powerful now that you can’t even hate on it that much
Though the date api overhaul proposals need to hurry up
C devs thinking a kilobyte is bloat
its so powerful it kidnapped princess leia
can anyone check cause I think I'm actually tripping
C devs when they see C++ users using a couple bytes of overhead for smart pointers to ensure a safe program
you are
is my bot's response time slow or not?
Actually nvm smart pointers have 0 memory overhead
But it’s technically still slower :troll:
C devs using unsigned char over int because it saves them 3 bytes of memory
come on it does 100% esp if your bot has message content commands
add a timer at the beginnign of your event, and another at end of your command
C devs using unsigned char over int and not realizing that it’ll be aligned to 4 bytes either way because of the CPU
see how much ms the command takes to complete
anything beyond that, is internet issues
I thought of doing that but I'm too lazy
I'll just ask another human to run a couple commands and test it out
pain
you think it's my bandwitch's issues or my vps?
what a waste of 3 bytes

ItsOkayBae using strings for booleans instead of bitsets for settings :troll:
bandwitch
when I converted those strings back to booleans it broke my entire saving system I had to rewrite it again back to string
😩
noob
but now I kinda realize I just could've put a toString before saving the input that it would've been solved
so my bad ig
too lazy to try and rewrite it again
tho
I’m now thinking about how much memory overhead it would save you to use bitsets instead of fucking strings for true/false settings 😭
On a large scale that would actually be a pretty significant improvement
once my bot joins more than 200 servers I'll rewrite it
I think I just like bitsets as a data structure tbh
atm I'm too lazy
They’re cool
Also this year I’m taking a digital electronics class and I’ll finally be able to learn how the low low level shit works
Like logic gates and shit
I don’t care about memory THAT much but cmon it really wouldn’t take much effort to use bools instead of strings
And if you think about it you could save a few clock cycles by comparing 1 bit instead of at minimum 1 byte at a time 😉
youre complaining about using strings for bools while discord sends you an array of guild features as strings instead of a bitfield

It’s fun
Maybe I’d enjoy the compiler optimizations part of langdev
I know C++ I just am not very good at it
And the C++ community is kinda unhelpful in a lot of cases
Seems like they always want you to do something with an obscure stdlib function
everyone tells you to install boost
boost is bloat
Honestly the main difference between C and C++ at this point is the fucking standard libs
C++’s stdlib is basically a whole language itself
90% of stackoverflow answers for c++ use boost
Can't wait for someone to make a C++ compiler but instead of including the std library it uses boost
lmao
I still wanna make OogaBoogaLang
CavemanLang
Whatever it’s called
Sounds like a fun project
lmao²
me when std::any
Lmao
Me when you can return multiple different types from a C++ function by throwing them instead of returning
namespace std as fuck
fuck::any
it's basically what goto does
Although I was told that’s tapping into some sort of special c++ virtual machine environment at that point
Not sure if that’s true or not, but was told that by some c++ expert
me variable = "rock"
me console output rock // "rock"
very nice
i tried making a multi type hash map
in c++
the compiler went ape shit trying to generate all possible template combinations
Reads too much like js
Refer to #general message for my plans
std::hash_map<T, std::any>
ezpz
amazing
Enjoy template errors
I would 100% write a discord api wrapper for caveman lang
Write one for BreakfastLang when I finish it
you made that too :0
Though you’d have to be pretty knowledgeable on how to create one since I don’t have any idea how you would even start
And I don’t have interop with rust or FFI for C or anything
brb writing tinycave and tinybreakfast
Though I think I may add some interop with rust

Also it’s not really object oriented :troll:
rewrite tinycord in node-gyp when
lmao
Waffle I found the perfect name for your caveman lang
just use dpp with node gyp
C man
so it would sound like a C branch
and the long name would be Cave man
yes
lmao
🤣
brb writing a discord wrapper in binary
pov: binary
discord lib written in tapes and punch cards
I should just make a bytecode compiler for x86
discord.f
The parsing… would be easy…
And it would basically just be as easy as going straight from assembly to opcodes
Since asm is basically just opcodes already if you think about it
or straight to gay
A little bit more abstracted than opcodes but not by much
is there a discord api wrapper in fortran
Probably
fortran and C are kind of transpilable between each other no?
I’m sure they are
i believe ive seen libs like that
with both versions
@wheat mesa write something in intercal
can anyone tell me what this does 
/^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/
well its a valid protocol
idk what the purpose of this regex is
my phone is diedieying
pepsiying
💀
i go sleep kthxbye
you okay tim?
gn
what is intercal
bro my school blocks github
it's so annoying
I just want to work on my language at school
we do a little bit of non descriptive commits
lmao I accidentally committed my cranelift ir file I was testing with
whoops
my country blocked the godot game engine 
brug
maybe they were super biased towards unity
if anything unity is way more of a threat than godot at this point
cough cough ironsource
didn't unity colaborate with some company that spread malware
I watched a vid about this like a month ago but didn't see any updates on that
^
ah that's the company?
that kinda reminds me of my game
gonna have to go finish it at some point
remember: RollerCoaster Tycoon was made entirely in assembly
and has literally 0 bugs
yeah it's the most impressive thing I've ever seen
the only C it uses is for DirectX compatibility layers
that man literally won the life game
it's hard for anyone to ever reach that level of skill
I mean, there's also the templeos dude
he made over 20 million for that game saga though
well deserved
Hard work with no promise of a big reward, yet it still happened
That's respect right there
only up to the third
then it's C iirc
rct was THE game franchise of that era
until sid meyers came
templeos guy is just on another level fr
according to him, god sent to his mind the entire source code
the most insane part is that he fckin managed to write an entire OS "alone"
False
The company didn't inherently spread malware, it was just a form of harmless adware as it wasn't really in the way it was just there and the idiots who click through an installation wizard don't pay attention to the check boxes download the advertised software that is patched into it
The whole malware thing came from people abusing their SDK
You can't hold a company responsible for people abusing their software for what it wasn't intended to be used for.
At that point you might as well just blame windows as well
still malware, still sucks
Not to mention, Ironsource has since abandoned that project and made amends for their "mistake" and have focused on advertising purely
Yes but the company can't be held responsible for other's misdeeds
Then you might as well shame windows as well
we do
And yet you guys still use it despite the risks?
because windows has actually gotten good at blocking malware
The internet ain't going to be sunshine and rainbows, and not to mention Ironsource's intentions was never to promote the spreading of malware
there's some other attribute of the company buying unity that's concerning but I won't say
They might of dabbled in adware but they never did any malware
They didn't buy unity though?
They just made a exchange in stocks but that doesn't mean they bought out unity
ah, not a buyout, but still a merger
Yea
All that merger does is enhance unity's ad side of it
So unless you don't use Unity ads
you have nothing to worry about if you still think you'll be harmed in some way
The only thing I dislike about the people who are fighting against the merger is they didn't do any research before hand and just go based off rumors
I mean, doing one search for the company brings up https://www.thegamer.com/unity-criticised-for-merging-with-known-malware-distributor/
"The... company best known for its malware delivery system? You're merging with them, and proud of that?"
Again, I feel a little offputting about this
I personally feel you can't blame a company for someone using their software for what it wasn't intended to be used for
Sure, their SDK helped people do malicious things, and that is primarily why it was abandoned
They didn't want to keep that image going so the abandoned it and decided to focus on their companies main point, which was advertising. This can be seen just by searching for installCore or ironsource's website
most companies don't develop software with malware in mind. imo it doesn't matter if it wasn't intended to be used in some way—it still was ultimately its use value to people. it's like me being apologetic towards a crypto company that got drained because they had bad security: sure, it wasn't the use value, but it still happened, and now I'm broke
Okay, but putting all that blame on a company for something that was relatively out of their control. Just seems like a shit thing to do. They have already made efforts to make amends for a mistake they didn't intend on making and yet people give no fucks.
When it comes down to it, even if their software was used maliciously. They can't be the only ones to blame. Not to mention even if their software wasn't a thing, people would still find other ways to do it despite this fact.
Yes, and they deserve every ounce of criticism they get. I'm more sympathetic to the people who got malware installed on their systems due to that company's bad practices (and other brands that chose to use them as well). But this has dragged on for a bit
Well I guess we can just agree to disagree
Although, I feel little sympathy for people like this
People shouldn't be installing random shit on their computer
If you got malware that is kind of your own fault
Anyone knows how to get the user information?
[Map Iterator] {
GuildMember {
user: User {
id: '920847730480390175',
bot: false,
system: false,
flags: [UserFlags],
username: 'Rim Kyung-Mi',
discriminator: '9069',
avatar: 'b266c41fea5df722db5a199caf89cdfa',
banner: undefined,
accentColor: undefined
},
avatar: null
}
}
its from message.mentions.members.values()
Why are you doing that
using message.mentions.members.values().user is undefined
ermm something economy things
I need to get the id's from one mention or multiple mentions for storing it on database
Also it looks like only one user was mentioned, you can just do .first()
Yes i know, but i need to make it one || multiple
Then use a loop
.values() as it says in the result
returns a Map Iterator
for(const member of <Message>.mentions.members.values()) {
<Database>.insert({userId: member.id}) // idk how you do your db stuff but just insert your member.id appropriately
}
ah i understand now
so it has a array of member objects
alright thanks for that
no problem
so i have a react component in a file defined like this:
// component.js
import {Component} from 'react';
window.addEventListener('load', () => {
console.log('load');
});
class Main extends Component {
// ...
componentDidMount() {
console.log('componentDidMount');
window.addEventListener('load', () => {
console.log('load 2');
});
}
// ...
render() {
console.log('rendered');
// ...
}
}
const container = document.getElementById('ui');
const root = ReactDOM.createRoot(container);
root.render(<Main/>);
when i render this component on my pc, it always logs in this exact order:
rendered
componentDidMount
load
load 2
but when i render this component on my phone, it always logs
load
rendered
componentDidMount```
basically the component is a modal that starts out with a .hidden class, then when i get the load event, i remove the class so it fades into existence
but with the second behavior, the load event comes first and at that moment there's no rendered component to modify
anyone know why ?
oop
i was just trying to solve the problem mentioned above
you can ignore the second one
Well it seems you wanna do it on mount no?
or am I misunderstanding the situation here
front end work 
I don't know much about react myself

Im an angular kind of guy
a cute angle
the logic doesn't make sense anyways
I'll see myself out now
by the time react gets to the render function everything should be loaded
Doesn't react render before running componentDidMount
as in the load event should be emitted after rendering?
yeah my bad
you shouldn't be using the load event in the first place
hm
does this mean that the first behavior is wrong
because the load event gets emitted after render is called
you're trying to show a pop up on the page load, right?
yeah
i think you can just use a boolean state for this with a default value of true
states come later in the lifecycle
iirc you can use componentWillMount
which runs before render
Actuallyy wait no
componentWillMount is deprecated so you can't use it
something like this?
class Main extends Component {
constructor(props) {
super(props);
this.state = {
hide: true,
};
}
componentDidMount() {
this.setState({hide: false});
}
render() {
return <div className={this.state.hide ? 'hidden' : ''}></div>
}
}```
TIAS
Using state is definitely a good idea though
also is there a reason you're not using hooks?
it still has the same effect, pops open correctly on my computer but not on phone
the reason would be i did not know that exists
you should definitely switch to react hooks
how would i use this?
so since setHide is a setter when changing what hide is you'd do setHide(false)
or setHide(true) if you want it to be true
Honestly
using classes is dumb anyways
React is the only time I'd never use classes
i tried the boolean state but i got the same effect
oh wait it worked
forgot to webpack
too good of a server for bots?
https://i.imgur.com/ixcChYf.png
I don't think its enough tbh /s
ooo?
do you use djs?
mhm
but on a serious note
I think your current hardware should last you for a while if managed properly
It is basically just splitting up the workload
Think of it like child processes of the main process
it splits the guilds up to manage em better and is less strenuous
At roughly 1.5-2.5k you will need to start sharding
discord won't accept it otherwise iirc
oooo
Sharding also comes with some thing that people sometimes find challenging
I have this method...
public void paintComponent (Graphics graphics) {
super.paintComponent(graphics);
Graphics2D graphics2D = (Graphics2D) graphics;
player.draw(graphics2D);
graphics2D.dispose();
};
As you can see within the .draw() method, I passed down graphics2D, however, within the .draw() method.
public void draw (Graphics2D graphics2D) {
graphics2D.setColor(Color.white);
graphics2D.fillRect(x, y, graphics2D.tileSize, graphics2D.tileSize);
};
.tileSize is undefined?
I was like, alright, maybe I didn't use public, so I did so and it still doesn't find it?
public final int tileSize = originalTileSize * scale;
Mmm dn java
else i'd help
But whenever I see undefined
my first thought is usually Is 'x' really what I think it is?
I used the wrong variable, my bad.
Yes.
let end_dt = '2022-08-10T12:15:00-04:00'
let date = end_dt.toLocaleDateString()
console.log(date)```hey guys why is this returning undefined?
I basically want to get that end date variable and convert it to a timestamp basically
toLocaleDateString should be used on Date instances
so basically new Date('2022-08-10T12:15:00-04:00'). I see!
that actually returns me "8/10/2022"
So what i would have to do now, is convert this to a timestamp and use the discord styling tag right>?
However, can't i just use regex to remove the string before the T and after the - character?
That would be way easier
Yup got it using regex!
you really just called String.toLocaleDateString
💀
you can do new Date(end_dt).toWhatever()
iirc there's also ISO format that you can parse
/(\d+)-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/
idk how gmt offset format works in iso format

pong
Pong!
or has that been a thing for ages and i just never noticed
also, what does the voiseStateUpdate event give you? is that just fires when the bot joins/ leaves or is that just when it gets moved
Indeed. It's the only command tho.
ok
the voiseStateUpdate event doesn't exist...
you sure?
only saw it used in some bot i saw on github
so it might just be a shoddy missimplamentation
client.on('voiceStateUpdate', (old, New) => {
if(old.id !== client.user.id) return
if(old.channelID && !New.channelID) client.queue.delete(old.guild.id)
})
``` this was all it did henc why i was asking




