#development
1 messages · Page 1614 of 1
To get the unicode representation of an emoji you do \emoji
yeah like \:tools: which is what I did here
startswith first arg must be str or a tuple of str, not bytes
hm, try avatar=await self.bot.user.avatar_url.read()
not even sure if you can pass it like that in python
if not try py avatar = await self.bot.user.avatar_url.read() create_webhook(name='xyz', avatar=avatar)
I have done the custom status part but it's not showing the status
I have done the custom status in bot part but it's not showing the status
The form cards will (potentially) include a screenshot of the form too
wtf
(node:30640) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'find' of undefined
at Object.execute (/app/Commands/Moderation/baninfo.js:20:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:30640) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
const bannedUser = bannedUsersArr.find((user) => user.username === args[0]);
i don't see the problem :/
bannedUsersArr is undefined
as per the error
Hey Admins and Mods!
You may have heard about a feature for bots currently in beta called Slash Commands! Essentially, the way users interact with bots is about to become much simpler - it's as easy as typing "/" to bring up all the commands that bot can do. Slash Commands come with features like autocomplete, validation, and error handling. No more typing up memorized commands, which means bots no longer need to read user messages!
We're excited for how this update will unlock more fun with bots, and since we know many of you are careful with where and how you manage bot permissions, we wanted to give you a special heads up on what this is and what small actions you can take today to prepare for the upcoming release.
What this means for you
- We are launching a new permission: "Use Slash Commands."
- Currently, if you've wanted to avoid bot spam in certain channels, you may have turned off read/send message permissions for bots.
- However, if those bots use Slash Commands in the future, you'll need to configure this new permission in order to keep your channels consistent with how they're set up today. Otherwise, Slash Commands may be able to get around your old permissions setups. Commands are sent directly to the bot and not through reading user messages.
- Go through your channels and decide where you do and do not want to allow Slash Commands to be used (yes #botspam, no #deleted-channel).
You can see this permission option today on desktop, and on mobile in a few days.
Thanks for all your hard work!
P.S. Attached is a lil preview of Slash Commands in action.```
what do u think about this cry
slash command perms
ye
also they're on by default lol
Does the guildmemberadd Event needs the member intent? when I just want to giveout the member.user object?
ik
yes
but in future it will be used by other bots
all member related events require the server members intent
so, I need the member intent?
as defualt perfix as well
its defined i see
wtf
wait
@earnest phoenix
const { MessageEmbed, MessageFlags } = require('discord.js');
const Keyv = require('keyv');
const bannedUsers = new Keyv(process.env.bannedUsers);
const { deletionTimeout, reactionError, reactionSuccess, pinEmojiId } = require('../../config.json');
module.exports = {
name: 'baninfo',
description: 'View details about a banned user.',
usage: 'baninfo `username`',
requiredPerms: 'BAN_MEMBERS',
permError: 'You require the Ban Members permission in order to run this command.',
async execute(message, args, prefix) {
if (!args[0]) {
let msg = await message.channel.send(`Proper command usage: ${prefix}baninfo [username]`);
msg.delete({ timeout: deletionTimeout });
return message.react(reactionError);
}
const bannedUsersArr = await bannedUsers.get(message.guild.id);
const bannedUser = bannedUsersArr.find((user) => user.username === args[0]);
if (!bannedUser) {
let msg = await message.channel.send(`${args[0]} isn't banned.`);
msg.delete({ timeout: deletionTimeout });
return message.react(reactionError);
}
let color;
if (message.guild.me.roles.highest.color === 0) color = '#b9bbbe';
else color = message.guild.me.roles.highest.color;
const banInfoEmbed = new MessageEmbed()
.setColor(color)
.setTitle(`${message.client.emojis.cache.get(pinEmojiId).toString()} Informations du bannisement`)
.addFields(
{ name: `Defendant's name:`, value: args[0] },
{ name: `Issued by:`, value: bannedUser.author}
)
.setTimestamp();
if (bannedUser.reason) banInfoEmbed.addField('Raison :', bannedUser.reason);
if (bannedUser.unbanDate) banInfoEmbed.addField('Temps restant :', Math.floor((bannedUser.unbanDate - Date.now()) / 86400000) + 1);
await message.channel.send(banInfoEmbed);
message.react(reactionSuccess);
}
}
very very distant future, slash commands are trash right now, majority just prefer staying with message based commands
i see
how to do topgg vote
bannedUsers.get returned undefined, ergo bannedUsersArr is undefined
in discordpy
I will not hide it, i'm not good with making bots, so it would mean a lot to me if someone would explain or paste the script that could make your bots send a random image or text after a specific command gets written by user. something like when i would say !cat then it would send me a random image of a cat i set up (btw i use python)
depends
do u want to grab a random picture from an api
or a random picture from an array set by yourself
probably an api
if thats the case u must find said api
im sure there r tons of apis with cat pictures tho
Sorry i have no idea what either of those mean
What is an API? (Application Programming Interface) API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API. What exactly is an API? Finall...
So is the error message a temporary malfunction? And bot invites will be fixed? I checked the date of when that was said... that was like a week ago 😅🥲
since u seem to be pretty unexprienced i'd recommend just grabbing some cat picture links and setting an array and get the command to work tha way
then try using an api
Python pictures tho*
what
Nvm 🤣
Language: js
HI i am making a tempstorage for storing ids for a time.After the given time it deletes the vaule.how would it be possible with a constructor or exports?
just use a database
i want it temp only on runtime
then a map/collection?
yes but what exports or constructor
either, or just a variable
i would still recommend a database
should i use timeout or date.now which checks if it expired?
i would database it too, but 🤷♂️
it should be temp and not for the whole time
read what i said
databases do that
I have to make a Ratelimit for my Custom Commands bot :c
running settimeout or setintervals is going to unecesarrily increase load on your bot
Is it possible to customize or fetch ratelimits?
what?
for what?
yeah i agree with you bot
slash commands?
ratelimits are different than commands ratelimiting
ratelimits are discord send messages
custom commands you can execute djs stuff just in other form
like $editChannel
ratelimig your commands locally has nothing to do with fetching ratelimits
what lib you using?
djs
d.js should handle everything for you
you only need to ratelimit command usage
to make sure nobody spams it
thats it
If you want a cooldown, a map in a variable with expiry time is perfectly fine.
so if i send edit channel tons of time does it get rejected
or stop using d.js and move to detritus, they got command handler built in
any lib handles ratelimit
it just queues it
so await it
well, spam creating channels is api abuse even if the lib prevents an actual ratelimit
the whole struggle you going for?
or spam editing
that'S is thing i am trying to tell
imagine having to code a custom command handler in the most popular discord api wrapper

that's why i am asking
in detritus this is all you gotta add
and only once
no need to spam it on every command
this make it so you cna use the command 5 times every 5 seconds it resets
like this is a custom command a user can make
Just out of curiosity, ive not found a way to myself yet, is there a way of having the console output of a node application go to the console as well as a txt file? Ive been running my bot for a while but its hard to track errors that happen whilst i sleep as when i reconnect to the screen session, I cant actually scroll up (Im running it on ubuntu)
so 1 per command per second
wdym ?
guys, just the way we can do
function getCreationDate(id) { return new Date((id / 4194304) + 1420070400000); } getCreationDate("744517607239057479")
in the discord console for my account's made date, what else can we do?
d.js is too basic for a lot of stuff, i personally hate it cuz memory is insanely bad and its too shit overall
detritus has a command handler built in internally
discord.js-light 
so you dont need to worry about all that crap usually
i can not change my code then i have to change 350 files
you can lmao
honestly, telling people to swap libs for unrelated issues isnt a good way to go about it.
i need caching and not fetch that would spam the api
see your execute() or run() function?
you dont need either
the lib should handle ratelimits for you
if you want a cooldown for commands, thats a different story
that is cooldown for request
i would still recommend going out from d.js
its trash
wait, what, i programmed my whole bot in discord.js
not for commands that are custom commands and have their own events
that whole code you see there is on detritus
wdym custom commands?
a command is a command
period
its a function
i need cooldowns for function like editchannel createchannel and more
custom commands are made by user and not by me
@quartz kindle does d.js handle global ratelimits?
it does not since you can do rainbow role or like staff
ratelimit != global ratelimit
you get normal ratelimits on every payload you recieve from the api
global ratelimits are a lot more finicky to play with
umm? ples
his concern is someone making a command which abuses the api erwin
I would limit each custom command to a specific number of api requests.
and implement a cooldown
yes correct intelligent boi
nono, i got what he's doing
he needs a cooldown still
but not per command, globally
queue it
^
and dont let users use createMessage
There's no need to handle global requests, make it a queue process
createChannel
This standardizes your process
make a function yourself
We don't have a cheat cheat of the entire javascript language available for you. This is literally "just javascript".
it made date?? 😳 bro congrats
lel the only easy way is to use own definded ratelimit
where you taking it to dinner?
function createChannelCheck(options) {
queue.add(async () => {
await createChannel(options)
})
}
this
theres no easy way
you do understand what you trying to do is not only dangerous but quite a hassle to deal with right?
first, im willing to bet you dont have whatever bot you using on a VM
which highly means a user can do something like
message.channel.send(process.env.TOKEN)```
what is a vm
that can't do this lol
own made function like
$userTag
what you are doing is the equivalent of having an open eval
you either do it right or you dont
i do not evaulate anything
wait let me show
you're letting users do it themselves
its the same
the code will get executed either way
Sounds like DBD.js
indeed
yes it is
i have no clue what they doing, but it seems they are allowing users to create their own commands
Is there a permission that allows bots to talk in every channel? I thought the sendmessages permission allowed that?
My bots having the issue in some guilds where it doesnt have permission to talk into some channels (such as welcome channels)
and judging that they dont know how to convert d.js createChannel, im willing to bet they didnt do a good job at doing stuff by themselves
dbd.js is basically its own scripting language, I'm not sure it's as open as if you had direct access to discord.js' feature set.
thats exactly what im concerned about
if they have d.js accessible in their code
it'll likely mean you could do message.reply(message.client.token) or something retarded of the likes
take channel permission overwrites into account too
const authorID = (d) => {
return {
code: d.command.code.replaceLast("$authorID", d.member ?d.member.id : "")
}
}
module.exports = authorID
dont
no
see like this is afunction
admin perms is bad
no evval
what about the channelCreate ?
wait
i sure hope you accounted for escaped chars
Ok I just want to be sure of what you're doing, Rake. Are you giving bot owners, as in, the dev, the ability to create custom commands, or server owners/members the ability to create custom commands on an existing bot on multiple servers?
module.exports = async d => {
const code = d.command.code
const r = code.split("$createChannel[").length - 1
const inside = code.split("$createChannel[")[r].split("]")[0]
const [
name,
type = "text",
returnID = "no",
parentID
] = inside.split(";")
const channel = await d.guild.channels.create(name.addBrackets(), {
type,
parent: parentID
}).catch(err => null)
if (!channel) return d.error(`:x: Could not create channel '${name}:${type}'!`)
return {
code: code.replaceLast(`$createChannel[${inside}]`, returnID === "yes" ? channel.id : "")
}
}
module.exports.info={
cooldown:"1000",
max:1,
dbcooldown:8
}
Those 2 are very different, so, which one is it?
server owners
Then you're absolutely going to get people that find ways to break the bot
^^
This just isn't a thing you want to do
the .info is my ugly cooldown
you do NOT want to give server owners the ability to use the entirety of dbd.js
also it highly seems like you're not cleaning your strings
that is not dbd i have modified every files
escaped characters will bend you over nice and smoothly
yeah this is very much a super dangerous thing you're doing
you'd have to clear the entire system of any possibility of accessing any part of the app that the user shoudln't be able to get
that happens in the interpreter
impossible.I tried everything
are you a hacker?
lmao
I'm asking seriously. do you have any hacking skills?
that is not a open eval you can't exacute anything from a string
flaz scrapes from api

the try brick my bot
That doesn't answer my question
there you go, give them a piece of VM's
I'm asking because if you have never done any hacking, you probably don't know the number of things that a hacker could/would do to this system.
I don't think you really understand the extent at which what you're doing is dangerous.
if i find a bot with an open eval
i turn the bot off
pls dm me we can talk
Well that's one thing, but like, some math commands are actually easily hackable
its literally harmless but its hilarious
okay then do it
No.
i do not have any
whats your bots invite, and whats the command
I think this dude's not clear on what I'm trying to say
but I guess it's your reputation and your life, man.
There's a good chance you'll get sued if someone uses your system and gets hacked because you weren't aware of how security really works.
Just a fair warning.
require('fs').fsWriteFile('../../A Friendly Reminder', 'You have an open eval, which allowed me to create a file in your system, just like this, i could delete everything. I turned off your bot, but pls fix this', 'utf-8')```
fs.unlink() lmao
thats a creative one
that would not work
require bash and run it in bash script
you can eval bash code with my bot
here a math function
const sum = async d => {
const code = d.command.code
const r = code.split("$sum").length - 1
const inside = code.split("$sum[")[r].split("]")[0]
const fields = inside.split(";")
if (fields.some(n => isNaN(Number(n)))) return d.error(`:x: Invalid number in \`$sum[${inside}]\``)
const n = fields.reduce((x, y) => Number(x) + Number(y))
return {
code: code.replaceLast(`$sum[${inside}]`, n)
}
}
module.exports = sum
i have 0 eval in my code
now run bash commands
can't run much there either
look, if oyu're 100% confident that your system is 100% perfect that unhackable, I guess the conversation is over and solved.
^^
okay let's do it lel
exactly what hind said
oo
Now I'm wondering what your original question was, since it was lost in the entire debate about whether or not you're a security expert.
someone said their system is unhackable?
yep
yep
time to change that 
kekw
i love proving people wrong on that
ratelimits for creaetChannel
@earnest phoenix 725721249652670555, right?
since people might spam
yes correct
which i already answered them, use a queue system
see my status
,
where's the link to this code page
atm i reject more then 1 createchannel
ironically, dbd.js uses discord.js in the background which means that it's automatically in ratelimit buckets.
¯_(ツ)_/¯
oh no wonder why he said it's unhackable
there is cooldown for commands
it's barely working 
per guild or per command?
But you're letting people write their own commands, which means they could easily just bypass ratelimits by spamming shit in loops if they wanted to
that is not dbd anymore that has been hardly modifed
guild
then theres your problem
someone creates 5 guilds,. adds the same command, spams them in each
now what?
LOL that's a great system indeed
your work is off to a great start already
your site ratelimits me
Me: Logs in once
The site:
I somehow spammed your API by... refreshing the website page
yes because you spammed it
I can't hack your website if your website is broken 😂
I somehow spammed the API by pressing "login"
do it lol, inform me when you did xD
wait per secs
i... i... was just browsing?
lmao
you click once on the login
I WAS LITERALLY JUST BROWSING
lel
LMAO
xD
.ga troll
Wait for what? I literally clicked "login", man

let me fix this
HOW DO YOU GET API SPAM BY CLICKING CUSTOM COMMAND LMAO
reloading 1000x 
spammed it hehe
wait per secs
maybe there is a loop in the login?
lol
if your users are gonna get an API rate limit warning by simply clicking "login"
One of my bots actually executed user-provided code - and I'm confident it was 100% protected from attacks
your platform is quite frankly gonna be shit
im 100% sure this website is copied
If your "security" is as good as your ratelimit code I'm not very confident in your ability to protect your bot, to be honest.
yes it is lol, but the panel isnt
what are you even trying to say million
I'm scared for you, Rake.
DIscord 
its on a github somewhere
that is a template
yeah, indeed
i can't even fuckin
ive seen this being overcopied a lot
tbh
yes
TypeError: /home/container/views/file2.ejs:42
40| <select style="max-width:60%" id="trigger" class="form-select">
41| <%let word,interval,join,reaction='' ;%>
>> 42| <% if(fetchedcc.triggertype=='word' ){word="selected" }%>
43| <% if(fetchedcc.triggertype=='interval' ){interval="selected" }%>
44| <% if(fetchedcc.triggertype=='join' ){join="selected" }%>
45|
Cannot read property 'triggertype' of null
at eval (/home/container/views/file2.ejs:30:21)
at file2 (/home/container/node_modules/ejs/lib/ejs.js:691:17)
at tryHandleCache (/home/container/node_modules/ejs/lib/ejs.js:272:36)
at View.exports.renderFile [as engine] (/home/container/node_modules/ejs/lib/ejs.js:489:10)
at View.render (/home/container/node_modules/express/lib/view.js:135:8)
at tryRender (/home/container/node_modules/express/lib/application.js:640:10)
at Function.render (/home/container/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/home/container/node_modules/express/lib/response.js:1012:7)
at render (/home/container/index.js:159:9)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
BHAFHISU
LMAO
i'd like it if it didn't take on avg. 12 seconds to load up a page on your website RAKE
by the time i want to hack it it's slow
wait let me fix it
GAMER
moment
good error logging 
could've written a simple function to return a 500 server error
And note: You can do this stuff on yagpdb too. Spam their Apis. I saw even ppl with rainbow roles.
So we know this is node.js and we know it's EJS-based.
but that involves writing another frontend page
/home/container/views/file2.ejs:42
``` its running in docker
i think
oh my it's nodejs based?
yea
flaw time
"unhackeable" btw
doubt it
yes it is
docker? no way
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request
Reason: Error reading from remote server
Apache/2.4.46 (Ubuntu) Server at ccommandbot.ga Port 443
nice
done
"well technically the definition of hacking involves affecting the backend work of a program or script"
no no i mean as in one of those ptero hosting things
inb4
so i'll just process.exit, aye?
yuup
because i updated it
I'd like to point out, @earnest phoenix , that the reason we sound like we're bashing here, is that you are overconfident in your ability to secure something and we're seeing that you have a long way to go. We're laughing at you hoisting your own petard more than anything else.
if i REALLY was bored, i would've gone and use nmap on his VPS/Host
thats a port scan?
i am really bored
yeah
poh
i used nmap a lot on kali linux
just dos his bot 
thats way do not make a cc bot xD
LMFAO
bad old days of erwin
that is just for the test .then i will host it on my own infratructure
you can login now
i studied cryptography for CS long enough to know this ain't how it'll work lol

that are only cached users
oh no
either way, it was at 23 or 27k users
i could use .membercount but idk do it
youre "testing" with 140 servers?
yikes that site
wait
why are you handling all of your front end through the API
that's literally counterintuitive
if you hit F5 5 times I get an API rate limit???

shit ratelimits
lol
jesus christ the more we find, the more of a shitshow this becomes
surely you didn't intend to actually force all of the front end design into the API right?
prob used wrong middleware settings
you guys are spamming that never happned with me
careful with that login, btw.
that s onetime
^^^^
did not expect to be thrown into a discord with that. I f*cking hate that tbh
potential MITM attack 
every single time i see a server with that i nope
hello pls help me my music bot enters the voice channel finds the song but comes out immediately. What is the reason? i installed ffmpeg and not have a error
you DONT need it
whole thing crashing down
i need autjoin to help users
you dont
No, you don't, you just need a "Support Discord" link on the site.
add a big ass button or a return code
safe you are spamming
global as in, 60 global max per second on the rest api? or global as in, track per-bucket limits across processes?
@quartz kindle can you help me pls
Man dont join servers for them
Just use oauth2 to redirect to the support server
probably the former, dont think they are doing the latter
If by "Spamming" you mean clicking "logoff" then clicking "login" to get the above screenshot then clicking "continue", ONCE.
they do handle the former, yes
hmm I can log in
you have a bad definition of "Spamming" if "logging off then back on" is spamming
then wont even have to deal with that
wait i am making a video,which shows where i login
Do you even test, bro
"unhackeable"
bruh this whole thing is coming down the more we look into it, we're trying to get you off your high horses
i'm awestruck how you legitimately thought at first impression that your design was failproof
^^
xD
thx for help.
welp, time to go grab food on the market
would be fairly easy to take the bot offline tbh
side related note but i'm proud of my website design i wanted something sleek and minimalistic

lol
no need to even set a interval loop to force the bot offline
Dylan proved amazingly well the missing links on https://spooderfy.com/home 's site
oh well
anyone broke the thing yet?
that's a nice webpage design you've got CF8
i've wanted to do some vector artwork for my website too but i suck at graphics design 
im amazing at creating shit but horrible when it comes to coding frontend
good, less animation 👍
if i were to learn next and koa i'd probably make some insane artwork
web devs get paid well for a good reason
const limiter = rateLimit({
windowMs: 60 * 1000, // 1 minutes
max: 50,// limit each IP to 30 requests per windowMs,
message: 'Pls do not spam our api!',
headers: true,
});```
it never writes the message by me
everyone likes to dunk on them but it's not something too particularly easy to achieve
css 
good start.
that will not work
why?
why do your docs indicate it
your docs say that exists
^
lmao
you provided us pseudocode with your interesting custom lexer bot of yours 
lel
I mean, I know docs are hard, but these docs are harder.
run the command in 50 channels
dont even, just write sendMessage 50 times
oh my
thats an OPTION?
OOF
you could create a bot message loop
where it keeps reading its own messages of the command instance
YIKES
triggering it further
it has a cooldown lel
not possible only to other bots
is it cooldown per guild?
amazing

so i add a bot on my server to send your command every 15 seconds, and you fuck yourself over?
sounds good
i could easily create farm servers with webhooks reproducing the same effect
and have the bot respond to each msg in those servers
try it again
big brain
how do i do that
im sure there's a way
with regex
hmmm
that's why i asked how to Implement cooldown ?
use %all% as trigger
no, you asked on how to ratelimit createCHannel
Oh god
not send messages
so more you are trying to hack, spam his cc bot, so more he gets the attention. Its a win win situation for him
send messages has already a cooldown of 2 seconds
if i werent going to the market rn i would've so used webhooks to show you how useless that is
i can force ratelimits for your bot which would hinder all other servers
would only need 6 or 7 servers
how webhooks isn't it yours
it has a reject mechanism
okay now im starting to take this personally
you really think i cant ratelimit the bot?
just make 50 channels per commands
within 20 minutes?
you can
i did
within 5 minutes
you can when you want
the sole fact that i CAN makes it bad for you
you can event ratelimit yag lol
would anyone be potentially interested in helping me with something JS-based? unfortunately while I can code it I'm not the best at it 
get a bot that has 6 or 7 reactions in 1 command
I want to imitate the UI of the Discord HTML text bar
spam that command, all other guilds will get the embeds but not the reactions
For my website to give a "command test demo"
tims bot xD
@quartz kindle want me to break yer bot lul
lol
lmao
good boi 🍪
how would you do that btw?
forcing you to constantly be on reaction ratelimit
other servers will get the embed but not reactions
not even global, just the ratelimit for reactions
well im protected against per channel limits
if you're constantly under it, the messages you send on other guilds will get the embed, but not the reactions(slolwy)
lol, wow 
my help command has 10 reactions
wow xD
easy way to ratelimit it
but you cant use it twice in a row
you can only use it again after all the previous reactions finish loading
Tim is to kind, to do bad things with his bot xD
so its simple task to see if a user has an active command
hey you never did this i saw your code
I spammed $createChannel[] 50 times
you could in theory prevent other people from using my reactions by spamming them
haha would never work
my help menu will ignore reactions if receiving too many
i'm almost ready to migrate to postgres
because i already did them
so i dont need to anymore
ynot
:^)
postgres and libpq poggers

i have a weird question about std::unordered_map
it feels like im doing something wrong, 10 million strings are using 1gb ram on the heap, when their file size is 100mb
brain also knows cpp
ye but i dont wanna ping people
wrong brain
wrong brain xd
lmfao
LOL
@green kestrel
?
lmfao
i know a bit c# if it helps
LOL
does c# have std::unordered_map and malloc?
good question, i know it a bit, never used it indepth
Are you storing C++ strings, C "strings" or Node.js strings
using System.Collections.Generic;
void UnorderedMap()
{
Dictionary<string, int> map = new Dictionary<string, int>();
string s = "test";
map.Add(s, 1);
int i = map[s];
i = map.Count;
bool b = map.Count == 0;
map.Remove(s);
}
``` would be the equivalent i guess
im converting node.js strings to c strings
and storing them in an unordered_map
the only way i found to do that was to malloc each of them, then put the pointer in the map
which feels stupid
Maybe the node.js objects are taking up the space? Or is the unordered_map itself using 1 GB
was currently testing your bot on 10 channels. You cant ratelimt it, but you can load the .help in every channel lol. And why does it react with 10 emojis, when it just has 6 options on the landing page?
is has more options on other pages
rate limits are per channel, reactions included
rather react it first, when you react on that option !?
so i dont mind multiple channels
ah, thats good for you xD
i dont think so
the node addon api docs say that Napi objects are only alive for the lifetime of the function
which makes sense because if i try to assign them directly to the map, i cant access them anymore
i get garbage data
@quartz kindle malloc is not a thing in C# since you dont do memory stuff, its handled by the compiler i guess
ah
if to do this this->map[key] = input.As<Napi::String>().Utf8Value().c_str()
accessing this->map[key] after the function ends gives me garbage data
if i do this instead this->map[key] = input.As<Napi::String>().Utf8Value() then it works, because it uses std::string
but using std::string makes it use like 2gb ram
c++ memory alloc with std::string differs
if i use malloc or strdup, then it also works, but still uses like 1gb ram
my question is
i was under the impression hash tables like unordered maps would handle the allocation of the value
you're using a hash set?
the bot cooldown work @misty sigil hehe
but i can only get it to work if i malloc the values myself, then put the pointers in the map
so i end up with 10 million mallocs
i need it to have keys
you could set the keys after
std::string is even worse
like making a temporary or pseudotable
you're just translating values over at that point
isnt there any thing that i can use to allocate strings instead of having to allocate them myself?
and combing through it with a loop wouldn't be too hard i think
Our rtmp handsake was a sucess
afaik with what you want to do in c++, no
unordered_map is just a container
rust's starting to look real nice rn 
lmao
i can think of a million ways to improve this
im sure there must be already something made by other people for this
but i cant find anything
what r u tryna do?
this is usually where i google "stackoverflow allocate memory for string"
yes but i am a bit late ig

any ideas why the stuff in this if wont execute js } else if(message.mentions.members.some(m => m.id == 731339718410764418)){
o
also use ===
but it worked before
holy shit tim that was quick
hmm
tim how are you storing those values in the map though?
this should work regardless
The number is too big
yes but isnt that number above the JS bound?
u32 is too small for that 
i put it in a "" and it still doesnt work
TFW chad u32 python topples the virgin u32 js method
maybe you didn't mention the right member
unlikely
i tripple checked
Python with it's unbound ints 
Tbh making a unbound integer is incredibly simple
m is a member
member object
show me
i tried a million different things now, the best way i found so far was to use std::unordered_map<uint64_t, char *>
im trying to store buffers on this map, but if i try to put the buffer itself, it disappears once the function ends
weird
wouldn't it be safer to check if the objects are the same instance?
you could fetch the obj's details instead and check that way
You could also put the id in a string ;-;
but cf8 showed that wouldn't matter
you could also run this in console terminal and it gives the same check
oh dear
generally or atleast the python method is a struct that contains the accurate number which is a f64 / double and then a linking power of ten binder
JS you sneaky bitch
its not really sneaky
it is
its just a implicit overflow cut down 
it's fine if you're just comparing it
that's what i don't get
have you tried string views too (std::string_view)? well they do the same under the hood. does your value need to be modifiable one? if not you could try using std::unordered_map<uint64_t, const char*> if that works
because iterating the number statement would ofc force it to be rnd down
because it tries to parse the string as number
i tried const char, same issues. i havent string views yet, but wont they cause the same issue of the data disappearing?
oh
so "242351388137488384" will turn to 242351388137488400
because the C string is coming from a Napi object, and the docs say the object only lives while its in the scope
and 242351388137488400 == 242351388137488400 is true
that's hacky though
shouldn't both be parsed though through the same method?
it should always be a string
ah yea, didn't think out of that. well best bet is probably mass allocate the strings or trying to copy the memory somehow?
exactly
const reason = '`' + args.join(' ') + '`';
banEmbed.addField('Reason', reason);
msg += ` Raison: ${reason}.`;
BanInfo.reason = '`' + reason + '`';
}
message.channel.send(banEmbed);
await member.send(msg);
await message.guild.member(member).ban({ reason: `${reason}`});
message.react(reactionSuccess);
}
reason is defined but he says no :/
whats the problem
and i was under the impression unordered_map was supposed to handle the allocation
i mean, isnt that what hash tables do?
you can't use reason outside the block where you declared it
allocate stuff in a table for you?
well kinda
oh oki
hazar
thx
now for the fun bit of actually transmuxing the video 
because i can think of ways to do it using my own custom made hash tables
but how to use outside?
so im sure there should be a hash table somewhere that does this
declare reason in a place so that you can use it where you want to
but how xD
reserve function on the std::unordered_map allocates space for size of uint64_t + char* (1), but that does probably help you on allocating the strings theirselves
the weird thing is, map[key] = C String gives me correct memory readings
about 300mb ram for 10 million strings that total 100mb combined
but i cant access these values at all
they all return garbage data
a ban command
and if i do the malloc way, then it works, but it consumes twice the memory
what's your full code?
what about malloc'ing 100 billion strings at once? (overloading delete and new operators)
its in french
well i gtg hope someone can help u
lol thx
@pale vessel @cinder patio im glad you are looking over how js numbers work, but even if i parse both as string it doesnt work. do you know of any way to make it work?
if it still doesn't work then you got the wrong ID
would not work any more
Try logging the mentions and check for yourself
don’t care™️
@earnest phoenix declare reason outside the if statement, to make it undefined by default
how? O_O
happens after 5 times tested it rn
Make the id a string
this makes it global to the scope
so in the end you'll be comparing 2 IDs which are strings, not numbers
or like flazepe said, you could have the wrong id
but generally both IDs should be strings
} else if(message.mentions.members.some(m => m.id == "731339718410764418")){```this doesnt work either
@mellow kelp I tested a ban but the reason is: undefined
:/
then you have the wrong id
why not mentions.has()?
i know its right
i didnt know that existed
initialize reason in that case
Docs exist
let reason = ''
you can use mentions.has(id)/mentions.members.has(id)
i mean you have to initialize reason
Hello
can someone tell me why dsl bot won't respond my vote? ;-; it must be 9 server vote, but it still 0, and also the autoroles didn't work at all, i was googling it like forever 
so would it be js (message.mentions.has("731339718410764418"))?
Yes
I initialized but nothing owo
the previous method should have worked though
no idea then
npm WARN discordchat@1.0.0 No repository field. anyone know how i can fix this?
lol
whelp i changed to yours and it worked instantly
¯_(ツ)_/¯
also tysm
anyone ^^
its no problem, the github repo is just missing, nothing special ^^
oh
so that means>
Want to post your server count to Top.gg? Here you go! Enjoy!
You might need to do:
npm i https
npm i querystring
tried to use this to show server count on top.gg
use dbl api, top.gg/nodesdk
i only use simple discord bot maker xD
Oo. imma look into that
what i do with that
@leaden beacon are you good in javascript?
not really
@leaden beacon ```js
await message.guild.member(member).ban({reason: reason});
I have a Const reason but
not works :/
"reason" is not defined
the member(member) never works for me
also you can just do member.ban if you alr have the member obj
await member.ban({reason: ${reason}});
there is a error?
and reason is not defined too
you dont need the ${}
its not in a string so no need for a literal
i never worked with api things where i find my api key? im prop dumb lol
do that
its not defined reason
did you try what i just said?
How do I do an inline reply in discord.js
above the ban run js console.log(reason)
but if I console log I will can't get the reason with the reason in bannisements
hi i can't install better sqlite3 you can help me?
do you have build tools?
ehh what?
cool
its. for. debugging.
you want help or no?
yes but
okay wait
console.log(reason)
reason is not defined
O_O
where do you define reason
@earnest phoenix
look
okay
@round cove 
hi, i have html <div id="modroles-to-show"> <% modRoles.forEach(role => { %> <button id="<%- role.id %>" onclick="remove()" value="<%- role.id %>" name="modRole" style="border-radius: 10px 10px 10px 10px; border-style: solid; border-color: #<%- role.color.toString(16) %>"> <span id="role-box-span">X</span> <%- role.name %> </button> <% }) %> </div>
@earnest phoenix you look?
how do i make it so when u click on the button it removes it?
any ideas?
i have this function: js function remove() { const btn = document.getElementById('') } but idk what to put in the params
@silver river Please don't post your horrible memes in development. That's what #memes-and-media is for.
Bruh I post it then u guy said to not 🗿
I even post it right there
your code makes no sense to me
🗿
rip
like i have no idea what your doing
abuse
no?
cache
anyone know how to resolve my issue?
check here https://traps-are.gay/
is it possible to get user object by passing id to the discord.com/api without having to oauth login?
@earnest phoenix I found!
But
The reason is: `haha`
how to remove "``"?
I just added the const
oh i'm dumb
yess finally
@earnest phoenix thanks anyway ^^
im pretty sure theres a way to customise the error handlers in py so instead of it being {commands.NoPrivateMessage} you can make it into {commands.NPM} but ofc you gotta define stuff etc
im thinking of this caz im lazy sometimes xd
attach it to client class
I tried it
or global idk
but it just worked in the same file
not different file
You mean different file as an entirely different script,dependency or library?
like this

nsfw?
huh, i guess it's some kind of library, you can move up the connecting script to the beginning of the script before the import para.js line or move the import below the script so it can inherit it's value
It's okay as long as I don't type it on my top.gg page
if nsfw is allowed in non-nsfw channels, yes
-_-
I tried as client.db
Oh lol, didn't even notice
I don't get it
I can only connect once
bot.js
exports
exports
