#development
1 messages · Page 1417 of 1
So bots run on servers or a computer.
They need a constant server or computer to stay online @hollow elbow
I have a hosting program
what is your "hosting program"?
Even if I haven't one. It should be online. I am editing now.
@sturdy vine did your bot reach 100 guilds? Iirc the guild member intent doesn't work at 100 guilds until you request it from discord.
Do you have the guild member intent on?
yes
In both your code and the portal
Yes, intents are manually enabled in code.
Is it about that ?
@restive furnace
@solemn latch
but it worked about 2 hours ago
No @hollow elbow.
You need to pay for a vps to keep it up.
But it was online two hours ago.
Because it was running on your pc
Did you just start it?
don't try to run bot in vs code's terminal
I am trying.
what should I do ?
Sorry if I can't make true sentences. English is a foreign language for me.
hello everybody.. https://github.com/top-gg/DBL-Python-Library/issues/35 is this dblpy py3.9 issue fixed yet?
So whats probably happening is the bots disconnecting and not remaining online.
So you'll have to close your current terminal and open a new one.
if not how do i manually send the request
"send the HTTP requests manually for now. I will close this issue when a fix is implemented."
The issue doesn't appear to be closed.
I think I have to code from start.
Shiv would know. If you post in #topgg-apihe will be more likly to see it.
oh ok
anybody help pls
hi
hi
wana help
why do people even use a lib to wrap around top.gg's api you're just bloating your app
@hollow elbow did you start your bot again?
I cant
@hollow elbow what you want tho help you
Close the current terminal and start it again
man
My bot was online 3-2 hours ago
In logs there isn't an error
I regenerated my token two times
@hollow elbow come dm
ok
sketchy stuff
oops wrong channel
how can i do this? the bot reply to the message that was used for the command to work.
you add x amout of money to the other persons account and subtract x from yours
you'd need a database setup first
replies?
i saw that earlier
you can just <@ID_HERE>
replies
OOOH
like ^
replies
that
yeah
theres a new payload iirc
let me fetch it rq
i THINk its type 19 or 18
19*
lemme just check rq
its definitively message_reference
but im not getting much luck
one sec
can somebody help me

JDA can do it, d.js doesnt support it yet
https://github.com/discordjs/discord.js/pull/4874
i could very well be wrong though
im trying to manually send it though
not using any of their methods
the docs already have message reference in it
send() should be able to accept custom payloads just fine
regardless of support
I tried using .send() but it didn't work, so I went with js client.api.channels(m.channel.id).messages.post({ data: { content: "hello", message_reference: { message_id: <message>.id } } });
Basically same as making a raw API request, but discord.js already has a handler for that, why not use it?
so im starting to use sharding
h
and it says shard died something is already listening to port ::: 9000
if there a way to specify a certain port spawn them on
or-
something is already listening to port ::: 9000
Don't think this has anything to do with shards
mhM
9000 looks like a ws port
only one process can listen to a given port at a time
cant really disagree with that
you have something in your shards that's trying to use the same port
you will need to either move it to the sharding manager, or set it so it only runs if its on a specific shard
i have sharding manager
nice error code
what is host.js
what is it doing in the shards
nothing
then remove it
lma9
so you have another thing trying to use the port lol
nope
show full error
uh ok
doesnt necessarily mean its within the code
other apps might be using 5000 as port too
wasnt netstats a thing?
or netscan?
netstat -tulpn
that
lsof works iirc
dont quote me on that, i havent dicked with that in a long time
dont quote me on that, i havent dicked with that in a long time
haha i quoted you on that brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

@young flame run netstat -tulpn
uh ok
next run rm -rf /
science
AH
don't do this
-del sys32

1 now
you cant use dblapi webhooks in all shards
im not trying t
you need to put it in the manager, or set it to run in only one shard
o
const {ShardingManager} = require('discord.js');
const config = {
token: process.env.token
}
const manager = new ShardingManager('./index.js', { token: config.token });
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
manager.spawn().then(() => {
console.log(`Launched ${manager.totalShards} shards...`);
}).catch((err) => {
console.log(err);
});
dis is
meh tinggy
you're using dblapi for both server count and webhooks?
no
only webhooks?
only server count
only server count?
yes
then delete the webhooks lol
delete dbl.webhook.on
delete webhookPort and webhookAuth
yes
ok
if you want to use the autoposter, you need to give it your client as well
like clinet user?
are you using dbl.postStats?
flag_um | Hello everyone, I have a problem here! I created a command called "embed" but when I type the command the console says it doesn't exist ... How can I solve this?
flag_br | Olá a todos, Estou com um problema aqui! Criei um comando chamado de "embed" porém quando vou digitar o comando o console diz que não existe... Como posso resolver isso?
flag_es | Hola a todos, ¡tengo un problema aquí! Creé un comando llamado "incrustar" pero cuando escribo el comando la consola dice que no existe ... ¿Cómo puedo resolver esto?
delete the entire postStats code and use the autoposter
love how he posted it in 3 languages
oh
for example new DBL(config.bot, client)
if you put there your client, it will enable the autoposter
and send the server count automatically
@pure lion 👉👈
ok
question
launched shard 1
video is for streaming
console log playing soccer with my npm .
well thats one option
@quartz kindle Can I send in private?
your bot is dying every time it tries to post server count
show your server count code
ok
server count?
@quartz kindle I sent
anyone knows a package to convert a string like this I :heart: cookies to I ❤️ cookies ?
there is no embed command
the code that sends your server count to top.gg lol
@river thistle you could map unicode emojis to certain words and then just check if the string contains one of them and replace it
@river thistle Discord does it for you, if that's what you mean. Otherwise, twemoji-parser I guess
where you used postStats
here
@quartz kindle I sent it wrong, wait
Either twemoji or twemoji-parser, not sure which one
Oh, you can't search for names?
not that one, you said you were using postStats, where is it
nope :/
Well, use the emoji map
this is where i the server count for post stats at
if you are talking bout this one
oh yeah
imma check it out
@quartz kindle
where is postStats
your logs are showing that its still running
it changed the server count
postStats isn't in my code
i did a change all occurences and ran it again and console log is still having a stroke
looks like some random yt tutorial copy pasta frankenstein bot
@quartz kindle b
try removing client from DBL
what exactly does error out?
what causes the empty object?
or add the debug event to see if it finds something
its just wired that it crashes right after it got loaded
did you try removing client from dbl?
still is having strokE
try what tim suggested
i tried using the ping command and uh
add client.on("debug", console.log) to your code
but make sure to comment it out before going into production
and it spammed it like 10 times
pff 7k ms this is nothing
nice

client.on('guildMemberAdd', member => {
const channel = member.guild.channels.cache.find(channel => channel.name === 'welcome');
if (!channel) return;
channel.send(`Welcome to the server, ${member}`);
});
it spam it 10 times
why
my bot got DDosed by a command that accessed an API and some genius constructed a search item that i requested from the api that caused the API to send 1 million results. caused the bot to hit 300k ms or so. need to search for the screenshot
show full code
all my coded ?
yes, except the token
@river thistle https://static.emzi0767.com/misc/discordEmojiMap.json
ok
thaaaaanks
What's the problem?
here
@quartz kindle @lusty quest
never ever put one client.on inside another client.on
H
ok
// good
client.on("bla", bla => {
})
client.on("bla", bla => {
})
// bad
client.on("bla", bla => {
client.on("bla", bla => {
})
})
H
something is silently killing your bot
this is the only thing
const host = require('./shard_index.js');
i have for the sharding
@quartz kindle I still do not understand
its something with the sharding
it worked fine before
const {ShardingManager} = require('discord.js');
const config = {
token: process.env.token
}
const manager = new ShardingManager('./index.js', { token: config.token });
manager.spawn().then(() => {
console.log(`Launched ${manager.totalShards} shards...`);
}).catch((err) => {
console.log(err);
});
H
where did you host your bot?
no need to reset if your token is not in the code
heroku wont give you enough horsepower to run 2 shards
you have .run in the main file, but .execute in the command file
so your bot tries to use .run but it doesnt exist
on my own vps
then fix your sharding manager
i diD
its possible that it panics and just crashes
lol
you'll need to show your code
did you need to run your bot in shards? sure at some point you have to go throu it but its not worth with less than 1k guilds to look into it
@quartz kindle how do i solve this?
i guess start over with recoding the bot. its a complete mess of copy / paste code
@quartz kindle Ok.
uh
this is normal
tf lol
niceee
like i said comment out the debug before going into production
i did
no you did not. otherwise there would be not this console spam
i talk about the client.on("debug") line
i added this
if you keep it it will spam all the hearbeat stuff into the console
yes its for debugging but it doesnt show anything why it crashed
how did you managed this now?
remove whole listener
this
do you know how to code i am wondering?
hoW

This is your place: #development message
give me a sec
the debug line. in case you need it later
ok

but why the entire error?
why not
Comment out the error ez fix
Well it doesn't really makes for me anything, I've done it like this, but nothing on website domain
(Second one is name and 3rd is where it points to)
(@hollow sedge)
Hi, i'm having this weird issue and i have no idea what's cusing it, it just came for no reason whenever a command is executed (maybe whenever the message event emits) <-<
is there anyone who wants to help me with makin my site on glitch? ive done a little bit of what ive needed to with the time ive had today. ive got an nav bar and some working buttons currently down. im happy to share the link to hel with development in dms aslong as your somewhat decent with css and html
@quartz kindle well
it works ty lol
it didn't die instantly and revive itself
and it didnt spam chat
panik 
panik best girl
yes
wdym what should i change in it ;--------;
;-;
oh (s)he's offline
lmfao i fixed it
ok
i did client.token = "nothing to see here" after declaring client to be sure no one steals it
😭
const isBoosted= types.some(w=> weatherAffinities[weather].includes(w));```
+ `**IsBoosted: **` + ` ${isBoosted}` + "\n" this sadly only returns true or false. How do i make it so that it actually shows what the weather type is? This is the link where i am getting it from https://nycpokemap.com/js/script_gym.js?ver645
yo guys i made an embed but when i use the .setThulbnail(message.guild.icon) i don't have the server icon
i don't have an error but what should i do to have the icon of the servers
It's setThumbnail() and message.guild.iconURL()
If the server has no icon, then it will be null
oh my bad i did that but i tried it in a server whitout icon lmao
you really shouldn't.
yea ;v;
i did a while before but i guess it wasn't working so i didn't knew it was that
the only things i found was some weird https request and json data ;---------;
in google
sorry i don't use glitch or a custom domain, I just looked up your problem
Fine, I solved it by putting www. before domain
Anyway, thanks
:D
:D
const isBoosted= types.some(w=> weatherAffinities[weather].includes(w));
- **IsBoosted: ** + ${isBoosted} + "\n" this sadly only returns true or false. How do i make it so that it actually shows what the weather type is? This is the link where i am getting it from https://nycpokemap.com/js/script_gym.js?ver645
could somebody please help me?
they aren't
How????
they just aren't man
why are there so many ifs
ikr
bankAmount is 1000
amount is 100
dont you have switch case in py
^^^
you don't need to point that out
also that isn't the case
one of them is a string
and you need to find out which
you cannot use print to determine if its a string
print(1000) and print("1000") are identical on the terminal
So how do i know which one is a string...?
type...?
Aha.
print(type(x))
Alr
D:<
Tho i am sure they both r ints
In my db they both show as int thats why i am 99% sure they're ints
But gonna print their type n see
if they both end up being ints the problem might be in one of the helper functions
Told you they both are ints
I just made the amount argument to int and it worked
Idk how that fixed it tho
Lmao
async def withdraw(self, ctx, amount):
should be async def withdraw(self, ctx, amount: int):
otherwise amount is a string and might not be a valid number
yo guys, i created an embed but can someone tell me how i can show the emojis of the server
i used .addField(message.guild.emojis) but i didn't show the emojis
Py or js?
either way you're wrong
you need a name and value
that's universal
AFAIK there is no lang that allows something ambiguous like that
embed.add_field(name= ,value= )
``` if ur py
<--- Last few GCs --->
[52737:0x2079a30] 199079397 ms: Mark-sweep 1162.9 (1429.3) -> 1162.9 (1394.8) MB, 3154.0 / 0.0 ms (average mu = 0.456, current mu = 0.000) last resort GC in old space requested
[52737:0x2079a30] 199082305 ms: Mark-sweep 1162.9 (1394.8) -> 1162.9 (1390.3) MB, 2908.2 / 0.0 ms (average mu = 0.292, current mu = 0.000) last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x30c2c2aaee11 <JSObject>
0: builtin exit frame: parse(this=0x30c2c2abc8a9 <Object map = 0x279b030cac9>,0x394fd8d11081 <String[515]: {"t":"PRESENCE_UPDATE","s":15421464,"op":0,"d":{"user":{"id":"760548xxx28xxx5093"},"status":"online","roles":["7641571xxx8813285","76421195xxx570152"],"guild_id":"740389xxx730548","game":{"url":"https://www.twitch.tv/yxxx","type":1,"name":"Wesxxxizde.","id":"ec0b...
My bot just crashed with this in the log
Any ideas? 
Nope
Just regular log stuff around it
well from what i can see someone changed their status
Nothing out of the ordinary before that error, and just the bot restarting after that error
1 is watching I think
ill check
Streaming
Kekw
all i can say is check your code
Discord is a stable platform
ya
Not doing anything with presences really
huh
Like I don't have anything that would do something on presence updates or change stuff depending on user presence
uh.. quick question, im thinking of making something.. i googled and it doesn't seem to exist but I MUST BE THOROUGH
if i wanted to make something that configured a nodejs console like how there is chrome inspect element console for browser.. does something like that already exist?
Nope
okay
well you can now blame your lib
could just be an insanely abnormal crash though
How tho
What could suddenly use 27gb
were u responding to me or someone else?
kk
bot joined a new very large guild, memory leak, could be so many things
The error is always referring to libnode.so.64
that's the c internals for node
either there's an actual mem leak or too much legitimate allocation
Is there a way to increase that limit?
--max-old-space-size=<memory in MB>
or with env
NODE_OPTIONS=--max_old_space_size=4096
@pliant gorge
do you use pm2?
Yeah
do you have an ecosystem file?
Nope
you need to create one to use env in pm2
So I create one, put the stuff in there I need
And then I start my app with that file?
yup
So literally pm2 start someEcofile.js instead of pm2 start bot.js
yes
everything is in the ecosystem file
for example
put NODE_OPTIONS: "--max_old_space_size=4096" in env
change max_old_space_size to something like 8gb or whatever
also change max_memory_restart to the same thing, or remove it completely
I see, it's a property of it
Guys can someone help me?
this music bot is giving this Error: Error parsing info: Unable to retrieve video metadata
And can I change the name of it or does it have to be ecosystem.config.js for pm2?
#development message @drifting wedge do you know if or if not?
not sure tbh, try it
👍
i think it needs to be named exactly that for you to be able to run npm start
otherwise you need npm start ecosystemfile.js
They say if it's in js it needs to end with .config.js
ye idk, mine has the default name
well on to a new endeveor :}}}}
sry im so late for now seeing this
first time i cud do something that nobody else has done(even tho it is just a utility thingy like every other "new" thing)
Hello! use a web page to host my bot and put it 24/7, can I publish it even if I use a host?
ramriro, quiera decir algo?
Ahh, hola!
uso una pagina web para hostear mi bot y ponerlo 24/7, ¿lo puedo publicar aun que use un host?
si! justo la que uso...
la uso para hacer que mi bot no se desactive
entonces... lo puedo publicar a top.gg aunque use un host???
ahh entiendo.. para mi, no uso una pagina web y publicar my "bot" desde mi computador
"Command Prompt" > node fileName.js
pero quiera publicar sin usando tu computadora?
si, con una pagina web, ya que si apago mi computadora, el bot se apaga, en cambio en una pagina web... lo puedes encender y aunque apages la computadora el bot seguira online
hay maneras pero no se si hay una manera que es "gratis"
siento porque soy un estudianto de espanol.. hablo ingles primeramente
Ok, I'll tell you in English so you understand
recomiendo https://spanishdict.com traducir.. es el mas bueno
gracias
si, en una manera.. por ejemplo, tres meses en el pasado, registrado mi "bot" y un mes antes ahora, es verificó
Ahh, entiendo
xD
gracias y tengo otra pregunta....
hm
puedo usar discord.js para mi bot? ya que cuando entre al interfaz de publicacion decia algo de discord.js y discord.py
Ahh ok, gracias
no problema, adios
fairly certain the issue isnt in that
actually
like that or what ?
that doesnt return an image my dude
It doesnt return anything
@opal plank
well they want the image to at least work
invalid url in payload either way
It's randompuppy
dunno what the heck is that
idk if it grabs posts or images
So they're using meme subreddits 
console log it
hmmmm
Good way to debug
anyway, back to scraping
Somebody help when i enter working command for example !say it send me 4 messages not 1
and whith !nuke it clone the channels
HElp
I fix it
i was running the bot with 4 consoles
🙂
HTML/JS
Any easy way to convert HTML code to a clean string?
for example
<text = 'HELLO'> </text>
</br>```
into
```HELLO```
kinda like this https://onlinestringtools.com/convert-html-to-string
I use cheerio
cheerio.load(html).text();
ez clap
I use it mostly for scraping though
Prefer it more than jsdom or whatever
hmmm i wonder if puppeteer has something similar tbh
already installed, getting that right on
Hey, recently my bot passed the 80 servers and i got some issues..
- it looks like my bot just resetting himself more than 1000 times in a day, i've tried to fix the issue but i cant find the source of the error/issue, im just getting the shard disconnected message and i can't see any error, how i can make the source code show every error if there is? it looks like im not getting all of the errors..
- For some reason after shutting the bot down, or resetting him from the pm2 he stays online, it looks like the issue started when he passed the 80 servers, also when resetting him he just respond twice until i reset and change his token..
Thats the console log im getting everytime he reset himself : https://cdn.discordapp.com/attachments/381889950666457088/781315561166602260/unknown.png
@pale vessel any clues?
What's html[1]
isn't current API version, version 8?
@pale vessel a string containing html
Discord.js isn't using v8 until next major release
I'm assuming you already tried it
(despite the error)
lemme ignore error and see it
what? you mean djs? isnt it 12?
Discord API version
@pale vessel worked like a charm, ty ❤️
isnt discordjs = discord API?

Very pog
That is a wrapper
It's v7 in latest Discord.js/Discord.py
why did he replay me with that question o.o
Whats different @opal plank
Wrong ping
Sorry
Check api version by <client>.options.http.version
Anything significant, other than error messages
@solar rose What events are bound to your shards?
have no idea what does it mean..
how do i make discord bots read a variable
He'll probably ask you to do what he did so here @solar rose
Are you using a ShardingManager?
By learning js
depends on what language you like tbf
no, i just debug shard disconnect
i dont, its probably spawn when im starting the bot with node lol
have no idea about sharding
<Uhh, "just getting the shard disconnected message" so you don't know about shards?>
with ```
client.on('shardDisconnect', function (evt, id) {
console.log('Lost connection: ' + evt + ' (' + id + ')');
});
client.on('shardError', function (error, shardid) {
console.log('Connection Error: ' + error + ' (' + shardid + ')');
});
ClientOptions? sorry first time i hear about that.
new <discord.js>.Client( /* whatever inside of here */ )```
nothing.
So this means it's not a shard error exactly but it might be because of weak connection to gateway or a few of the events emitting but causing an error for the bot to crash
How often does the bot crash?
If it crashes every hour or something it might be because of the events
its kinda wierd
after im starting the bot there are 10 - 20 minutes without reset
and then reset every 1 minute
How long does it take for the bot to startup fully?
10 seconds +/-
Hmm
<client>.on("error", error => console.error(error))```
Might try this
@solar rose Joining this conversation late so sorry to ask if someone already has, but you're having issue with your sharding?
No, gateway closing connection between the bot and the gateway itself in random times
I suspect this might be a connection issue but it might be just an issue with the events emitting
Every few hours the socket is loosing the connection to the gateway or the gateway is closing the connection for reasons
"The internet is a dangerous place, disconnects happen." As the docs say 
It closes the connection to gateway and open a new one to make the connection between gateway and the bot stable
Yeah but with the difference it sometimes needs a resume package and rarely a full reconnect
(to restore the session)
Hi
this works as intended. but is there a way to limit the decimal to 2 places
if someone's name is like {token} and i have token as a var, what prevents the bot from sending a message with an fstring containning the person's name but it sends the token?
.toFixed(2)
if you're not evaling the person's name, there is no way the bot will send a token instead
you are not doing {token} you are likely doing {message.author.username} or whatever
mhm
whatever the username is, its treated as a string, not as a variable
@drifting wedge
@drifting wedge
@drifting wedge
@drifting wedge
the pings are free right?
@drifting wedge
@drifting wedge
@drifting wedge
@drifting wedge
@drifting wedge
@drifting wedge
Ya happy now?
what did i do wrong
What in the fuck
if answer is 100.000 i want it to round down to 99.999
What in the fuck (2)
Assuming answer is a number between 0 and 99.999
thats how the code is suppose to work.
@limpid bear what is answer
What would you wantit to be
Random number or user input
How many commands does the bot have to have to get it up to top.gg????????????????????????????????????????????
Why can't you just check if it's 100?
@earnest phoenix there is no specific answer to that question, any number would do
ok
ok. let me explain from step one. i am trying to check if its 100, but i know i am not doing the if commands right
why are you doing assignment in the if condition
Actually
^ there's your error
also why bother defining answer six separate times to alter it a bit when you could combine it into one expression.
I'd see if you wanted to keep it short but I doubt
the defining answer is the math.
Also the first one isn't necessary at all
i want the command to have a input for encounters
let answer = ((1 - fullodds ** encounters) * 100).toFixed(3)
could even replace Math.pow(x, y) for x ** y
true
Which is faster?
i believe operators are always faster than methods and functions
the difference is probably in nanoseconds
Ah ok
well i was able to shorten up the code.
that did not solve the problem.
i am trying to stop it from rounding if it is going to round to 100
so i want
if: answer = 100
say: 99.999
if: answer < 100
says: answer
You can make some custom css when you edit your bot page
It is not very clear from the photo, but I can link to the people who are interested.
Where can I find them :(
When you're on your bot's profile page there's a button that says "Edit"
Then on the "Detailed description of your bot" section you can use HTML and CSS.
So for instance you can type
<head>
<style>
body{
background-color: #fff0f0;
}
</style>
</head>
to change the background color of the page
answer would be determined by a user input and math
What is the math
"let answer = ((1 - fullodds ** encounters) * 100).toFixed(3)" the user input would be the encounters variable
Hello, can you give me a shining nice css code?
no wait
and what would fullodds be
right now it is 0.9998779296875
all of it is variables
all of them are variables*
so, it is stored somewhere
like var fullodds= 0.9998779296875
something like that?
if u didn't tell the bot to store it in a database it will not do it.
this is the full code
I thought encounters is a user input
ok. i need the code to see if answers is 100.000 or something below 100
and have a response that reflects that
let encounters = message.content.substring(7)
let fullodds = 0.9998779296875
let answer = ((1 - fullodds ** encounters) * 100).toFixed(3)
if (answer == 100) {
message.channel.send()
} else if (answer < 100) {
message.channel.send()
}
if (answer > 1000.000 {
}
eh didnt defien args
that's too advanced for him
oh right
check its heart-rate
Hey I'm the owner of the server this bot is for. I don't know much about code but this is the info we really need
The formula this bot is meant to perform is
(1-((1-X)^E))*100
X equals user input and a positive proper fraction
E equals user input and a positive whole number
It needs to not be able to display 100.000 and it needs a % at the end
uh
its a joke btw
heartbeats take a maxium of 14ms
if i have a str and i want to replace "a", "b" and "c" to "x" "y" and "z" how would i?
like if i have "abc is pog"
well minimum
in python
maximum is FUCKING 75K MS
i had pinged one of my bots shard
@drifting wedge use the .replace method
ik but how can i replace mutliple
wrong cap
response = "[author] is very [server]"
a = 1
if a == 1:
if "[author]" in response:
replacedresponse = response.replace("[author]", "{ctx.author.name}")
if "[author.mention]" in response:
replacedresponse = response.replace("[author.mention]", "{ctx.author.mention}")
if "[server]" in response:
replacedresponse = response.replace("[server]", "{ctx.guild.name}")
if "[members]" in response:
replacedresponse = response.replace("[members]", "{ctx.guild.member_count}")
print(replacedresponse)```
like this didnt work
it like i have multiple things
part of it is you're not using f-strings
no i dont wanna use fstrings
u just wanna have the actual like {} thing
str
o
nope i got it
thanks
i just did the same thing so response = response.replace
thanks
no need to send it 10 times
I don't like the logic that should be applied on all commands is in the command body (if bot sent message, parse args)
The thing is, you can make it more realistic by measuring the text and setting the time of when the bot is gonna stop typing longer than 3 seconds
The most complex say command
Hmm yes
let x = args[0]
let e = args[1]
if (/^[\d]*\/[\d]*$/.test(x)) return message.channel.send(`${x} is not a proper fraction.`)
if (e < 0) return message.channel.send(`${e} is not a positive number`)
let final = (1-((1-x)^e))*100
message.channel.send(final)
```@south cedar
regex go brrr
You could check a fraction with the modulo operator by seeing if x % 1 === 0
ah
also you sure e is a number or string
ah
And assign the arguments to a variable
how would i go about doing that
It actually needs to look more like a?1/64 32 where 1/64 and 32 are the variables
Arguments must be just message.content splited by a space with String.prototype.split() and slice the command itself off and assign it to a variable
is there an example
How do you make the bot read a fraction as a variable
library?
This is the bot @limpid bear is working on
read it as a variable or parse it as a fraction
yo guys i have this : .addField("Server Owner : \n", message.guild.owner)
but when i used in some servers instead of the owner i have null
Basically the calculation is (1-((1-X)^E))*100
Idk much about coding. I'm sorry. A lot of this is gibberish to me but x can be any proper fraction
@limpid bear is the one coding it
Wait i think it's .split()
Because the owner isn't cached, you must fetch it
the command should be !start 1/4092 100 1/4092 = "fullodds" and 100 = "encounters"
Basically the command needs to be
a?calc X E
Example
a?calc 5/1365 69
await <message>.guild.members.fetch(<message>.guild.ownerID)```
Prefix and command are still undecided
split the string by /, it will return an array
the first item in the array will be your numerator and the second one will be your denominator
this ^^
if (num[0] > num[1]) return message.channel.send('Improper Fraction')```
what 🤔
based on that code 10/2 is improper
You must cast it to a number before checking if it's greater or lesser
Improper if the numerator is greater than the denominator
ok, how can i add the user input to the command. so i can test it.
but the numerator can be greater than the denominator
The numerator should never be greater than the denominator
let x = args[0]
let e = args[1]
oh, you want it like that
let x = "5/1000";
let [a, b] = x.split("/");
a > b // true
// ---
parseInt(a) > parseInt(b) // false```
@earnest phoenix Drunk?
i have the
let x = args[0]
let e = args[1]

how do i use the args
Is args even defined
no, thats what i want to know
why are you copypasting code
let args = message.content.split(" ").slice(1)```
That's what args is
ok, how do i use that
Can someone help me build a voting webhook for my bot? (Python)
I hope you're not making a new message event for every command

