#development
1 messages ¡ Page 82 of 1
Yessir
Add a console.log(message) inside of your messageCreate
is your bot even coming online?
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
]
});
const request = require('request');
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', message => {
// Only respond to messages that start with "!chatgpt"
if (message.content.startsWith('!chatgpt')) {
// Get the message text without the command prefix
const prompt = message.content.slice('!chatgpt'.length);
// Send a request to the ChatGPT API
const options = {
method: 'POST',
url: 'https://api.openai.com/v1/chatbot',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.CHATGPT_API_KEY}`
},
body: JSON.stringify({
'prompt': prompt,
'model': 'chatbot'
})
};
request(options, function(error, response, body) {
if (error) throw new Error(error);
// Send the ChatGPT response back to the channel
const chatbotResponse = JSON.parse(body).response;
message.channel.send(chatbotResponse);
});
}
});```
Current code
oh... you never logged in
It's just because the token is there I didn't copy it
Well, I was the problem and I got new one
I think the error is fairly self explanatory no?
The message isn't empty.
Undefined
That's what it log
The api key also says never used
I got 0 ideas why it is not working
That's how to parse the answer? No?
I haven't used the request lib
I usually use built in node-fetch
Log body
There is no response prop on it, hence why you're getting undefined
Url invalid
hey guys, just had a general question. if i wanted to start a side hustle, is developing discord bots a decent way to do so? i've never made one, but looking over the docs and checking out the ecosystem, it seems pretty cool. i'm a fulltime dev just looking to do something for fun and still get paid đ
finding funding is too difficult if making money is your objective
I'm lucky to have 1 consistent backer
ah good to know
even then, I'm still doing this at a huge loss
and this has been going on for like 5 years
i've seen a bunch of posts about people paying money for discord bots on reddit, and it's something i've never explored so i decided to ask you guys, in your nest đ
it still seems fun, though. i might give it a try.
maybe some commissions would be nice to do, but a lot of devs can just churn out trash like nothing
Definitely not a good way to make money
It's inconsistent and many people use discord bots simply because they're free in the first place
i'm currently switching stacks to elixir and phoenix, so it might be a good exercise to create some kind of open source discord library with elixir
just as a fun project
might alr exist and lib creation is a nightmare
if you aren't dedicated to maintenance, do not make a lib
there's this https://github.com/Kraigie/nostrum
You can do like a one off thing just to get used to the low level api, but I can tell you that even a simple wrapper is a nightmare to maintain
yeah, sounds like it
thanks for the advice đ
i think if it's something i can't monetize easily, i might as well do something 100% for my own fun instead
e.g. nothing to do with discord bots ha
I make a music bot for the hell of it. Audio related stuff is kinda getting deep in demand
Discord and YT cracking down on music bots
i don't really use discord, what does a 'music bot' do?
take song input and play the song?
play music in a voice channel
Music bots have to dedicate 100% of the resources to it
One could take in data from many sources like yt, or soundcloud or spotify (just yt but scraping metadata), and some other less than popular options
Most of what I do to add new sources is scraping web pages
a lot of places dont have an api in place
sounds boring tbh
aren't scrapers a pain to maintain on big sites like youtube?
there's a new deploy like every day
they are a pain, but changes have been super slow recently so little updates required
and you could get away with using already maintained stuff like ytdlp
unless you're super dedicated to native to lang solutions
which is what I'm working on
yo @neon leaf one thing that actually pisses me off
I dont get what the mailcrow hostname is supposed to be
mailcow*
Whats the best sql server out there for a discordjs bot?
Postgresql is pretty nice
default to sqlite
All depends on your needs
Ahh whats the difference btwn postgresql and sqlite? Sorry new to sql đ
They're both SQL databases, but Postgres is used in larger environments, while SQLite is usually used in smaller environments.
The main difference being that Postgres uses a client/server model while SQLite is embedded.
Client/server meaning that your app acts as a user and talks to your database elsewhere, while embedded means that your database logic is sort of inside your app (bot)
Note that your database is not literally in your app when embedded, it's just closer to you.
I personally think that embedded databases, especially for Discord bots (since they're usually small), are a much better choice
ah i see. Is the database in sqlite visible? as in is there anyway we can view it with our own eyes?
It'd be a file on disk, but you'd query (i.e. get data from) it with SQL.
ah i seee..thanks for info!
Sqlite is for when need a fast and straightforward storage
It'd be akin to an SUV
Postgres is a huge complete toolset included inside a rich and fast database structure
It'd be akin to a truck with turbo
sqlite doesnt work for multi process data access
I'm pretty sure it does, though it's restricted to a single writer
Your address, example "mail.agaga.com"
So say I have a domain that I want to have subdomains point to specific rust servers. Would I just make a nginx config for it and have it proxy_pass to my server's ip+port
so like
server {
listen somePort
server_name 2x.horizon-rust.store
location / {
proxy_pass gameServersIP:port
}
}
or does proxy_pass have to be a http(s) thing
oh?
You shouldn't be having nginx redirect a client if it's on another machine. sub domains under nginx only makes sense if it's on the same machine in which case, proxy passing it to a local port is what to do based on subdomain. Otherwise, your DNS should just point to another ip
If you want to host multiple rust servers on default port just buy multiple ips
I have multiple
then use em
yes...but..the domain will be the same
no
Im not buying multiple domains for the servers?
The servers will all be named the same just different versions, one will be 2x, one vanilla, etc
for each rust server you add a A record with the ip its on
done, I cant access 2x from 1x that way
yea, I tried that
then show exactly what you did
since you probably didnt bind the servers to ips
just 0.0.0.0
ping amanda.moe
then ping beta.amanda.moe
They're on different servers with nginx installed.
But I also have a http only bot which I have Discord post interactions to on amanda.moe just under a different path. Subdomain would be the same concept
I did bind the servers to ips
I realize the issue now
Whenever i add numbers to the subdomain cloudflare ignores everything after the .
shouldn't the dns entry just be the subdomain name and not the full address
indeed
really?
yes
Your * record should be the domain name
Then A is for subdomains and just the subdomain. In my example, it's just beta
or was it CNAME
whatever
I'm tired. Have fun
try it out ÂŻ_(ă)_/ÂŻ
I am
what are the numbers behind a , called again?
example
10,5% discount
decimal? Also, that's a regional formatting for EU
thanks
Ah bio says german. Makes sense. US uses .
ye
i am unable to create a index in mongo db with the same user id
You are most likely trying to create two documents with the same _id, right?
_id It is unique to every document and should not be overwrited
but mongo db say's we can't create another one with same user id
User id
so mongo will have to build it as with unique id
it typo
Have you tried to set a default value for userId?
And then check if this error occurs?
default not
why we need default value for a useriD
Just asking 
turns out my host blocked 465 und 587 or smth
i have an input tag for multiple files
and i want to upload it to multer
my code:
let data = new FormData()
data.append("images", $(".input").prop("files"))
fetch("/post", { method: "POST", body: data})
in post.js
parser.array("images")
why its not working?
Is anyone here well known with the challenge response authentication protocol?
if yes, the client would put the challenge in a mac function right, and send it over to the server (that only checks whether the hash is equal to its own crested one). Couldnât we then as an attacker try to intercept this message and just send it later on so that WE instead of the actual client gets authenticated?
Define "not working"
If I wasn't at mobile data I'd send a meme here
lmao
Love how this is still a thing
Just made the bot application and can't even see the token
For security purposes, tokens can only be viewed once, when created. If you forgot or lost access to your token, please regenerate a new one.
yes but where is it đ
you only get to see it once
when it's generatede
reset it if you can't find it
and then put it somewhere safe
https://github.com/Perfare/Il2CppDumper so this program is made on python, when others run the .exe a file explorer window shows up and u chose the files
but when i do it it opens a cmd and then closes it immediatly
did you download the correct release for your arch
actually nvm
Do you have the correct .NET version installed on your computer for running the release you downloaded?
my dotnet versions are becoming like mush potato
keep in mind you may need to run it directly in the terminal as opposed to opening it
even if i am using windows?
why that terminal looking out of this world
using a custom terminal for colors and font
starship
pro hecker
eh I just like the way it looks
it's not meant to be used in the default command line
ok so it works now
earlier i was running the .exe by doubleclicking
(i also installed another sdk)
so one of them did the job
here's what I have it set up to look like in a different app
and choose the il2cpp executable file
so as i am reading this github repo it says i shall run the il2cpp executable file?
like this thing is confusing me besides the metadata file that ik what to do with
i'd rather keep it some dark color behind
i lose focus quickly
I just have it set up like that
im like a moth
you can change it to whatever you like
https://github.com/0x3C50/pyasm official brain damage generator
only use this if you are willing to learn whatever this shit is
that's pretty basic
just bytecode ops
the actual compilation process of python -> bytecode is more interesting than the bytecode itself
certain things are uh
to put it lightly
abhorrent
to be fair nobody writes raw bytecode for a reason
it's just meant to be an efficient format to compile code to
well there is a reason
it's just that the reason is stupid
it's more of a fun toy than an actual project anyways so who cares
what feature can i add to get the presence intent
my bot can't get past 100 servers
i got denied presence intent for one of the best features i ever came up with and i got no more ideas đż
what was the feature
The use is within our anti-raid system. It is detecting unusual patterns in presence. every form of "detection" adds a suspicious point, if it goes over certain treshold of points the user will be suspected of self botting by our bot. if the owner allows it, that will also be logged by our bot and moderators are notified. Such point of detection can for example be; staying online while no activity is being detected. having multiple presences eg. browser and desktop presence, "browser" obviously being the instance of the self bot.
bad copy paste but it explains the feature that i made
is this a clone of the guy waffle was talking about
No, that's bae
sounds kinda just like unnecessary data mining on users that donât consent to it
And might catch like 5 people out of 20 thousand
They got denied when they tried to get presence intent without a good reason
Since then bae's been trying to find a good escape goat to get it
Lmao
I donât think theyâre ever going to give it to you knowing thatâs what youâre using it for
Because it definitely sounds to me exactly like what they want to prevent with the whole intent system
And they're back calling the antispam/nuke an antiraid feature
Really Discord just doesn't want to give the intent to anyone unless they absolutely need it
There are VERY few reasons that you would absolutely need presence data
Itâs very sensitive data
And therefore theyâre very protective of it
a couple commands use it, plus this anti raid feature is cool, detects self botting users and notifies staff about them
if that were the case they would've told me to remove the feature, not just say something along the lines of "this is not a use case we would provide the intent for, however if you add additional functionality which needs the kntent, u can reapply"
if i disable the intent and let my bot go past 100 servers i think around 6 commands would fully break
and some backend stuff too
I can't really see a single way you'd detect a selfbot without more than 50% false-positives
Yeah
If it was possible discord would've done it already
yeah that's why i use a treshold system
Youâre also sending data to server owners about accounts that did not necessarily consent to have that data shared
the more detection points the higher the chance of self botting
goes from 0% to 100%
at around 10 different ways of detecting the self bot so far
This is probably part of the reason they denied your request
i'm not nexessarily sending the owners any data
just saying something along the lines of "hey watch out! (user) may be self botting"
probably should've said that in the application ...
I donât see how you need presence data for that. It just sounds very very very unreliable
Mind to give an example of what'd be detected as selfbotting?
for example staying online with no activity or being online on multiple platforms eg. desktop and browser
those two would account as around 25% to self botting, if it gets past 70% the bot sends a notification to the owners
staying online with no activity
Lmfao
most of discord's users
yeah that's just one of the ways detections
Dude, Iâm on mobile and desktop right now. I have it open on my computer
You see how problematic that is?
well that would not give any point
only browser activity can count as a self bot
and not many users use browser anymore
less than they use desktop that is for sure
well true
And not everybody has a computer with enough resources to run discord on their native application
but that is only one way i detect it, if someone does that it won't automatically send notification to the owners
Nor does everybody want to
it would have to add to more than 70%
Again Iâm saying thatâs unreliable
that by itself would be around 1/10th so 10%
I think that detecting self bots is not something you can do
Otherwise like @lyric mountain said, discord would already be doing this
âProbably notâ - a single dev with access to way less data and resources than an entire multi billion dollar company
well that is why i'm saying probably
its less likely because i haven't seen anyone really get banned for self botting
or they do and just don't care lol
And yet that makes you qualified on the methods used to detect them..?
They ban them before you see them most likely
if they provide the data for them so might as well create something unique
I think that itâs not fair to assign arbitrary probability values to people based off of data that you just randomly decide makes them to be a selfbot
Hence why your request was denied
Itâs not necessary
You just decided it was correlated
i mean it's not random, all of the data gatheted together makes quite a good argument for self botting, that's a kind of algorithm
which makes sense
person with no activity and staying online on both mobile and browser has a higher chance of self botting and person with activity and only mobile even if just by that 1 or 2%
how's that not fair
that's how any system works
^
I imagine you'll also be flooded with false positives on servers with minigames
Since people tend to spam the hell out of it for credits
He is just giving random values to it with absolutely no reliable data other than âI said soâ
nope, the bot doesn't send notifs unless it goes over 70%, and the notifs can be toggled on and off
well they're clearly not random
He made it up
it doesn't look like it
Youâre telling me that 1 in 10 discord users that use their phone and have their browser discord open at the same time are self bots? Thatâs clearly incorrect and unreliable
Waffle means your severity metrics aren't really solid enough
no, again, those detections will account to around 25%, u need at least 70% to get a detection
Then it's, at worst, unreliable; not made up.
Like, for such types of detection you usually need a metric of how likely an action is from a selfbot
yep
And what makes you think that presence data correlates with selfbotting? Do users that just donât set statuses selfbot?
Itâs not just unreliable it is completely unreliable
that's the same thing
Ye, u don't need presences for detection
i imagine you would need a self bot to for exame change your status or presence every 30 seonds right, my bot records that data
Online status doesn't mean anything
I donât think youâre going to convince discord to give you access to sensitive data with this system
i also watch for users sending embeds in chats
I donât get why youâre arguing about it. Discord already said no and I highly doubt they would change their mind
Okay thatâs the only legitimate thing Iâve seen so far
i didn't really want to share all the methods lol
That has nothing to do with your original complaint; getting presence data
Thatâs what this is about
Like, for detecting a selfbot u need to watch for bot-exclusive features
yeah presence is a part of the detection
Like embeds
Okay then why do you need presence data that is so clearly unreliable
just proving its actual data and not made up
The rest should be enough
its nice to have additional data
plus i also use it for other things, such as afk statuses, and game commands
Depends
like hangman
There's actually a quote from sun tzu abt that
Ok then while youâre at it why not have my credit card number, SSN, address, phone number, email, and all of my personal data so you can determine if Iâm a real person or not
"Even worse than no information, is wrong information"
I think
Been some time since I read art of war
that has nothing to do with presence
and you do not need the presence data because it is sensitive on a user to user basis and completely useless for your intended purposes
nobody cares if their presence is being checked or not, its literally visible if u click their profile and if it really bothers anyone they can dm me and i'll blacklist them from my bot
Yes they do
Automated systems can determine a lot about you based on your presence. Not everyone is assuming thereâs a bot monitoring their status 24/7/365
So...if I had a selfbot I could just ask u to ignore me?
Then u don't need presences if it works without it
it works better with them
i think presence is around 40% of the overall self bot detection
so without it it would never even go past 70%
would never trigger a detection
Then itâs a bad system based on what youâre telling me
So by ignoring my selfbot I'd have 40% more chance to pass undetected?
its good, it worked before
well, that is true
but it was required by discord so i had to do it
might change it up some
i read advaith notes on that
Discord is not going to give you permission to have access to very personal and sensitive data at a mass scale just because you have some unfounded ideas about how presence is connected with selfbotting
wait why are we even discussing this
Because you wanted presence intent
i oeignally came here for a another idea to use the intent
And weâre telling you that discord is extremely unlikely to ever give you that even if you have some other feature that needs it
Well ok, I won't try convincing u how pointless the whole thing is, just know this is basically sisyphus' tale
at this point i got so many features that use it
You'll chase ur own tail trying to cover the many holes users will find on it
2 big ones and other smaller ones in game commands or user info commands
and backend stuff too
Personally if I saw a bot monitoring my presence to see if Iâm a selfbot or not then Iâd nope the fuck out of that server asap
People do not want software monitoring their personal info so closely for such illegitimate purposes
I'm personally curious to see how this will end up
I donât even see what the point is even if you do see a likely selfbot. Theyâre going to get caught just the same as the rest of them, they show that theyâre obviously selfbotting some way or another
if discord won't give me that then they should just tell me what to change instead of gaslighting me
If anything your bot would cause people to receive way more false bans than true bans from server owners trusting your bot too much
That's not why they didn't give u
Nobody is gaslighting u
The thing is that the reason is way too weak to get a privileged intent
We've been trying to tell u that for a long time
bro its not like i'm storing every bit of information on the user, there is just occasional periodic checks, and all i'm storing is basically true of false, is that detection or was it not
The only ever time I used presences was to know when people was online for my tamagotchi module
if it's too weak i will find a better one
So the pet wouldn't die when people were sleeping
and i use that for games like hangman
...how and why
if they go offline theu get kicked out kf the game
inb4 bae says âgood idea Iâll make thatâ
the hangman games last between 10m to an hour so it was needed
Fun fact you can go offline without needing to be offline
Ha good luck making a tamagotchi module
my bot says u can't go offline during hangman game
Thing is complex af to properly work, part of the reason why I dropped it
can't rly be asked to make something that big rn
Btw, as waffle said, u can go offline during the game without getting offline status
There's also the invisible status
i had to add that cuz ppl were going offline during games n that game was made for big severs
they just can't play
Wouldn't be more sensible to add a timer?
nope that caused too many problems
...how?
ppl would be mad that their time ran out, and it was a big commotion, a more simple way was to add lives on wrong guesses
Why patch a hole in a wall with putty when you can replace the entire wall
Also, if someone took longer than, say, 1 minute to make a play then it's player's fault
My tcg uses 3 minutes for WO detection and very few were slow-thinkers
that makes ppl mad cuz they have to wait, imagine 10 out of 25 ppl in a row go offline then they have to wait 10 minutes for game to continue
Mostly newbies that didn't read the guide
better to detect if they go offline
Then have an option to end the game immediately
Or votekick
Yeah
well that would be hella complicated đ
Not at all but sure
No, that's a proper solution
An example to freeze a game in ur current system: I leave my phone with discord open and go take a shower
Or go to the market, whatever
i would have to intruduce another command that goes into that command its a whole other mess to handle
Or worse, I slept
Ur using commands to play?
my hangman is activated with a single command and then ppl just put keywords in the chat which make the game work
like end skip or guess
I was supposing u had a runtime for interactive games independent from commands
yeah that is what i have
Then how is a votekick too complicated?
say a game started and a person has to guess they have to either guess say end or skip
Hangman can't skip, but yeah
how would ppl vote kick then? i would have to add a command to do that
that would be even more mess to handle
Like votekick @somebody
Then u don't have a proper game runtime
Been there, done that, threw it out of the window and rewrote it
cuz the way i do it rn it might not work too well
well rn i'm gonna have to focus on getting the intent one way or another because i want my bot to go past 100 servers
come on that game took me a week to makr đ
Just give up on the intent, u won't get it with legitimate ways
u want me to go through that hell again
Only a week?
i have to, at this point my bot relies on it too much
"only" đż
My runtime took 4 months for v1 + 1 year of QA and bugfixing
i dedicated about 4-6 hours of my day for that đżđż
v2 took around 2 months
that must've been really big then
Not much
The issue was that I allowed too much technical debt
So I was making holes trying to fix others
My current runtime is rock solid cuz I learnt from my past mistakes
well i might have to do that for a couple of my things
Rewrites are always worth it
but no way i'm going to remove presence, i'm too deep in this to stop
literally i would have to rewirte 80% of my bot
and that bot took me literal years to do
from the beginning to every command to every rewrite and to every bugfix ever
I can't really imagine how presences would compose 80% of a bot
Don't u have encapsulation?
not rly 80% just that most of the functionality relies on passing the presence info from one module to another
Actually, what type of coding are u doing? Functional or oop?
so about 80% of all the scriptsin the bot have some part in presence
it's probably just 80% of the purpose
And I suppose ur not using interfaces/abstract classes
i think a bit of both
...
what language do you use
why not???
With interfaces you'd have to change a single place to affect everywhere
So the changes would be minimal
Heâs using js, heâs definitely not doing traditional OOP
i'm using a mix of c#, javascript and bash
which one is the majority
How in the fuck
javascript is the base
then it's oop
Honestly most are using functional js nowadays
uploads binary by accident 99% go
And I hate it
most js is not functional today
How are you using C# in this project
mainly servers and hosting, and some parts of my website
Youâre assuming he cares about actually making classes for things tbh, the commands are probably object oriented but the rest is probably functional
Idk, never understood the charm of functional prog
I feel like writing redundant shit without mutability
Perhaps I'm just too used to java
wdym everything u writr is mutable to some degree
oop isn't when {}
Not with functional
Functional by definition strives for non-mutable values
well in my case i use a mix of both
oop is when let c = new Command(); c.call() c.name
Everything is passed by function calls
i store everything in a class, which u can call from every script because it is binded to the very core of my bot
I prefer oop, feels cleaner
That's oop
but that class is accessible and inside it there is functions to get data, edit data, and remove data
Doesn't matter, keyword is class
NoâŚ
but in it there is also prewritten stuffa
Thatâs still OOP
and functikn which cannot be changed
đż
btw i just hit a new PR with my bots uptime
month and a half of uptime with no downtime
is it open source?
nope
Thought so
Well for one, u get some perks in certain services
technicallt everyone can look at and steal ur hard work
it kinda bothers me
so i only open source stuff i didn't spend a long time making
The other is that it allows u to ask people to help u fix issues on it, and increase user trust
They can't
And even then, nobody would bother to
people do
they can, and trust me they would
No they cant, not if u license it
i can't even count the times i went on github and steal some of others ppl code đż
you think they care about licenses?
this^
Well, if they get famous u can use it as a resource
and if their bot is closed source nobody would even know lol
good luck actually enforcing it for a small bot
yeah this alsp
if it's large then sure if you can bother
my bot would probably hit about 1k servers by now
mee6 not about to let their code get exposed
buut obviously discord won't give me the intent
If it's small nobody would bother to search for its source code
some people do
Unless u wrote the next billion-dollar code
i meannnnnnn
And what good would it do to them?
đłđł
they have the same commands my bot has
making my bot useless
Ever heard of coca-cola?
yes
If your bot does something well, you make an image for yourself
they don't share their recipe that's why copycats like dr. pepper taste like poop
(imo)
Even if others try to copy it, everyone will know yours is tge original
Heck if it was so simple I could just clone loritta and get a famous bot
well my bot so far hasn't made an image for itself soooo yeah
People won't copy a nobody's bot
they do
What even is there to steal?
idk, my website css, my bots framework, my bots functions or classes, its commands or almost anything tbh
If they clone 1:1 of ur bot they'll get a bunch of unmaintainable code
If they try to publish to topgg they'll get denied
If they publish on any other list u can recur to the license
i still don't see the point
At best it'll be used as a private bot of a 10-member server
i don't wanna deal with a bunch of kids stealing my code
That's the thing, u think a bunch of kids would even know what to do with that code?
probably
They'll buy a server, setup a database, bother to maintain a whole bot at their own?
i mean i sometimes look at other peoples code when making games to see how they did it
or see how people did the stuff i did
Isn't that a good thing?
That's just taking reference
and if they did it better than me i will obviously take the code đż
Like reading a cooking book
tbh no, i personally wouldn't want that
Or reading an academic research
Unless youâre going to make money off of it or youâve been contracted by a company and under an NDA or something, I donât see why open sourcing is an issue
or make a paid version of my bot
Not even, why would people use a paid bot if yours is free?
^
stealing my work is one thing
they might not know my bot exists
Your work is comprised of like 300 different peopleâs thoughts when you ask for help on things
Just saying
And copied code
^
What will u be losing then?
a code which i understand and copied it together myself đż
Ah yes because that makes it your work đ
it's not like the whole bot is compromised of people giving me code
You know thereâs a word for that in English classes⌠plagiarism C:
Which speaking of, you may be expected by some of the licenses of code you copied to make it open source.
Some licenses expect you to make anything you use open source.
I was going to copy paste a simple vector2 class from someoneâs GitHub, then I saw the license and didnât want to bother with all of that and just made my own
You also might not have the license to make profit(and therefore anyone who would copy the bot anyway)
so me writing a script, getting stuck on one line, getting help for that one liner and getting on with mt life afterwards make it not mine?
No, but saying that everything you did was your work and yours alone would be a false statement
Anyway my bot is licensed under GPL, it contains an intricate game framework and the entire tcg module
I would feel bad for whoever tried to copy it
And that applies to literally every project on the planet
well the part which was my work i would not want other people using
Someone elseâs work was used at some point in the process
And the many nights trying to understand how to use it 
Yeah I tried using your repo to understand reflection, it was actually pretty understandable
rip
Java is verbose, but very readable
java is one of the languages where u get stuck at first but then it just becomes a part of your life
Why thank you
The issue is trying to manage the bot itself
Yeah you have a LOT of code in there
Much less now after the rewrite
you would hate reading my games code prob
i write my c# like i write my js
(very unreadable for people besides myself)
Yeah if itâs anything like that than I would pity whoever has to look at it
I hope your formatting is better since visual studio is pretty strict on auto formatting C#
i use vsc đ
Unless you specifically fight the formatter so you can save 3 lines
https://github.com/OtagamerZ/ShiroJBot/blob/master/src/main/java/com/kuuhaku/utils/Helper.java what waffle meant probably lul
Exactly what I was talking about
Wait, vsc for cs?
Bro youâre just intentionally making developing difficult for yourself
At that point
that's A LOT of imports dammm
why
Ah that's normal, intellij prefers individual imports over package imports
i am good with vsc
I never write a single import
Also @lyric mountain why did you make it an abstract class instead of just making a private constructor?
intelisense installed, formatting done the way i code
Show me some C#
Cuz it doesn't have a single instance metgod
It's all static
I know
hold on
But you could make it a private constructor and would function the same
Abstract classes tell the runtime I won't be instantiating it
Ah
let me get some screenshots cuz i cba getting on my pc
Some sort of optimization perhaps?
Ig so, but I usually do it out of habit too
Abstracts are never instantiated, only extended
I usually prefer private constructor but they both serve the same purpose
(In this case)
here is some
acceptable though visual studio wouldâve put the brackets on separate lines
Though I do prefer the Java brackets now
yeah i had to manually disable that
Inline brackets ftw
Though you do have quite a few explicit type usages when you could just use var for simplicity
But again not a terrible practice
yeah had people say that
but if i know what the variable is gonna be whh should i use var tbh
C# prefers type inference when available
I also like rust for that reason, everything that can be inferred is inferred
Rust enforces it?
No no
Just the way itâs written strays you away from it because it declares variables like typescript
let variable_name: TypeName = initializer;
Ah
Since you donât write the type first often times youâll just end up letting the compiler infer
@wheat mesa u would really hate me for the way i write my js though đđ
thanks
Lmao sorry bae, but we usually refer to the "bae-o-meter" when people appear here with peculiar code
thanks đżđżđż
has anyone ever reached my level of code
No, but close
dang
A guy that used }; let stuff = ...;
one of the best things to do to make your code more compact đ
people should learn from me
And nier unreadable
doesn't make a difference to me
maybe even more readable
anyways i'm gonna go already i'm tired asf
gn
and happy new year
Cya
Can you actually delete DMs? I thought you could only close them.
Yes, "deleting" would be purging the whole chat and closing it
Tho actually, it'd not be possible
Since u cant delete the other side's messages
Nvm then
you can delete the bot's messages, the rest will stay
the dm will also still be open for the other party, you have no control over that
umm.. is topgg made using scratch
no
wait what
Waffle, I have a Database: sequelize
I am confused as in how to make a blacklist system using this database.
Under the assumption you mean like blacklisting a user from using commands you can do this in a multitude of ways.
Lets say you use /blacklist <user> what you could do is insert that data into your database. What I would do is the username and id to make it simple.
Then in the command handler you could code something like.
//fetch user by userid and store it in a variable
if(interaction.user.id === databaseVariable) {
//return whatever you want here.
}
You can always mess with the local HTML and remove the unwanted messages.
Its someone else who got banned via the bot
Yes blacklisting a user.
just wanted to know if its possile
If you're the owner of the bot yes if not only the "someone else" / bot owner is able to do it.
How would I fetch it to add the user into database? Then I can probably do that but in reverse for removing it
I mean I only know how to do this in mariadb. But there should be an insert method to yours and also a fetch.
For example for me mine is
async function fetch() {
try {
let connect = await pool.getConnection();
return connect
} catch(err) {
console.log(err)
}
}```
Yes I am the bot owner
Then you'd fetch the users dm channel.
Then fetch the messages and fins the one you want to remove.
Then when you do just call the <message>.delete() method.
At least it used to be like that.
Ty"
I tried fetching the DM channel, nothing gets returned
Let me see the documentation. I haven't used djs in a while.
Have you got the message intents?
Yes
It is a private moderation bot for a large server so we have all intents enabled
Did you use the <Client>.channels.fetch(some_id) ?
It returns a promise so it has to be resolved.
It didn't return anything for the DM channel
fetching the user and then doing .DMChannel returned nothing
i can't remember the captilisation but i followed the docs
Nope
From the docs.
You should then cache the user.
Then get dmchannel
It should return a DMChannel
Then inside of it you can check the messages.
hi does somebody know whats wrong here and can help me with it
const Discord = require("discord.js");
exports.run = async (bot, message) => {
let embed = new Discord.EmbedBuilder()
.setDescription(`You can find all the commands in the selection below.`)
embed.setColor("#2E3192")
const row = new Discord.ActionRowBuilder()
.addComponents(
new Discord.SelectMenuBuilder()
.setCustomId('select')
.setPlaceholder('Nothing selected')
.addOptions(
{
label: 'Select me',
description: 'This is a description',
value: 'first_option',
},
{
label: 'You can select me too',
description: 'This is also a description',
value: 'second_option',
},
),
);
await interaction.reply({ content: [embed], compontents: [row] });
exports.help = {
name: 'help',
aliases: [],
}
}
you have given us no information on what is actually wrong
oh yea sorry it says interaction is not defined at the bottom
because it's not defined, you have no variable named interaction
but i have that in none of my commands
I would highly recommend learning javascript before copy pasting code from the internet
And its not even slash command i guess
Just change interaction to message
okay
would a collector in djsv13 actually 'pause' a while loop or would the while loop just move on without waiting till the actual collector stopped?
Because right now i happen to have the issue where it keeps on spamming the while loop without the collector being fully done
(I am trying to repeat a certain collector as long as a certain variable is not in the correct format)
depends
if the collector is async it'll run in a different moment
else it'll stop the loop
collector is indeed async
the same applies for anything in any programming lang
async = parallel
which means it's non-blocking
there's a misunderstanding here
the while loop IS working
the issue is that you need to wait for the async task to return something
yeah it is, but due to the async it will run seperate from the while right?
yes, unless you await it
await
await on the actual collector or while?
await can only be used on async stuff (well, in a way that it does anything at all)
connect the pieces now
we await the collector obv.
Yes
Hi everyone Iâm very new here and Iâm trying to learn how to do things to better my profile and server.
I've used the await on the collector
sadly it's still spamming everything
while(boolhit1 && boolhit2 || !boolhit1 && !boolhit2){
boolhit1 = false
boolhit2 = false
const collector5 = r.createMessageComponentCollector({filter1,
componentType: "BUTTON",
time: 10000,
max: 1,
});
await collector5.on("collect", async (i) => {
if(i.member.id !== gamedatabase[key].user1){
return;
}```
That's cuz ur making an event inside a loop
on doesn't return anything
but we had to use the await on the collector right?
Isn't this exactly what we are doing
Not really
Ur creating an event listener there
Also on isn't async per se
It just executes a task that might be async
i know that i am creating an event listener
but like, the djs v13 collector itself is an event listener right?
Apparently
so what should i do else? Maybe remove the while loop and have some sort of other way to do this?
Check the docs to see how to properly await for a single message
Also, why are u using a loop btw?
it's not really a message
but a button
I am trying to make a user click a certain button, if not the right one is selected, it will repeat the process
hence the while
Collectors have filters no?
Simply put the button check in it
It won't execute unless the correct button is pressed
i tried simplifying what i was doing in my explanation. I am trying to catch the input of 1 user, get the input of another user and then compare them to see whether a user made a goal.
It's basically a 1v1 shootout
where one is a keeper and other one the shooter
i try to keep on repeating this game till someone has scored as you can see
only problem that as soon as i reach my endgame it keeps on spamming this shit multiple times when i click a button
U should write a proper game runtime for such interactive games
yeah i know but this is just a temporary solution for now
as i want to present it to my friends
so its not really something too serious tbh
Only thing i am trying to figure out rn is how i can make sure my while loop doesn't start a new interation till my actual collector is done
I smell technical debt, but well
See the docs to see if there's any way to collect a single press
technical debt?
If there isn't, use a promise to lock the loop, then resolve it inside the collector
Things you leave for later but forget about it
It snowballs very quickly and can easily make the code unmaintainable
As bugs start to grow from the ground
Yeah that's true, the whole code is done already tho so this would be the only thing to fix and then i can play it with my friends
If it was something for public use or anything i would've used actual functions etc, but i thought that they were not really needed atm
Well, yeah the listener (collector.end) is one.
The max is set to 1, so it stops the collector when a button was pressed.
Problem is that it continously tries to only run the first part inside the while and then reloop
May i show you the snippet of the while?
Done for now
Then use a promise as I said
the async/await?
I have tried that already but it doesn;t work
I said promise, not await
const lock = new Promise()
Then await it and resolve inside the event
i see, so i will await the lock at the begin of the while loop, and then use .then(function(value){....} )?
Never worked with promises but this is what was on w3schools
You will await right after you add the event
You'll use resolve
and imagine that we would have 2 events?
One
Because i am having one collector.on and one collector.end
I have no idea what ur doing, but you just need a single event to process the press and release the lock
yeah i am lost in this promise as well
Promise is just a task that might complete later
var promise = Promise.resolve(17468);
promise.then(function(val) {
console.log(val);
});
//Output: 17468
```I see, i am following this little snippet to basically understand it a bit more
it's on geeksforgeeks
but a promise.resolve basically returns a value that is trapped inside right? But how would it fix our timer issue?
const lock = new Promise();
collector.on("collect", evt => lock.resolve(true));
await lock;
For example
oowh
i see now!
Will try it out then.
that const lock = ...
must be placed outside the while i suppose
i see
and for each single collector i must create a new lock right?
Or only 1 for ALL collectors?
Suppose i have 2 collector.on
You need to create a new lock for every single time you want to lock
Just make sure collector.on doesn't stay alive after resolving it
Else it'll memo leak
Uh, what the hell are you even trying to do exactly?
He's trying to await a collector event
why not just use the event itself?
Well...scroll up
I'm not sure what I'm looking at tbh, I just know that they want to run collectors inside a while loop
this right?
I dont think creating a promise is essential, nor the most readable/efficent way of doing this.
I don't know if there are other ways of awaiting the collector result
There's a complete misunderstanding here, you can't halt the while loop from iterating like this when you're using a collector because that's not how promises work, the way you can achieve this is to make a function and put your entire code you want to run repeatedly, and once your conditions are met or the code has run the way you want it to, call the function again
Basically recursion
U can't use promises as locks?
hmm? Yeah this is what i am trying to do.
Oehh recently got that in c++;
wouldnt you just create a new collector each time the last has ended, until a win condition is met.
essentially what i am doing atm
With the while
no need for a while loop, just create one inside the event callback
not sure whether that would work?
Might need to show yall the snippet of the while
thats how other bots make turn based games.
so you guys can see what i actually have
For my runtime I just make a single collector that handles everything
The entire turn logic runs inside it
^ that works too
Just make sure only the playing users are captured
After that it's just checking if the user is equal to the current player
owh wow that is actually pretty smart
I will do that the first thing in the morning then, thanks yall for the help
U said u didn't want to make a proper runtime when I told u earlier ;-;
the problem with this is
that i only use 1 general collector right
but that collector is bound to a message
so after all these user actions, i would want to send another message and create another collector etc etc
but that wouldn't be possible within the while
that's what i've been trying to avoid
You'd need to use a collector that isn't bound to anything
owh is it possible for a buttoncollector to not bind to a message?
Then filter to grab only of the specified message's buttons
Promises are just a floating state that holds an uncertain value, which can be either resolved or rejected, the program will keep going until you resolve the promise with the await keyword which'll halt the execution until the promise has been resolved, consider the following:
while (true) {
const foo = new Promise((resolve) => setTimeout(resolve, 5_000));
console.log('bar');
await foo;
console.log('baz');
}
This'll work as expected, it'll wait between each console.log() call for 5 seconds, and the while loop also waits for it
But consider this scenario:
while (true) {
const foo = new Promise((resolve) => setTimeout(resolve, 5_000));
// Let's say `bar` is a collector.
bar.on('collect', async () => await foo);
console.log('bar');
}
This one won't work the way you might expect it to, because the callback may or may not be called, and so the iteration keeps going and doesn't wait for the execution to be fully completed
What you're thinking of are mutexes and their locks, promises however, work differently
I thought they worked like java's CompletableFuture (or just Future)
https://discordjs.guide/popular-topics/collectors.html#basic-message-component-collector we sadly can't remove the message
where the collector will be bound to
You can
owh i can?
All messages (except the ones the bot doesn't have permission to delete) can be deleted
It doesn't matter if a collector is bound to it or not
Although be sure to stop the collector before deleting it, because the collector may throw an error if it's not finished collecting yet
I've never thought about it throwing an error if deleted.
Good thing to keep an eye on
Does discord.js have a way for a user to simply select "on" or "off" without me specifying a value like String or Number? These are sub commands. Like if someone hits "on" I don't need it to use a String choice 'on' I can call which option they selected?
name: 'auto-play',
description: 'Makes the music player default to auto playing',
type: 1,
options: [
{
name: 'on',
description: 'Turn on auto play | Will queue related songs',
type: 3, // string
required: false,
choices: [{name: 'on', value: 'on'}]
},
{
name: 'off',
description: 'Turns off auto play',
type: 3,
required: false,
choices: [{name: 'off', value: 'off'}]
}
I see.
Knew that was there, wasn't sure if it was what I wanted but I'll test it out
Though I personally think a single option like status of "on" or "off" (or even called play with a boolean) would be better, since the fields are likely mutually exclusive
Well it's nested within my settings command
it's for my database for initialize my queue
So I think understanding what you mean.
name: 'auto-play',
description: 'Makes the music player default to auto playing',
type: 1,
options: [
{
name: 'status',
description: 'Turn on auto play | Will queue related songs',
type: 3, // string
required: false,
options: [{name: "on", description: "on"}, {name: "off", description: "off"}]
},
but wouldn't I have to still specify boolean in type n whatever
oh no I think I get it.
It would mean that the command is run like /set auto-play status:on
Does this output the responses as fields or just one big description?
A friend sent me this since I don't know JS
Connecting Google Form to Discord
why would you not just https://tryitands.ee/
from the look of it, should just be in the description
I can't try it and see because I can't see what Discord sees it as
But I cannot confirm whether or not the rest of the code actually works, I just looked at what you're sending in the POST request to discord
What in the hell is that code
@sharp geyser

