#development
1 messages ยท Page 1739 of 1
yeah. once per day or sth like that
covid apis usually have much faster updates
if you download it from browser, its file name vary for each minute.
so yours will get slightly outdated
and if you download that file every minute you will probably be ip blocked as well
so there are still rate limits
also you you probably want to parse the csv with code, in excel its readable like turkish bot code
A minute interval is overkill imo
you'll just download it once a day or once a few hours.
Once per day is fine since you don't really need that much precision with this data
it contains all the countries
if you start to hammer the url they will eventually add ratelimits
yes. if it is a bot, it would be fine
you can manually change the csv file if you want, but i'm going to make it download each bot starts.
maybe use a cron to update it
like once on startup and then on a shedule
so you wont have to restart the bot every day
I'm thinking of running a repl every 48 hours to fetch that file and store last results and the ones before it in cache
you can compare the differences between both files and offer an approximate average for a given time frame
or use some tensorflow hackery and make a predictment for the future
that is also an available use case
for example of it was 500 the day before, and 600 now, in 12 hours you can say its 650, without having any data
That's gonna be tough to do on a low-cost machine I believe
best solution for py developers LMAO
also works on js
if there are tf bindings or alternatives, maybe
Though I'm not sure how good Tensorflow is at using machine resources
There are TF bindings for JS iirc
there is tensorflow.js i use it for one bot
Do you have any usage stats for it?
i didn't used tf but i know people using it and they say it uses the hardware as a slave
well it detects toxicity so its just text classification
but what i can say is that a 10$ Digital ocean droplet wont cut it
now i have a Dedicated root and it barely puts any load on the CPU
AI eats cpu for breakfast
lol not really
if you do image stuff yes
but text stuff not really if its a fast cpu
like if the tensorflow stuff runs on my Bot it barely gets one core over 2% usage (ryzen 3600x)
%2 is much for a ryzen 3600x!
on one core, not 6
because on the server, you would have only an intel xeon trash cpu
and this for less than 2 seconds at best
What data type do you guys use in your database when you want to store the guild id? (In the Discord documentation it says its a "snowflake"?!?!) Is it just an integer?
well its a server
then maybe nice?
use a string
yeah snowflake is integer
if you use integer its possible that it will get fucked
@lusty quest How?
like js likes to round them
i use MongoDB and just say the field is a string
then just put the id into the field
Alright thank you. But the ID will always be a valid integer right? Will never start with 0 for example?
yes
js cant handle discord IDs as integer keep it in mind if you use js
Thank you guys
you use djs?
@lusty quest Thank you!
i know it. js gets the id as string.
you can use parseInt() to convert
@blazing sentinel I'm currently building an API in PHP so no this won't have anything to do with JS
not sure if php can handle bigints
use int64 if you can
ok then. i dont know much about php
i use postgresql for my bot, and using bigint for channel, user or guild id's
@blazing sentinel I will do the same!
ok. good luck ๐
I think bigint was added in node v10
still defaults to int for numbers
Yeah you have to use the constructor https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
BigInt is a built-in object whose constructor returns a bigint primitive โ also called a BigInt value, or sometimes just a BigInt โ to represent whole numbers larger than 253 - 1 (Number.MAX_SAFE_INTEGER), which is the largest number JavaScript can represent with a number primitive (or Number value). BigInt values can be used for arbitrarily la...
(or appending n to the end of the number apparently, which is cool)
depends
you have to use a library that actually supports bigints internally
if youre interacting with a database
an older db lib will use normal numbers as an intermediary value and fuck you up
also hi Tim
:^)
Great name
you too
Yeah, I have being using discord-api-types for my client implementation, which just uses strings.
string to bigint is safe, just a bit more costly in resources
ik too many requests error
I buyed server and from that time I didnt have that rpoblem
problem*
Databases usually only allow so many bytes for a primary key column. VARCHAR is usually frowned upon, so using a native bigint would make sense.
yes if you can safely transfer them to and from js without precision loss, use them
bigint uses 8 bytes, string uses 17-18
I haven't needed a database yet, so not my problem lol
xd
Anyone here done a benchmark between ERL and JSON for the gateway API?
not yet, ive been wanting to do it for a long time
wdym full image view
router.get('/servers/:id', (req, res) => res.render('dashboard/show'), {
guild: bot.client.guilds.cache.get(req.params.id)
});```this is saying ```ReferenceError: req is not defined```no idea why
it's markdown
how to make full image view
just google markdown images
not to be like to people need to click
the syntax is
so i forgot !?
ye
kk ill try
your code is wrong
nop still same
how so?
still same
you're doing .get(path, reqres, object)
instead of .get(path, reqres(render,object))
works for me
try putting it in a new line
not in the same line as the text
all 3 links each in a separate line
not the imgur page link
ah okay, got it now
thanks
how?
where are you getting the error?
i have only this
that can be used too
it dont i try
yes
yeag
thats correct
yeah
show code
that is it
i have it
wheres the !
when starting the program, i fixed it by doing ```js
router.get('/servers/:id', (req, res) => res.render('dashboard/show', {
guild: bot.client.guilds.cache.get(req.params.id)
}));
ohh wait i put it now
thats it
ty
so much
another question
why i have this
i type how widget said
is that because my bot is not aprove yet?
yes
ohh
kk then
ty
i need help about this
i go on discordbot.io and that want me to add bot on my server
so how will then people donate me if they are not in my server?

because i dont have support server yet
should work as a string...
How do i make it a string
I fixed it by not using audioonly filter seems like ffmpeg crashed everytime
I am unable to add background url while submitting my bot, when I save details it says unexpected error occurred. What have I done wrong?
they are updating top.gg UI a lot there was time when you cannot edit bot
it wasnt long ago
I think it'll be fixed soon
okai
is there any recommended size of image for the background url?
on the top.gg page?
when we add the our bot it asks for background url while editing, is it having any size or something that is recommended other then PNG and jpg
png has a higher quality
That is markdown you're using not HTML
+startbot
<a href="https://blah.blah">Text</a>
bruh
what am i using?
The image is MD and you said you need HTML
becasue i am
Am I loosing my mind
This is HTML:
<a href="https://blah.blah">Text</a>โ
This is MarkDown:
[Text](https://blah.blah)
thank u
let keyword = ['Ye', 'More Words', 'Words', 'More']
let alts = keyword.forEach(element => element)
for (var i = 0; i < 1000; i++) {
let img = new Image()
img.src = "./image.png";
img.id = "alttags";
img.alt = alts;
document.body.appendChild(img)
}
i wanna get each of the keywords and place it in the img.alt but not the whole list 1 keyword per image
not sure how i am supposed to do this
Ask in their support server
what's that forEach for?
mmmm that code doesn't make much sense
can't you use keyword[i]?
but don't loop 1000 times
i am trying to create the same image 1000 time
and add a different keyword
on each alt
ok so i've been killing my braincells just for that
EEE
thanks
that will only work for the first 4 images
Can someone help me out please
lol freelancing can get stupid
You should ask in their support server
Thanks sir
Hello everyone
i want to use https://pm2.io/docs//plus/guide/custom-metrics/
To add a custom metric for number of requests
hey
{"store1":{"name":["Footsites"],"emoji":["๐ข"]}```
${database[store1].emoji}
why is store1 not defined?
because you're using store1 as a variable
And a variable like that doesn't exist
Use string instead
how do i convert it from variable to string?
it's already in ""
so how can it be a variable?
because you're using string literals
okay i've got it working
${} marks it as an interpolation
edit the message
you need to re-create the whole embed and then edit the message with the object
you forgot about js being able to dynamically modify properties
right, crack
hey i was trying to modify the embed completely
s = await message.channel.send(statusembed)
}
if(message.content.startsWith(`${config.prefix}change`)){
const args = message.content.split("\n").map((x) => x.split(/ +/));
if(args[0][1] == 'store1'){
if(!args[0][2]){
message.channel.send("Please input a new emoji to add!");
return 0;
}
database["store1"].emoji == (`${args[0][2]}`);
fs.writeFileSync("./database.json", JSON.stringify(database))
const statusembed1 = new Discord.MessageEmbed()
.setFooter("Services status check!")
.setTitle("Service Status")
.setDescription(`๐ข Operational\n๐ด Down\n๐ Degraded Performance\n๐ต Under Maintenance\n๐ Locked till drop`)
.addField(`Stores`, `${database["store1"].emoji} ${database["store1"].name}\n${database["store2"].emoji} ${database["store2"].name}\n${database["store3"].emoji} ${database["store3"].name}\n${database["store4"].emoji} ${database["store4"].name}`)
.setTimestamp()
.setThumbnail("https://www.linuxnix.com/wp-content/uploads/2011/05/status.jpg")
.setColor("#00FF00")
s.edit(statusembed1)
}```but as you can see i was getting scope errors
so i tried to use let s = ""
at the begin of my code
and tried the scope trick, but it gave me a s,.edit is not a function error
on which line?
i only have one s.edit. All the way at the end.
i tried logging s inside the !embed scope, which worked, 2nd one in the !change scope didn't.
yah nvm i placed the let s = "" in my message event. Worked now
is there a way to check the realtime votes from my bot in py?
am I being stupid or am I being stupid
let zombieXP = profileSuccess.profile.members.[`${correctuuid}`].slayer_bosses.zombie.xp
why doesn't this work?
basic syntax error yet i'm so confused
no it isn't
alright then
uhhh i got another question
so this is part of the api
let profileid = playerSuccess.player.stats.Skyblock.profile;
but is there any way for it to get the first file name in that "folder"
(yes i know it's profiles and not profile)
so under profiles, i want it to get the first file name
right
i don't know what that is, it seems to be an object
opens this up
I just need it to get 4dfab9aa438c4dc39e1274d7853a5f59
the first array preferably
yeah, so, you're going to have to use Object.values() and pass theprofiles to the values() method
this will return an array of values
huh
once you get that just index it with an index of 0
can you change that to monkey brain language
uh
lul
what don't you understand
you have an object right now, objects have keys, meaning to access a value you must know the key
i've never used apis really
anywhere lol
don't understand anything
if you want to access a key that you either dont know, or that is dynamic and can change on every request, then you have to convert the object into a list of keys
so you can then get the first key
Guys are you gonna update 24/7 ๐ bot?
to convert an object into an array, you use Object.keys(yourobjecthere)
Object.keys() will give you an array of keys inside the object
can someone show me the piece of code needed lmao
I mean it's offline , that's why asking...
well the array changes per request
Python ?
Ahh JS
after you get the array, index it ([0])
and you got the first object inside profiles
myobj = {
key1: 10
}
let arrayofkeys = Object.keys(myobj)
let firstkey = arrayofkeys[0];
console.log(firstkey) // "key1"
let valueoffirstkey = myobj[firstkey];
console.log(valueoffirstkey) // 10
yes
alright so
let arrayofkeys = Object.keys(profiles) // profiles is a var
let firstkey - arrayofkeys[0];
let profileid = profiles[firstkey];
the id of the profile is the firstkey variable
your profileid variable is already the contents of the profile
arrayofkeys is ["4df97w4ghg0384g",...]
SkyBlock
firstkey is "4dfubwog88g3g3go3g4hou"
profileid is the data that is inside the thing
Lavalink or YTDL, which is faster?
Math.floor(Math.random() * (33799 - 32200) + 32200)
self.bot.ready does not exist
ohh no, they pushed slash commands to the beta branch of d.js. i see a ton of people coming here complaining that it doesnt work.
LMFAO
What
it doesnt work?
var obj = json[i];
const id = obj.id
}``` i am looping through a json using this. How do i check whether the message.author.id is in here?
im working on adding it to djsl master
isn;'t there a property named contains?
Object.values(obj).includes(message.author.id)
love you
wait
we have multiple ids
oh ic
json.find(item => item.id === message.author.id)
returns undefined
if you have multiple properties that have different IDs use json.find(item => Object.values(item).includes(message.author.id))
but wait doesn't this already loop through the json
which means that i wouldn''t need the for loop
you don't need it
alright, so if i define a variable named m to this
Is a cronjob just a while True loop with sleep?
i can access other data by using m.(datavalue). For example: m.status
yes
idk how timers work on the os level
Not precisely
Sec
interval = 1 * 60 * 60
if __name__ == '__main__':
while True:
login()
send_request()
time.sleep(interval)
owh wait i forgot one side note
"metadata": {
"discordid": "345138133429649408"
}```this is actually how the discordid is stored
alongsdie other info above the metadata
wait that is really easy. Just .metadate.discordid

how do i send a message as soon as a for loop reached its end?
...send it out of the for loop
wait is that really that easy?
Yes
because i am getting cannot send an empty mesasge errors
eventhough the txt file is filled with info
what's your code
wait one sec i need to try something
function getRandomBetween(min, max) {
return Math.random() * (max - min) + min;
}
const constant2 = Math.round(getRandomBetween(32200,33799));
function string(length) {
var result = [];
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var size = characters.length;
for ( var i = 0; i < length; i++ ) {
result.push(characters.charAt(Math.floor(Math.random() *
size)));
}
return result.join('');
}
const randomstring = string(10);
fs.appendFileSync("./generates.txt", constant1 + ":" + constant2 + ":" + username + ":" + password + "-" + randomstring + "\n");
}
console.log(database)
message.author.send(database)
}
}```
the txt file gets overwritten with info, but before that console.log(database)
txt file db :troll:
it's not a db
just some lines of constants from the json file
it immediatelly resets the file after its sent.
damn that code is so messy
did you copypaste parts from so
lol
anyway
you have no variable named database
i do
let database = fs.readFileSync("./generates.txt", "utf8");
๐
stop omitting parts of your code if you want help
i will shitpost somewhere else
@fast wind
omitting code and asking for help is like going to the doctors because you've been coughing but you didn't mention that you smoke 2 packs of cigs a day
sorry cry
ilysm
it's not a database holy shit
fail
lmfao
i am just using the txt file to send to the user
-You have to be connected to a voice channel before you can use this command!
perfect crop
lmao
NO
darn
anyways, does anyone know why this issue is occuring?
stop using var and use let/const
okay but that can't be the issue
guys why are you still trolling me
i am genuinely trying to get help here
would appreciate if you could be a bit more serious
provide your actual entire code
without omitting parts
and you'll be taken seriously
?????????????????????????????????????????????????????
okay my bad wait let me bin it
also like
where is database defined
50% of that code is copypasted from SO ๐
Lol
lmfao
aty the top of the code
if you don't want to be clowned, stop behaving like a clown
is that like a base64 id generator?
nah just a random str
it's the first result on google for "js generate random string"
and you can tell they copypasted it because of the uniform padding on the variable declaration
lol i would just use crypto to make a hex string
is way compacter, and crypto is a build in module so you have it anyways
assuming they implement it correctly
One message removed from a suspended account.
/hug
how do i delete the contents of a file after a message is sent?>
message.author.send({
files: ["./generates.txt"]
})``` I know to use fs.writeFileSync("./blabla.txt", ""). But how do i perform it AFTER the .send
await it
<Promise>.then(...)
wdym luca's code is the best code ever created
you need 50 years of experience to pull off something like that
Beautiful isn't it?
whoever did it is a god
you could make a spinning donut out of that
i've tried that but it would still perform it before the .send
idk why but this makes me wanna npm i async-await
// Promise.prototype.then(...)
message.author.send(...).then(() => {
// Write file
});
// async-await
await message.author.send(...);
// Write file```
npm i *
how do i get my bot's webhook url?
Asd
let args1 = ""
let args2 = ""
if(message.author === 'bot') return;
if(message.content.startsWith(`${config.prefix}generate`)){
const args = message.content.split("\n")
.map((x) => x.split(/ +/));
if(args.length == 4){
args1 = args[0][1] + args[0][2]
args2 = args[0][3]
}
else if(args.length == 3){
args1 = args[0][1]
args2 = args[0][2]
}
console.log(args1)``` Why does this console.log return nothing?
<Message>.author is an object, its never equal to string 'bot'
You're looking for <Message>.author.bot
aha yeah sorry
that isn't the issue tho
let me provide an updated snippet
let args1;
let args2;
client.on("message", async message => {
if(message.content.startsWith(`${config.prefix}generate`)){
const args = message.content.split("\n")
.map((x) => x.split(/ +/));
if(args.length == 4){
args1 = (args[0][1] + args[0][2])
args2 = args[0][3]
}
else if(args.length == 3){
args1 = args[0][1]
args2 = args[0][2]
}
console.log(args1)
console.log(args2)```
Because the length of the array might be even equal to 4 or 3, that's why they're empty
Try logging args.length at least
done that
it shows 4 or 3 depending on how i use it
let me log them for you
And you're accessing non existent indexes
args[0][1] can be undefined for example
Try logging args[0]
:c
event is not defined
Because you didn't define any variable called event...
You're calling the <EventEmitter>.emit() method and the client class extends the EventEmitter class
You can do Client.emit(...)
I was going to do a server statistics command for my application but the code is not working, can you help me?
how make this any one say pls i cnt know html
message.guild
The HTML element represents tabular data โ that is, information presented in a two-dimensional table comprised of rows and columns of cells containing data.
thx
whare should i rigth my eliments
<table>
<thead>
<tr>
<th colspan="2">The table header</th>
</tr>
</thead>
<tbody>
<tr>
<td>The table body</td>
<td>with two columns</td>
</tr>
</tbody>
</table>
Learn HTML
Didn't work :/
what?
Use CSS for that
or <h1> tags
maybe you should go through a simple HTML and CSS tutorial
Can someone tell me why the bot doesnt return and throws an error instead:
let user = msg.mentions.users.first() || await client.users.fetch(args[0]) || undefined;
if(!user) return msg.channel.send("User not found")
bro ic cnt know htm;
bro u cn
just lern
HTML (Hypertext Markup Language) is the code that is used to structure a web page and its content. For example,ย content could be structured within a set of paragraphs,ย a list of bulleted points, or using images and data tables.ย As the title suggests, this article will give you a basic understanding of HTML and its functions.
What error?
404 not found
huh. interesting. I thought that would return undefined
well I guess you have to catch it then
ยฏ_(ใ)_/ยฏ
seriously kid, you do know it's can and can't... right? Why do you never type the a?
its like you write k instead of ok
ok maybe but there's millions of people that use k , I've literally never seen anyone say "cnt"
except this dude
What's cnt
It's when you're too lazy to type "can't"
but you can type literally every other word correctly
bro check your bot token
I see thz
when i ask you cnt give
owo
No, it's not an API problem, or a token problem, or a definition problem. Please, stay aside, go read the html tutorial, let me handle this ok?
ok sir
Thank you madam.
What, you can call everyone 'sir' but I can't call everyone 'madam'? what a double standard.
i am boy
And I am not.
thank you :)

Hi I got a development question, is it hard to cluster shards for discord bot
pretty hard yeah
Where can I learn it?
That's... not something you just "learn"
clustering is a super advanced concept in application development
How many guilds is your bot on?
Oh I just want to learn clustering
Ok but this is like saying you "just want to learn nuclear fusion" and all you want to power is a flashlight
This isn't something you just pick up
Oh true
It takes years of development experience to understand something like this
Sorry for being rude , the actual reason is because i want to know how to make clusters beforehand
Oh?
Yes.
clustering is something bots like dank memer need - on millions of guilds
learn to breathe before trying to learn how to run a marathon.
Yea, probably need to let my bot grow first
So is it needed to cluster shards or nah
I think you're using the word "Cluster" thinking it's relevant to you. it's not
You will be able to shard later on, but don't worry about this until you reach about 2000 guilds. Then you can think about sharding and execute it.
And for most discord.js bots that literally just means doing new Discord.Client({ shards: 'auto' }) and that's it.
@earnest phoenix if you want to learn what clustering is, I recommend you read https://en.wikipedia.org/wiki/Computer_cluster
A computer cluster is a set of computers that work together so that they can be viewed as a single system. Unlike grid computers, computer clusters have each node set to perform the same task, controlled and scheduled by software.
The components of a cluster are usually connected to each other through fast local area networks, with each node (co...
how to look for sub folders
fs.readdir('./commands', (err, files) => {
if(err) return console.log(err);
let jsfile = files.filter(f => f.split(".").pop() == 'js')
if(jsfile.length == 0) {return console.log("Could not find any commands!")}
jsfile.forEach(f => {
let props = require(`./commands/${f}`)
bot.commands.set(props.help.name, props)
})
}) ```
Call fs.readdir again.
If there may be an arbitrary number of subfolders consider making it recursive / use a loop.
has someone any improvement ideas for this help panel?
Ahh ok @umbral zealot and @sudden geyser
In combination to my first message, ```js
fs.readdir("./commands", (err, directories) => {
handleError(err);
for (directory of directories) {
fs.readdir(./commands/${directory}, (err, files) => {
handleError(err);
// `files` is your JS files
});
}
});
Use a font that's easier to read, that's... not very helpful UX-wise, tbh.
how so like
See the example I wrote.
Do someone know why when I start new terminal nvm won't bind as alias ?
it fucked up my bot like 20th time
I mean, this is exactly what I wanna do.
bit of fun innit
Ok
Hello for me html and css not working on bot description when adding bot
Could you show it?
nvm working now but gif has some issue with resolution
dose anyone know free 24/7 hosting?
free regardless of quality?
yes
replit
?
that is me having to re cod
my code
why?
you can hide your token
you SHOULD hide your token
yes
Indeed
recode
2 line change
what
Hmm


Need your help
no no no, he means the sports streaming app
Why you leave me alone

not a very smart individual, are you
Every time ping me
is 24/7 for no offline?
Hey how old are you?
me?
no, the guy with the cat pfp
I can help you but you need to be a certain age that I won't say until you tell me your age
when do you guys recommend beginning to shard? iโm currently @ 720 servers, i know by 2000 you should definitely start sharding but should i begin to learn about it now & implement more towards 1500 ? or should i wait a bit longer than that 
regarding "free" hosts they dont exist (exept you have a friend who runs it on his Root server or Paid VPS)
a lot of people say 1000 but idk
if you reach 1k i would start
alright, thanks yโall
its what discord recommends
n about free hosts, donโt use em, even if they say โfreeโ, itโs either just a trial for a week then you have to pay or itโs an untrustworthy site that leaks your token & then youโre screwed
or steal all your code and sell it
i recommend DigitalOcean
they are fine if you dont do heavy stuff like AI
i use repl
free hosts are ok for testing, but for production they are no where close reliable enough
if you run stuff like a website that maybe work a free host is fine, if it starts to use critical data get a paid vps and secure it properly
imagine not getting 3 free vps from google cloud and oracle cloud
i don't have to 
I maked a bot and I know one admin he added my bot in 100 real servers in one day after we apply for verification it says suspicious growth 
duh
well this is suspicious growth
you have to get now to 280 or so guilds
if you do the same thing again i guess you get flagged again
Can we add 10 servers daily and make it 280
Then?
you do nothing, it has to grow naturaly
bruh
there are many people who try to trick into certification, idk what happens if you get flagged again tbh, maybe they just kill the application
[PostgreSQL] I'm using an implementation of Facebook's DataLoader utility for batching query data for my backend GraphQL API and SQL query. This makes it possible to load a bunch of IDs from different fields in one SQL query (e.g. calling loader.load_one(...) in 10 different places results in one SELECT * FROM users WHERE id = ANY($1)).
For simple fields, it's been relatively easy, but with connections, I'm hitting an obstacle where the data to load may be different from one another. For example, connection => [{ id: 1, cursor: "123=", limit: 3 }, { id: 5, cursor: "93752=", limit: 5 }].
The issue I want to solve is not with DataLoader: it's how to model such a query. I'd like to avoid forcing the loader to call the database multiple times for each connection, since that would break one of the core problems DataLoader solves.
If we re apply without adding any servers or losing
your application is flagged. this means you have to reach a higher amount of Servers to get certified.
why don't u just use chunked queries?
why is everyone using another language here ;-;
like, select N rows filtering by row number
SELECT * FROM users WHERE row_number(ORDER BY id) BETWEEN 1 AND 20
or if you want:
SELECT * FROM users WHERE row_number(ORDER BY id) BETWEEN 1 + (20 * :chunk) AND 20 + (20 * :chunk)
hello
why count server does not work?
you need to post
post what?
Servcount with the DBL API
ok thank you
Discord.py how to get the no of bots in a server . i tried this
if bots.bot in bots:
await ctx.send(len(bots.bot))```
but no responce
I don't think I can use chunked queries because multiple connections may request different rows from the table. I'm using the row's id primary key (a uuid) and a created_at field (TIMESTAMPTZ) to create an order for cursors (one small challenge when using uuid due to them not being incremental).
For example, one connection requests 3 rows at most and wants the first 5 rows, and another connection requests 5 rows at most and wants the last 2 rows. It's a bit confusing to model in my head and describe, but this gets even harder if I add more fields, so I may go back to the drawing board and think about how to model the data loader.
send this request:
POST https://top.gg/api/bot/:yourbotid/stats
Headers: { "Authorization": "your DBL token" }
Body: { "server_count" : servercount(in d.py len(bot.guilds)) }
POST, not GET
You're trying to send len(bots.bot) in every iteration of the loop.
what language do you use @final pebble
and you wont do it from your browser, your bot will do that
python
also you need a DBL token
yes, i cant figure out what to do...
go to your bot > edit > webhooks > copy token
Just have a variable that you add 1 to whenever it finds a bot, then send the value of that once the loop is done
ohhh thanks sir
Keep in mind that you're gonna need the members intent for that to work
i have it
ok then what?
one problem could be you do not have the member intent enabled
bot_count = 0
for bot_user in guild.members:
if bot_user.bot:
bot_count += 1
await ctx.send(bot_count)
Don't spoonfeed please
get your DBL token from your bots topgg page > edit > webhooks
yes i have it
yes i did
and but it in your request headers as Authorization
thanks sir i got it already
which request library u use? aiohttp or requests or urllib?
i dont know what u talking about
additionally you could do send the length of bot.guilds
which library do you use for sending http requests?
hmm, thanks again ๐
i dont know
in requests, u can do sth like this:
requests.post("https://top.gg/api/bot/mybotid/stats",headers={"Authorization":"your DBL token"}, data={"server_count":len(bot.guilds)})
but you have to install requests library using pip
and add import requests at the top of the file
ahhh ok will try now
thank you man
how much servers does your bot run on?
24
ok
if your bot gets bigger, use aiohttp instead of requests
i gave the example with requests because it is easy
but requests is not async, and it will block your code
turn out iam using requests
@blazing sentinel
how time does it take to update because still does not counting
i don't know. it must auto update
at the time
https://top.gg/api/bot/mybotid/stats
i copy this link and bot my bot's id ?
that is the right way?
https://i.callumdev.xyz/17o0n.png
DELETE FROM usuarios WHERE usuarios.id = 98
Is there a way I can alter this query, so it would auto delete any children
I think you need to use ON DELETE CASCADE
And how would I use it? I am not the best with MySql at all
But there are many variants in replacement of CASCADE
You need to use on the foreign key constraint.
@snow urchin see https://www.mysqltutorial.org/mysql-on-delete-cascade/
yes, but that doesnt show how to edit an existing table for it, I do not want to create a new table
"How to remove children with parent" 
unless im being dumb
anyone tried deep learning bot hosting on repl for free?
you can't at all
Deep learning bot hosting?
replit is too weak for anything AI-related
ignored
It shows how to delete any rows referencing the parent row that was deleted.
@lyric mountainnot ignored
I don't know what "deep learning bot hosting" is. If you're referring to deep learning AI you run on the host, see what Kuu said.
yep, i made a test discord bot with DL but idk if repl can handle
it can handle about 10 requests MAYBE
you'll hit RAM ceiling way too fast
that or you'll have about 1 answer/hour
wondering about also repl provide gpu hosting by default ?
i see since there tensorflow package avaliable
Sorry if this is in the wrong place, but just a brief question on the best way to display lots of data?
More of a "user ease of use" type question but any answers / suggestions are appreciated.
You should use pagination with reactions.
yes, that was my other idea ๐
and yes, as lite said, paginate
thank you guys, i do realize it's quite crowded
well luckily haven't run into it yet, but ive noticed on mobile devices it does not display as nicely
6000 chars max per embed
yep
I don't remember which one was
value
The best way to display your content is to only include as much information as the user needs (as Kuu said). For example, allowing a user to look up achievements for a specific category (e.g. a game) or pointing the user to the website.
having it on the website ain't a bad idea either, but i really like the reaction and pages idea
updated node from v10 to v14, now getting this error
https://i.callumdev.xyz/swv0a.png
@clear marlin i see your name ๐
i guess it's not updated properly
it did.
try running node -v
ye ik, it has updated just fine
if you're using pm2 then you're having a common pm2 issue
they are
how can it be resolved
manually define the engine path using either the command line or an ecosystem file
or completely remove pm2 and all apps from pm2 and try adding them again
https://i.callumdev.xyz/z55bx.png
this is my deploy script, what would the engine path be put down as?
pm2 start server.js --interpreter=/full/path/to/node/version
you can also try --interpreter=node@14
or with the full node version: node@14.5.5 or whatever yours is
so --interpreter=node@14.16.1
and I presume I need to rebuild node modules after updating? cause its screaming at me now
LOL
yarn rebuild doesn't seem to work though, says rebuild is not a command
delete node_modules and whatever package.lock yarn uses
and have it install again
i stopped using yarn because of shit like that
it sucks at building native addons
then try the full path to where node is installed
ive not a clue where its installed at ๐
ye, got that done now, now logs screaming at me with this
https://i.callumdev.xyz/uq6gh.png
well it says that module must be installed separately
so add it to your package.json maybe?
right ye, thought it already was
data?.["test"]
thanks
ยฏ_(ใ)_/ยฏ
hey
how do i define a variable on my request? ```js
request(options, function (error, response) {
if (error) throw new Error(error);
});``` i should await it right? And then simply const ... = request(
async function part1(){
await message.channel.send(`>>> Your Game will be starts in 5sec\nType :- \`cancel\` to End`)
await message.channel.send(m)
await message.channel.awaitMessages(m => m.author.id == message.author.id,
{max: 1, time: 1800000}).then(collected => {
if (collected.first().content.toLowerCase() == 'cancel') {
message.channel.send('**game ended**')
status = 1
return
}else{
const right = collected.first().content
if(right == m) {
message.reply("โ
")
status = 1
}
}else{
const wrong = collected.first().content
if(!wrong == m){
message.reply("W")
}
}
Error :- unexpected token else
So what can I do?
else is already in case nothing above is true
hey cry, is this right what i've done?
like the method used
don't understand what you're trying to say
i am trying to define a variable to my request.get
and i asked if i could just await it and then define a variable to it?
you want to return response into a variable?
so it would become something like this: ```js
var test;
request(options, function (error, response) {
if (error) throw new Error(error);
}).then(() => console.log(test))```
okay like this?
i can't
owh
how would i ever get info from it then
you need to wrap it in a promise
// synchronous library
const result = something();
// asynchronous library with promises
const result = await something();
// asynchronous library with callbacks
const result = await new Promise((resolve, reject) => {
something((error, result) => {
if(error) { reject(error); }
else { resolve(result); }
})
})
owh so it is not possible to use .then?
if the library does not support promises, no
callbacks are an old thing, before promises existed
alrighty!
you can also use what cry said
yeah i had a look at that earlier but i don't quite get that. Rather just stick with what you told me
const promisify = require("util").promisify;
const somethingPromise = promisify(something);
const result = await somethingPromise();
it depends on the function tho
promisify does not support all things
var request = require('request');
var options = {
'method': 'GET',
'url': 'URLGOESHERE',
'headers': {
'Authorization': 'AUTHGOESHERE'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});```yeah this is exactly how i get it
why are you using request
it's deprecated, you should've gotten a warning when installing it
umh yeah
is there an efficient way to grab all the guild members ids using discord.py
because this code was from like a while back, i just got back to it
replace request with node-fetch
i still don't quite get why i can't do const something = response.body
request probably has a ton of vulnerabilities by now
because we already have the contents right
because the value is in the callback function
it isn't returned to you
request was designed in 2009
^
Maybe from some random SO answer
wait i actually receive an object from the request, so can't i do: const test = JSON.parse(response.body);
Is anyone has an idea how can we calculate bot's ping on slash commands?
What is this in the first place
If I'm answering people will complain about my CSS < 3 tactics
its fine
why would you need that?
i need help
convert the container around as display: table; as the inner containers (divs) to table: cell;
they will align with the total table width
alright ty
or
@fair axle the ping is the same either way, you ping discord's domain, whatever endpoint you go to wont have much effect at all
the modern approach
SHUT ...
... there we go anyone just waited until I, the dinosaur, answers
it puts it all in the middle
Yes common table behavior
Because I wanna calculate the bot's response time
read what i sent
add text-align: left: for the table cells
hold on, that looks like you're using 1 DIV only for the whole menu
show the structure
red is the page width, blue is your div
Ciao
<div>
<div>menu 1</div>
<div>menu 1</div>
<div>menu 1</div>
</div>
if you don't stretch the blue div, it'll wrap around the content
styles="width: 100%"
Thanks

my brain
it boils down to the request itself taking longer response time due to the servers in all honesty
if you do 5 requests, you'll see all of them having a similar but slightly changed response time
Even I am not using tables in 2021 anymore...
Can I change the time of guild created at


