#development
1 messages · Page 1978 of 1
Yea.
But I'm not finished all my commands, so I need to update that thing to what in order for the guild commands to register instantly?
The front page does show an example with them, but you'll need to fill out GUILD_ID
await rest.put(Routes.applicationGuildCommands(guildId, GUILD_ID), { body: commands });
Alright, thanks!
<script>
async function addUser() {
const { value: userid } = await Swal.fire({
title: 'Enter user id',
input: 'number',
inputLabel: 'User ID',
showCancelButton: true,
inputValidator: (value) => {
if (!value) {
return 'You need to enter a user id!'
}
}
})
if (userid) {
const { value: reason } = await Swal.fire({
title: 'Enter blacklist reason',
input: 'text',
inputLabel: 'Reason',
showCancelButton: true,
inputValidator: (value) => {
if (!value) {
return 'You need to enter a reason!'
}
}
})
if (reason) {
$.ajax({
url: "/addUser",
type: "post",
dataType: 'json',
data: JSON.stringify({userid, reason}),
success: function(result) {
console.log(result)
document.getElementById("userCount").innerText = Number("<%= users.length %>") + 1
const Toast = Swal.mixin({
toast: true,
position: 'top-right',
iconColor: 'white',
customClass: {
popup: 'colored-toast'
},
showConfirmButton: false,
timer: 1500,
timerProgressBar: true
})
await Toast.fire({
icon: 'success',
title: 'Success'
})
}
});
}
}
}
</script>```
have i gone stupid
Uncaught ReferenceError: addUser is not defined
i removed all and made it do alert("test") and it worked
so its a code issue
is the function loaded by time you use it
I think script tags behave a bit differently
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> is at the top
I'm referring to the addUser function
I do not understand animations in css at all 😔
since that clearly doesn't exist in whatever area
ah ok
trust me none of us do
I don't even know css and don't want to know it exists
its at the bottom of the page before </body>
All I am trying to do is have a link change color on hover but not instantly
transition
I tried using a transition but I have 0 clue of how it works
I think script tags are loaded just as regular tags: from top to bottom, so if you try using that function before it's been defined, it won't work
.link {
transition: 0.3s;
}
.link:hover {
color: red;
}```
like that
that works
(just tested)
Mmm that doesn't work for me but I figured it out
.link {
transition: color 0.3s;
}
.link:hover {
color: red;
}
Apparently that tells it ye use that prop on whatever is using it e.g hover
alr
I also fixed my nav bar
1
2
which one do you think
The border shadow on 2 is darker
Yea I thought so as well just wanted a second opinion
hey i have made this little quiz for friends, the question1 is always the right answer. How can i actually randomize it's place, from 1. 2. and 3.? js .setDescription(`Which one is the lie about ${user.username}:\n1. ${question1}\n2.${question2}\n3.${question3}.Type the number *1, 2 or 3* below to guess!`)
how do you define the questions?
User inputs
$.ajax({
url: "/addUser",
type: "post",
contentType: 'application/json',
data: JSON.stringify({userid, reason}),
success: function(result) {
const Toast = Swal.mixin({
toast: true,
position: 'top-right',
iconColor: 'white',
customClass: {
popup: 'colored-toast'
},
showConfirmButton: false,
timer: 1500,
timerProgressBar: true
})
if (result.err) {
await Toast.fire({
icon: 'error',
title: `Error: ${result.errmsg}`
})
}
else {
await Toast.fire({
icon: 'success',
title: 'Success'
})
}
}
})```
is that formatted wrong
because its not working 
when i remove the "success: function(result)"part of the code it works
ok i'm a fucking dumbass
i fixed it
why are you using ajax anyways
thats no excuse
wdym user inputs? the users define which questions and which answers?
need to make success an async func anyways
Cool
right @spark flint
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! disbots@1.3.1 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the disbots@1.3.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-02-13T05_07_16_737Z-debug.log
exit status 1
Anyone know how to fix?
This error log does not provide any valuable information to work with. Try running node index.js to get more information.
/home/runner/Disbots-2/index.js:1
x/*=======================================================================================*/
^
ReferenceError: x is not defined
at Object.<anonymous> (/home/runner/Disbots-2/index.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
lmfao what
I am using replit.com btw
show your code
Show my index.js?
Yes.
I'm aware
You have an un-escaped character there. Remove it.
idek how that came, i must have typed random stuff while sleeping
it's very obvious that he just typed x at the top
I "love" helping people who don't know anything about their language or coding in general. Trying to teach someone how to think in terms of logic is "really fun"
teaching the concept of types should also be simple, but people usually have difficulty with it
what is the difference between computer science and software development
Comp sci can teach hardware components and their logical approaches as to how we got from then to now. Also the concept of firmware
Comp sci does mostly focus on software development though, since that's what most people are after other than the pink thigh highs
I learned how DDR ram came around and their generational improvements
At the time, I was somewhat hoping they'd cover firmware or OS dev since that's what I originally wanted to get into, but coming out of it and knowing what I do now scares me to think how tf someone would try to teach that

thank you so much Tim i was trying to get around this problem for 6 hours
You're thinking of Computer Engineering.
Computer Science focuses mostly on theory. Software Engineering focuses on development.
Comp Sci is usually theory backed with a tiny bit of practical application of code written like were in 1993
Pretty much
great work Anthony however I took some points off because you used 21st century patterns in your code
"You used C++23. However, we only allow C++98 here. Therefore you failed"
next time please do not be excited by the class material I'm teaching or attempt to learn more by reading ahead
This actually reminds me
I had to blindly guess the C++ standard an old friend of mine used by literally trying out all of them going back all the way to 98
They were taught C++98 in some engineering degree
My uni teaches 98 lmao
and I TA'd 98 for almost 4 years
What a fun time
We taught C with classes basically
Unis are a joke
they require you to have a terms of service and privacy policy now
terms of service describes how users can use your bot
privacy policy describes what data you collect
as well as how long you store it etc
don't set it to google.com because they'll know
what happen if I try to set topic in voice channel. Will the topic persist?
They try google.us and you hacked the system 
set it to goggle.com to do a considerable amount of trolling
what can I do ?
hey i have made this little quiz for friends, the question1 is always the right answer. How can i actually randomize it's place, from 1. 2. and 3.? ```js
.setDescription(Which one is the lie about ${user.username}:\n1. ${question1}\n2.${question2}\n3.${question3}.Type the number *1, 2 or 3* below to guess!)```
use an array and shuffle
as a rule of thumb, if you have variable names that end in numbers you're probably doing something wrong
in this case you can generalize your problem by putting answers into an array and shuffling them and formatting it into a string later
i asked you yesterday to show how you define question1, question2 and question3
that's what I was gonna ask hahah
Asking doesn’t guarantee to get an answer 
Asking basically means they’re gonna ask again tommorow and ignore your attempt of help
Welcome to top.gg

can anyone help me how to reply when the button is clicked?
You will receive a button interaction object with your event listener
?
Did you already create a listener for the interactionCreate event?
fake can you also help me build the next facebook
const client = new Client({ intents : 32767 })
const prefix = "!"
client.on("ready", async() => {
console.log("bot is online")
})
client.on("messageCreate", async message => {
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift();
if(command == "ping") {
message.channel.send(`:ping_pong: pong! ${client.ws.ping} ms.....`)
}
if(command == "button") {
const embed = new MessageEmbed()
.setTitle("These are some discord buttons")
.setColor("GREEN") ..................

wheres the rest of it? perhaps the archives are incomplete?
Instead of listening to the messageCreate event you will have to create an event listener for interactionCreate
ok i will try
Ignore the dude called Tim, he’s a known troll but we can’t get rid of him since he invented JS

Oh oh, we made him angry
const prefix = "!";
and that, my friends, is how bad bots are born
Will die soon
god please be soon

MESSAGE_CREATE > *
i wonder if you can get self bots to work in djs just by setting the token from BOT to user or whatever the prefix for user tokens are
asking for a friend
meh do they really check
only one way to check :^)
theres also the lib string in the identify
i'll remove that i mean he will remove that
xD
do it on a fake account
well yeah what im already doing
or better yet, do it on FakE's account
actually but then
if someone stole your token they could do that to ban you
but then ah they'd rather have you banned than have you spam send dms or something
also discord recently told eris to remove all selfbot support
not like it worked anyways
yeah if someone stole your token, you'd have bigger problems
discord isnt doing that much to stop self bots
they could do a lot more
its annoying and time consuming reverse engineer apis so they could use that to their advantage
even if its changing something like "content" to "value" it could stop a lot of attacks
but then old clients would die lmao
nvm
honestly just setup traps idk and ban on the slightest inconsistency
you're forgetting that false positives exist
Does someone know why docker keeps throwing me this error? /bin/sh: 1: [npm,: not found
this is what i have:
it's the reason why so many votebots still exist on topgg. I could make it crazy difficult to vote with bots but it would also be crazy difficult to get legitimate votes in and would piss everyone off
you're missing a comma
That hurts developers as well since it's an unnecessary breaking change
And self bots will just update the value
And old clients of actual users may just stop working
yep, when you're fighting against bots there are so many things that make your life difficult
didnt see that, thanks! but i dont think thats the problem... give me 5 minutes to bundle it and see
also I recommend moving npm install above copy .. so you cache the dependency installation
Like, that's like going "oh, I'll just rotate this string by one character and hope anyone who manages to break in is stupid enough to not figure out how to decrypt it"
have you actually built your image off of the node image?
also be wary of doing a COPY . . without having a .dockerignore to stop it trying to copy things like your node_modules folder
thats the go-to for most anti-abuse tho. Make shit complicated and frustrating and not genuine security
hello guy im try to open share screen by selfbot i use this code frome discord.js-selfbot but this is dont work
client.on("message", async (message) => {
if (message.author.id !== "920038866621177927") return;
let args = message.content.split(" ");
if (args[0] === "~play") {
const connection = await message.member.voice.channel.join();
const stream = await ytdl(
args[1],
{
stream: true
},
{
quality: "94",
}
);
connection
.play(stream, { seek: 0, volume: 1 })
.on("finish", () => message.member.voice.channel.leave());
console.log("playing");
}
});
oh nice self bot bro
Yes, but using that in areas where genuine security is required is what I'm talking about
Like your password
what??
you can't really stop bots like that tho
oh fuck
why 😅
dont use selfbot 😬
I think the easiest way to raise the bar significantly is to completely block clients through tls fingerprints. I'm curious why cloudflare doesn't use that heuristic to stop anyone connecting with a user token not on a browser
trust me, you can't screeenshare through djs
surely there must be a good reason but I don't know what that is
or any other lib really
why b?
no lib has video streaming implementation
this is bad
just stop making selfbots you nerd
lol
😒
video streaming is undocumented and it's way too much effort to reverse engineer it, so nobody bothered to implement it
Except me 
why risk losing your account
but you gotta pay me to tell you how it works 
ok
damn capitalism everywhere
discord won't do anything to your account unless you actually start affecting other people (i.e. mass dm)
come to prv😂
how do i make the imput a fa icon?
no
why
even if you got told how it works you probably wouldn't understand it
because I am a mean individual who doesn't like people self botting :P

🥲 💔
welp
😛
ok i try by my self 😈
<button><i class="fal fa-face-confused fa-shake fa-6x"></i></button> 
you're underestimating the technologies used and their flow
it's not as rainbows and sunshines as just using djs
oh yeah
i get a new idya i well do it
you dont touch a discord lib at all
its a form
i dont
you will spend most your time working with a WebRTC client and dealing with all the handshakes around that
time to find out where they hid the video streaming code in the discord.js codebase
but i have othe package to get a chrome tab i use this

😂
dumb people will stay dumb because they think they're the smartest
smart people will stay smart because they know they're not the smartest
ok guy ill work on it i need to create it for tomorrow
🤷♂️
passing screen inputs to puppeteer so you can stream random shit on a headless browser 
i see someone do this before
oh I mean you log in once and save a session
userDataDir bois
storing a token in localStorage
and now im in 2 discord derver that have this bot
Lmao
hello how do I get my selfbot verified by discord so ppl can add it to their server

Then use type="submit" as attribute on the button
😂
i put this to my bio

always suprises me about the intelligence of discord users
i get infuriated
You can also go totally crazy by applying the font family to your input tag
<input type="submit" class="btn btn-default" value="" style="font-family: 'Font Awesome 6 Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;"/>
But I would suggest to use the button as I mentioned above
help prometheus isn't reading metrics from my services
webserver where
bruh why are my logs out of order
wait no I'm just... reading it in the wrong order omg kill me
a slightly scary piece of rust code
bit nicer
The background actually is more scary than the code
@quartz kindle trying to get it to work i just found out something
gateway intents ALSO work for user accounts
if you dont provide any you wont get any events
but privileged intents do not work
probably a bug
no material theme, literally unusable
material 
you have now been cancelled
you must find another community
no more javascript for you
maybe python will accept you
but they hate people that use semi colons

did you get blocked
not sure
Is there a bot spam channel?
Ok thx
not sure how I'm exceeding rate limits 4 hours in between requests
what is that graph
just a scatterplot of individual requests per website
Ratelimits of once per day is the best.
All my sites use it.
^_^
@modest maple do you use json logging in rust?
depends on if i need it to or not
how do you get a user with a user id?
normally I just expose it behind a flag on the runtime with like --json-logs
what I do for lnx atleast
What library are you using
nodejs
so discord.js
Use <Client>.users.fetch(...): https://discord.js.org/#/docs/discord.js/stable/class/UserManager?scrollTo=fetch
lmao
I suppose everyone forgot eris existed
Wait no cache?
fetch will look in the cache for you first
if not it'll ask discord for the user by their id
UserManager.fetch adds the user to cache if it isn't there already
Ah ok thx!
unless you specify in the options you dont want it to cache
and detritus too
useful if you need to fetch multiple objects but dont want to store them
about sums up the library
damn stole the words from me
hmm alright. I'm trying to do a proper loki + grafana setup and I feel like json makes life very easy
where's erwin when you need him
Then do it
Its like
5 lines
and SnowTransfer
shameless plug
I didn't say I'd maintain Discord Libs to not plug them
Dealing with Discord's shit is annoying
I got a DiscordAPIError: 404: Not Found
But the id exists
My first and last time using Google API
make sure you didn't accidentally copy some other ID like a message ID or channel ID or what have you
how many bots would there be if there were no discord libraries and everyone had to use the api
a few
🤨🤨🤨
impossible for someone not to make a lib but ok ig only 10% of bots rn would exist
Good thing I understand how stupid the api is
I'd probably spare myself the pain of doing another bot
yo
so like
if you were to do map.entries() are results ordered?
based on which element was set first
if its a Map then it's insertion order
although I wouldn't ever rely on insertion order of things like that regardless
say less
less than that
1% is already a lot imo
yes
It probably depends on what you mean with no libraries.
If example bots exist I bet it wouldn't matter much
But still there would be alot less bots
lets go down to the implementation details (not that i care too much)
how tho
if its a hash map the order is based on the output of the hash
unless theres an internal object which keeps track of each objects position
OR
the map is also a linked list
pretty sure it uses two stores
an array of keys plus a hashtable of keys values
that page is actual waffle
what do you mean lmao
sounds about reasonable
or rather, a linked list, as described in the link above
since there is no need to access data by index, you dont need a full array of indexes
a linked list is enough to iterate in order
i went through so many segfaults to implement a working linked list
xD
In discord.py is there a way to stop users from spamming commands and gettings the bot API banned?
I've added cooldowns but i'm not sure if it works for the API bans
make cooldowns per channel
Do the e.g @commands.cooldown(1,15,commands.BucketType.user) work for API bans
Like do they count as a API request
when you say api ban, are you referring to the discord api, or some other api?
Or 429 cannot quite remember
429
Yeah
then your api ban may be due to other bots as well
since repl.it clusters projects under the same host, a different bot may spam the api and get you banned
despite you not being the one actually spamming the api
Could this get my discord it's self banned?
For spam or something
Or only IP based
only ip bans
requests are made under a token
tokens exceeding rate limit buckets are more prone to bans
although, if the lib handles buckets properly, it's really hard to hit buckets unless it's intentional or sharding at a large scale
Do cooldowns count as a request
If you don't reply to people who are on cooldown and just return, then no requests are made. The user input is ignored
So I should not make a @command.error?
Okay ty for ur help
Chad-Only Business Oriented Language
question are bots required to be connected to the gateway to send messages?
No?
How can I do something like this:
Like I have a object with all the cards possible in the game and with their arena, ability, name...
And I have a array that calls the owned cards from my db, and it's another array with only names, e.g ["Giant", "Archer", ...]. If I want to get all owned cards arena, how do I get it? I know that I have to check it from the object but how's it with multiple entries
reason i dont want to use webhooks is because i want to edit messages as well
People make serverless bots
sql?
im guessing that wont really fly with discord.js since objects need to be cached
what's the primary key for the cards?
all
and where do you store what cards each player have?
a third table or an array within a column?
?
how do you know what cards each user has?
I store it in another table (i think), every time a player gets a card it puts the card as true (owned) and it pushes in the table
why do you have an owned value at all?
like, do you have a diagram of ur database so I can understand the actual scenario?
some database tools have a diagram generator (just saying)
yes
yeah you cant
I just need to understand his structure
iirc discord made it so you have to connect to the gateway every once a while in order to be able to send messages
eh?
otherwise it returns a 401
no?
You can run bots entirely without connecting to the gateway now
this is the entire point of slash commands and HTTP
let me try
you don't even need to add bots to the server
oh maybe its because my permissions dont work lmao
afaik your bot needs to connect at least once in order to send messages
In Python, is there a shorter way to express "if x, x, else raise"? Take this for example:
if ctx.author.id in whitelist or ctx.author.guild_permissions.administrator:
return True
else:
raise UserChecks("You are not whitelisted to use this command.")
I thought I could use or:
ctx.author.id in whitelist or ctx.author.guild_permissions.administrator or raise UserChecks("You are not whitelisted to use this command.")
But that's apparently not valid syntax. I could abstract this away into a function, but is that the only option?
nope its not permissions
has connected more than once
just hasnt connected recently
like 2 years lmao
What error is discord giving you?
this works?
oh god the color
not at all
ok
So once you connect to the gateway you can send messages? 🤔 then that must be the issue
like, normally you'd have this:
- User (id, other info)
- Owned cards (user_id, card_id)
- Cards (id, name, other info)
then when an user collects a card, you'd add in the middle table
containing both user ID and card ID
no need for a boolean field at all, just check if the card exists there
OR you have an array column (not recommended) in user table
- User (id, card_ids, other info)
- Cards (id, name, other info)
I don't think they know what you're talking about. quick.db completely hides stuff like this and just lets you add / remove things from the database. I think it just stores everything as JSON in a single table
garbage
omg
indeed
What the fuck
this helps?
ok
My eyes
might as well use a single JSON file, lmao, just make sure writes are atomic
Just use mongo.db if you can't be bothered to learn how to use relational databases. It's as simple and it's 100% better than what quickdb is doing
sure you can. Just create a script which gets all data from your current db and saves it to a mongodb one
how
but it sure saves it in a .sqlite file lol
in a json.sqlite
what's easier, postgreSQL or mongoDB?
const allRecords = await db.all();
// loop through all records and add them to your mongo db
mongoDB
mongoDB is JSON but better
its not abt easier, it's just a messy way to try to turn sqlite into mongo
like, the whole thing abt sql is how freedom u have with queries
his DB is already fucked up thanks to quick.db, might as well go full JSON
better I start from 0 and go adding all the data slowly
Mongo is easier, postgres is “better”
tutorial to incorporate and use mongo?
ty
From the way I assume your code is set up, swapping to mongo might take a little while
Depends on your code
I have too much time so it's okay
If it’s organized and proper then it wouldn’t take long at all
nah. Switching to sql will definitely take longer, considering this person knows nothing about relational DBs, and that they're using quick.db
freedom (like flexibility) and sql don't go together
not even a villain would make that comparison
100% swapping to an SQL database would take longer, swapping to mongo is gonna take a little while too though
how so?
the opposite of my code
I’ve seen the way he has some things set up and I think he makes a lot of unnecessary db calls if it’s what I remember
my code isn't messy but the db sure is
(Also you’re going to want to implement a cache preferably if you’re using mongo)
Depending on what kind of data you need to store
cache?
Can I ask for UI advice in this channel?
A system so that you’re not making unnecessary queries to your db
Basically if you have some sort of data, say a prefix for a guild stored in your db, whenever a guild uses a command you want to see if your prefix cache has the prefix, if it does, then use that prefix, otherwise, fetch it from the db and put it in the prefix cache
This is usually done with a Map of some sort, in djs they use the Collection class for caches
But I’d focus on getting it working without a cache first, then implementing a cache after
SQL is not an expressive language. When writing small, simple queries, SQL looks like it works until you need something slightly more complex or if you need to change a query. There are many instances where wanting to make minor changes to a query results in 1/3 to 1/2 of the query being rewritten. The standard is huge to the point where no database fully conforms to it, and it doesn't help that every new addition results in more syntax, making the language more verbose and less reusable.
I feel like the playback control icons are too bold do you guys know any icon libraries?
^
sorry, where is "flexibility" being denied there?
I didn't say "smaller" or "simpler", I said "freedom"
Personally I hate using SQL, but I like SQL databases more, so I just get the best of both NoSQL and SQL by using an ORM
being flexible doesn't mean you need to be small nor simple
you want them to not be filled?
yh
with sql you can manipulate the data however you want before leaving the database, that's what I call freedom
you could just use SVGs instead of using icon libraries:
Forward:
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M15.5 3.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-1 0V8.752l-6.267 3.636c-.52.302-1.233-.043-1.233-.696v-2.94l-6.267 3.636C.713 12.69 0 12.345 0 11.692V4.308c0-.653.713-.998 1.233-.696L7.5 7.248v-2.94c0-.653.713-.998 1.233-.696L15 7.248V4a.5.5 0 0 1 .5-.5zM1 4.633v6.734L6.804 8 1 4.633zm7.5 0v6.734L14.304 8 8.5 4.633z"/>
</svg>
Backwards:
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M.5 3.5A.5.5 0 0 1 1 4v3.248l6.267-3.636c.52-.302 1.233.043 1.233.696v2.94l6.267-3.636c.52-.302 1.233.043 1.233.696v7.384c0 .653-.713.998-1.233.696L8.5 8.752v2.94c0 .653-.713.998-1.233.696L1 8.752V12a.5.5 0 0 1-1 0V4a.5.5 0 0 1 .5-.5zm7 1.133L1.696 8 7.5 11.367V4.633zm7.5 0L9.196 8 15 11.367V4.633z"/>
</svg>
flexibility is not limited to small and simple. but adding more syntax and calling it "flexible" because you can do "more" is not really flexible, since every bit of syntax added requires more input from you and makes queries much harder to write and maintain
I dislike ORMs more than SQL, but that's just me
appreciate you gang
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path d="M5 6.25a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0v-3.5zm3.5 0a1.25 1.25 0 1 1 2.5 0v3.5a1.25 1.25 0 1 1-2.5 0v-3.5z"/>
</svg>
This is pause
flexibility is literally being able to do whatever u want with the data you're getting
I don’t know SQL very well and an ORM just prevents me from writing horrendous SQL that would probably be exploited
simplicity/complexity and rigid/flexible aren't mutually exclusive
To me, SQL is both complex and rigid, unless I misunderstood this
Sql has a lot of freedom
like
One of the my sql queries I use for my analytics is like 10-14 lines long 👀
It's not very efficent but it works extremely well.

I prefer ORMs tbh. I find it better than just inserting large SQL code inside of a string, but that's just me
I use prepared statements anyway.
well yeah but the string is still there just not in the middle of ur logic
Does any1 know someone to host a discord bot for free/cheap
replit or heroku if you're willing
heruko is pretty good
Okay ty
I’ll say that I never really had issues with Heroku but it’s certainly not something for scaling imo
Nah scaling is easy on heruko
Heroku scales great
but it's pricey
Isn’t it expensive
Yep
Is heruko free?
Heroku has a free option yeah
You’ll only get like 21 ish days of uptime per month with one dyno
i would recommend somehost but that shut down, https://client.vertexnodes.com/ is the replacement
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Unless you add a credit card
but it's not about how many lines it took. it's about how you actually got there (this being what I don't like about SQL) and how you'll modify that query in the future. I don't want to sound aggressive, but do you think it would be simple to modify that query?
Which will give you like 40 days worth of dyno hours per month iirc
Is it free?
I wouldn't trust that
I use python anyways
https://capy-cdn.xyz/XKEqLXgX.png anyone got any suggestions for my new site
the gradient is animated btw
its not just shitty blue and purple
Hopefully I will never need to, its only for analytics.
But yeah it's not easy to modify, or even write(or atleast for someone my experience level).
But the general ideas on that query can be applied to many other cases.
It's quite easy to find examples of exactly what you want to do online(even if they are not the best way of doing it)
fun fact I just learnt: making a djs client with no intents, connecting then disconnecting the websocket makes djs a discord api wrapper without the gateway or events
I think you're really mistaking "small" with "flexible"
I don't think I am.
I have question that i dont want answer like change hosting
Why bot cant be online when i type node bot.js no error just nothing happens and process wasntt killed
Are you doing the client login?
Yes
client.login(process.env.token)
Key = token
Value = my bot token which i get from discord dev portal
I don't care if someone has a 10-30 line SQL query. I care about if that query is simple to modify (hence, flexible, since you can easily change it to meet other needs) and how writing it in the first place went, since it won't matter how much syntax you give me to do x, y, and z when I can barely do any of them.
no, adaptive is being able to fit multiple needs
flexible is being able to handle something with great freedom
they sound similar don't they
Like sqlite?
that's confusing. then what does "freedom" mean in this context, because it sounds it overlaps with adaptive
being able to manipulate the output however you like
so adaptive. being able to manipulate the output however you like is a form of adaptation. if you could only manipulate it in this narrow scope (like what happens with sql often), that wouldn't give you much freedom, flexibility, or adaptability
this feels more like a grammar war, which I don't want to get into
no
adaptive woul be able to use one code for multiple needs
or reuse
Anyway, I do mean a form of flexibility. In fact, a dictionary form: "able to be easily modified to respond to altered circumstances or conditions" which sounds, to me, exactly what I'm complaining about. In fact, it sounds very similar to adaptive: "A change that is made or undergone to suit a condition or environment."
orms are pretty flexible (imo)
to me they aren't, but to others, they certainly are
Mine is less of an orm and more of just a way to buffer insert statements together
but comes with my database layout as typings
Hey how do i let a cron function run once each friday at 9:am sydney time>?
cron.schedule('0 0 * * 1', async function() {```
using maths and setTimeout
I find their docs so damn confusing
wha?
I run a function every week at tuesday at 00:00GMT by finding how many ms is remaining today and then set a timeout for remainingToday to set an Interval for doing the task
wouldn't cron be a better option?
Then you have to install another dependency and read their docs which like you mentioned is confusing
I think setting up a "cron" manually is easier the way I described
I think that cron is easier and more reliable in terms of events, but yeah their fucking parameters are so damn vague
anyone know of a good way to prevent command spamming from bypassing a cooldown if the bot like lags or something?
that scenario is highly unlikely
True indeed, but it happens and I aint want my users to sell one item 6 times
store the cooldowns in some central place, like a map
then check it when the user runs a command
we use redis to save it in memory, and we do check
that's a party
use your language's equivalent of a semaphore/a lock
What do I select for bot?
the one that looks easier
railway is another free option out there, I personally recommend railway more than heroku
?
same
i host my bot on railway, really good
👍
👀 does discord provide referer headers? No right?
Thought so, thanks
Local
That allows anyone to connect to your db afaik
oh then still works
railway makes different ips for every deployment so with this, it's not a major problem
Morning, can anyone help me with discord permissions for a bot?
Basically I get this error {"message": "Missing Permissions", "code": 50013}
When the bot tries to change everyone role permissions in newly created channels removing their visibility.
I've been banging my head with it for 30 minutes trying different permissions combinations, but the only one that obviously seems to work is admin (8)
you need manage channels permission
how was it to send a log when connected to db?
already has it
manage roles?
client.mongo.connect(console.log("Connected to mongo")) <= this?
yes
thonk
all
have you tried modifying another role?
What could I add to make it work?
bot modifies everyone and user permissions
but not other roles
i know, have you tried another role except the everyone role
nop
what if it works?
I need to modify the permissions of everyone.
iirc the bot also can't modify permissions it doesn't have
idk if you added it already but maybe a features preview on a button or on the side and when you scroll down theres like a command list when u finish inviting the bot
ah
modifying the everyone role also requires manage role
I will add more info when you scroll down
as mentioned on the docs aswell, this also includes the everyone role
alright
is there like the style css heartbeat code available like can it still be used?
like on the bots profile
Css heartbeat? 👀
Like an animation?
yh indeed
Like this?
https://codepen.io/cjrh/pen/qEgbVw
visit http://fivera.net/ Forked from Fivera's Pen Heartbeat css animation....
yh but kinda slower
alr ty
doesnt work im trying to get it for the profile if that works
In what way is it not working?
it shows a heart on the bottom of the Long description but nothing else
What is your css?
example if your kinda confused of what i ment
That's not a heartbeat, that's just moving up and down.
looked like a kinda heart beat for me ig
is there a new version of promise.all that does everything and then gives you the results even if there is an error
found it
I was thinking promise some lol
it looks like that was a thing in bluebird.js
Bluebird is a fully featured JavaScript promises library with unmatched performance.
Op, is it?
I've never used it, just was a quick Google search
AllSettled seems really powerful
it'll let you get rid of the try/catch around Promise.all
i wonder how new it really is
it's probably like 4 years old
it's nice cause try/catch wouldn't even solve the problem
since you'd lose all your promises that did succeed
or what the errors were
wtf is bluebird
bluebird was a library for promises before promises were in the spec
it still is a library
I see
const collector = new Discord.MessageCollector(user.createDM() , filter, {``` why is it throwing this error: if (options.time) this._timeout = this.client.setTimeout(() => this.stop('time'), options.time);
^
TypeError: Cannot read property 'setTimeout' of undefined
might not solve it, but createDM() returns a promise
is there an easy way to see which ecmascript version a version of node is using? does nodejs 14 support ecmascript version 11?
hmm not sure
because i am trying to create a messagecollector in my dm
but it's not working
found this https://node.green/#ES2020
make sure systems knows it don't wanna get errors later on
The ECMAScript version used in the Node.js runtime is specified by the V8 engine, as that's what implements the standard in the JavaScript land, https://node.green/ keeps track of all the JavaScript features that are available in different Node.js versions (You already sent this but just a description)
what do you mean by not sure?
await the promise and check if it fixes it
yeah
that website is trolling nodejs a bit. i didn't know nodejs still doesn't have tail call optimization
Those optimizations are done by the V8 engine, and it's actually correct, it still does not support it because it's one of the hardest to implement with all the abstract shifting made in the core of the engine, and the custom language the V8 engine uses AKA Torque
maybe they could make like a subset of the language that supports recursion somehow. it's probably a lot trickier than i understand
massively
a lot of features could be removed to simplify it
are there certain features that make it more difficult?
You see, the recursion in the technical terms isn't that simple in case of optimizing such a thing that could cause extensive failures in the other parts of the engine, some recursion methods are proposed to fix this problem and implement it already, but it is still being discussed to this day, the features that could block this from being implemented are mostly in the parsing phases, the syntax sugars that could cause lots of problems
This problem was also encountered with the optional chaining operator (?.)
This is also the main reason why the pipeline operator (|>) TC39 proposal is not on stage 4 yet, as more and more syntax sugars are added and the syntax gets more complicated, it becomes extremely hard to stabilize with the new features and optimizations
i wonder if they could keep track of the features used and then enable the optimizations if only a subset of features are used
that might slow it down too much though. idk
That would add way too much overhead, to initialize a new marker and mark every feature that is unused, and omit them entirely, although this is already done, but partially
if(message.content === "start"){
const questions3 = [
`test`,
]
let counter3 = 0
const filter3 = (m) => {
return m.author.id === message.author.id
}
//verander deze naar dm en ga dan alles ook voor firstmember doen
const channel = message.channel;
const collector3 = channel.createMessageCollector(filter3, {
max: questions3.length
})
message.member.send(questions3[counter3++])
collector3.on('collect', (m) => {
if (counter3 < questions3.length) {
message.member.send(questions3[counter3++])
}
})
collector3.on('end', (collected) => {
console.log(collected)
})
}```I still can't get this to collect the messages in the dm
i mean, the message.channel includes dmchannels too right? What am i doing wrong
The <TextChannel>.createMessageCollector() method takes a single parameter, an object with options you should specify
god trying to setup prometheus has been a huge hassle so far
Maybe a flag like "use strict" could let the engine know to use optimizations and let it fail when the rules are broken
yeah i know i've fixed it.
But it just doesn't get info from the dm
This is v12 btw
idk i am too lazy to upgrade to v13 not going to lie
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.
You're risking a breakage, v12 will stop working soon entirely
i will change it soon, but for now i am trying to fix this
are you talking about the message intent breaking v12?
I don't think that'll be the major breakage, but I've heard it was an endpoint change that would cause the whole lib to fail
Let me know if anyone knows how to fix this in v12
Does it send the question at least?
hopefully that'll be after the message intent change. i'm deleting that legacy project after that
In what way are you expecting it to accept the answer? To log the collected messages at the end?
Also have you tried logging anything in the collect event listener to see if anything is actually being collected?
reason why i quit lol
developers are lazy
Preach
i dont want to be changing my code every month because discord.js released a breaking change and i have to update
i quit because bot deving is annoying and end users are dumb
now i get paid to do it for people who haven't realized that yet
😅
Ah the life of a developer
Major releases are to be expected, and it's not really discord.js' fault that Discord keeps changing major stuff that could cause heavy breakage
btnlistner.on('collect', async (b) => {
let i = await interaction.fetchReply()
switch(b.customId) {
case 'previousPage':
currentPage--;
if(currentPage <= 1) i.components[0].setDisabled(true)
break
case 'nextPage':
currentPage++;
if(currentPage > 1) i.components[0].setDisabled(false)
if(currentPage <= pages) i.components[1].setDisabled(true)
break
}
})``` Any idea why I can't change `i.components[0].setDisabled(true)`? It says it's not a function, I've tried `interaction` too.
not that, things like message intent i understand
but they changed a lot of function names
without deprecating
just flat out removing them
The top row of components are action rows, not the actual components
so [1]... [2] ... ect?
components[/* top components, AKA action rows */][/* The actual components in the row */]
That's kinda dumb but it makes sense
thanks.
Then yeah, many discord.js users were also angry against that, causing breakage for consistency with Discord's naming conventions, removing utilities and similar stuff
While i.components returns MessageActionRow { type: 'ACTION_ROW', ..... i.components[0][0]/[1] return undefined, and there are buttons in the row. This is also gotten from a let i = await interaction.fetchReply().
Ideas?
Oh yeah I forgot to mention something
components[/* The top components, AKA the action rows */]
.components[/* The actual components within the row */]
djs...
You make me cry sometimes.
I mean, that's exactly how Discord designed those in their Discord API

Ah, gotta love discord.
they did start deprecating instead of removing though which is good i guess
like using message instead of messageCreate gives a warning but still works
One more thing, (I'm still newer to buttons) i.components[0].components[0].disabled = false; nor i.components[0].components[0].setDisabled(false) work. What am I doing wrong?
You have to edit the interaction response with the edited components
I'm a dumbo. Thanks.
pov you're a javascript developer by heart using c++
Gg
been there done that
JavaScript the root of all problems
also I was thinking how to add different colour characters in my string print function for my os
I settled for a cooler looking modern solution where you can pass a function which gets called with the character in question and returns a colour
c++ has a very nice lambda syntax
I still don't know what captures do
do they just copy a variable from source function to the lambda?
i hope not, wouldnt that be inefficient?
it probably does something like ownership shenanigans on the memory
nvm
An entity is captured by copy if it is implicitly captured and the capture-default is = or if it is explicitly captured with a capture that does not include an &.
You can capture by copy or reference and you probably know what both of those mean. So capturing by copy obviously means that variables value wont change inside the lambda function if you modify the capture variable outside of it.
(node:3037) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
at /home/runner/Disbots-2/src/server.js:235:48
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3037) 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: 2)
(node:3037) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3037) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
at /home/runner/Disbots-2/src/routers/servers/server/view.js:73:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3037) 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: 3)
(node:3037) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
How do I fix?
this is the weirdest syntax ever:
commands[interaction.data?.name]?.(interaction);
well undefined is still a valid potential object key
guaranteed to return undefined, but still
://
Maybe not the case 😉
time to move to DPP then!
same as { "undefined": 123 }
Seems like javascript converts whatever to a string before performing a key lookup.
bro is self advertising
yeah objects only support strings as keys
javascript converts software into developer pain
for non-strings you need to use Map
JS is amazing, just wish I could solve this stupid error
(node:3037) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
at /home/runner/Disbots-2/src/server.js:235:48
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3037) 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: 2)
(node:3037) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3037) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
There is also WeakMap, which has some interesting GC properties.
what do you call .send on?
well how about you show server.js?
more specifically around lines 235
discord's preview doesnt show line numbers
i dont feel like downloading it and opening it in vsc
res.redirect(req.session.backURL || '/')
client.users.fetch(req.user.id).then(async a => {
client.channels.cache.get(channels.login).send(new Discord.MessageEmbed().setAuthor(a.username, a.avatarURL({
dynamic: true
})).setThumbnail(a.avatarURL({
dynamic: true
})).setColor("GREEN").setDescription(`[**${a.username}**#${a.discriminator}](https://disbots.xyz/user/${a.id}) User named **site** logged in.`).addField("Username", a.username).addField("User ID", a.id).addField("User Discriminator", a.discriminator))
})
}
});
This is the code around it
for line 235
client.channels.cache.get(channels.login)
Is returning undefined.
Does anyone knows why my music would lag sometimes and sometimes it wouldn't at all? the code is in djs and it's a very basic music command with ytdl without applying any filters in the ytdl function. At first I thought it had something to do with filtering but that didn't change anything.
Like one day I was playing and it was lagging a lot(like A LOT) and then it's not happening rn.
can i offer some advice @earnest phoenix ...
comments
you have precisely TWO comments in 900 lines of code
one says views, the other says models
just sayin
I am very unorganized 😅
Hm, Ill check it out
it does help, especially if you need others to help they can pick stuff up quicker
I'll do that, thanks for letting me know.
nice
Well, comments probably won't help here either lol. Breaking things out in files and self documenting functions would help a lot more.
(node:3124) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
Ok, so I see the error comes whenever I try to login through Discord on my website.
tbh the program already self documents itself
I can tell what like 1/2 - 3/4 of it is doing
so you making a bot list?
noop
It actually is a fork of a very outdated one. I have deleted more than half of the code and been rewriting it as most of it does not work
The original code was so messed up you couldn't even run npm install without an erorr. smh
hmmm yup
https://bhbotlist.xyz/, https://disbotlist.xyz, https://flowlist.xyz all the same
youll need to make it very different or google will penalise you
thats the one i cloned it from
i am i've deleted more than half the code
yeah i mean the site content
(node:3290) UnhandledPromiseRejectionWarning: ReferenceError: emojiArr is not defined
at /home/runner/Disbots-2/src/routers/servers/server/view.js:73:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:3290) 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: 1)
smh i now get another error
thats how i found duplicates, e.g. your certification page is exactly the same
ik once i fix the bugs im going to redo the entire html / css
good idea
is there no official support for this code?
or have its devs abandoned it
oh there is, but i have a feeling the owner does not even know what code he wrote
everytime i have a question he either says Restart it or he says i have to go
what exactly happens when two people click a message component button at once?
like, when you click the button, does it show the loading state to other people as well? probably no right?
it does
every interaction is isolated
oh
i read the question wrong
the loading is only shown to the person who clicked it
so basically its spam-safe as long as the user is the same
but not spam-safe once multiple users start clicking
so i still need to add cooldowns for the buttons themselves
Depends on your action an interaction triggers
I doubt there’s a case multiple selfbots or scripts will try to spam components
no but for example a help command with multiple pages
with multiple people clicking prev/next
ephemeral responses dont have rate limits?
Idk but at least only one guy can spam it’s pagination components then
I know what I'm doing tomorrow
ah you mean make the entire help command ephemeral
dm help commands
Yes
extremely bullshit UX but works
why not limit interaction to a specific user?
i like the idea of a help command being public
oh
I don’t see any public interest for the help command if people use pagination to go through it anyways, as everyone wants to go somewhere else
so you can for example put it in a read only channel, and have people refer to it
If you need a help command so big you need pagination then why not send it in dms to avoid spam
what if, instead of changing the pages, it send the respective help page as an ephemeral?
like tip.cc
dude my help command has 90 pages
literally
like, user clicks category -> sends ephemeral with content
oh astrobot
the original message stays untouched
i forgor how massive your bot long description is
lul
90 buttons
God damn, you better send a link to the docs 
Stop making jokes of my jokes

You gonna pay the price now
I’m going to sleep and you will miss my expertise

maybe it's the opposite
Shut up 
does <GuildMember>.roles.highest default to guildId if there's no roles?
Go and take a bath in the Ganges 
I'm not a hindu
i sincerely believe coronavirus is real unlike 99% of the nation
Techincally @ everyone is also a role with it's id being the guild ID. So yes
Why my bot can't send a dm with only that one person? It always throw this error DiscordAPIError: Cannot send messages to this user, but in others it's working perfectly fine
they have dms turned off
DMs turned off, blocked bot, not in mutual server, etc
Just catch the error bruh

my bot casually throwing irrecoverable errors like segfault or somehow receiving sigterm
child_processes do be kinda quirky tho
Pro tip. Don't fuck with gif encoding
sometimes after inviting a bot it redirects to other website so how you do that
OAuth Redirects.
yeah where the option is found in developer portal
You have to add it here but it won't work unless you have set up an OAuth authentication service.
how to set that up
why undefined?
wdym?
yep
i see
hello how do you put a button in a webhook?
what do you mean
you ask the webhook nicely

I would like to know how to put a button in a webhook I had put this code but there is nothing that appears
"components": [
{
"type": 1,
"components": [
{
"style": 1,
"label": `bihbn`,
"custom_id": `row_0_button_0`,
"disabled": false,
"type": 2
}
]
}
]




