#development
1 messages · Page 1605 of 1
how do you want to make a command without a command handler
that's not how making a command works
obvously there is confusion
obviously*
moon, normally people who don't use a command handler just use switch/case
you ubnderstand what im asking right
if statements are inefficient and how else do you plan to check the command
is this what u want
ew
switch/case should be used there
ye this is disgusting but i think its what he wants
i dont fucking need it now
im not a javascript fan so my first and only attempt to make a discord js bot i did it that way
congratulations
i already started coding my own cmd handler
python all the way
its fine it just looks shit
agreed
why tho
cause
sense not since
i tried and failed and once i failed i realized that i was just to stupid to understand it
so i never tried again
thats a shit reason imo but you do you
but i did code my own cmd handler and use that
its been a while since you started
you're using js, no?
i mean trying a lot and not managing to make it work is not a really good excuse to do it in a shitty way
yeah, command handler is basically make a map for commands then read a directory, requiring every command, then add it to the map with the corresponding name
then you have the function on the message event do all the shit
like tests
alr
all your doing is keeping one file under 50 lines
Preferences in nutshell
it saves me 50 lines PER command tho
and im not even using one file or everything
because I do perms checks and shit
i code my own way so i don't like people calling my way of thinking stupid

i use multiple files i only wanted to know how to do it that way sine im obviously not used to coding in js
if i wanted to use a command handler i would have coded one myself
thanks anyway though.
I think instead of you guys going "ew cringe" and "disgusting code you do you"
You should provide more constructive criticism into why it's better to program one way than to opt to insults
This is how you begin forming programming arrogance and it's never a good thing.
but then how would i show that i hate javascript? 
lmfao
Here's a secret
Nobody in the software industry cares what you hate and like about a language
shhh dont say it, it is a secret
Either you're hired or you're not.
@crimson vapor for example, instead of going "you should use switch/case" without reason and calling their code blasphemous, actually provide a reason why, ie. better organized structure, easier to read code, or code maintainability reasons.
oh my the whole switch case thing
that one video where a dude said that yandere dev should use switch case because it is better (he even said he isnt even sure if it is) and then everyone just started splurting out that too
makes me want to leave ngl
Honestly I dont like switch cases
I feel that
Because it doesn't feel like constructive criticism
It feels like toxicity
You feel like when you ask for code help
if you gave a valid argument i probs would have agreed and tried it
People will spend more time picking away your code than actually helping solve the issue you're having
i've already dmed ken about it though so i don't think it matters much
I think as long as you got the help you needed then that's what matters
But this inflation of ego I see in many programmers saying that is the right and wrong way to use code practices without explaining why irritate me
Its nothing more than a more organized approach
Literally a +/- 2 microsecond difference if you run it in C++
Thats how miniscule the practice is
Yeah, to me its just switch cases are harder to read than a chain of if statements for me personally.
I just want to say that I'm not calling anyone out
I think people just need to be on the right page on things like that
It's good that code is being critiqued, it's bad that you're not giving a sensible explanation of why.
switch case is effective at a large scale
where you need it to jump instead of evaluating comparisons
if you dont even do ```js
switch thing:
case True:
do true things
case False:
pass
who are you
ima be honest i dont even understand how switch cases work btu they need to do comparisons too right
like to check if it si the right thing to jump to
Its good to understand them
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
The switch statement evaluates
an expression,
matching the expression's value to a case clause, and executes statements associated
with that case, as well as statements in cases that follow
the matching case.
using if else for command handling is generally an antipattern because commands (usually) have arguments and should be approached atomically
app.get("/users/:userId", async(req, res) => {
let user = await client.db.get(`user-${req.params.userId}`)
if (user) return res.send(user);
else return res.send("Test")
});
Why does it not send anything when user is undefined?
I'm cool with debating the practical implementations of which to use
I just wish people gave a valid reason instead of opting to insulting others code.
what is user?
an object
you probably wanna use res.json(user)
so like reading it
Yup
o
but with an optional break
and I need to make it so when the id doesn't exist
Thats the only main difference
what does the database return if the user is not found?
you could console.log the user and check what value it has
And the best part is all the beginner coders or skidders on the internet think that its superior in every way to else ifs
yeah
it returns undefined
did you console.log it?
that should also make sure that the request handler is actually running too
yes
FetchError: invalid json response body at http://127.0.0.1:3000/users/259776081316282368 reason: Unexpected token N in JSON at position 0 I don't get what this error means tho cause if I go into the browser it shows "Test"
"Test" isn't valid json
Hi,
I made a bot and I want to request all users with a specific role, but it doesn't show all of the users which have the role.
I looks like it only shows the users, which recently sent messages.
you need to enable the guild members intent @vale juniper
My favorite
{
}
Removing lines of code =/= memory allocation
thats json
I think instead of saying It saves lines of code
Say it gives the code a more cleaner approach
Not really, under the hood most compilers use a table, which makes switch statements faster, of course it only becomes noticable when there are a ton of cases
sorry
how are you getting the users
All good
saves duplicating code
Yeah thats valid
Especially when debugging
not a big deal
Command structures
oh
any permissions checks or cooldowns or shit that makes command handlers actually pog
Depends i think
i just don't use command handlers
they are
They make formatting commands really easy
Imagine you have ur code ready, then u find a bug after a couple of weeks without making significant changes on ur code, its really stressfull to find the issue on a messy code
don't they have like
But tbh
issue at line
Hmmm
Just do whatever u feel most comfortable with
this line at this part
the main reason command handlers are used is to increase performance (maps are faster than if/elseif), stop duplicating code, making shit very scalable, ex
thanks
yea
Tbh could care less if someone is coding their stuff in an impractical way or not. That person is gonna learn how to do better ways in the future
Its not like we all learned somewhere and that should be respected
There's nothing wrong with pointing out what can be done better, though
Criticism is always welcome yes
The mutual sentiment I've seen from many programmers is as long as you give validity and provide reasoning through critical thinking as to why, then yeah
But sometimes it honestly does not matter
Despite me using classes and cogs in d.py
I can still write messy code
Using organized methods won't make you an organized programmer
"Being organized" is subjective
message.guild.roles.cache.get(roleID).members.map((m) => m.user.id);
discord.js doesn't cache all members
You have to fetch all members in the guild in order to get all members which have a specific role afaik
(fetching all members is not a great idea)
message.guild.members.cache.filter(m => m.roles.cache.has(roleID))```
try this
spoonfeeding much
The code they gave already works, all they have to do is fetch all members
wait... its correct ?
instad of get
use like
fetch
get is cache only i think
yes
I forgot role#members was a thing
Their problem isn't with the role, it's with the members. Fetching the role won't do anything, although it is a good practice to fetch it
instead of fetching all members just set it so they are always in cache this way =>
const client = new Discord.client({fetchAllMembers: true})
lol
although its not recommended
Okay, thank you I will try that
thats not good tho
uses a lot of ram
i can practically hear the jet engine sound from your cpu
also I store all guild invites
so it needs all members cached
to calculate who invited whom
dammit vscode just crashed
nice
so
i was installing quick db
and this shows in npm
npm ERR! gyp ERR! stack Error: Cannot find module 'psl'
whats the alternative ?
fetching them yourself
the error explains itself
but why is it being removed ?
npm i psl?
psl doesn't exist
so
so do npm i psl
yes
it was already not recommended, so i guess they dont want to support it. besides, their implementation is flawed, it doesnt respect gateway rate limits correctly
nice...so that means I should just add fetch members to my loop which each 10 minutes fetches other stuff too?
if you need to fetch all members just put it in the ready event
loop over guilds and fetch them for each guild
you shouldnt need to fetch every 10 minutes, once for each guild should be enough
what if the bot is added in another guild ?
fetch on guildCreate
Yeah, like, just store member count somewhere then add or subtract it everytime someone joins or leaves
good luck with ram usage tho :^)
my bot needs that data to properly do invite tracking
^
Just have a map of guild-members count
Is there actually any case which you 100% need every user cached?
It'll be as precise as you can get
this
also hi sans
hi tim!
i guess if you rely on memberUpdate a lot
Hey Tim
hey tim
Any idea how to stablish a webhook that requires SSL?
webhooks don't care about SSL, your web server does
make your webserver support ssl, then change the url to https
like clearing values in a database for all users in a guild
Im using Python's Flask trying to create a webhook with Patreon and it asks for https, ive already created a self signed SSL but Patreon says its an invalid certificate :/
Self signed...
use certbot
self-signed SSL certificates aren't valid
look at letsencrypt
free certs are easy
I could implement that... nice idea
Ill take a look at that, thx
erm, yes
this is an unpopular opinion
but i really hate discord bots that rely on you to vote as their way to rate limit their commands
that really gets me
rate limit?
yeah so like
imagine only getting to use a command once every 2 minutes or something
o
lol
if people like your service, they'll actually vote for your bot
it's not the other way around
true
Unfortunately, most people won't vote without getting something in return, even If they like ur bot
"too much work" u know
i thought about it for my bot
my bot relies on an API that costs money so i thought
"i can present two options: 1. those who help donate money for my API fees get more perks,
or 2. if they vote once every 24 hours they get perks for that day"
but it feels so cheap
that's what i was thinking
maybe instead of limiting the potential use of it
maybe actually grant them new things to use for that limited time frame
Streak system is the secret
i also send them a dm saying that they got money
Ye my bot has a rolling system and I just give extra rolls for those who vote
that will encourage them to go "shit i should keep voting for these perks i otherwise have to pay for"
Rate-limiting is kinda wack
that's my current idea
oh yeah streaks
i remember playing mobile games every day as a kid just because of the daily rewards 
Every vote in a roll gives more rewards?
You need money to buy spawned cards
So the more you vote, the more you get per vote
ooh yeah
Once you reach 7 day streak, you can redeem a gem
shittt
the stacking up vote stuff
that's really smart
is big stonks
big stonk
people have this anally retentive side of them that once they get a streak going they dont wanna loose it more than what the rewards are
your idea is unironically good
Which can be used to reroll your cards, make them foil, buy gif profile or buy an extra deck storage capacity
its not really a new idea
my thing is i need a motive to get people to vote
it's not about forcing at hand that i like
its the idea behind almost every afk game
or every mobile game that has time limited progression
Also, I periodically make raffles with each vote being a ticket
So people tend to be regulars on top.gg
Nonetheless, ratelimiting commands with votes is dumb af
By default a normal user can use 200 characters per message
There's no limit on a "daily character quota"
I intentionally did that to let users experiment with exploiting my limit on purpose
If you donate $1 on patreon you get 300 extra characters
but what if every vote I grant 50 extra characters?
Well, first of all you must note that votes give u no money
I know
Sorry to ask you that but how exactly did u do that patreon integration
So you need a sustainable way to get income
but the tradeoff is that voting gives reputability
which is what i need for ultimately any donations
They have websockets
And apis
don't get me started on it
the patreon api is so ass
Ik
patron api sucks big time
all you need to know is that it works for me 😂
That's why Ive been struggling with it
Sorry but, more users won't mean more donations
Why tho
true
You REALLY need to give them a very good reason to pledge
if i let people at hand translate super huge messages i can lose money quickly
Yeah
I help for a bot with 5k servers and it makes more than @robust trellis
my problem is finding a good motive for pledging as a patron
The easiest way i thought about was using the patreon bot to give roles on the support server for patrons, and then giving the rewards for those who have the role
i'm still trying to find ideas on that
It works but websockets should be better
my method is that the patreon api auto-writes you into my bot DB for the new character limits and if you join the support server, you get autorole'd.
I never really managed to implement a patreon integration with my bot
Like
Do they REALLY need to send the whole page's info on each request?
That's what i wanted to do but i Just cant integrate my bot with Patreon
it's really hard
A simple id-value-blablabla json would suffice
patreon API is one of the hardest i've yet worked with
idk why they made it so difficult to make work
did i hear shit yet complicated api?
i use tinydb for exactly that
yup
patreon api in a nutshell
Erwin, no, please
Don't talk about twitch
NO
Nooooooo
Too late, he'll talk about it
look, im trying to find a competitor for the spot of worst big fucking api, ever. period.
you know it's really bad when YouTube's video feed API is better than Twitch's overall API
Would u mind giving me a brief help in the dms with that integration? :/ Just like, How to get started bc i dont even know where to start
Google Drive API is pretty bad
I mean nothing beats google's
nahh
twitch api gives me anxiety
What did I say?
Google shitter than twitch
ive spend around 5h using gmail integrations
twitch was a good 2 days of constant work
Just no, twitch api is so gross that it's not actually an api but what we brazillian call "gambiarra"
between the shitty docs and the wrong snippets without the proper necessary means to do requests, google was a lot better
Opa
The DeepL API is surprisingly nice tho ngl
it's majorly HTTP request based but it's intuitive
its very rare that you need WS for most api's
this is the one i wrote
only really for receiving events
gambiarra is okay ish, this feels like os cara do barraco tem coisa mais bem feita type of deal
look, websockets are nice n shit
i mean they've always been pretty rare
but when your docs are straight up wrong
you get 403's a lot
half of their api is dependant on the older version
they're awful to scale compared to regular HTTP
which is deprecated
they didnt port half of the shit to the new lib
its insanely messy
currently at the n 1 spot of shittiest api's ive worked with
Is there any other option with api than patreon or donatebot?
i feel bad for twitch api wrapper devs
not that i know of kuuhaku
Tabaxi™️ payment paltform™️ for bot devs™️
2022™️
this
i feel like if twitch bots used the new twitch chat reply feature
they'd be so much cleaner and efficient
Plot twist: twitch supports no bots at all, it's just regular user accounts
getting hot here init?
github intensifies
idk if that was sarcastic, but in case it wasnt, thats a thing btw
twitch doesnt differentiate bots and user accounts
Selfbot bro
Ik
unless you need multiple iterations being ran at the same time
then you fucked lmao
Twitch is all about selfbotting
twas you know the HTTP/1 protocol is synchronous 
discord isn’t
though in fairness they varified my bot for special ratelimits within 4 days
so, that was nice
i kinda wish twitch had something similar to discord's support for bots tbh
like the UI badge and shit
already tried sirius
it kind of does
not happening
yeah
its been on hold for over a year
twitch's method sucks ass
Do you know what I wanted? Proper message control
i mean what should we expect
its not coming
Like, delete 'n edit stuff
indeed
that’s stupid
cuz those 8 year olds dont want a toxic chat 
"toxicity of feminine streamers"
not like we know the demographics is 99% horny teens, and not kids
Yeah have you seen just chatting kekw
but own up to it at least?
like anime weebs being called degenerates
just accept it lmao
funny how simp is banned but calling someone a retard isnt
banned for nsfw name
simpons? imagine south park gameplay
What in the actual fuck
whole lotta dev chat going on here
yes
indeed
Boo!
Want to join?
how can we develop a strap-on
well
so i can fuck twitch's ass sideways over?
LOL
stap-on wise
they differ so much
also there is so much engineering going into them
are you owning up to pegging someone/being pegged CF?
i did some work experience with a manufacture of them 
Neither

being pegged is a confusing and rather painful experience
😅 luckily for me
fuck is just luck but with arms and looking down
Wait until you discover resident evil 6
I also am looking for code jockeys voluntary programmers who can help me with my project
but that won't ever happen 
if your code is not a mess.... its not code
Nah
Long
I am very new
Ling
I just started today
dont make a bot as a first porject
Did you learn the basics of that programming language before diving into a Discord library to make a bot
Are you the first trial?
I think so 🤔
Help me plz
with what bro
Congrats
Read the documentation on how to get the bots latency?
Thanks 😊
I don't know where to find the docs
Do u mind sending the links
Ok
@icy skiff ok,can u say if my code is good or not?
I mean i guess
Then
Python makes command handling really easy
I followed a tut and now I am experimenting what I lesrnt
Just do
@commands.command()
async def(ctx):
// Ur command goes here
I highly suggest looking for another tut
agree to dissagree
when my bot joins a server it sends a welcome message like its supposed to, but if i kick it and add it back it doesnt say the message
is that supposed to happen?
No.
no
then they are lost
Make sure to fix whatever is crashing your bot otherwise your shard can't start
being stubborn is the issue, not the code
whelp im prob not gonna change so.
Just use mongoose it’s the exact same as json but safe and non-blocking
yo Erwin, you up for supplying me with some constructive criticism
not rn, i gotta ditch in just a couple seconds
Alr
be more than happy to trash all over your code later
prob ask @quartz kindle meanwhile
Yes that would be pog
i mean
i've never used ts, but i've learned a ton of it just from doing typings and watching people talk about it
You up for reading my code?
Always bro
The big thing is the structure cuz idk how to structure code well ngl
No Readme 
any specific part you want reviewing?
oh shit
lots of files in there
@cinder patio you made a programming lang?
yeah, mafiascript, it's kinda shit tho
i've done the same thing too
File structure is the big thing but also anything in the bot/src/lib
i made my own lang to see how it would work out
you mean src/bot/lib? xd
nice
my code is worse lmao
Mine's not statically-typed
saw nothing ok?
and it's also written in c++
Using slappey where do I edit code in the files to add commands?
i have more works but they're mainly gists
the first time I really used c++ for a serious project
@odd stratus I don't know what's wrong with the code
i asked for help with a diffrent thing smh
Is it under commands ;-;
I also got lazy with the parser so I just used bison and yacc
@hushed berry i hope this gives you anxiety https://gist.github.com/goverfl0w/6fe47c4c8676f650d7675296ced771f8
I found my PHP database script you were talking about

@crimson vapor this could make use of fs.promises and also withFileTypes is your friend
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./index.js', {
totalShards: 'auto',
token: process.env.TOKEN
});
manager.spawn({ time: 180000 });
manager.on('shardCreate', (shard) => console.log(`Shard ${shard.id} launched`));
screw you tim ||im joking if you need a spoiler on that||
xD
You should get a full error telling what is causing a crash
go away 😡
@odd stratus
const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./index.js', {
totalShards: 'auto',
token: process.env.TOKEN
});
manager.spawn({ time: 180000 });
manager.on('shardCreate', (shard) => console.log(`Shard ${shard.id} launched`));
Ah right I heard about that once but idk much about it
require("fs/promises") or require("fs").promises
then await readdir(folder, { withFileTypes: true })
withFileTypes gives you DirEnt objects instead of file names
Dirent contains a method isFolder()
so no need to use stats to see if they are folders or not
Ah
Just tried your version and it gives an error like "The amount of shards option must be a number". Try something like this instead:
Tim if you say anything else link the message in dms cuz my phone is almost dead
that moment when you know nothing about JS but know java so you just go in guessing. I mean just looking at the code it seems easy to read so, easy language???
ok @odd stratus
Ehh depends on what you're trying to make imo and how much you know
Hmm I should try making a bot in TypeScript 
Knowing one language well makes learning every language after that alot easier
basically, any rule java has, you can throw it out of the window, welcome to the crack of programming
hey tim seriously tho why isnt this logging?
#development message
seems like you would know
yea i came from java
js seems like a breath of fresh air
Definitely ⬆️
no errors hollering at me every time i space something wierd
Man you gotta have gone through some shit to say that lmao
I know the basics
if it makes you guys feel better
i spent a majority of my programming career knowing only PHP
I just wrote a new command to speak. Is using Slappey a good idea?
and learned every other lang off of my PHP knowledge
then again i learned java in my school robotics program witch i quit cuz i couldnt take the demanded detication so...
I generally would pick rust over c#, c# over java and java over js
ok so how do i do it proper
g-code is something i never want to see in my life again
g-code?
Docs
how do you get the thumbnail to appear in an embed? im using a direct imgur link
discord or imgur have been having issues so the images don't show for whatever reason
Ah
oh okay
try using another image hoster
that code is pretty much what i got from the docs lmao
would it work if i used my own custom url?
don't know
So me being a idiot and doesnt know what hes doing wrote this.....and it doesnt work🤣
Im a certified idiot
cause what do I do 😦
lmao i have no idea
im a certified idiot too
@odd stratus I use repl.it and this host has the index.js folder already generated and cannot be deleted or renamed. I put the fragment code in the index.js file to be started first and then I extracted the code that runs my bot, it didn't give an error, but it only gave the console (fragment 0 released)
but i do diffrently
Yeah im using slappey lol
And the test command works so I copied it 2 times, first by typing, then by ctrl C and V
and it doesnt work
See certified idiot
nvm
i am a real idiot
XD
You know how you trn your computer on and off again, i forgot to save! Sorry for wasting time
=[
So did the new code work or no
i put my bot on a new server and it takes like 3-5 seconds for it to send a message back
yes @odd stratus
@odd stratus I think the error was not in the code, but in the way I put in the files the shards have to start first that the client
i put my bot on a new server and it takes like 3-5 seconds for it to send a message back
thank you so much for your help helped me a lot
writeFileSync does not have callbacks, its a synchronous function
it either returns, or it throws an error
corrupted heap errors be my bae
how i do to get user by id, but user is not on a guild
discord.js
setTimeout(reset, midnightTime())
function reset(){
setInterval(function(){
var d = new Date();
var today = d.getDay();
if(today == 6){
//weekly reset here
}
//daily reset here
}, 86400000);
}
function midnightTime() {
var midnight = new Date();
midnight.setHours( 24 );
midnight.setMinutes( 0 );
midnight.setSeconds( 0);
midnight.setMilliseconds( 0 );
return (midnight.getTime() - new Date().getTime());
}
This is what I have right now, but the problem is that setInterval function runs after that milliseconds so it will skip the first time the function is called I don't know how to fix this
<client>.users.fetch(user id)
put that reset function inside setTimeout
thanks bro
probably wanna await it
okay
that isn't going to fix the issue though
it's still going to run after the interval hits that amount of ms
make the callback of setTimeout its own function
call the function outside of the setTimeout
then pass the function to setTimeout
if I call the function outside of the timeout it won't be consistently at midnight no?
I am trying to have it do something once every day at midnight, and once a week at midnight as well
yeah
you need to calculate the time until midnight, put that in a setTimeout
yeah that's what the midnightTime() is
yeah I think I am doing this
the reset function gets executed midnight, but because of setInterval the code inside waits 24 hours more to be executed
I don't want that, I want it to be executed immediately when the reset function is called but I also want it to repeat everyday
//pseudo
//copypasting this won't work
function intervalfunc() {
return "pp";
}
function reset() {
setTimeout(() => {
intervalFunc();
setInterval(intervalFunc, that big ass number);
}, midnightTime());
}
in this context, reset should only be called once
helo how could i do one !givemoney bot?
pray to discord gods
pp
oh i thought i had done the async version smh
whelp thanks for pointing out my stupid
guys
And yall kept telling me dont do sharding till I get like 1k servers or so
And I only had 11
welp..
look at this:
callback version*
async != callback != sync
if you'd want the async version: js const fs = require("fs/promises"); //... use fs like here normally except await it, but why though if you're not processing files in P A R A R E L L
You can shard anytime, but you get no benefit from it, even worse - you have multiple websocket clients, which use way more resources
technically the callback version is async
everything that is not sync is async
promises are just a form of async
oh
but if you use lots of callbacks, it's c a l l b a c k h e l l then
thats where i was going lol
lmao i have just under 100 servers and i only pentalize from single threaded at the very start when it sorts data and prob async would fix that some
hence why im rewriting
You cannot use let/const in a let statement without a code block
for example:
if (expression) let a = 50;
Is wrong, because a will never be accessible
hmmm ok ty
An example would be using a let statement after an if block without the braces. Without the braces, a block like that will only accept 1 statement.
if(!fs.readdirSync(this.dir).some(d => d == "data.json")){
let data = {
"joinMessage": "[user.ping] has joined, using invite [invite], created by [inviter.ping] who has [inviter.total] invites.",
"leaveMessage": "`[user.tag]` has left, [inviter.ping] now has [inviter.total] invites.",
"banMessage": "[user.name] was dumb and got themselves the big ban hammer. [inviter.ping] now has [inviter.invites] invites.",
"embed": false,
"joinchannel": null,
"leavechannel": null
}
fs.writeFile(this.dataDir, JSON.stringify(data, null, 2), (err) => {
if (err) throw err;
console.log('Saved file to' + this.dataDir);
})
}```
so i have code
aaaand?
shouldnt that make the code valid
try it, looks good to me
thats the code thats erroring tho
that code looks correct, are you sure it's coming from there?
That's really odd
thats me
i get the wierdest errors
my discord bot is delayed by atleast 5 seconds
any recommendations
i have a good enough server\
it could be the code
or something
idk
@earnest phoenix if you have a lot of startup items it will take a moment
mine almost takes a minute and its running on a 9700k
sounds like its commands taking 5 seconds
ratelimited?
That can't be the problem
you probably forgot to save or something, because there's no way the error is coming from there. The error only occurs if you have the following:
if (...) let ...
for (...) let ...
And I highly doubt an empty space would cause such an error
i removed the space and it worked
and yes it was saved
hmmm yes exe not sus at all
huh
send the exe out here in public
why you keep del.eting
i gotrchu
in a rar
this isnt that exe
@earnest phoenix send the executable file
tha you uploaded in my dms
there dm it to me

yea idfk
@earnest phoenix Don't share things here that could potentially be malicious. This is your only warning.
Even if it wasn't malicious, just don't do it 
(node:3304) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open './db/data/guilds/731342408293285928/members/627660958499864586.json'
i dont understand my life
json database moment
can you link the attachment to me
i'm interested in what it is lol
he deleted it
damn
i got hxd and IDA ready lmfao
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
shoot 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.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
hi guys
One message removed from a suspended account.
1.a - well this is kind of invalid because you cannot assign a static class to a variable
1.b - no, you should avoid the static pattern in the first place, it defeats the point of OOP and creates god classes. you should have something like ```cs
public class Facts
{
private YourDeserializer _deserializer;
public Facts()
{
//fill the data here
//i.e
_deserializer = new Deserializer();
}
}
//in another file
internal class Deserializer
{
//you get the point
}
//in end user's code
var facts = new Facts();
facts.GetRandomFact();
1.c - use json if you're having dynamic content, otherwise just fill the array manually
2 - yes, the less dependencies the better, the only excuse is that the system.text.json is garbage in some cases so you could use newtonsoft's json package
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
why i get this error?
did you read it
yea?
so, what do you not understand about it
how could i fix it?
🤷♂️
that error is worth dogshit when you don't provide your code
One message removed from a suspended account.
you're probably sending a response after already having sent another one
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.
do public class, not static
One message removed from a suspended account.
this also allows super easy integration with DI
One message removed from a suspended account.
yes
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
for (const warning of results.warnings) {
const { author, timestamp, reason } = warning
reply += `By ${author} for "${reason}". ${timestamp}\n\n`
}
message.reply(reply)
const embed = new MessageEmbed()
.setAuthor(`Warnings for ${target.username}#${target.discriminator}`)
.setThumbnail(message.guild.iconURL())
.setTitle(`Warnings`)
.setColor(`YELLOW`)
.addField(`${reply}`, 'hi')
.setFooter(`Boop!`)
message.channel.send(embed);
This is a command that lists the warnings for a certain user. But embed field seems to be limited at 256 chars, is there a way i could get through this?
One message removed from a suspended account.
for context
//an example
var services = new ServiceCollection();
services.AddSingleton<ASuperCoolService>
.AddSingleton<Facts>();
this is an example of a proper pattern
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.
yeah i see but like what could i do to send the warning lists
One message removed from a suspended account.
One message removed from a suspended account.
to list it on descritpion?
One message removed from a suspended account.
i should list the warnings on the desc?
One message removed from a suspended account.
alright i'll try that real quick ty
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
yeah i can set a limit on the warnings displayed or something
One message removed from a suspended account.
One message removed from a suspended account.
aightys ty
the method would exist in the class
//example
public class Facts
{
private Random _random;
public Facts()
{
//...
}
public Fact GetRandomFact()
=> _facts[_random...];
}
One message removed from a suspended account.
errr no
ikr i'll set a max of warns a user can have for sure, i am not gonna fill my db with warnings
One message removed from a suspended account.
embed body can go up to 2048 chars, fields up to 1024
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.
hard limit is somewhere near 4k iirc
6k
One message removed from a suspended account.
you then don't need it
One message removed from a suspended account.
it was just an example of how you should structure your class fields
One message removed from a suspended account.
thx bro :>
i checked the code
and i had
if(test1){
res.render('tst')
}
if(test2){
res.render('tst')
}
or something like that
and both relations was true so yea
thank you for idea
:}
that did the job properly ty!
How to I setup the bank part of a bot?
bank part?
Like how ZeroTwo tracks your coins and gives them to you for doing ZT! Work?
node:internal/modules/cjs/loader:926
throw err;
^
Error: Cannot find module 'discord.js'
Require stack:
- C:\Users\Admin\bot\index.js
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:923:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:768:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:995:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:92:18)←[39m
at Object.<anonymous> (C:\Users\Admin\bot\index.js:1:17)
←[90m at Module._compile (node:internal/modules/cjs/loader:1091:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:971:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:812:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [ ←[32m'C:\Users\Admin\bot\index.js'←[39m ]
}
help
Is that starting the bot?
I had to redo my entire bot to fix it
I think you might have messed up something in the slappey files but idk
ok
yes





