#development
1 messages · Page 2056 of 1
ahh yea it is && not ||
hello How do I use the secure search feature in my music bot?
you need to check with the music sources your bot uses
if you use soundcloud you have to look into the soundcloud's system for how to enable it, if they have one, or ask the soundcloud community
okay thanks
can you guys explain me what secure search actually is
secure search or safe search is a feature present in most services that offer searching functionality, to filter out "unsafe" content like nsfw
tnx for the information
what is message.partial?
if i remember correctly its a boolean to say whether all data is available or not (partial)
for example if somoene reacts to a message that isnt cached it would be partial
and then you can call a method which would fetch that message and make it no longer partial
I see, so does it have any uses? I've just been reading some code on stack overflow about moderation logging and I came across that
if (message.partial) return;
So the reason you might want to return if the message is a partial is not having access to everything you need.
If you dont have partials enabled you don't really need to worry about them.
youd use it to check if you need to fetch extra data or not
in a reactions case the message
dont see why youd ignore a partial message
no idea either that's why I'm asking
it was place in the messageDelete event, the code was for ghost pings
const settings = message.settings = getSettings(message.guild);
if (!message.guild && settings.modLogChannel !== undefined) {
const { members, roles, everyone } = message.mentions;
if (members.size > 0 || roles.size > 0 || everyone) {
const modLogChannel = settings.modLogChannel;
const modLogChannelRegex = /^<#(\d+)>$/;
let channelCheck, channelID;
if (modLogChannelRegex.test(modLogChannel)) {
channelCheck = message.guild.channels.cache.get(modLogChannel.replace(/<#(\d+)>/, "$1"));
} else if ((channelID = modLogChannel.match(modLogChannelRegex)) !== null) {
channelCheck = message.guild.channels.cache.get(channelID[1]);
} else {
channelCheck = message.guild.channels.cache.find(_ch => _ch.name.toLowerCase() === modLogChannel.toLowerCase());
}
if (channelCheck !== undefined) {
const ghostPingLog = new MessageEmbed();
ghostPingLog.setTitle("Moderation Logs");
ghostPingLog.setDescription("GHOST PING DETECTED!");
ghostPingLog.setColor(commandColor);
ghostPingLog.addField("Content", message.content.slice(0, 512));
ghostPingLog.addField("Author", message.author.tag);
ghostPingLog.addField("Members", members.size.toString(), true);
ghostPingLog.addField("Roles", roles.size.toString(), true);
ghostPingLog.addField("Everyone", everyone.toString(), true);
channelCheck.send({embeds: [ghostPingLog]});
}
}
}
``` finished
I wasn't quite sure how to optimize it best that's why the syntax is so bad
any idea why ^ the above isn't working? no errors
i got a question, so in my idex.js file i have command which will reply on interaction if it is executed in DM, that code looks like this: ```js
client.on('interactionCreate', async (interaction) => {
const WarningEmbed = new MessageEmbed()
.setTitle('Warning!!')
.setDescription(You are not allowed to use this command here!!)
.setColor('RED')
.setTimestamp()
if(!interaction.guild) return interaction.reply({embeds: [WarningEmbed]})
}
Now, when user call slash comamnd in the dm, it will get warning message how he cant use it in DM, now, i have one command which need to be executed in dm, but idk how can i make it so it overwrite this "prevention" inside index.js
would it work if i use
```js
if(interaction.guild) { return }
else if(interaction.dm) { /* Do something else*/ }
or it should go like ```js
if(interaction.channel.type === 'dm') { /* Do something else*/ }
where tf is the documentation for events?
I can't find any info about roleCreate and roleDelete event????
Here is all the DiscordEvents and their parameters (discord.js)
Here is all the DiscordEvents and their parameters (discord.js)
here
yea but these you have list of events but what you trying to do
roleCreatedLog.setTitle("Moderation Logs (Action: Role Created)");
roleCreatedLog.setColor(commandColor);
roleCreatedLog.addField("Role Name", role.name || "No Name");
roleCreatedLog.addField("Role Perms", rolePermissions || "No Permissions");
trying to look up how to get the author
the person who created the role
i dont even think that is possible
??? what
to check who created role
that's absurd
but does discord log that events in audit log?
if yes, i think u could use audit logs to check for that, not sure how but you can read docs here: https://discordjs.guide/popular-topics/audit-logs.html#who-deleted-a-message
can't
I deleted the entire event
I saved it into a zip just in case but it got corrupted for no reason 😭
guys...i ran into logical error...So i have slash command called "ticket" which will send an embeded message to the "defined channel" by server moderator and ir goona log theirs messages. and sent them to the channel, like
if user dosent call for /ticket command, bot not gonna log anything.
after user calls it, bot wil log every message that user sends in BOTs DM.
then, i need to create an /close-ticket command which will "close ticket" which mean that bot will no longer log users DM messages...
soo, i honestly dk how to do this, i got an idea...and just...lost it
for DB, i think that i should save Members id as well and then somehow create listener which will log users id when he "opens" a ticket
how do I check if the bot has permissions to check the audit log???
that is my theory
if (bot.permissions.has('VIEW_AUDIT_LOG')) {
// Do Something
}
i think this is name of permission
no clue if it's best solution but you could make it so once the execute the ticket command the user's id gets added to a database and then you just check EVERY message sent into the bot's dms and if the user's id is in the database you log the message
then just remove the id if they use clod ticket command
hey guys, how would i see where a site pulls its info from?
Once someone told me to use like the networking tab and check the incoming requests
I tried it with the site i want to scrape but i only got shit back basically
module.exports = async (message, guild, user) => {
const settings = message.settings = getSettings(message.guild);
if (message.guild && settings.modLogChannel !== undefined) {
const modLogChannel = settings.modLogChannel;
const modLogChannelRegex = /^<#(\d+)>$/;
let channelCheck, channelID;
if (modLogChannelRegex.test(modLogChannel)) {
channelCheck = guild.channels.cache.get(modLogChannel.replace(/<#(\d+)>/, "$1"));
} else if ((channelID = modLogChannel.match(modLogChannelRegex)) !== null) {
channelCheck = guild.channels.cache.get(channelID[1]);
} else {
channelCheck = guild.channels.cache.find(_ch => _ch.name.toLowerCase() === modLogChannel.toLowerCase());
}
if (channelCheck !== undefined) {
const fetchAuditLog = await guild.fetchAuditLogs({ limit: 1, type: "MEMBER_BAN_ADD" });
const fetchBannedLog = fetchAuditLog.entries.first();
const memberBannedLog = new MessageEmbed();
memberBannedLog.setTitle("Moderation Logs (Action: Member Banned)");
memberBannedLog.setColor(commandColor);
memberBannedLog.addField("Banned", `${user.tag} (${user.id})`);
memberBannedLog.addField("Moderator", !fetchBannedLog ? "Unknown" : fetchBannedLog?.executor.tag);
return channelCheck.send({embeds: [memberBannedLog]});
}
}
}
``` why doesns't this work?
no error, it just doesn't execute
DiscordAPIError[20012]: You are not authorized to perform this action on this application
at SequentialHandler.runRequest (C:\Users\Churt\Desktop\blacklister\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.js:198:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (C:\Users\Churt\Desktop\blacklister\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.js:99:20)
at async C:\Users\Churt\Desktop\blacklister\bot.js:65:13 {
rawError: {
message: 'You are not authorized to perform this action on this application',
code: 20012
},
code: 20012,
status: 403,
method: 'put',
url: 'https://discord.com/api/v9/applications/987817633544015956/commands'
}```
that is deffo the user id
Logged in as Blacklister Development#5412 (987817633544015956)
help me with this buttons i need to change it as play, loop, skip, shuffle, stop
this can happen, if you use ammm slash commands, this cann happen due to invalid Client ID (BOT ID)
help me @fathom sonnet
its a new bot application which makes me think thats why
they'll help if they can
just wait for someone who knows what they are doing to help
okay
i thought i'd share this
cant help woth buttons, I never really had to use it soo
cpp? dayum
its a pr someone logged against a c++ discord lib, adding some random js and a comment into it
they probably thought they were EPIC until the CI and codacy laughed at them
you can dm reply from slash tho lmao
Unfortunately, you cannot send a response in a direct message using a slash command. The response will be sent in the same channel as the slash command was executed. You can send the response as a normal message.
lets apreciate that he making slash commands in cpp
my whole bot and the lib are cpp
...why whould u doo that?
lol
lol
the pr is a copy and paste of a stackoverflow comment
https://dpp.dev/ you gotta be kidding me... cpp also have lib for discord bots? dayum
someone really have time to waste
its much more powerful than a js or python lib Vjecni
imagine, trying to hijack bot made in cpp
you arent going to get 35 million users in 4.8gb ram on js
how would that go
lmao
i mean yea... cpp devs are diferent breed
nah, just brain
nah, diferent breed
dynos token starts with MTU1MTQ5MTA4MTgzNjk1MzYw get hacking lads
The timestamp also can be approximated.
Look at the history of bot downtime, it will be within a window of it going down in the past.
Significantly limiting the values it could be(still a ton though)
hey why is my attachment sending as this:
like can't an mp4 file be sent as embedded attachment? Just like this gif file right here
better question...why my freaking slash command dont want to update...
like it has been 5 hours
i think that was a thing before
And why is this a better question than mine lmao? A question is a question.
i dunoo
you would technically have access to forging basically every bot token if you could figure out the secret key for the hmac right? Although they invalidate tokens so I imagine a properly signed token is still not valid unless you generate it
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
bro just gen a random string and call it a day
wahahahha
So apparently mp4 videos only embed if they are encoded with H.264 and nothing else. That is the only answer I seem to be able to find related to this issue, so not entirely sure if it is even correct (don't have the time to test it right now)
I don't myself see why this would be the issue, but due to only finding this answer I am just giving you what I found
ah that's really strange, thanks tho misty. You are awesome!!
hear me out:
take the video
upload it to yt
when you send it, it goona embed 🙂
if you have embed perms ofc
Vjecni you are honestly a life saver! I will make my bot upload dozens of videos to youtube and send them in the chat.
thats actually a great idea
just not sure how u goona upload them but thats minor problem
just ask yt to do it for you
no no no even better i will ask google to do it for me
no no no ask ICANN
(Internet Corporation for Assigned Names and Numbers)
That's for the clarification on what ICANN is
yes
no no no ask IUPAC (International Union of Pure and Applied Chemistry)
replace the I with a T
;)
ask bachelor
😉
Unrelated, but another thing I saw on the discord reddit was that embeds do have a size limit (apparently)
never heard of that being a thing
bro discord fucks its own api with all these new updates.
yep
I couldn't remember the size limit being implemented in v11 but that might have been my dumb ass,
That was 2 years ago tho so it might be false now or was even false then
i think it is...idk
For videos? It does.
I'm not sure the size limit, but ive had issues with it previously.
i goona lose my hair bcz of these music comamnds
Music bots ain't the same without youtube
Music takes awhile to figure out when doing it from scratch
thing is...my command dosent want to update
it has been 5 hours till i made it xd
Are you using guild specific commands?
for global, ik theny take about few minutes, but not few hrs
If you have made a change to the name/description of any command or their options I don't think discord automatically checks that for you
It was never a few mins
well i made some changes at... 5pm
...goona try to restart discord
@solemn latch discord doesn't check for changes in the names/descriptions of your slash commands do they?
Not sure if you'd know this or not
You have to update discord on changes.
i made change on command function
Misty totally off-topic, but weren’t you a mod in the past or am I tripping?
Anything unrelated to the data you send to discord is out of their control
So it is likely a you issue if it isn't any command metadata
Never a mod here no
Misty used to have bot dev role but his old account got termed
You might be thinking of that
sorry for my stupidity... I had 2 if() statements with same requirements
Stupid discord
I think music bots are becoming quite boring if all you have to listen to is soundcloud rappers
What exactly are you using again
d.js
i want to delete these music comamnds but have no idea how
i know that i need to get id of command...somehow, btw, this is how my slash commands loog: ```js
data: new SlashCommandBuilder()
.setName('name')
.setDescription('Description'),
Get the command ID (or any command resolvable) and delete it.
global command:
await <client>.application.commands.delete(id);
guild command:
await <guild>.commands.delete(id);
If needed you can also clear all commands by updating the application command data with an empty array.
For example:
await <client>.application.commands.set([]);
Tnx for this, goona try this tmrw but alsi, how to get the id, i know i had to do that, but dk how...
Never had to delete commands
You need to fetch the commands in order to get the ID
client.application.commands.fetch()
This returns a promise
A collection of all registered commands
You gonna filter/find your command by it's name, after fetching the list and boom you got it's ID
where do I use these, in my main js file, in routes? I got no idea
you need to do this only once, when your bot is ready
so probably inside the ready event
Ahh kk, will try, tnx
How can I make addChannelOption only show text channels
theres .addChannelTypes() but doing .addChannelTypes(["GuildText"]) doesn't work
Am I the only one to assume that this is impossible to do in 3 days as a single person or am I just crazy
What is this
.addChannelOption(option => option.setName('resultschannel').setDescription('Select a results channel').setRequired(true).addChannelTypes(...channelTypes))
Is this something new to v14?
not sure
unless they are paying like 5k, stay away
Funny thing is, they assume they getting all that for free

also tell them that "proffesional" is not very professional
Lmao
I was going onto mc market and seeing if anyone was offering jobs and found that gem I now remember why I don't go to mc market anymore
reminds me of this idiot who wanted a bot that had like 400 commands
for 200 bucks
Apparently they don't know news channels exist anymore
Also the idea of sending a message to multiple guilds at a time yikes
Go into their server, invite ticket bot, server stats bot, YAGPDB, MEE6, and Wick :p
Ah yes, what a steal
Lmao
For free???? The fuck
I wouldn’t do that shit in 3 days for anything less than a thousand dollars tbh
Yep
That sounds like stress hell
I wouldn't do it in 3 days period
that is too small of a deadline for 0 bugs
0 bugs in 3 days for 5-6 bots
I could probably do it in 3 days with no bugs if some conditions were met
I guarantee they have more requirements than that as well so have fun with that
- I get paid a shit ton
- They pay for my coffee to stay up for 72 hours
Those types of people never put what they really want in the description until after you give them the finished product
kek
"Oh, but I didn't mean like that, I wanted it like this"
It’s funny because people think they can exploit freelancers
"No money for you!"
Fuck people that do that
Freelancing in the development world is often time very difficult and inconsistent work
Not to mention it’s impossible to find anyone that values your time
It's more aggravating cause they are extremely vague in their description of what they actually want and leave it up to you to interpret
One of the reasons I am starting to dislike programming more and more
It is starting to not look like a profitable job for the amount of time i've put into it
Nobody said you had to freelance
Land a decent job and you’ll be set
It’s difficult to get into the industry but once you’re in you’ll have an easier time
i want a job where i do nothing all day and make 10k a month
LOL??????????
I know a friend who virtually does nothing and gets paid 16 an hour
I’m lucky because I apparently have a few family members who are very experienced with the computer science industry
Tf where
16 an hour is essentially min wage at this point
Texas minimum wage is still $7.25 an hour but basically nobody works for anything under $10
He literally just works at his own apartment complex
Not even teenagers
broke broke seethe cope
16 dollars an hour makes you 1 month's salary in brazil, in 12 hours
His job description is to help around the complex and stop people who are going against the rules
but he just sits around for the most part
Much different cost of living, but still that’s tragic
In California a 1 bedroom apartment costs like $2k a month at the least lol
Washington is fucking insane
Where I live it’s close to like $800 I think
Here it is similar to california
I pay $1100 for a 2 bedroom place with cats
it is just a little less iirc
i can hardly pay 100 bucks a month
poor tim
tim insanely smart
also tim
My mom pays $1700 a month for our house, 3 bedrooms 2 bathrooms, it’s still overpriced as fuck though
"just get a job"
tim be your own boss
#HireTim campaign when???
i mean, jobs here are absolute garbage
start a service tim
im open for a remote job
I hear top.gg needs a new CEO :^)
lmao
#TimForCEO
i have zero CEO experience
don't need it
You’re the CEO of your life
lmao
That’s CEO experience right there
well i am
tim watcha makin
omelets
hopefully my api will be ready in the next couple months
but for now i have to decide if im gonna go for snake case or not
xD
The day I land a good paying job is the day I start donating to Tim’s projects bro
Ah, the struggles of programming
tim what's the api for
i got a sponsor for tiny-discord, which was nice
The day I make something that makes money is the day I will die happy
astronomy/astrology
Oh that's right
What was the sponsor
wick bot
What do they give u
hundred bucks
Well there is your rent
Free tim from society
We should get the smartest people in top.gg together to make something that will get dumb people to pay for it
matter of fact lets start a pyramid scheme!
Yes but less bugs would be nice
i hate marketing scams
It’s a feature
crypto scammer
reminds me of this dude from nigeria that was trying to convince me to sign up to his crypto platform
I am surprised he didn't try and convince you he was a Nigerian prince
Damn
LOL?
tried to convince him to pay me to "release my funds" but he called me a scammer
lmao
Honestly just tired of being broke 😔
Where was this from
Bro min wage in Washington is like 15 an hour
I still have no physical social security card
wat
I know my number but without the card I can't get a job
Request one
Can't
Yes u can
Not from the states?
Not without a workin car dingus
Take a bus
how can I wait for my forEach loop to finish before proceeding
Who the fuck takes busses
A lot of people
plenty of ways :))
I am not having my organs stolen by some crazy person
youc an request a new SSC online you dingus
Not without an account
for await (const member of membersToCheck) {
await membersToCheck.forEach(async function(member) {
const response = await fetch('https://api.phish.gg/username', {
method: 'POST',
body: JSON.stringify({ username:member.user.username }),
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json()
console.log(`${member.user.username}#${member.user.discriminator} (${member.user.id}) - ${JSON.stringify(data)}`)
if (data.match) {
flaggedMembers.push(`${member.user.username}#${member.user.discriminator} (${member.user.id}) - Flagged on Phish.gg API for ${data.reason}`)
}
msleep(250)
})
}
let resultsEmbed = new MessageEmbed()
.setDescription(`I found **${flaggedMembers.length}** possible scam accounts!\n${(flaggedMembers ? `Click the button below to see a saved copy of those user IDs.` : `Since I've not found any flagged accounts, there is nothing you need to do!`)}`)
.setColor((flaggedMembers ? `#bf2828` : `#178234`))
await channel.send({ content:`Hey <@${interaction.user.id}>, here is your server scan results!`, embeds:[resultsEmbed] })```
The account is your ssn lmao?
and since I am under 18 I can't make an account
thats my current code but its bad
Do you not know your ssn
Do you not know how it works 
im not DUMB and need a replacement
I literally already tried everything you are saying
uses generators
doesn't know how to promise.all
Seems like you are dumb if you don't even know how something works, yet you try and educate someone else on it
just saying
i didn't know you were apparently 9yearsold
i'm just bad at js
But yes I do have my ssn, thing is they don't allow you to use it to make an account unless you are 18 or older. Another thing, they don't allow you to use your parental figure's account to request for your card for some dumb ass reason.
Social Security is just really dumb
Do you have a passport
it doesn't wait for the loop to be over before continuing
Nope
gg
Never been out of the states
you cant await an async forEach
i mean it works with no errors
either use a for loop and await each iteration, or map it into an array of promises and use Promise.all()
it just doesn't do anything
but since you're making http requests, better do it sequentially with a for loop
brooooooo
membersToCheck.forEach -> await Promise.all(membersToCheck.map(() => { /*your code*/ } ))
i did a loop twice
dont use concurrent stuff on http requests
unless you wanna get limited/banned/flagged/blocked
right lmao
its my own api
Love it when you lose motivation to work on something you're passionate about
🤝
i'm gonna do direct API requests to bypass CF ratelimits
if its your own api, make an endpoint for fetching multiple things
good point
bun have you slept
no
too gay to sleep
or rather, sleeping is too straight
Watch that become a thing in the future
wth is going on
it’s called depression
👍
Check yourself before you wreck yourself
Not really depressed just bored
awesome, that one worked! ty
I also realize I need to work on something but I am just meh
who has some poggers projects
Wdym by that
me
what they be
I am mainly working on something to house short stories/books that people can read for free
nice
nice nice nice
nice
Pain to work on though
How do you determine this?
theres several regexes i use for the usernames
the malicious guilds bit relies on user reports, and is for things like fake QR code verifications
latest is .gg/pizzashack
oop it broke

Right
L
So you just add to the DB then?
yeah
hey bun
hi
want some pizza from my shack?
no 
😔
I kind of want to learn a different language but I can never keep at it long enough to stick with it
lmao i accidentally posted stats to my monitoring API from my test bot
fucked up the graph
Looks weird
Not a very popular bot either
drops to 0 servers a few times
Rust
But why
ok and
🚀s
I don't have the mental will power to put myself through rust
If you use rust you have an excuse to put “blazingly fast 🚀” in every section of your git repos
Fine I will learn rust, but where should I start
Duality of man
Uhhh
Idk
Console project
My first project was ambitious, the math_parser_rs thing
Yea no thanks
I may know programming basics, but I don't have the knowledge to try and solve a problem that complex
I guess a good place to start though is to actually install rust cause apparently I no longer have it
Time to drop some rows
Yup
friendly reminder that almost every single package that has "fast" in its name its slow af
@round cove
lol
they asked why i declined the bot so no
I didn't see that part
am I missing messages
dms
ascii...?
So I am writing a program in rust that takes in a array of alphabetic chars that are lowercase e.g abc and assigns a value of 1-26 through the alphabet a being 1 and z being 26 ofc. Issue is, I accomplished this but in the least efficient way possible, so I am thinking I can use ascii instead as I am using chars. But I have 0 clue of how to efficiently get that value of a being 1 and b being 2 and so on.
forgot to mention I am adding the sum of those numbers so abc would end up equating to 6
Wait what
You can do charVar as u32 and get it's ascii value then subtract -96 and if it's a then it'll equal 1 since a in ascii is 97
Wouldn't I have to change the value I am subtracting by each time tho for each letter?
No?
yes
if a is 97 on the ascii table
GUESS what fucking b is
your mind WILL be blown away
I feel like you have an attitude towards me
nah I just have the assumption you've been to college and you haven't
since in higghschool or something
I am still in highschool
yeah
Math was just never my best subject
I think it's more you don't know your ascii table
which is usually in the first CS class
I also don't know that no
I am still angry that my cs class taught me jack shit
so subtracting -96 will give you what you want
I expected i'd learn something new in my cs class but I didn't
Well that worked thanks :)
(:
I at least learned a good bit about rust during this
does it make sense at least
Yea it does
MessageEmbed author name must be a string. ?
what were you doing before
!>!>!>!?!?!? REally?
deadass 
sorry that was toxic
Yes it must be a string
i just plasyed leage
but it keeps telling me passing strings is deprected
helpEmbed.setAuthor({text: `${client.user.username + " Help Menu", client.user.displayAvatarURL()}`});
oh nvm
the fuck is that
lol
text?
I edited the code in like 5 ms so my bad
didn't see the issue
I am so confused by that
To answer your question before, I was trying to use octal instead of ascii
so I was subtracting 140 instead of 96 which obv wasn't giivng me the right results
nice
use std::io;
use std::ops::Sub;
fn calc_sum(characters: Vec<char>) -> u32 {
let mut sum = 0;
for char in characters {
if char.is_alphabetic() { sum += (char.to_ascii_lowercase() as u32).sub(96) }
}
return sum;
}
fn main() {
let mut characters: Vec<char> = Vec::new();
let mut chars = String::new();
println!("What letters would you like to sum up?");
io::stdin()
.read_line(&mut chars)
.expect("Failed to read input");
for char in chars.trim().chars() {
characters.push(char)
}
println!("{}", calc_sum(characters));
}
I could probably still make this better somehow but I like my first time using rust
I learned a good bit about it just from this small challenge
so basically to explain I took the entire script that wrapped it in parenthesies to fix the deprecation error without looking at how to actually do it
does that make sense 💀
So wait, why does hello world equal 124
it should only be 91 as I ignore spaces
please tell me how you got 91
gg
math was truly not your best subject
ok
Dylan how is ur day
fine
i wasn't mad at all lol
I see
which one is better, A- or B+ ?
Well any A is better than B
its a minus tho
how about a B++
no
how about a C++
F--
btw you can just use rs let chars = chars.trim().chars().collect::<Vec<char>>();
for turning an iterator to a vector
yes
Thank you for that

This might be a dumb question but I don't really mess with ascii so
My first time using rust was all messy
What if I already have the ascii representation, for example a is 97 on the ascii table that I looked at, so how would i then get that letter back?
This is under the assumption I don't have its letter I just have its ascii representation
like you have the u8 byte?
ascii representation as in what?
the index in the alphabet (0 -> 26) or the raw char code?
a is 97 from what this table is
you can cast to char
oh god apparently I am fucking with lifetimes rn
At least I am getting a lifetime error
what's the error
3 | fn cipher(text: Vec<char>) -> &str {
| ^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
help: consider using the `'static` lifetime
|
3 | fn cipher(text: Vec<char>) -> &'static str {
I am new to rust so I am probably doing the return type all sorts of wrong
what does the function cipher do
It takes in the Vec of chars and does a ceaser cipher on them and returns the result back
Use a String for that
Mmm then I will have to rethink what I am doing
to convert a Vec<char> into a String, you can turn it into an iterator again with .into_iter() and then call the .collect() function
use std::ops::Sub;
fn cipher(text: Vec<char>) -> &str {
let mut cipher = "";
for char in text {
let mut result = (char.to_ascii_lowercase() as u32).sub(96);
if result == 26 {
result -= 25
} else { result += 1; }
cipher += (result as char)
}
return cipher;
}
fn main() {
println!("{}", cipher("hello world".trim().chars().collect::<Vec<char>>()));
}
This is what I was doing at first but I realize now that rust strings don't work the same as js
you can't add onto them like that
Yea but I don't know how to get it to actually push the characters onto the string
cipher.push(char)
also since return cipher; is a return statement and it's the last line of the function, you can just use cipher
mmm I tried that just now and got this:
error[E0604]: only `u8` can be cast as `char`, not `u32`
--> src\main.rs:15:21
|
15 | cipher.push(result as char)
| ^^^^^^^^^^^^^^ invalid cast
|
help: try `char::from_u32` instead
--> src\main.rs:15:21
|
15 | cipher.push(result as char)
then do that ig
Right, and changing the casting of result to u8 got me an overflow error with subtracting
thread 'main' panicked at 'attempt to subtract with overflow', /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e\library\core\src\ops\arith.rs:240:1
why
🤷♀️

you're subtracting too much
chars can only be unsigned ints
going into the negatives will cause overflow
let mut result = (char.to_ascii_lowercase() as u32).sub(96); but it shouldn't be a negative number
subtract with 97, not 96
*underflow
same thing potato potato
why though
the char code of a is 97
you're probably calling this on a space
space is 32 in ascii
subtracting it with 97 returns 0
Can I just ignore spaces 
also you don't need to call sub, number - 97 would still work
either way null subtracting by 97 still causes an overflow
log the value of the character, I guarantee it's a space causing the issue
It is
just do (char as u32) + yourCaesarOffset
if char.is_alphabetic() {
// perform cipher
}
In case of a here:
a - 96 = 1, you're adding 1 to it, which means a char with char code 2
yea so then it'd be b
I am thinking about this all wrong
Yea my sleep deprived brain can't think of a solution rn
i hate it when people rewrite a project in rust and instead turns into a bloated nightmare
So wait why am I even subtracting
my brain is all muddled now ima prob just go lay down or smth
you should
at this point https://github.com/mTvare6/hello-world.rs is less of a meme and more of a satire
WAIT
that repo is not wrong; most big rust projects are like that 
What would you like to cipher?
Hello World
Here is your original input:
Hello World
Here is your ciphered output:
ifmmpxpsme
Got it working
use std::io;
fn cipher(text: Vec<char>) -> String {
let mut cipher = String::new();
for char in text {
if char.is_alphabetic() {
let mut result = char.to_ascii_lowercase() as u32;
if result == 122 {
result -= 25;
} else { result += 1 }
match char::from_u32(result) {
Some(char) => { cipher.push(char) },
None => { panic!("Invalid Char provided to cipher") }
}
}
}
cipher
}
fn main() {
println!("What would you like to cipher?\n");
let mut input = String::new();
io::stdin()
.read_line(&mut input)
.expect("Failed to read input");
println!("Here is your original input:\n{}\nHere is your ciphered output:\n{}", input, cipher(input.trim().chars().collect::<Vec<char>>()));
}
If you can refactor this go for it, but whatever you change explain how it works so I can learn
yea
Is there even a key I can press that isn't a valid char?
I don't really see one on my keyboard
whats the best practise for perms btw?
is it best to require the same perm the bot would need to use the command, only have manage server perms to use commands, or both?
Typically it is best practice to only require the perms required to do the action
you wouldn't want someone to have Administrator to be able to ban someone
surely u want people with administrator to be able to ban as its all perms
but i think i get what u mean
Well yes but what I mean is
Don't make it so they HAVE to have it
logically speaking you'd wanna check for BAN_MEMBERS perm
Im creating an app that gets invite data from the discord.com/api/invites/ endpoint. However, I have been getting 429 errors after not that many requests. I have read the docs about ratelimits https://discord.com/developers/docs/topics/rate-limits and I am not exceeding 10,000 requests or 50 requests a second. If it is important the 429 error is not returning the X-RateLimit-Limit and X-RateLimit-Remaining and such headers, just a retry_after
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Some libs don't check admin for when checking specific permissions. In this case, it'd be ban members or admin or guild owner
yea
Just col as u16
so like this? I should also console.log() something but dk what exactly xd
fixed it by creating function that does the same thing, but is not an implementation of Into<u32>
col is a struct btw, it's a pub struct Color(u32);
give an explicit type to whatever that expression is being assigned to instead of casting
impl Into<u16> for Color {
#[inline]
fn into(self) -> u16 {
self.0 as u16
}
}
``` fixes it
I doubt inline does anything for those trait implementations
when you don't inline functions that do one tiny thing: 💀
I know gcc won't do it for you but idk about rust
Fetch return a promise, you need to await it
ahh
const commands = await …fetch();
commands will be collection
You gotta find you command by searching it
const target = commands.find((cmd) => cmd.name === "command name");
Then using the var target like in my example to delete it
target is a command resolvable
95% of the functions in my rust project is inlined and most are const, idk it's just my reflex 
inline is still just a compiler hint though
ammm..hmmm thisis what i have tried, and this is what i got:
xD
i know, i'm aware of that
What vsc theme is that?
it is moonlight theme: https://marketplace.visualstudio.com/items?itemName=atomiks.moonlight
you goona have 2 options
Moonlight and Moonlight II
i use default
one
You need to assign your fetched commands to a var
yea but if i make commands a const or any other var type, i got: commands.find() is not a function
ah i got it, i got it
tnx man, tnx verry much ❤️
well as it says, pip3 is not recognized as the command, so either you dont have installed it or you havent added python to PATH in environment variables
I'm running into a weird error when trying to install Django on my computer.
This is the sequence that I typed into my command line:
C:\Python34> python get-pip.py
Requirement already up-to-date...
nope, just add it to path
then it should worj
well check that link
it is easy
open start > search for: Edit environment variables > Environment Variables > under: System variables > click on path > then click edit > pop-up will appear > click new > add your pip3 path
finally found out why my crap wasnt starting on boot, it was cuz i have nodejs v12 installed via apt and v16installed via nvm so starting the bots just with the normal node command defaulted to the v12 verions and failed. i used whereis node and then used the path though nvm and now it all works through the script and directly off of cron too
pip3 should be in %path% (your disk where you installed py)/python 3/scripts/pip
or it is python3/bin/pip
idk
cant remember
i literaly wrote whole procces
up there
open
💀
you needto have this...
you can run them trough cmd
also
rundll32 sysdm.cpl,EditEnvironmentVariables
if you cant find it that way
or you can press START + R and paste ```fix
rundll32 sysdm.cpl,EditEnvironmentVariables
are you admin on the PC?
or there is someone else?
well, if you are admin then u should be able to use that comamnd
well...where did you installed it?
lol
if you didnt select custom path
then it is probably on C disk
so C:\Python310\Scripts\pip.exe
bro... how many disks u have on the pc?
also have you even installed it
I don't think you even have Python installed in the first place, try running the installer again and see what happens
Or you haven't installed it properly
Yeah
and follow installer instruction carrefully
yep u can do tht also
kk
yes
also
u can do customize
and select your own path
where you want it to be installed
ok now go next
now you can check these last 3 if you want to
but u dont need ti
now select your path
where you would like to isnstall py
The default settings should be good enough, for the first option on that list
You can choose to install for all users if you don't want to install them again
You don't need to copy the path, and you don't need to provide a custom path
well he dont have to, but if he want to find it easier, or to not forgot where it is...why not
I mean yeah, but I don't think it matters much to them, so ¯_(ツ)_/¯
Yeah go ahead
i mean..ok
It should, I suppose you didn't choose the option to add it to the path when you installed it first
You should probably close that terminal and open it again after Python was installed
try restarting vsc
How can I do something like this, I spotted this on @rose warren's profile
You can use Discord's RPC library
Ok thanks
no problem
You're welcome
Beware that the RPC library is deprecated and might stop working in the future, so it's recommended to use the GameSDK instead
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Ok
great job
Awesome
you welcome
What do I do if my bot is missing intents?
wdym
you should add intents:
show me
Enable them on the developer dashboard
Yeah I did
show me your code
why?
I've made it for my close friends and it's kind of weird
We can’t help unless we see the code
its ok
What are the chances it’s a nuke bot 
should I dm?
oh well I hope I dont get banned
`const Discord = require ('discord.js') ;
const bot = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"] }) ;
const token = 'blah blah wont show it to you;
const PREFIX = 'W.';
bot.on('ready', () => {
console.log('I am online!')
})
bot.login(token)
client.on("message", (message) => {
if (message.content === "W.ping") {
let embed = new Discord.MessageEmbed()
.setTitle("🏓 Pong!")
.setDescription(${client.ws.ping}** Latency!)
.setColor("RANDOM")
.setFooter(Requested by $message.author.tag);
message.channel.send(embed);
}
})
if (message.content === "W.zelo") {
let nicknames = ["you're dumbass", "you're an idiot", "C U M", "You're gay", "SUS", "Fuck me"]
message.channel.send(${nicknames[Math.floor(Math.random() * nicknames.length)]} is what zelo wanted to tell or call you!)
}
if (message.content.startsWith("W.cum")) {
let victim = message.mentions.users.first()
if (!victim) message.reply("Mention someone to cum")
else {
message.channel.send(${victim} Got cummed lol)
}
}
if (message.content.startWith("W.hook")) {
let dude = message.mentions.users.first()
if (!dude) message.reply("Mention someone to hook")
else {
message.channel.send(${dude} Got hooked lol)
}
}
`
can you use code block
code block?
also its not client
what do you mean?
use ```js
where?
in your message
ok changed it
you are using discord.js v13 right?
yeah
Anything wrong with it?
look at v13 changes
hm alr
this type of embed sending is outdated
^
u now use message.channel.send({embes: [embed]})
also .setFooter({text:''})
Ok
they really want to complicate using of djs
yeah
eris is good at that topic
hi
hi
can't be that difficult to update or use djs tho just a timely matter depending on how much you got
Wouldn't it be cool if you never had to update your code though
Someone could develop software that updates the code for you
What? No. That's stupid
Is it?
What if you have a huge project and you want to upgrade the framework you're using
Just use the raw API and never worry about having to update unless the API itself changes
would it be easier to have a build tools that allows you to update the code to the new framework or having to do it manually?
That would definitely be an annoying and unreliable tool to develop
You could never cover every edge case. Plus, you'd have to code logic for every update to convert
obviously this wouldn't be an automatic thing
And then the users would blame you for breaking their code 
@foggy pilot bro the PAYE tax in the uk is horrible
just an example of such a tool
https://github.com/rectorphp/rector
they've withheld like £50 of my paycheck bc of emergency tax or whatever (wrong channel)
I switched to raw api and never have to deal with updates. Only when there's a new api version
sounds like the sanest thing to do indeed
I can't tell if that's sarcasm, because the raw api is easy to deal with
no i'm being serious!
it's way easier to just use the raw api
maybe a simplistic wrapper for ease of use
its a shit country
that is why
If you truly care enough to use the raw api, it’s not too terrible if you know what you’re doing. If you want fast development time without boilerplate code, a library is a must
my 20% going to fund bojos parties 😍
There are awesome js libs for the raw api called SnowTransfer and CloudStorm
i'll take a look at those
don't look at the contribs tho
hahaha why not?

oh it's all you xD
Hi, I have a question concerning .setPosition for roles creation.
I use role.setPosition(1) after creating my role but the position does not change and stay at the bottom of the roles' list.
Does someone has already gotten this problem ?
Thank you so much for your help
that pretty much means v12 is officially dead
people still use v12? 
stupid question
but
i'm sending a post request with a 10k array as the post body
it returned Entity too large, so I upped the client_max_body_size whatever its called to 2500M and its still returning that
have you tried... not sending a 10k array
to what
idk how to make it smaller arryas
arrays
body: JSON.stringify({ memberPayload:membersToCheck.map(member => [{ username:member.user.username, id:member.user.id }][0]) })```
what i currently do
membersToCheck is all the members of the server
way
awit
wait
this is probably the ideal solution for you
size = 10 means 10 arrays right?
ahh ok
dafuq is this [{ username:member.user.username, id:member.user.id }][0]
basically
for .map
.map(member => { username:member.user.username, id:member.user.id }) won't work
because => { //code }
member => ({ username:member.user.username, id:member.user.id })
use lodash jk please dont
i see so many libraries using lodash for one single feature
if that isnt bad enough


