#development
1 messages · Page 34 of 1
nah you love assembly
lmao
computer club kids saw me writing assembly, immediately all focused on my computer
little did they know all I was doing was fucking around with registers and had no idea what I was doing
bet I looked like a wizard though
could use regex
if it's in the form of a mention in a message, it should just be in message.mentions
most of the time you shouldn't have to worry about needing to work with the raw text like that
i think they're scraping an embed
and if you are you might be overthinking it
mention.replace(/[<@\!]/g, "") works better
/g returns an array tho
.replace
hi c user null
don't you have IntelliSense?
me when people don't like type safety
IntelliSense is a magic IDE thing that detects types and hints things to you (it does other stuff too but not relevant to this rn)
IntelliSense is a must have for every dev
Almost every IDE has some sort of a version of it, whether it be their own branded one or just straight up IntelliSense
It will save you a load of time
is it not on vsc by default?
i feel forced to change my editor
no, a form of it is. There are other extensions that make it more powerful though
I wouldn't know about js for that thing, I use ts anyways
There are lots of them in the extensions marketplace
based
what language?
fetch user, open/fetch dm channel, send message, make sure to catch it
Yes you can
i forgot how to do it though
attachments://something afaik
VSC has IntelliSense built-in for various programming languages without the need for an extension, the languages with built-in IntellSense support are JavaScript, TypeScript, JSON, HTML, CSS, and SCSS
It's literally in their documentation
i used SCSS and i need to install an extension to get IntelliSense
I figured that it would have intellisense for at least js/ts, considering it's literally built on electron
Built-in IntelliSense support for SCSS was added recently
cool
also @earnest phoenix
That's correct, you just have to add the buffer as an attachment and give it a name, and provide attachment://NAME OF THE ATTACHMENT to the image field
@spark flint ^
let file = new MessageAttachment(await line_chart.toBuffer(), 'moderationGraph.png');
let embed = new MessageEmbed()
.setImage('attachment://moderationGraph.png');
await msg.edit({ content:null, embeds:[embed], files: [file] })```
this worked for me
Yep, that's correct

idk i always do let embed = new MessageEmbed()
let lets you reassign the variable entirely, const only allows mutation of the variable's state
probably some more intricate details I didn't mention there but I'm sure volt will correct me if it's wrong
It's better to use const to declare variables if you aren't going to mutate it later, and let if you plan to reassign it, since this can allow for further optimization
And remember that const still allows mutation of the value itself in the variable, not reassignment of the variable
Waffle is correct there as well
has anyone here used the chart.js-image package? trying to add data labels 
For a simple example
// Declare a constant variable.
const foo = {};
// You can do this, which just mutates the value.
foo.bar = 1;
// But you can't do this, as you're reassigning a constant variable.
foo = 9;
Now var is an entirely different level of fuckery
Honestly we would've removed both the var keyword and the non-strict equality operators (==|!=), but those are just set in stone now, would cause too much breakage if done so
it infuriates me when i see someone using let but doesn't reassign it later
Same
let mut moment
me when someone does let mut and doesn’t mutate the variable
That would be a compiler warning
I like immutability by default
That’s something I think a lot of languages would benefit from
Also it would save the optimizers some work since anything that isn’t declared as mutable is const
true
this is what i finished with a couple hours after
@earnest phoenix do you know if the js date api overhaul is coming anytime soon? Might have to make something with dates soon and I don’t wanna use the existing one because it sucks balls
Overhaul?
There’s a date api proposal that made it to stage 3 last I checked that completely overhauls the current date api to not suck
sounds like it won't be implemented for a while
You mean the Temporal API?
That's coming soon, we're already working on the implementation and these are several tests, just looking for edge cases to fix and to optimize some things
So you want the mod to have to add details
I imagine you either use slash commands or maybe modals if those work
Can anyone tell?
isn't it on your profile
How does it authenticate the users then? I’m asking to see if it’s good then I can implement it on my own website
look into something known as OAuth2
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
No not integrate…
Like a simple username password login
There should be a token right?
Yea that’s true
that’s where Oauth solves that issue
I am asking for top.gg npm package
the npm package is just a wrapper to interact with the api, it still requires a token to function which can only be generated for approved bots on the site
scrape html and abuse the fact that cookies are header based
It's so easy to complete login flows via scripting
does anyone know why my bot's activity getting cleared (disappeared) after being up for hrs?
I only set the activity once but for some reason it keeps going away
nah shouldn't normally do that, either your library resets it or something else
im using d.js, issue only happens lately, still on v13 tho
is there a way to download a big file and upload it at the same time to reduce memory usage in axios?
When people vote for your bot on Top.gg, use the Top.gg webhook (see #topgg-api) to send the voter's info to your bot's server. There you can listen for the webhook data and store their ID along with a timestamp in your database. Then regularly check your database for votes that happened over 12h ago and send reminder DMs to those users. You'd probably also want to store another column in your database to signal whether you've sent the reminder DM already so as not to spam reminders after 12h, or delete the row after sending the DM.
: )
How to make JavaScript "string choices"?
Like with Discord.js intents but you fill them in as strings instead of flags.
Or channel types
Like this.
are u making a lib?
glad python has array.choices amirite
then don't worry abt that, it'll be extra work for little return
Ight.
that's called "magic constant" btw
It’s a union type constant
interaction.channel.type is probably "DM" | "GUILD_TEXT" | "ETC"
(In that case)
in js you can do that with jsdoc
Hey, someone know how i can type this with Typescript?
this.jsonLangs = require(`../langs/${this.playerLang}`);
// Using exemple:
this.jsonLangs.language.lang_conf
(Its a big file so type manually will take too much time)
that's achievable through JSDoc
or
just use typescript
eg.
js
/**
* @param {"BLUE" | "RED" | "GREEN"} impostor
*/
function amogus(impostor) {}
ts
// typing via types
type sus = "BLUE" | "RED" | "GREEN";
function amogus(impostor: sus) {}
// inline parameter typing
function amogus(impostor: "BLUE" | "RED" | "GREEN") {}
you can't, it's a dynamic import
you will have to import the types manually from said json files and make an union type for them
I don't need help anymore..
you didn't state that so here i am

that was not
Ight.
acknowledgement != end
but anywho
@thorn spruce but from what i saw they are language data right?
yep
then the key struct matches across all languages
for this case i suggest typing the language struct
or you can not care about the type at all
the type definition of the language object exported from json files
that was i was doing before xD
for my case i just use fallback keys
if the data is there it will replace said keys with translation string; otherwise just display the key
export type LanguagePack = {
[K in 'en' | 'jp' | 'cn' | 'kr']: Record<string, any>;
}
export function i18n(key: string, lang = 'en', langPack: LanguagePack | Partial<LanguagePack>): string {
const keys = key.split('.');
if (!AvailableLanguages.includes(lang))
lang = 'en';
let data: Record<string, any> | undefined = langPack[lang as keyof typeof langPack];
if (!data) return key;
let level = 1;
for (const subkey of keys)
{
if (typeof data![subkey] === 'string' && level === keys.length)
return data![subkey];
if (!(subkey in data!))
break;
data = data![subkey];
level++;
}
return `{@${keys.copyWithin(0, 0, level).join('.')}}`;
}
export const useLocale = (lang: string, pack: LanguagePack | Partial<LanguagePack>) => (key: string) => i18n(key, lang, pack);
here's what i use
typing is a little bit ugly though, due to property key typing in highest parent object
I prefer with types personally
for large translations, typing is recommended
but
if you add unique keys to each language
typing breaks
My files literally looks like
key :
key : value
key : value
nop for me its the same key for each language
more easy
yes
but as i can saw you have one file for every language ?
yeah
for lazy-loading
one file for each language here
same
damn KR / CN / JP
yes
some good languages in facts
lmao
in facts i just remember
if my files are the same i can just import one of them
and do ```ts
typeof fr
'object'
typeof operator will only show you primitive types
it was a good idea in my head

@thorn spruce
{
"Command" : {
"subCommand" : {
"fr" : "Salut %s !",
"en" : "Hey %s !"
}
}
}
And I have a function translate in my command context and i just have to do translate("Command.subCommand", author.username)
And JSON are any type
import dialogues from "../../dialogues.json" assert { type: "json" };
On file all languages
Thanks copilot for translation ^^
oh
ofc i can do json deeper
{
"Command" : {
"subCommand" : {
"subSubComand" : {
"fr" : "Salut %s !",
"en" : "Hey %s !"
}
}
}
}
And if it can't find a translation i get some thing like {Command.SUUUBComand -> params}
can i add my own localization
kthx
If I have a bot that doesn't need intents (like none at all), do I need to verify for more than 100 servers (obv im still verifying but can it join more than 100 without verifying)?
still need to verify
i checked, its not
verification is only required if you enable one or more gateway intents
really? didn't know that
however i'm obviously still gonna verify lol
gateway intents require verification at over 100 servers
I'm pretty sure it's still required
there are 4 verifications
1 - to allow more than 100 servers
2 - to allow usage of GUILD_PRESENCES intent
3 - to allow usage of GUILD_MESSAGES intent
4 - to allow usage of GUILD_MEMBERS intent
you can do all 3 at once, but they're analyzed separately
#1 is for presence intents i think
ok edited
forgot abt the 4th
but still, that doesn't mean u dont need to verify for 100 servers
rip yea
If you're reading this page, you're probably on the path to Big Bot Growth™. Congratulations on your success! We're always thrilled to see a new creation flourishing in the world of Discord.
You're...
gotta verify ig
ye, the verifications are mutually inclusive
So I wasn't wrong—win!
you must have the approval for all enabled intents, and disable those which u dont
still got easier verification process lol
dont need to submit reasons for those three intents
i have all 3 disabled
gg 
I mean, it's a single verification
still gonna take me like 2 weeks
ye
just as a note, the process to get the intents post-verifications is...awful, to say the least
how do I make my bot run a command with different alliases (for example createinvite/createinv) for now mine run only 1 (getinvite) and I can't seems to make the bot execute the command with different alliases
ooo I misspelled aliases by using 2 l, woops
no it shouldnt
ephemerals should delete themselves after a while, or the user deletes them, like you delete system messages
what permissions does a bot need to lock a channel?
I just read a log saying that it is unnecessary to ask for manage channel for a lock cmd
Why not just make a channel with those roles only
welp that's what I found in #mod-logs for a reason about a bot being declined: Your lock command requires the bot itself to have the manage_channels permission. It only needs the manage_roles permission, though. Please only request permission(s) the bot truly needs
im getting this error in running my code
from discord.ext import tasks
import topgg
dbl_token = "Top.gg token"
bot.topggpy = topgg.DBLClient(bot, dbl_token)
@tasks.loop(minutes=30)
async def update_stats():
"""This function runs every 30 minutes to automatically update your server count."""
try:
await bot.topggpy.post_guild_count()
print(f"Posted server count ({bot.topggpy.guild_count})")
except Exception as e:
print(f"Failed to post server count\n{e.__class__.__name__}: {e}")
update_stats.start()
someone please help me
what are you trying to do tho
i dont think .forEach would do anything interesting on a single element
oh
that will only work if all members are in the cache
client.users.cache?
so what permission does the bot need to lock a channel?
Imma try both of them cause I dk too
I'm new too :/
I mean someone in #logs declined a bot saying that : Your lock command requires the bot itself to have the manage_channels permission. It only needs the manage_roles permission, though. Please only request permission(s) the bot truly needs
so it's not manage channels for sure
you would need to fetch all guild members
yeah then ig manage roles is what it needs
for that you need the members intent
as the declined message also states that
I tried but that doesn't seem to be the corerct perm too
no that wont work
you would need to fetch all guild members and for that you need the members intent
guild.members.fetch()
hmm?
you want to hide the ip?
message.guild.roles.cache.get('0').members.map(m=>m.user.id).forEach(member => {
let user = client.users.cache.get(member)
user.send("hello")
});
should work
only if all members are cached
you use backslashes
dont
if you REAAAAAAALLLY need to
for(const member of message.guild.roles.cache.get(ROLE_ID).members) {
await member.send(...)
}
but again, that only works if all members are cached
because roles dont actually have members
members have roles
so djs has to check all members to see which member has that role id
what if we reverse it?
like, fetch the members first then filter them by role
:/
thats exactly what role.members does
hence why all members have to be cached for it to work
i see
unfortunately discord doesnt give us a way to see that
role objects dont have any member information
im getting this error , someone please help me out ;(
Well I tested , my bot even thought it says different in the review , my bot requires manage channels perm to lock a channel
angular 
yes
?>
it's just discord doing a little trolling


I will be taking on a developer role soon
i guess you have to import <variable name> from <module name>
while you just have written it like import <variable name>
nah
more like import { exportName as varName } from module
it's annoying
or import exportDefault from module
i know
import export in python ?
but you are making it like a storyline
wait did i get confused in javascript and python
you can do from moduleName import exportedName
that's why i asked 😂
also import moduleName as name
lol you are good
i'm not
so you work with both js and py .. right like me ?
chaos, total chaos
also ocassionally c#
Ohh so mainly js ?
undefined behaviour moment
*typescript
cool i am getting started with it
raw js is devil
😂 esm and ts is much better
I'm still using CommonJS lmao
no i didn't said it's a lang
I'm honestly surprised there's still people who use the old require() to import stuff
actually cjs is better import imo since it supports nested object destructuring
require > *
Ohh , but ur still good with it
lmao
I mean, if u got MANAGE_CHANNELS I expect it to also include managing its permissions
and MANAGE_ROLES to be able to modify only the actual roles, not the channels
but oh well
that's what worries me cause it has been the reason for many others...
even though I tested the cmd and it only works with manage channels
ye, common mistake, for some reason discord only requires manage_roles to edit the channel perms
manage_channels is for managing the channel structures
in fact I don't modify role perms for lock cmd , I modify channel perms
so that might be the cause
it's more convinient to lock channels based with their own perms overwrite than manually locking role by role
doesn't that require "manage channels' perm?
it does
yes
told you
but if everyone is a role
then manage role perms alone would work
unless there are complex unique settings for each channel, then oh well
I am talking about everyone role
if everyone role has mange channels perms it will work
the point is to work with manage roles tho... not manage channel perms
well as sayuri said it's better to with manage channels.. why manage roles is required to lock the channel ?
I have to go with manage channels cause that's the only perm it makes it possible to work. What I am saying tho is that:
Yes
failsafe
.catch()
no idea how mojang api works
still, .catch() for any promise-based actions
Because axios rejects on 400 status codes
Just .catch like he’s saying
You can set your own custom validateStatus func for axios to not throw if you wish
it's a good habit to .catch() any and all api calls, even those that are guaranteed to work
you never know when the server might be offline
whatever u want to do when it fails
ye
https://github.com/Tomato6966/Multipurpose-discord-bot/blob/main/commands/⌨️ Programming/compile.js what is this for?
does this ltierally just compile the code inside the bots files? what's the purpose of this? 😮
It’s a recipe for disaster if he actually runs the code too
I’ll look at it when I get home
He uses an api it seems
They take some code as input, send it to an API to be processed, and display the result
So they're not running it on their own bot process
don't know why they decided to have every file end with .cpp though
or why the folder path includes an emoji
what's the point of the eval in the very end of the code though?
I think it's just for translation
English, Russian, etc.
A bad idea to use eval for that, but it doesn't look related to the code evaluation.
ah I see, that's a little bit weird lol
does dyno do this command by looping over ALL of it's cached users? would it work on mine just as well?
my bot is in a couple big servers so it should be fine?
If it’s cached it shouldn’t be a problem (depending on what operations you’re using) Do not fetch a ton of users though
I won't try fetching them, I will only use cache for this command
it is safe though, right?
I'm getting a message saying it successfully purged amount of messages, when error is reported to console and I don't know how to fix it, this is for (Errors with bot not having access).
I don’t see why it wouldn’t be safe
send the code
Caches are designed to be fast
It’s your command, you’ve gotta be the one to figure out what to do with it
not sure what is the best way of getting all the users, there is multiple ways to
You might be trying to bulkDelete messages older than 14 days
and I want the fastest one
const { SlashCommandBuilder, PermissionsBitField } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('purge')
.setDescription('Purge up to 250 messages.')
.addIntegerOption(option => option.setName('amount').setDescription('Number of messages to purge.')),
async execute(interaction) {
else if (interaction.member.permissions.has(PermissionsBitField.Flags.ManageMessages)) {
const amount = interaction.options.getInteger('amount');
if (amount < 1 || amount > 250) {
return interaction.reply({ content: 'You need to input a number between 1 and 250.', ephemeral: true });
}
await interaction.channel.bulkDelete(amount, true).catch(error => {
console.error(error)
});
return interaction.reply({ content: `Successfully purged \`${amount}\` messages.`, ephemeral: true });
}
else {
await interaction.reply("You need: MANAGE_MESSAGES for this command!")
}
},
};```
Sorry it took a while-
Filter out the messages that are 14 days or older, then try purging
remove the console.error then lol
Also limit the number to 100
The bulkDelete endpoint only takes up to 100 IDs
Idk if djs splits the requests but either way it’s a bad idea
There’s like 2 ways, it’s either from cache or from fetching
you should also save the number of deleted message and compare it to the messages actually deleted, that way u can tell the user if the messages were over 14 days old
I mean for MISSING ACCESS error, it sends to console but still continues to say it purged successfully.
u can get all the users in a guld from message.guild.users.get or you can get it from client cache client.users.cache.get also u can do client.api.users.get
Alright thank you!
100 messages got it!
It continues on after your catch statement
That’s why it’s still saying that in the response
should I make it 99 just incase?
no need
Oh, how would I stop it
It’s all the same pretty much
Just don’t be fetching
use try {} catch {} instead
I would just have a try catch block
Yeah
That way when it throws it goes straight to the catch block
try {} catch {} ty
alr, client.users seems the more convinient so I'll go with that
as long as the user is cached
I use client.users normally.
await interaction.channel.bulkDelete(amount, true).try.catch(error => {
console.error(error);
//Should end here if error
});``` Better or did I type that wrong?
oh boy
try {
somethingThatCanThrowHere()
} catch(e) {
// do stuff with your error here
}
Did it wrong-
/facepalm
I meant the first one lol, I realised.

// Lets save our discrim and confirm that it is indeed a valid discriminator.
const discrimToFetch = args[0];
if (isNaN(discrimToFetch) || (discrimToFetch.length > 5 || discrimToFetch.length < 4 )) {
return message.reply({
content: "I was unable to fetch the users, because the discriminator you've chosen is not valid!"
});
};
// Lets now fetch the users.
const fetchingUsers = client.users.cache.filter(member => member.discriminator === discrimToFetch);
if (!fetchingUsers) {
return message.reply({
content: "I was not able to fetch any users with the discriminator of your choice."
});
};
``` so how will this work?
Works! I forgot abit of it so it accidentally kept the error message when purging but it works now! Thank you!!
wait does filter exclude or include I forgot?
try it and see
includes whatever resolves to true and excludes whatever resolves to false
so it will include anyone who has the discrim of the users choice, nice
message.member.roles.add?
what do you mean?? is is the Id of an user?
message.guild.users.fetch(id).roles.add(...)
np
u might wanna await it though, not sure how the promises work with this one
const member = await message.guild.members.cache.get(id);
member.roles.add(id);
great
Just as tip instead of chaining multiple conditions just check if the length is !== 4
oh I forgot that was a thing 
_to name just one improvement _
just one :0
what's wrong with it 😭
should I paginate it or???
I think 10 names should be fine, I don't think you'd need that many anyway
bruh what
Cache is not a promise
fetching is a promise
ok ok relax
anyway that's how it looks
good enough w me
Why not make a pagination function that just takes an array of anything and returns back a 2 dimensional array of the items/pages
And/or object
cause I'm too lazy to make something like that a function that I will possibly use only 2 times and then forget it exists
besides you won't need that many users for a discrim function anyway
u need just 1 actually
I'm being generous

Have you considered not scraping your previous embed and instead just saving the users? Not sure why you’re bothering with that, I have never seen a proper use case for scraping your own embed
Not to mention there is no reason to have an await there
People gotta stop slapping await on everything for no reason and look at their IDE telling them that it does nothing 
awaiting things for no reason is probably a bad thing
why not just use it on promises?
await a non-promise just wraps it in a promise
await has no effect positive or negative on non promise returning properties/methods
and changes execution order
your ide tells you
Press control a and then press backspace and start again
https://stackoverflow.com/questions/55262996/does-awaiting-a-non-promise-have-any-detectable-effect
This post seemed to explain how awaiting a non-promise effects your code
Maybe more people are actually using notepad than you might think

anyone knows why on class in typescript the keyword this is null?
How are you using this in the class?
to call a function in the same class
your ide will tell you that too
show code
I don't see how this can be null
vscode problems
the three grey ... means "hey look at this"
like
That's weird
The extensions have nothing to do with it as it's built-in to VSCode, it should let you know if the typings are correct
If the return type of a function is not a Promise and you use the await keyword on it, it'll let you know about that
It's already enabled by default
are you setting the function to a callback where the function doesn't retain the this reference?
eg: eventemitter.on("thing", thing.characterSelectionUI);
if that's the case, you need to call .bind
tbh, I'd reset my vsc to default if I didnt have that on for some reason.
not just for the await thing, but everything.
in the config, there's a strict type checking option everyone should have turned on
that too
actually i am doing that but .bind expects one argument that argument is this right?
correct, in the example case, you would do
eventemitter.on("thing", thing.characterSelectionUI.bind(thing))
nope
set to EventsManager instead of this in the bind
this would be referencing globalThis
ohhh yeah that worked thank you :)
it's less characters to just write arrow functions though
But… variables are a thing you know
Why waste a few thousand cpu cycles on processing a regex for something you could just have super cache friendly available for it 🥺
Your usage of the await keyword is mostly correct, although the said suggestions provided by the VSCode refactoring system should appear at these lines for example
https://gist.github.com/IThundxr/a6478c811198830927766bef5c667db9#file-application-js-L178-L179
Since you're using the await keyword on something that is not a promise, if it doesn't show up then the typings are unknown here so VSCode doesn't know what to suggest
If you hover over it, it should show up the typings, if it's any then it's unknown
not to be confused with the type unknown
tbh you don't even really need to await the .send() either no?
I don't see a real reason to await it unless you are going to use the result from the promise
theres a lot that probably doesnt need to be awaited even if they are promises.
What does it say when you hover over them?
or if you want it to run and wait for it to be done until it runs everything else
If you're writing pure JS, you need to use JSDoc on most things for VSCode to give good typings
new string[] initializers when
no
might as well make ts similar to C#
If you don’t await a promise and it rejects, it will not be caught by try catch blocks, you’d only be able to catch it with .catch
It should at least say any if it doesn't know the typings, you're either hovering over the wrong thing, or you're using an extension or some kind that overrides the IntelliSense, which is bad
Ah right
Forgot about that
co pilot does that
Misty refuses to handle errors
co pilot blocks a lot of intellisense
So badass
I use .catch and shit
doesn't that do essentially the same thing?
Lots of .catch makes me wanna puke
Callback hell
I've used it a lot and it only overrides the IntelliSense of the property/method lists when it's trying to suggest a property/method
You can't return in the parent scope unless you void 0 in the catch and check for truthiness
Copilot is pretty smart in most cases, but sometimes it has those edge cases
@earnest phoenix can you get rid of null, undefined, and errors and instead just make js like rust 😉
which is very often for me
I stopped using co pilot
I'm smart enough for all of the projects I write
I would if it didn't break 90% of the web, ...and the applications/libraries/projects
void 0
just use rust
interpreted languages will always have to have runtime errors
otherwise, you just have blue screens to debug
Rust is just amazing, it's error messages feel like it utilizes an AI
I thought you hated rust voltrex
I tried to use rust, but its syntax and paradigms turned me off really fast
Python users when they realize it's 66x slower than JavaScript, and 70x slower than C/C++ and Rust
otherwise, I'd use it in combo with Neon to write node native addons
The error messages are truly beautiful. Pretty printing errors is something that even if it doesn’t provide a whole ton of information to the user, it looks so much cleaner and less confusing than a massive stacktrace with a line number
I don't hate Rust in anyway, just the community that try to dickride Rust for absolutely no reason instead of taking constructive criticism
Rust users try to acknowledge the flaws of the language challenge just like the users of any other languages
Thats true. The main problem is that when I see people criticizing rust it feels like they’re attacking the language for very niche reasons
Similar to the way people attack javascript’s weird type coercion behavior that you rarely ever have a problem with
Like 90% of the time in the C++ discord people say rust is garbage because it’s hard to implement a simple thing like a linked list without the use of unsafe
And then they ignore the other billion reasons to use rust because of that one thing
can't implement a linked list with safe rust?
Yeah, but generally Rust users are just something else
damn never using it again
You can, people just see that the standard implementation for it uses unsafe
Waffle you're like one of the sanest Rust users I've ever seen
C++ users try not to ignore ```rs
pub enum LinkedList {
None
Node(Box<LinkedList>)
}
Challenge
Difficulty impossible
Then yeah that's why it has no idea on what to suggest, you need to assert that the interaction is an instance of a interaction that contains the message property, such as the ButtonInteraction
Looks like a bunch of gibberish to me
Probably because I didn’t start out with rust, I actually tried a ton of other languages before doing it
I feel like a lot of people go straight from c to rust and either really love it or really hate it, no in between
I think it’s great for certain things but for other things it can be painful sometimes
Also writing code that utilizes unsafe makes me feel cool
(If it’s a valid use of it)
why not use the built-in linked list
Precisely
Seems like a lot of people criticize rust for having a lot of unsafe sprinkled around the standard lib but then don’t acknowledge the fact that it’s already written for you so why does the implementation matter
I think Rust's community is fine, though there seems to be a split in mentality between people writing it for low-level and high-level code.
Let me dumb it down for you, since the interaction argument you're using in your code, it can have multiple types, such as CommandInteraction, ButtonInteraction, SelectMenuInteraction, etc etc; but that part of the code I just highlighted, VSCode doesn't know what type of interaction you're currently using, so it doesn't know if it has the message property which is why it's type shows up as any in your case
You can do something like this:
import { InteractionType } from 'discord.js';
...
if (interaction.type === InteractionType.MessageComponent) {
// Do things that use the `message` property, because the `message` property only exists on interactions that are message components.
}
Actix-web is a prime example of that, since the maintainer used unsafe soundly and for performance reasons but contributors didn't like it since there were safer ways to do so.
And you can see it in some of the standard library's APIs
I mostly don’t care at all about the use of unsafe until it becomes excessive
A lot of the usage of unsafe is primarily in the lowest of levels
Such as in langdev where you need to use transmute to obtain a function pointer to machine code that was generated via JIT compilation
I spammed unsafe everywhere in my Rust code
idc what other people say about it
Usage of the unsafe keyword and blocks is absolutely fine if it's necessary, because not everything can be done in Rust's safe way
like if i know that something is not None then i would use .unwrap_unchecked() over .unwrap()
because there is no point in checking
yknow what i should do
but why it is an option then
I feel like rust is the type of language where you will eventually end up doing something unsafe anyway
though honestly I think the low-high level split is rust's greatest weakness
#[forbid(unsafe_code)] is just stupid
Not if you know that you'll never be touching something unsafe (excluding the standard library functions that use unsafe code aggressively)
Because they do 
Chances are in rust somewhere in your project there will be a use of unsafe, whether it’s by you or by a dependency
Which is perfectly fine
It doesn’t degrade the overall safety of the language, there are just some areas where it’s not a “one size fits all” type situation
"Unsafety" exists in almost every code regardless of how perfect it may seem, so indeed
Then again not everything can be done in Rust's safe way
Especially when you're working with something bare metal
Yeah
unsafe {
let ptr = std::ptr::null() as *const u8;
let troll = *ptr;
}``` 
is that basically null pointer exception?
no
try it out 
Pretty sure that just Segfaults

No crash here
is AWS or Google Cloud better for a datebase?
I believe it depends on the environment, rust playground likely has some sandboxing done differently
I’m sure on some systems it’ll just give you random memory garbage back
But it’s definitely UB so nothing is guaranteed
You're running it through the Rust playground?
That bot runs it through rust playground yeah
I’m on mobile
So I can’t test on my system
I mean you can definitely still use our compiler explorer :^)
But it can look a bit zoned out on mobile
Yeah the mobile experience isn’t as great
Plus I just threw it into a discord bot since I didn’t feel like pulling up godbolt
how should I set up donations for my bot?
yes
our?
buy me a coffee or patreon or stuff like that
Don’t try to set up your own financial stuff like that though, let a professional company handle it
prolly that's why paypal is a bad idea ig
Buy me a coffee is PayPal I believe
We (the LLVM Developer Group) actually develop the compiler explorer and maintain it since we use it all the time, like excessively
The Godbolt usage is almost everywhere in the development of LLVM
I can see why, it’s a very convenient tool and very fast to see what kind of optimizations that happen
Can LLVM optimize me
I use it at school just out of curiosity to see how smart LLVM is
Try to see what it can see
Honestly it's kinda satisfying to see all the optimizations and their differences in different optimization levels, such as 0, 1, 2, 3, z, s, etc etc
I can't login into paypal since I changed my number and lost my old sim card
what do I do?
There's also fast but we don't talk about that, it's optimizations are too aggressive in ways that it avoids being complaint with the standards
bruh wtf I can't contact paypal without logging into my account LIKE BITCH I NEED TO ASK ABOUT MY ACCOUNT
😭
I’ve seen fast before
Some of the things it does are questionable yet really giga brain
Like what
yooo can anyone acc told me cause I cannot change the number
I can’t remember the specific example but there was something someone compiled in the rust server that I didn’t expect it to optimize
so...
Welcome to the circle of 2FA
That’s why I hate it and deny to use it anywhere

What does new one do the OS inbuilt one can’t?
I mean just speaking about to show an imagine or not

I had to call them motherfuckers at 1am just to change my number
Does anyone in this channel use linux as a daily driving OS for development

nothing, but its damn nicer to use

I do
Not just for development, but for everything
but I got my account back
now
I can finally
set up
donations
but the buy me a coffe website isn't paypal, otherwise it would have an option to send the money straight to ur paypal
I’m considering booting linux on to my windows laptop, so that I can use it as a work/school laptop exclusively, since I don’t use it for gaming anymore. What’s the experience compared to windows like?
(For things like that)

bro wtf it's not even a one time thing I can't log in anymore
flexed on 
all the reason to not use paypal
thought u went to sleep 😑😑😑
Voltrex writing an essay atm

i woke back up 
thank god i never had issues with paypal
The experience is way smoother than Windows, and way faster; especially for development as you mentioned as most of the things you need for development and building/compiling is easily given to you instead of using something like Visual Studio as the base builder for things on Windows
And most of the software you need is already available for Linux (well most of the popular Linux distributions at least), although not all software is available of course but there are ways to run it
If you need something that is Windows-only and necessarily need it, then I wouldn't recommend switching over, but I'm sure everything you need is available, and you can customize a ton of things for your liking to make things easier
Other than those, everything else is just better in every way
bruh paypal tweaking 😭😭😭
same, if i do have issues they get fixed quickly 
b-b-but gaming :(
what if youre both
i only drink sweet wine
I think I’ll end up swapping to linux on that machine fairly soon then. I’m going to need this laptop for college next year, and I’d rather not shell out the money for a fancy one, so linux can probably take the most advantage of the hardware I have in it and make it last as long as I can possibly go before needing an upgrade
Gaming on Linux these days is just solid, most of the games you need can already be played at almost the native level using compatibility layers such as Wine, Steam Proton, and various other launchers, such as the Heroic Launcher as the replacement for the Epic Games Store/launcher
What about the BIOS thing
but the mobile app just doesn't wanna log me the fucc in
:scream-1: :scream-1: :scream-1:
Emoji fail
Manufacturers these days provide native builds of their BIOS update utilities for their PCs, however since my laptop's manufacturer (Lenovo) didn't see much use of Linux in the old days, it didn't provide one for the older ones, but now they do for the newer ones
My laptop is Lenovo too :troll:
Switch then 👍
However not all manufacturers are the same, a decent amount of manufacturers provide BIOS update utilities natively for Linux for a long time
acc gonna need me a paypal alternative
rip
And BIOS updates are not necessary as long as your PC works fine, but is recommended
what's the best one
Solid
dualboot ez
Valorant not running on Linux is based
wine is bad anyway , it rarely even works
But I’m sorry for your LoL situation 😔
I mean it's not bad but doesn't work for most games
The main reason Valorant doesn't run on Linux is because of it's anti-cheat, since it's not natively available for Linux
i remember last time i tried installing drivers for my laptop nvidia gpu i bricked my linux and had to reinstall
xD
Use Wine then /s
The newer versions of Wine are Godly, it works for almost everything
Valorant’s anticheat is basically Chinese government level spyware ngl
does that display a windows error box?
bruh if u run any of my games on wine they're gonna look corrupted 😭😭😭
No, it BSODs your windows pc
lmao
like I'm taking textures, sound all purple
But just edit your registry so you can make them run better :troll:
Then use Steam Proton, because it's specialized for games
Steam allows running of non-Steam games as well

wait wait
is Paypal buisness one of paypals apps cause I just logged in using that?
I'm not gonna get my identity stolen?
Bye bye PayPal money
wine.on("bsod", e => {
system.panic(e)
})
looks legit
Idk man big tech companies suck at keeping logins it feels like
can i just use it bare?
I was locked out of my steam account because I couldn’t remember my password, I reset my password, then tried to log in and told me the password I had literally just created was wrong
Waited a couple hours for servers to maybe update or something, still didn’t work
How do I run my bot 24 hours?
Had to contact support and wait 2 days for a response with another reset link
lmaoo that app is so trash what the hell even is that 💀💀💀💀💀💀💀💀💀💀💀💀
I was logged in, I clicked an option to send money and it opened A FUCKING WEBVIEW and FOR THE LOVE OF GOD IT ASKED ME TO LOG IN AGAIN
FUCK THIS SHIT

How do I run my bot 24 hours?
let the program running 24/7
@earnest phoenix check mentions
It stops the Wine translator because Linux systems does not have BSODs, can't have them either
Kernel Panic?
I want to know how to make it work all the time
Kernel panics are not necessary BSODs, although you can count them as one in some way
literally have it running all the time
dont close it
can anyone send me like 1 cent just to confirm that it's working?
My bot on Repilit Hosting stops working automatically every five minutes

idfk if it's the correct account I just went to paypal.me/myusernamehere
but prolly, the same profile picture showed up
replit doesnt support that by default, so you have to use a pinger service to keep it alive. im not sure if that still works tho
Can you send me the links to the site that made the bot work?
I wanna make my own paypal client
I used replit when I started coding
But you can use uptimerobot to ping your repl
Dealing with transactions is a complex and difficult task, especially regarding legality
There is a reason that people don’t like reinventing the wheel for that sort of stuff
When the government is involved, it will be annoying to make
create a webserver inside your bot, for example ```js
const express = require('express');
const server = express();
server.all(/, (req, res) => {
res.send(pong);
});
server.listen(process.env.PORT, () => {
console.log("ping server online");
});
then create an account on some pinger service, like uptimerobot, and create a new automatic ping task to ping your replit url every 5 minutes
UpTimerobot It does not keep the bot online all the time
“Oops I accidentally committed 5 counts of felony tax evasion and 3 counts of wire fraud”
Sometimes replit force stop your repl
I have never seen a worse website ever

Wait until you see any government website ever created
it logged me out because I REFRESHED THE WEBAITE!!!!!!
AND I CAN'T LOG BACK IN AGAIN
Don't use paypal, send the money directly 👍
Should I put this code in my project?
god help the next person who picks up the customer service cause I'll be screaming so hard I'll rupture their eardrums
cant u just use patreon and just withdraw to ur bank thru that 
good idea
I’ve heard that patreon is a better experience than dealing with any sort of PayPal dogshit
definitely, many people seem to use patreon so might as well try
Use onlyfans for your bot’s premium subscription 😉
other than a bunch of fees and taking most of your money, they're pretty good
ayo wtf
if you already used uptimerobot, you should already have that code in your project
OnlyFans is not just for nsfw dealings, before that was popularized it’s basically just like another patreon
gonna show them what,the bots juicy code? 😂😂
"Oh man this code got me actin' up"
😭
LMAO
"oh my god dereference that null pointer harder"
lol I can't... does creating account on pateon take long cause I pressed the create account button 2 minutes ago 😄
sounds like you have bad internet
only took me like 10 seconds
i just sign up with google
ezpz
or suspicious browser history that cloudflare doesn't like 🤨
2mb/s 😄
faster than mine 
how is that even a factor?
slower than usual
bruh I can't create the account
You guys have internet?
apparently you have 
probably yeah
everythings just going wrong for you huh
like not even kidding bruh wtf is this shit
I just tried logging in and it said that I already have an account with this email
WHY
WHY
I just want to setup donations bruh why
Yeah Bae‘s code should be restricted to NSFW channels only 
😭

Nah it should be listed as a ToS rule

Your code has gone too far! I couldn't sleep for a week because of it

the heck why does it use my actual name is my username
I don't want people knowing my name
u cn change it
When abstract gets a new meaning
where?
oh I see it
why is every website messed up for me lmfao..
nah bro what the actual hell is this
every single website
my adblocker?
could be
nah on my phone I got no adblock and it still gave me that
something wrong
definitely
but maybe on pc idk

I need someone to help me stop procrastinating
do I start with calc hw or do I do physics
ok goonna try turning it off
ok it was my adblock
anyways... how do I make it so people can acc donate?
make a tier
how...?
all I got i the home page, and the settings page
nothing else on my screen
bro help me 😭
k I found it
Create a simple donate button with the inbuilt features
That’s it
Not that anyone every donates anyways
But as long as you can dream it… 
😭 maybe.. just maybe
bruh relax they might just will and u know it
https://www.patreon.com/itsyoboibae how is that? does it work?

I hope you're not trying to use patreon api
what does this mean also?
why not?
I wanted to use it for perks in my bots, I assumed I'd be able to check who is my patron
You'll not succeed
wot why
Patreon api is among the worst ever created
even worse than mine? 
its worse than paypal's
oh god it's awful then
Don't underestimate patreon api
and paypal's api is already one of the worst in the world
I haven't even used paypals api yet, but I can tell it would be just awful by the experiences I just had with the application and the website together
They not only send a kilometer-long response, but the entire thing repeats a ton of sections so u don't really know what data you'll be using
Split by space, [0]
and the one thing you want, to know if x user is pledged or not, is hidden behind layers and layers of useless info
If u use space as delimiter
dam I will still maybe try but tomorrow as I don't have the strength to deal with this any longer 
at least the page is set up which is good enough for me

"PayPal" 
I kinda wanna do it as I've dealed with paypal before it went to shit so Ik how to get money out of it but idk
should I just do it directly to my bank?
Remember both take quite a big tax off your income
Well...yes, as all transactions have
depending on which country your paypal is from, there can be an additional receiving tax and conversion fees
The "small" percentages end up adding a lot
aw man
Oh good fucking luck if you are implementing paypal with their oauth2 docs
my only tier is called buy me a coffee which is 3$ 😭
You don't like reading docs to begin with
so you will def hate paypal docs
they are so fucking bad
yes, yes yes I know, I just tried logging it 5 times, scream at the poor customer support dude for an hour cause I couldn't log in
in the end I gave up and tried using patreon for donations









