#development
1 messages · Page 60 of 1
Actually I could just wrap the ore.Amount.Value in parans and - 5 it so it does that calculation first
or not it just remains 5 😔
Am I just that bad at math
uhh there's no one universal standard. I think it depends on your machine. I imagine whatever the default is works well enough
Okay thanks a lot!
Lua 🤢
Ilyt
Since when is bcrypt better than scrypt? Always heard and read it was exactly the opposite. Bcrypt shouldn't really be used for future systems but go for argon2id and scrypt as alternative if argon2id is not available.
Yes scrypt is more 'recent' and less 'tested' which gives it a downside
scrypt is a memory hard algorithm that makes a bruteforcer pay a lot for both cpu and memory
Personally wouldn't qualify bcrypt as being more secure than scrypt, unless I've missed something which can be quite possible 
Plus bcrypt has a limit of 72 bytes that scrypt, I believe, doesn't have 
If you want to move to bcrypt, I believe the default cost of 12 is good enough, you can go to 14 if you wish; at least 10 for sure - keep in mind that bcrypt only works for 72 bytes
The limit of 72 bytes can be shown easily:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA (72 chars) => $2a$12$qunATwVFGO3eM6vNZgoIsemyLKTNzqqGgTFlaEnQiaF6V1P03KCry
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA (100 chars) => $2a$12$btgY9Xom0xY74Lrv1.3bKe0TCAKp2UXsBVGLEluLE8gD.w.ceeXiW
Now checking the hash generated by the 100 characters string with the 72 characters string, you will see a perfect match.
So keep in mind that only the 72 first bytes will be taken in consideration, and not the string in its entirety
thanks alot, yes I will think about that 👍
Awesome
Sorry if that was too much I just love to write 
No it's perfect. I also found the thing with only 72 bites but thanks for the quick demonstration :D
best payment methods for webapps so far?
At least we don't argue 20mins again xD

Yeah, custom emotes for me so on my personal server 
did you design them yourself?
Commissioned someone, I can't draw ||Kind of goes off topic
||
aight^^
.
what you mean payment method?
your project provides premium features which would be the payment method you would implement
stripe
not available 🗿
i don't wanna move into crypto since most don't know shit about using it
stripe isn't crypto 
i am aware
just saying since most of the popular payment methods aren't available for me
then i could use crypto
but this is the problem with it
Got that thing clarified btw?
I think the best is not storing any kind of passwords on your own system lol. Cryptography is difficult to get right so I just leave it to the experts. I've only added oauth to things I've built for years now and it works great
Yeah true
They would be right in my case.
yess indeed
Nice
ok so I have this SQL Code,
select * from stats where type='msg' and guildid=$1 order by value DESC
how can I find a specific userid with that, aka to get his position?
yes
eh just iterate through it with indexes, index+1
that should be good enough
unless you directly want their position as in for example "You're currently position x"
yeah, basically that
don't think thats possible with sql itself, you might need to query the users you've already done, then index them yourself with a for loop
so for example something like
ranking = empty 2 dimensional array (index, stats_data)
for i in length of sql_response
ranking.append(i+1, stats_data)
you can do it the other way around too to be able to get that user easily
if thats understandable
Do you know bot permissions on Bot-test guild?
thanks! will do that, btw you can do i++ instead of i+1
wym
yeah just for understanding 
if you're referring to top.gg approval: https://support.top.gg/support/solutions/articles/73000502501-how-the-bot-reviewal-process-works
um hello. is this the right spot to talk about learning how to build bots and related tech?
cool. i just came across top.gg so there is still a lot i need to read, but I also have written a simple bot like a year ago. It just played ping pong with u. But I am looking for more information on how to build more complex stuff and perhaps more information on what are the benefits to developing this type of software?
"build more complex stuff"
like?
What you need to learn, and the tools you use will depend on what you want to do.
before i landed on top.gg i was playing around with a bot called 'karuta' and also have been needing to investigate more cloud hosted DB solutions and possibly making a bot that utilizes an API with CRUD operations... but i am still kinda learning this stuff. Been primarily working in Node.js and HTML but looking to start expanding the stack...
im not exactly sure what i want to make in terms of bots, but it has my curiosity rn and seems like it could bridge into app dev nicely.
ideally for now i suppose creating a test bot with a DB would be a good start...?
yeah why not try starting with a ticket bot or something
You've kind of already hit the nail on the head.
If your goal is to make something like karuta you'll want to learn individual concepts.
Try making a bot with a very basic economy system, or the suggestion max gave.
then if you want to learn how an API works with bots you can try making a dashboard which users could access their economy info, or tickets.
ticket bot sounds interesting and yeah that also sounds good.
whatever helps me to learn the fundamentals of linkage between the services.
def like building UI
def interested in creating economies...
also like making games
Just be a bit weary of economy bots. Discord has taken some stances against them recently.
it could just be a user based system as well.. i think?
good article only half done tho, just want to say, i don't want to do gambling...
😂 ngl its a bad bot anyway (my opinion) but like yeah it has gambling etc but in the end like they said its not using real money for real money so it wouldnt break the tos. Not sure what will happen. The cringy part (again my opinion) is at the end they leave an invite to the bot 🤦♂️
Dank memer isnt the only large bot not allowed on app discovery
ok finished reading it
so is a user bot or farm basically kinda like a zombie army ?
They are user accounts made to farm a bot economy.
IE, if you get coins every level up a user might selfbot 1000 accounts and have them all chat just to get coins.
I know sadly
unbelivaboat isnt one right?
this is part of why CAPTCHA protocols exist?
what do you mean
Well, the bots cant use captcha unless they make you visit their site.
Which dank memer doesn't have to do if they don't want to.
its the name of a virus that would take a part of the PC and dedicate it elsewhere on the internet. like a bot net. but it had all kinds of applications. i am only vaguely aware of it.
ah
That's probably not what most users used.
oh no it was just me trying to understand the nature of what the article mentioned
bots can be used for good or evil, essentially...
I dont think that was the main point of the article though.
The main point is, dank memer and other bots cant be listed for gambling like commands
no it was a lesser point. i got the main point.
discord pushed a policy that blacklisted a bunch of bots for having gambling fns
im still interested in building another one.
any particular reference material or links for beginner bot / mid level coder?
Nodejs?
that's what i have been using as a host for my project yes.
but that project is a straight up game. see bio.
https://discordjs.guide/#before-you-begin
Not the best resource, but its okay with getting familiar with discordjs
is that like the main lib used for serious bots?
serious(the largest) bots make their own lib most of the time.
^
by creating their own API or host?
Large bots do use discord.js, and also sometimes Eris (although not really maintained much anymore), they also sometimes fork the existing libraries and make tweaks to them
But you're better off using the baseline libraries, discord.js will do and it supports most of the things you'll ever need
i dont understand why you would do that unless you had a way to seriously optimize it for your specific bot
dependency issues mebbe?
i know that was my motivation for writing my own game engine... among others...
They do it because of insane amount of things and load they have to handle due to the insane amount of guilds the bot is in, but nowadays that's not needed
also quick question: what is the voting about? what does that effect?
i notice most of the bots seem to have this fn
/vote
are the bots being ranked or something?
They just provide links to bot lists that bot is listed on, so you can vote it for it to be placed higher in those bot lists
ah so its basically an indexing fn
More votes = higher visibility in bot lists = more users
sort of like SEO
kinda yeah, except it's direct user interaction that leads to the bot getting promoted, rather than the bots contents.
SEO is a factor when listing on botlists though
SEO always a factor these days...
i swear it has bled into my naming conventions
this looks like a really good starting point tho
thanks again
ok 1 more question and this one is gonna sound dumb...sigh~
do you guys know which discord server is the official discord developer server?
SEO is a factor of whether or not you want your site to be one of the top searches on google :^)
I think a lot of people forget when writing a bot description on a bot list you want to optimize for SEO wherever possible.
Not just for the botlist, but for other search engines.
If you have a smaller bot, and not the greatest SEO for your website(or no website at all) writing good content and not using an Iframe might be the best way to boost your growth with not very much work and for free.
Bot/server pages which optimize for SEO seem to grow faster
anything that has a readable name field should be addressed with care. :3
another question: What are the guilds in relation to bots?
servers
ahh-
As "Activity" is a Nitro feature, will bots be able to also start them without the server having a specific level? 🤔
As bots apparently have some advantages when it comes to user-Nitro features
Do not know if there was an announcement on that or similar
Bots don't have nitro
The reason they can use emotes from other servers is merely an exception because it'd be dumb to limit that
Aside from that, bots have no other nitro features
Sad...
you can delete them not edit them
you can edit them
prove it XD
You're referring to
Bunnies make noises, but they are very quiet. Content rabbits purrrrr by gently grinding their teeth together, and excited rabbits oink
Right?
Its the most important part.
lol
of course
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
this includes ephemeral messages
gotta TL;DR
It works the same way as deleting but instead you use patch
ez
Its one sentence 👀
Hey woo, give me 5$ and I can turn it into 500 dollhairs for ya ;)
facts
Well tbh that’s not really important or necessary at all
Editing them, follow ups and now deletions can always fail since the message could already be dismissed, means has an invalid token
That is true
let's hope libraries would keep track of that lol
probably not aurel
And even if I can delete ephemeral messages now, I can also not do that and rely on that they disappear automatically anyways
They'd probably just throw an invalid token error if you try they wont likely do much other than that
Ephemeral messages can be seen by the recipient only anyways, so the data you provide to the user, is either personal or just out of context which doesn’t belong in the chat to reduce spam
Which makes deleting em really pointless
honestly tho ephemeral messages was by far the best idea discord came up with
I think its up there with the best
The best idea by far is making a bot api tho
all those pesky user accounts
I imagine it was hell when they didn't have a public bot api
deleting and/or editing is probably more useful on short notice things rather than something like autodelete after 30 seconds
I want him to delete the data after two minutes, but he doesn't delete it, what's the problem?
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const schema = new Schema({ UserID: String,
expireAt: { type: Date, default: Date.now, index: { expires: "2m" } } });
module.exports = mongoose.model("nsfwvote", schema);```
my goal is normally to save it after the person has voted and delete the data after 12 hours
2m isn't a valid time for mongoose
use time seconds instead
put 120 instead of 2m
is there any other problem
no
i'll try when I get up tomorrow
would it be okay if I recorded it this way
const votess = require("./models/nsfwvote");
await votess.create({UserID: req.vote.user});```
for example, I tried for 2 minutes at first, he deleted the data, but it stays here, then I tried for 12 hours, he deleted it again in 2 minutes, what can I do
can't u just store the vote timestamp like a sane programmer?
redundancy ✨
I need it but actually don't
You can use findOneAndUpdate to update the document if it exists or create a new one if it doesn't.
const votess = require("./models/nsfwvote");
await votess.findOneAndUpdate(
{ UserID: req.vote.user },
{ UserID: req.vote.user },
{ upsert: true }
);
it bothers me that the text isn't centered
Well yeah if you aren’t familiar with the containers and tables and their alignment it can be quite challenging
Except cosmetics and animations nobody actually need, CSS isn’t difficult tbh unless you understand the mentioned
In other words Lay-out principals
if signal == '80':
if track == '80':
if penalty == 'false':
if overspeed == 'false':
file = discord.File("/home/pi/Documents/Room_Sealer/media/adu/80/80-80.png", filename="80-80.png")
embed.set_image(url='attachment://80-80.png')
else:
file = discord.File("//home/pi/Documents/Room_Sealer/media/adu/80/80-80o.png", filename="80-80o.png")
embed.set_image(url='attachment://80-80o.png')
else:
file = discord.File("//home/pi/Documents/Room_Sealer/media/adu/80/80-80op.png", filename="80-80op.png")
embed.set_image(url='attachment://80-80op.png')
Could I f-string the file paths and skip having the first two if statements?
yes you can
would format it like:
doesnt match what you need, but something like this
file = f"/home/pi/Documents/Room_Sealer/media/adu/80/{signal}-{track}{'o' if overspeed else ''}{'p' if penalty else ''}.png"
as a overkill way per-se
Alright, cause this command is over 1,000 lines long and I haven't created the rest of the ADU yet
but now I have to delete it every 12 hours because when I can't find data, the gif system will shut down, if any, it will work.
add an interval function into it
setInterval(async function() {
const votess = require("./models/nsfwvote");
var vote = await votess.find()
await votess.deleteOne({"expireAt" : {$gt : Date.now() - 10000}});
}, 5000);```
my bad, timeout is better than interval.
setTimeout(async function() {
const votess = require("./models/nsfwvote");
var vote = await votess.find()
await votess.deleteOne({"expireAt" : {$gt : Date.now() - 10000}});
setTimeout(arguments.callee, 5000);
}, 5000);
why would it be?
why dont you just store the timestamp of when the user voted, and when fetching to see if the user has voted or not just subtract 12 hours from current time. if the timestamp is before then they havent voted. if its after they have voted. then you dont really have to unnecessarily run a 5 second interval checking for expired votes
setTimeout is better than setInterval because it executes the code only once.
the point of interval is to run the code multiple times
"better" is a strong word, why tf would u use recursion when setInterval is already there for that
The only reason I could think of is NodeJS.Timeouts block the process from closing by itself if there's nothing else running like normal, so once the timeout does eventually trigger, it'll close unlike intervals which will go forever, but even then, there's Timeout.unref()
i mean, a recursive timeout is pretty much the same thing as an interval
it just has a few extra calls
yep, just like this.
function setIntervalRecursive(callback, delay, ...args) {
callback(...args);
return setTimeout(setIntervalRecursive, delay, callback, delay, ...args);
}
const interval = setIntervalRecursive(() => {
console.log('Hello World');
}, 1000);
setTimeout(() => {
clearTimeout(interval);
}, 5000);
it is better to use timeout since it is more accurate
it's like saying dihydrogen monoxide is less healthy than water

Because the timing of setTimeout() is determined by the runtime environment rather than the clock.
yes
it is
the built in setInterval() function makes a call to the clock's setInterval function, which then sets an interval
setInterval/setTimeout both use a millisecond timeout, which is based on the timestamp of the calling time
basically if (now >= startTime + delay) doStuff()
setInterval is still defined by the clock
wdym makes a call to the "clock's setInterval function"? what clock?
the clock itself
lol
"defined by the clock" makes no sense at all
what clock lol
1ms is 1ms regardless of whatever clock u use
it's defined when the clock is ticking
they are both run during the event loop's timer phase
the body of the code, which has a definition of setInterval inside it
I'm 100% sure that's the case for cron, not timeout/interval
no, it is defined by the clock still
both setInterval and setTimeout are scheduled to run during the timers phase
both are affected by the event loop lag
so none of them offer any timing guarantees
if the event loop lags by 5ms, both wil be delayed by 5ms
whenever the event loop reaches the timers phase, both of them check if the current time has exceeded the scheduled time, and if it did, it runs the timeout body
so there is no difference in accuracy between them lol
yeah I'm wrong, both are an approximation
lets say I want to make a pagination for a baltop command, I currently have limit 10 on my query, how can I make it skip the first 10 results and give me 10 again for the second page? (sql)
LIMIT 10 OFFSET 10
thanks
if file == "north" or "North":
Chapter_1.North.north()
elif file == "west" or "West":
print("")```
but elif works in my other files
put it on the same indent level as if
last_password_reset BigInt
last_login BigInt
created_at BigInt
updated_at BigInt
If I have a user table with these columns. Is it good to store these times with a unix timestamp (milliseconds in js so BigInt)? I'm not sure if it's better safe them as DateTime or something
depends on you, datetime is a constant, means when inserting it, it wont be affected by the timezone
timestamp however will be affected by the system timezone or time_zone setting of your database config
(when inserting it)
probably better to store it in a timestamp directly instead
except a few examples of providing meta data only, I would also use datetime
as long as its only for internal use, unless you're telling that user when they last changed the password
actually, you can calculate the current time for a user based on their browser and the timestamp with a baseline can you?
So DateTime is just UTC? And timestmap changes each time_zone?
that still requires you to run the database and backend servers in the same timezone
no datetime is not UTC
datetime is a constant
For example: 25th of Sep 2022 - 19:00 is the same date and time across all timezones
There's literally no disadvantage of generally using datetime
Technically spoken, it's the better option and long term solution
Since 2038... and our 64 bit issue
So I could use DateTime and when there are two users from different timezones ?
The constant is the same for any user in any timezone, as I explained above
yes now let's say there a log that says when a user loged in. When I use DateTime it says the same time for both but it actually was different points in time for them
If you wanna calculate a cooldown or xx since xx you have to respect the user's timezone
yes but then DateTime doesn't work?
When querying your database you can get the datetime value and convert it to your local timezone (in your example the user's timezone)
Ahh okay I can convert on select
Any language I know has inbuilt functions to parse strings to a timestamp
If just the raw date matters, for example when showing Your ban will expire at 25th of Sep 2022 - 19:00 then no conversation is needed at all
As once again:
[...] is the same date and time across all timezones
okay ty
You can also add a timestamp as value of your datetime col
... SET last_password_reset = FROM_UNIXTIME(<timestamp>) WHERE ...
As well as requesting the datetime value in your query as timestamp
SELECT UNIX_TIMESTAMP(last_password_reset) AS last_password_reset FROM ...
But this will then again use your system timezone or configured timezone as relative timezone
So bringing the timestamp into the required date time timezone is required for both field types
But like I said datetime has the major advantage over timestamp that it is a constant
(and will be calculatable on 32bit systems after 2038) 
Imagine having 32 bits systems in 2038 in the first place 
Ok so I want to do some stuff on my bots website which requires to know alot of usernames from ids, fetching everyone would probably cause ratelimits so I got a idea, I have a database that assigns each userid a username and discriminator everytime they execute something, would this be a good idea?
sure
every time they execute something, check if there was any change
and if there is any change, update your db
btw, whats this error? I get that like every 5 min when I try to restart my bot
an error from a promise or an async function that was not caught
yeah, it also happens on a bot with only discordjs installed
unfortunately those kinds of errors are very hard to solve because the information to find them is lost
only djs installed but with your code right?
check if you have any promise or async function without a try catch or a .catch
nop, template bot
what template?
then post an issue about it there
this is my index:
https://hastebin.com/ucegukisur.js
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
multi files is actually the move
Hello
uhhh wat
am i reading
yes
How do I apply for staff team
you have both mongoose and pg, you have both a client and a sharding manager in the same file
plus you're caching all members
What
in the sharding manager
yes, cuz dashboard, and im not completely away from mongo yet
how many guilds is your bot in?
man... imagine joining a server and asking how to apply for staff
11
why are you using the sharding manager
I dont know but I have no reason not to because its set to auto
you know you're essentially loading 2 bots
yes
lmao
I mean I got an amd ryzen 7 5800x @ 3.8ghz with 10gb ram so why not
are you self hosting?
how are you gonna play games when your bot is using 5gb ram
does your server have 10gb ram too?
yes
lel ok
hey guys
how do i split a string by a certain character?
Imagine i have a sequence of word1_word2_word3 etc et
how would i cut it at _, in c++ btw!
can you use std lib?
uhh
#include <iostream>
#include <fstream>
#include <cassert>
#include <cstring>
string
only that?
well, then you'll need to google it a bit
const { Events } = require('discord.js');
const { guildId, RoleID } = require('../config.json');
module.exports = {
name: Events.GuildMemberAdd,
async execute(member) {
console.log(`New member joined: ${member.user.tag}`);
if (client.guilds.cache.get(guildId)) {
return member.roles.add(member.guild.roles.cache.get(RoleID));
}
}
};
When a user joins it doesnt get the role any ideas? (RoleID is in the config.json file)
You’re not awaiting the promise, doing any permission check, if your client is able to add roles to the member and you’re not checking if the guild (part of the guild member object) matches your guild ID of your config file
does anyone know why eris is getting so many downloads lately?
Btw if that config.json file ever changes, don’t expect it to update in your code until the bot is restarted
I use nodemon so it auto restarts
Not what I was trying to say
oh?
Well he could technically clear the cache and reload his event file and it would be up to date
and there was no update with some incredible feature
I’m saying that the config.json file’s contents will be cached upon the first time it is loaded, and therefore it won’t change until you restart the bot or clear the cache
As we don’t know that yet it’s just an assumption
It’s fine if that file doesn’t change though
Anyways let’s resolve the issues first I mentioned
probably just "hrrr djs sucks now"
its so bloated and unbearable
Someone can add my bot in his server ? DM ME
?
- "djs bad now 🤮"
- npm bots
- some broken ci system or something
top gg is sending me multiple requests
Did u remember to return a 2xx status code?
r i g h t
lol
yeah i forgot to
oops
Hey
Why is it so i have a command which will find and cache emoji from client but when i add emoji and try to use that command it just doesn't work the bot needs a re-start and then starts working why so?
because the client doesn't know that emoji exists
you'll need to cache it again
though I suggest you to statically list all emojis you use on your bot rather than dynamically loading them from your support server for example
the error says it all
i know, but i'm not executing it, i'm just reading the file contents
also i've never seen Windows flag a Python file as malware before
fun fact
I had that before
that's because you got some example code that is often used in python based keyloggers lmao
it's so funny that defender picked that up
that's crazy
you won't be able to do anything with it until you either whitelist it or rewrite it
Hi, I'm currently running my bot using Heroku and I'm currently looking for a alternative free server to replace Heroku. Anyone has their recommendation for free online hosting servers/VPS?
You wont find very many servers/VPS's for free.
Especially ones that are reliable.
Oracle has an ARM VPS that's free, but I've seen multiple reports of people having their VPS shutoff randomly and not be allowed to start it again.
Google cloud has a free VPS, https://cloud.google.com/free/docs/free-cloud-features#compute.
I would recommend the google free VPS over the oracle, if you ask me it will be a bit more reliable of a platform.
Lets say I have an array with 96 objects, how can I set it to example 25 (the last values should be deleted, not first) in js?
thanks!
AWS also has a good free one
I've had mine running for a few months with no issue
AWS can slap you with a hefty overage bill if you accidentally go over your limits without realizing it
I use Oracle because they can’t hit me with an overage, if I go over my limits it just stops my service until the next cycle
(For free)
get an rpi and plug it in somewhere in your home
it'll be more stable than any free vps
don't install a gui btw, those things have barely any ram or CPU to start with, you don't want to waste it on xorg
const weather = require("weather-js");
const discord = require("discord.js");
//TIME TO END STREAM
module.exports = {
name: "weather",
description: "Get the current weather of a specific location.",
category: "fun",
usage: "weather <>",
cooldown: 5,
run: (client, message, args) => {
if (!args.length) {
return message.channel.send(
"Please give the weather location"
);
}
weather.find(
{ search: args.join(" "), degreeType: "C" },
function (err, result) {
try {
let embed = new discord.MessageEmbed()
.setTitle(`Weather - ${result[0].location.name}`)
.setColor("#ff2050")
.setDescription("Temperature units can may be differ some time")
.addField(
"Temperature",
`${result[0].current.temperature} Celcius`,
true
)
.addField("Sky Text", result[0].current.skytext, true)
.addField("Humidity", result[0].current.humidity, true)
.addField("Wind Speed", result[0].current.windspeed, true) //What about image
.addField(
"Observation Time",
result[0].current.observationtime,
true
)
.addField("Wind Display", result[0].current.winddisplay, true)
.setThumbnail(result[0].current.imageUrl);
message.channel.send(embed);
} catch (err) {
return message.channel.send(
"Unable To Get the data of Given location"
);
}
}
);
},
};
Attempted a simple weather command
TypeError: Command weather doesn't export a class. lol
are you using some sort of a command handler?
check sample commands that it provided and see how they're defined
I'm guessing pogy's command handler
I legit cannot take you seriously with that profile picture
👀 I forgot to change it back.
keep it that way, thank you
Anyway, with pogy's command handler you need to extend Command.
Pogy doesn't use the common djs v13 style of command handler.
Why am I getting this error? reflects after disconnection
connect section
const { connect, connection: dbs } = require('mongoose');
connect("the secret part", { useNewUrlParser: true, useUnifiedTopology: true, });
dbs.on('connected', async () => console.log(`Successfully connected to the database!`));
dbs.on('disconnected', () => console.log('Disconnected from the database!'));
dbs.on('error', (error) => console.log(`Unable to connect to the database!\nError: ${error}`));
dbs.on('reconnected', async () => console.log(`Reconnected to the database!`));```
The hostname can not be resolved
Either try the IP you can get by resolving the hostname yourself or check your nameserver settings of your server
Yo, I had a Verified bot, and I took it offline about a year ago.
I see now you need message intents (So imma re-write to use the slash commands) and also discord.py is discontinued
TLDR it for me, to develop a python bot, what is the go-to library these days?
discord.py was discontinued, it's back on track now and it's maintenance now continues
oh tnx 🙂
I'm guessing that this isn't possible, but by any chance has someone using discord.js found a way to get the ping time from the user's Discord app to the bot? I know about client.ws.ping, but I'm pretty sure that's ping time from the bot to Discord's servers.
Unless the WebSocket is actually going directly between the user and the bot?
I don't know much about how Discord works internally.
its not possible, as there's never a connection between the user and the app directly
its always through discord
aka its websocket
the ONLY way you'd be able to do something like this is if you had direct connection to the client (like giving them some kind of app to install)
for obvious reasons, this has a little flaw in it
i want to run a Websocket script on python and get discord bot to receive such message and send it to a channel
is it possible ?
ok so, if I understood that right, u want to make a "message sender" client for your bot?
like telling ur bot to send X on channel Y
yes
yes, it's possible
not only is it possible, but I also have something like that on my bot
well i cant seem to get it to work
liq.ws.run_forever() - webSocket ..
dis.run(TOKEN) - discord
if the websocket start , the discord bot doesnt 😄
what websocket lib are u using?
import websocket
no
Iam
i just cant get the webSocket run with discord
as both of them run forver
so if one starts , it doesnt let the other run
did u do npm i ws?
he's using python
ah, nvm
python
well, python is monothread, but it's odd to have a sync ws lib
js is also monothread
idk how python handles websockets, but I'm assuming you should just be fine to use your library's built-in webhooks, no?
Since 99% of discord libs also support webhooks
ye, but that's why I said it's odd to have a sync ws lib
websocket, not hook
💀
😶
also those cheese breads turned out amazing
(sorry off topic)
I can't help anymore on this cus it's python, gl
pão de queijo, not cheese bread 
yes 🙄
I was worried it was going to suck because it wasn't sticking together in the mixer but then I put in an egg and it instantly started to bind into a dough lmao
lmao
very sticky to handle though, I must say it's difficult to shape them into balls
I wonder how tf they even discovered that mashing bread with cheese together would result in something good
and not some humongous mass of cheese slime
lol
how the fuck they even discovered bread to begin with
how the fuck is development suddenly about bread and cheese
take some plant, reduce it to dust, add water, make a bland mass of something, add bacteria and cook
A runtime I'm trying to work with doesn't support any K,V pair types and I'm trying to make my own and it also doesn't support static fields or constructor initializers for user defined types
I can probably get around not supporting constructor initializers
Meanwhile:
Ok we’re posting random shit?!
Lemme participate
if that ain’t satisfying then idk
If only the Thread network would be a bit more reliable
shit movie
console.log('Don\'t not shit on the movie. That\'s what toilets are for')
imagine using \ to escape quotes
hi
bye
alternatively, use different string initializers
console.log("Don't need to escape if u use another type of string literal")
I mean yeah I guess I could use those too
console.log(`"But what if I need both?" you might ask, well, it doesn't matter because js has 3`)
then comes groovy, with 6 string literals
wym 6?
def a = "This is a string"
def b = 'This is a string'
def c = /This is a string/
def d = $/This is a string/$
def e = """This is a string"""
def f = '''This is a string'''
thanks I hate it
those are all fr strings I can use!?!?
in groovy
Thanks I fucking hate it
the bot? or is there a language called groovy
the language
interesting, ive never heard of it tbh
5.times { println "Hello world!" }
whats better. JS or groovy
I'd say groovy because u get threads
I need to learn HLSL specifically for compute shaders so I can get around stupid BS of a bloated runtime wasting cpu cycles when I can just compute it all on the gpu
I imagine groing from js to groovy isn't hard at all, since it feels a lot like js
like what kind of runtime that runs 30x slower than c# native doesn't have K,V
lmao hlsl is nightmare fuel
gotta document on groovy?
just wanna look into it so idk what it is lol
there's also the "groovy goodness" wiki that shows the fun stuff u can do in it
It'd be cool anyways so that I can write an uber shader or make use of "ray tracing" with ray marching on a vr platform with mobile players
ok so, js has ts right? a superset that adds strictness to js
well, java has groovy, a superset that removes strictness from java
i hate ts with a passion but yes it does have it
so basiclly what im gathering groovy is basiclly ts but for java
aka a subthingy
it's actually super sad tho because everyone who talks about optimization in the runtime I'm trying to use is basically saying that I should use it as sparingly as possible and instead opt for using animators (Unity3D)
it's a very fun language, I was surprised when I discovered it
and the fact I can use it for runtime scripting fit like a glove for my use-case
can't u precompile it?
Ok, so I use js would it be hard and/or complex to change to java?
to java, specifically, I'd say medium difficulty
since you'll need to use a fuckton lot of specificity compared to js
if u hate ts, u wont like java at all
but tbh, I like java and hate ts too
Kind of. The C# gets transpiled down to asm bytecode, but it's still interpreted
u could make dlls so u can have pre-baked stuff
No dll loading in the game. Anti cheat
a
also wouldn't work anyways because they're components you add onto game objects
idk if you know a thing about Unity, but they're just fancy MonoBehaviours
I started using c# not too long ago, and barely if ever touched unity
I'd recommend touching it more. Maybe getting engrossed into platforms like VRChat. Would give you an excuse to learn and develop more
I'm still kinda learning, but I know enough to make what I want to make regardless of performance
it's in my todo list, I'd love to make a standalone game out of my tcg
sadly, even if I did I'd not be able to make it public because...anime stuff
?
my tcg uses cards based on anime characters
so I cannot legally make a game outside of discord
thus I have virtually no reason to touch unity, for now at least
but I will, one day
whats a tcg
trading card game, think of something like yugioh or heartstone
oh ok, just needed the acronym
Could make your own characters influenced by specific characters
I suck at drawing
if art is a problem, could end up being low quality like your average deck of cards
the king and ace and stuff aren't too terribly detailed
or use symbols which represent
not enough will nor time for that, since I still need to make new cards regularly for my bot
if I'd make a unity game, it'd use the same cards from the bot
your community got you slaving away I guess
lmao you bet it
luckily I managed to get some volunteers to gather images and rarities for each anime, so I mostly do the QA and programming
still quite a bit of work I'd imagine. I'd hate to sit there and fill in JSON
oh no json at all, the cards info are stored in the database
images are stored in the vps (and in a repo)
my api fetches the image for the bot, and my game engine does the rest
intellij allows me to have code highlighting/intellisense inside database editor, so it's almost the same as coding normally
I'm already looking for people to take over my bot's organization and online presence because while it isn't a ton of work, it's really advanced and really annoying work because I'm now in the realm of needing a metric butt ton of native libraries to decode a lot of audio formats to PCM and then figure out how to do audio processing on pcm so I can skip ffmpeg
oh, music stuff
I can imagine it, especially when you have to deal mostly with very low level stuff
the only time I ever used ffmpeg was to make a replay system, and it was awful
Tim and I looked at a breakdown of opus packets and we couldn't understand it at all
ffmpeg is god awful but it's so good at what it does
indeed
too bad there's nothing really for js
even the libmp3lame native addons don’t support NAPI
I'll have to start learning cpp to write my own addons

E
Oh right you've already lost yours
It’s called music 
c looks like a regex
Exactlyyy bruh, why do they make their life harder
I’m more concerned about “don’t not …”
I want to send the message at 00:00 it send it on time but send it infinite time any idea?
https://cdn.discordapp.com/attachments/956968473689473104/1031303814956982312/unknown.png
Create a bool to check if it is sended
Set boolean true after 1 message and don't send message if boolean is true
Do false again after 1 minute
or set a specific time to send it at that time for example
00(hours):00(minutes):01(seconds)
how can I do it? 
just normal audio playback, but also supports transformers like pitch and playback rate
these are actually really simple if you use a compiled c compatible language
what language is it right now?
TypeScript iirc
simple yes 
c++, rust or even C will make a much nicer language and all you'll need is libmpg123 and libopus
or you can directly link libavcodec
not related to development but does anyone know how to get linux kernel 6 on debian?
by running sid ig
can sid be considered "stable"?
hell no
oh yeah, just tried to install it on a test vm and it wont boot anymore
recursive timeout? While(true) loop with await sleep() is best!!
my servers graph has a shark fin lol
daaaa dum, daaaaa dum, da dum da dum da dum 🎵
🦈
app directory induced shark fin
I'm tempted to do a top.gg auction ad at the same time and to for epic vertical line stonks
lol
The idea was to use node native addons to get clang lib advantages in js as switching to another language would just be 
Still need to learn cpp anyways
I have some books I can read
best way to learn C++ is by experience, by doing
C++ books are ...drier than ghandi's flip flops
and youtubers have no clue wtf theyre talking about. the minute they type using namespace std you should nope the f out of there
it's unknown why, but for some reason, all indians are born masters of teaching c++ on youtube
no
they think they are born masters of C++
but a lot of C++ youtube is lik someone trying to teach you js by saying 'we just use jquery for everything in 2022'
no really, pretty much all big software had some indian participating in it, either directly or indirectly
yes, but those arent teaching on youtube, for the most part
those that know their stuff are charging for the privilege, or too busy to teach
theres someone on my discord whos obsessed with someone called cherno
we are continually getting them to unlearn the bs he's been tought
ic
generally, if anyone tries to teach you C++ as an "Object oriented language", they are wrong
its a multi paradigm language with object oriented as one of the many ways of solving things with C++
the minute you try to solve a problem by making everything classes/objects, youre probably doing it wrong, when there are things like lambdas, templates, procedural programming, functional, as well
would be like someone giving you a toolbox of 200 tools, and you using the hammer to solve every problem to build a house
"what are you using to smooth that cement?" "back end of the hammer handle" 
That works quite well 
How do you make a slowmode
which you can include the slowmode setting from https://discord.js.org/#/docs/discord.js/main/typedef/GuildChannelEditOptions
If it loads then ill have a look lol
Oh I mean commands slowmode
Make a Set (new Set()), on command execution see if their user id is in the set, if not continue command execution then add them and make a setTimeout that removes them after x time, if they are alert them and stop execution
const cooldown = new Set()
if(cooldown.has(someUserId)) Alert User & Return void
Do some shit and then cooldown.add(someUserId) then setTimeout cooldown.delete(someUserId)
Thank you so much! Ill begin adding it to the test command now 😄
I hope you dont try and copy that exactly its pseudo code
Also keep in mind this isn't persistent across shutdowns of the bot. If someone uses a command and are put on cooldown and the bot shuts down. They wont be on cooldown anymore when it comes online
Ok and no I'm not copy pasting.
Misty coming in clutch with the correct data structures
But what’s the time complexity of said data structure @sharp geyser 🤓
ur mom
Though a Set is probably relatively fast
only a nerd like you knows this answer
I'd assume it'd be O(n)
Set is based on a binary tree
same as map
Just give us the answer
But if it’s a hashset it’s basically a map with no duplicate values
Slightly slower than O(n)
Gotcha
Also waffle why dont we ever vc anymore been so long 😔
miss that cute voice of urs
😘
2nd best time complexity out of the most popular ones which are
O(1)
O(n)
O(log(n))
O(n log(n))
O(n^2)
😘
a hashset is O(1) no?
Yes
What is the most impossible time complexity to achieve
cmon waffle answer
Cap
There’s ways to get better time complexities, there are just pros and cons to consider
There has to be a theoretical perfect time complexity
O(1) means 1 operation
That’s in theory the “best”
But it also depends on what you’re trying to do
Some things are not possible to do in O(1)
Like for example, the minimum average time complexity for searching an unsorted 1d array is O(n)
If you know the array is sorted, it becomes O(log(n)) iirc
Because then you can do a binary search
Set in JavaScript is an ordered hashset
Ah
Why?
Is it because it’s not like Java where you can enforce the type system to guarantee ordering via an interface like Comparable
Hashsets are optimized for high-performance operations on unique data which Sets in JavaScript specialize in
Ah
I suppose the RAM isn’t a problem because you’d be using another language if you wanted packed memory efficiency
Yeah
ordered...hashset?
Yes?
so a javascript map with undefined as value essentially
How do you order hashes though…
order of insertion
^
ah
You got that right, although Maps are hash tables instead of hashsets as they don't need to be optimized for unique data
you can't because it's not a promise
promise me
pg.connect().catch(err => console.log(err));
figured that out so i added it here
.catch(console.log)
Hey!
I'm currently remaking my bot page and I'm absolutely not a web developer, and I need to insert an image instead of the description is there a way to do it?
I've already tried img src thing but it only shows alt and not the image
not a valid link, that's an album link
right click the image on Imgur, then copy image url
I need some help with console.table(), is there a not-confusing way to get a table with specified column names
Actually, can I change the (index) column's name?
nvm, got it working
average "do physics class by hand with lots of data" fan vs average "do it with javascript my beloved" enjoyer
Nerd
My brain is melting
Output:
Test
UnityEngine.Debug:Log (object)
System.Object[]
UnityEngine.Debug:Log (object)
Code:
public override void Start()
{
base.Start();
SendCustomNetworkEventWithData(-1, nameof(Test), new object[3] { 5, 2, 1 });
}
public void Test()
{
Debug.Log("Test");
return;
int num = (int)packet[0];
Debug.Log(num);
}
public void SendCustomNetworkEventWithData(int target, string function, object[] data)
{
if (!Networking.IsOwner(gameObject)) return;
if (data.Length > maxParamSize) return;
if (waitingForSerialization)
{
int index = NextUsablePacketIndexStart();
if (index == -1) return;
sendQueue[index] = target;
sendQueue[index + 1] = function;
for (int ind = 0; ind < data.Length; ind++)
{
sendQueue[index + ind + 2] = data[ind];
}
} else Dispatch(target, function, data);
}
private int NextUsablePacketIndexStart()
{
for (int index = 0; index < maxQueueSize; index++)
{
if (sendQueue[index * (2 + maxParamSize + 1)] == null) return index;
}
Debug.Log("[NetworkableUdon] => sendQueue is apparently full. Human error detected? Please back off.");
return -1;
}
private void Dispatch(int target, string function, object[] data)
{
if (function.Length == 0)
{
Debug.Log("[NetworkableUdon] => Attempted to send a function with no name. Are you okay?");
return;
}
recipient = target;
method = function;
Debug.Log(data);
packet = data;
RequestSerialization();
waitingForSerialization = true;
}
oh wait I know what the issue is
I have a setter callback for method that runs the code, so the code runs before the packet is set
Yup. That works like a charm
hallo
I've used that set technique I dont recommend it
thanks for expanding on why you shouldn’t use it!
lmao sorry
It's just complex. And you have to delete it from the set or it'll get stuck if something goes wrong
That can be done with a short async function of course
But just storing a timestamp in an object with users ID as key is simpler and no need to remove the cooldown again
Not sure how that’s very complex… but okay
let cooldownObj = {}
let cooldown = 60 * 1000
if (cooldownObj[userID]) {
if (Date.now() < cooldownObj[userID]) return "You're on cooldown" // cooldown
else cooldownObj[userID] = Date.now() + cooldown
} else cooldownObj[userID] = ( Date.now() + cooldown )
// do stuff
Basically this is my favorite
It's also pretty plug and play wit hthe database when you add that
I'm trying to update message with button while in select menu interaction which can be used x times when the message got updated for first time it was noramlly working but second time it says you can't have two buttons with same I'd cuz it's taking the button from first message into second one plus adding same button so how do i tackle this?
Like i mean i would have to rmeove byttn how do i?
would suck if you had millions of users who off and on used your bot and the object would just always be growing in your heap
Not deleting something once you're done with it is kinda dumb
keeping the data there provides no benefit
NodeJS.Timers are free
use a different ID
alternatively, if you don't supply a components property in your message update payload, then nothing is deleted/edited
TIL, properties that are undefined are not serialized in JSON payloads
NVM i solved it in my way
this is C# or JS?
js
Who wannztrade
Yeah I guess. You can add a delete too of course, but I don't think having millions of users is relevant here
it is if most are stored in an array
there are ttl map libs out there, you should use it instead
Hello
And so it continues... 👀 At the start of October, 6 out of 10 commands people used on my bot were slash commands. Currently, the projection for the end of October is a 66% adoption rate.
speaking of which: does anyone have any statistics between invites from app directory and invites outside app directory (direct, botlists etc)
would be interested too see
Maybe they shouldnt "gambal"
true
Its so stupid in my opinion
not that gambling that bots getting declined
I can see slots but why a coinflip?
gambling bots getting removed from discord or just the app directory?
just app
App directory
Because God for bid we teach 13 year Olds to gamble and its the end of the world
Oh...?`Where do they draw the line for gambling?
Like slots and betflip would obviously be gambling. But what about commands that just give randomized rewards? Like it can give a common or rare item...
Like almost all currency bots have some kind of gamble-ish feature
when it resembles actual gambling
random rewards isn't gambling at all, just rng-based system
Fair enough, what about "lootbox mechanics" then where you open something and get a couple random things
lootbox is kinda...a gray zone
that's why nowadays many games resort to that
it's the closer u can get to gambling but still not call it gambling
i thought lootboxes wouldve been thrown into the randomized reward type of thing
nah thats not considered gambling
something like blackjack and gamble on dankmemer is for example
I'm currently collecting this data but it's only been a few days so it's not a lot to work off.
Gimme a sec
pog pog
like, it is a randomized reward, but you're "betting" currency in hopes of getting a good prize
So this is actual invites over the last 3 days (after bot has been added to the server) but do bear in mind, you can't use a different invite URL in the Discord App Directory to the one that's on your bot profile, so that Discord count is polluted by people adding the bot through the "Add to server" button on the bot profile (not 100% App Directory).
it's really in the line between both worlds
It's honestly hard to track how effective the app directory is because of the fact you can't use separate invite URLs. The visibility my bot gets from being in ~50k servers and being used by their members, who like it and add it to theirs in-turn after trying it out using the button on the profile, is mixed in with conversions from the app directory. 
.addAttachmentOption(option => option.setName('proof').setDescription('Attach a proof').setRequired(true)),
^
TypeError: (intermediate value).setName(...).setDescription(...).addStringOption(...).addStringOption(...).addAttachmentOption is not a function```
data: new SlashCommandBuilder()
.setName('report')
.setDescription('Report a user!')
.addStringOption(option => option.setName('username').setDescription('Enter a username').setRequired(true))
.addStringOption(option => option.setName('reason').setDescription('Enter a reason').setRequired(true))
.addAttachmentOption(option => option.setName('evidence').setDescription('Attach evidence').setRequired(true)),
using Discord.js 14.6.0
Its not letting me use addAttachmentOption 
is SlashCommandBuilder even on djs 14.6
can only find ApplicationCommandManager on the docs
then thats probably outdated
allows you to access that through either the manager above or a https://discord.js.org/#/docs/discord.js/14.6.0/class/GuildApplicationCommandManager
app directory is currently giving me little to nothing because they incorrectly categorized my bot 
they categorize themselves? lmao
that's literal shit
you can’t change it either
it labeled mine as moderation meanwhile my bot has NO moderation whatsoever

Nice 👌 i didn't realise that 
I bet they don't even attempt to identify what a bot is really about
they just see the names and that's it
Ooh buzzwords!
ikr
"so how does it detect bot's category?"
"it's machine learning"
"based on what data?"
"kubernetes"
"you know you can't simply say techy words and hope us to fall for it right?"
"master repository"
yes, it's based in that comic strip
Well the app directory has been living up to the expectations I had from day one when they announced they were going to be doing it... It's pointless 
I'd rather add my commands that have bad words in them back and just remove it from the directory altogether tbh
I expected nothing, yet they managed to deliver less
the directory is so ,,, i don’t even know how to describe it
the crap they’re doing w currency bots ??
ion get it
Even bot.gg was better
and somehow bot who shall not be named still filtered through onto their directory 
Is that why Tatsu isn't on it?
yeah
What's the issue with currency bots?
gambling
Yeah where you bet currency beforehand
I knew it'd end up like that, I knew it'd be dumpster fire the moment they announced an "official" bot list

lmao
mines social but is under “moderation”
it can’t do ANYTHING to moderate. if someone adds it to moderate they’re screwed LOL
I wonder what my very specific one would fall under 
Probably gaming I guess
also for some reason the first day i added it it showed 15k guilds
when i had 9k
but then a few days later it fixed itself
mine says 13k but last i checked it was 11l
now it shows 9.9k
Yeah some of the counts were off
11k*
6k unavailable:P
i’ll have to double check my bot stats tbh
Mine seem accurate but we'll see later in the week I guess 
ah yes, le olde youtube tactics
inflate the number of viewers to make some channels look popular
lel
iirc twitch tried to do that too but people noticed
i'll have to trust their numbers anyway as i dont monitor my guild count anymore
at the end of the day, topgg will end up being the official botlist as always
^
will i be banned for posting incorrect server count if i stop updating it?
:^)
i rely on topgg for discovery and voting
Aren't all gaming bots addictive even if there's no gambling involved? I have servers who run hunger games day and night and are at over 25k rounds. That sounds pretty addictive to me...
thats what i mean
you know who does that? facebook ads
they say your ad had 500+ clicks, you check analytics and its like 100 page views
lmao
Voting is OP
never cared about voting lel i dont even know how many votes i have
probably like < 10
im implementing vote rewards (finally)
Voting has brought me so many servers. Probably like 90% of them tbh
Because of the seo boost on Top.gg
voting rewards is like the dumbest thing ever from a UX perspectivr
the new bots listing shot my bot to 250 and verification needed in the first 6 hours c':
and people still fall for it
People will do anything for coins
dem virtual coins
lmfao
ppl will fistfight you for them deadass
My coins can't even be used or traded. I don't even have a shop 
esp if its a currency bot
People just collect them
in terms of growth, this year was the worst year for my bot
I don't let people buy coins... Yet
when I do my economy features I'll probably sell coin packs if people want them
YOU 👏 NEED 👏 VOTING!!! 👏
its like i get adhd when i try to code
ive been thinkign of applying for bot reviewer since i resigned but
shrug
i love what im coding rn tbh
i couldnt touch it for months but im making a swag feature
i wanted to cry when i was doing my rewrite





