#development
1 messages Β· Page 1485 of 1
square.piece as Piece tells TS that square.piece is strictly of type Piece. So (square.piece as Piece).alliance would fix the TS error.
doing this, ts is not complaining any more. And therefore is now of type Piece
I'm already using this method, since last few weeks
But then your if statement becomes redundant
!. tells compiler that "don't worry about .piece"
yes, U (Feud) might be confused with ! and ?
anyone knows the answer?
?. is optional chaining
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
The ?. operator functions similarly to the . chaining operator, except that instead of causing an error if a reference is nullish (null or undefined), the expression short-circuits with a return value of undefined.
const piece = square.piece as Piece;
piece.alliance;
To me that's clearer when I have to access properties inside piece multiple times but to each their own
I use that approach, when I forcefully want to change the type of the object.
otherwise, if piece is of type Piece | null
I do
const piece = square.piece!;
piece.alliance;
it's just used to tell tsc "at this time, it will definitely have a value"
hmm, "or in this block..."
//Google Map
var lat = parseFloat(document.getElementById('52.379189').value);
var lng = parseFloat(document.getElementById('4.899431').value);
function initialize_google_map() {
var myLatlng = new google.maps.LatLng(get_latitude, get_longitude);
var mapOptions = {
zoom: 14,
scrollwheel: false,
center: myLatlng
};
var map = new google.maps.Map(document.getElementById('google-map'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map
});
}
google.maps.event.addDomListener(window, 'load', initialize_google_map);```
now the whole google map page turns bl;ack?
make sure it isn't your cache
huh
whats not cache?
browsers cache websites
Refresh with Ctrl + F5
make sure it isn't the cache's fault
;)
hey
could anyone please respond?
I don't know
does anyone wanna work on a bot together?
@normal sage nobody is going to want to make a bot with you unless you bring something to to the table for them
so what are you offering?
dm me
my labour is paid
ok
Never say never

dm me too
Mario for example
If a person says right
It goes to right
If person says left it goes to left
which language are you using
look into https://github.com/octalmage/robotjs
i use robotjs in my app
super simple API for controlling the keyboard (and mouse)
you have to have the game focused though
@earnest phoenix can I make my bot run N instances of the game on the VM
For each server
But wait
The bot can't share screen
;-;
I thought I had a really good idea
But I can share screen
And bot can control
that's false, bots can but it's really iffy
Iffy?
it's just presumed they can't because the mobile client ignores all video data from bots
Oh
no library supports video streaming regardless
you would have to implement it yourself
you have to use voice v5
voice v5 uses a new encryption method so that's fun
Ohh
sodium seems to have support for it
AES256-GCM
i started reverse engineering video but took a pause
it doesn't seem to be all that different from voice though
Thanks
I have an idea
Make a mario game using embeds and emojis
You will have to write the game logic tho
and have it run at 1 fps with occasional ratelimits lmfao
you also wouldn't really need to write game logic
you can still run the game
take a screenshot of it
and send it
it would still run at 1fps and you'd get occasional ratelimits
Mario game with 1 week cooldown for each server
@delicate shore your idea is still doable but you would have to show the game in a website possibly, not discord
cloud gaming in a nutshell
ye
you can do snake... and that's pretty much it
a mario game i think is too complex to do it in discord
I already did that
pacman maybe
But did not all to main bot
and asteroids
Pacman can be harder
tetris
anything that runs on more than a few fps is pretty much impossible to do without skipping frames
We can do pacman tho
Pac and ghosts will have 1 speed
But it will get ratelimted too much
it wouldn't be enjoyable either
Yes
people can just google pacman and play it if they want to
tetris is also possible, there will a timer for when the piece will fall, you can move and rotate the piece
co-op tetris
you'd basically have 1hz polling rate lmfao
I did, connect 4 game, for my bot
how about minesweeper
No
You can't detect mine clicks
and tictactoe, puzzle15 etc
but like
Unless user types coordinates
That sucks
are you implying your average user is smart enough to understand how that works
hm
Reactions could also be used
true tho
Abcdefghi
users are dumb
my connect4 game
music bots are also oversaturated and aren't worth making
cheese bot
see that is something you could do
chess with custom emojis
play against the bot
etc
how about an auto-board game
Monopoly ?
Nah
xD
make a bot that dms tim whenever it senses a discord.js like question
Lol
on message => send("use google")
Lol
opening some development channel to see use google after ever message 
in reality i don't really know any more bot ideas at this point
well i do have one last bot idea but it's just a twist to your basic moderation bot
people waste their very creative game ideas on implementing it in a discord bot
why not just get into actual game deving
turn your idea into reality
much good shit is wasted on discord bots
however discord bots are sometimes much easier to implement such ideas
because you dont need to deal with UI, you just abuse discord's lul
my bot for example could have had much more success as a web app, and i do plan to make a web app out of it
but fuck frontend
css about to give you a stroke
css will
btw whats the best reaction role bot out there?
I use Carl-bot and it works fine for me
I would jump straight into game dev if I knew how to do art
For ts, I have a type say type MyType = 'HELLO' | 'BELLO';
How do I change it to a enum like
enum EnumType {HELLO, BELLO};
enum EnumType {
HELLO = "HELLO",
BELLO = "BELLO"
}
but enums are better with numbers.. that's basically their whole point
U hv not got my point. I want to change that type to a enum
And I do want the numbers
Then just
enum EnumType {
HELLO,
BELLO
}
oh you want to convert it during run-time
that's not possible
also when that's transpiled to js, then enums are weird
yeah, but I do want to get that weirdness, 'hello' -> 0 and 0 -> 'hello'
we can use const though with enum, to not reverse map the numbers
type declarations themselves don't transpile to anything - they are just helpers for the typescript compiler and your IDE.
hmm ok thanks π
im pretty sure const enum was to make the enum not available at runtime i think?
I didn't knew about that though! π€
yea
well, it does make them available to runtime but they just compile to a basic array
hmm, yeah, I too just saw
actually I don't think they even get compiled
so for example
const enum Enum {
one = 1,
two,
three
}
console.log(Enum.one)
typescript will replace Enum.one with 1 in the compiled code
so im fetching the latest ban case in discord.js, but its giving me the one before the latest one
What does this mean? TypeError: fields.flat is not a function in a discord.js embed
im using Guild#fetchAuditLogs
and then entries.first();
Array.prototype.flat() is only available in node 11 and upper
entries.first(2)[1]; I guess
@pale vessel yeah but when i fetch the whole array from the audit log, the ban that just occurred isnt there
It takes time for Discord to update audit logs
so how to fix
wait
yes
Update your node.js version
thx
@pale vessel still alive?
ye
you told me to wait
yes, wait for discord
how
hey guys i have got a question
i just made my first website and want to deploy it to my vps.
how would i actually do that?
hmm okay but most tutorials actually only begin the website from scratch
I already have the whole website done,.
does it have a backend or just files?
just files
index.html, js and css
Here
?
a = 5+5
if a > 9:
print("a is bigger that 9")
elif a < 9:
print("a is smaller that 9")
else:
print("a equals to 9")
Elif is literally another if
I hv an array of instances of a class.
So to check if two instances are equal (with ref)
Should I use === or ==. (ik the diff bw these two)
I mean do I also need to check for the type?
U can only put one if, as many elifs and only one else
Is like an if but if you put else it checks both for being false
elif is the weirdest thing ever
Fr
@rocky hearth do you want to check if the objects hold the same reference?
I think I got it
why couldnt they go the normal route and just use else if
Thx orange
yes
Like
if:
False
elif:
True
else:
dont Activates
it actually has a decently good explanation
Nah elif is better
yeah just use ===
apparently
a regular else if
is just
an else
but with an if statement directly after it
but since python uses this weird indent thing

they had to make another keyword just for that
is there anyone that actually could help me to get my website up and running?
I don't get any of the tutorials i watched.
indent makes the code more easy to read at least for me 
lmao accurate
(this)

Lol
brackets make it even easier lmao
{=>{}{><~β€β}{}3{|{β}



But Y should I also check for the type?
whats worse, jsfuck or pyfuck
penis.js
π±
This library also has ReactJS bindings wiht the CondomJS wrapper component.
that is amazing
LOL that GPL
JAJAJAJJAKAKAKSKAKJAKWKWKWMEEKEKEKWKS

truly an amazing discovery
this is why i love programming
Yes.
that is amazing
issues are even better there
π³ LOLLLL
i love this community
lmfao vagina.js
is so homophobic π±

how to make a check if a role is higher in the list?
for example
let mod = message.guild.roles.cache.get('304313580025544704');
let botReviewer = message.guild.roles.cache.get('767389896133443625');
if(mod > botReviewer) return message.channel.send('Mod **is** higher on the list!');
message.channel.send("Lol Bot Reviewer is higher didn't expect that");```
<Role>.position
Lmfaoo
the code is amazing
beautiful
Jesus.walkOnWater = function(){
var elems = document.querySelectorAll('*');
for(var i = 0, len = elems.length; i < len; i++) {
elems[i].style.float = Math.random() < 0.5 ? 'left' : 'right';
}
};
Jesus.die = function(){
//check if Jesus died to prevent him to die again
if(_jesusBody) return;
_jesusBody = exports.Jesus;
exports.Jesus = undef;
// back to life in 3 days ---
//=====================
setTimeout(function(){
exports.Jesus = _jesusBody;
}, 3 * 24 * 60 * 60 *1000);
};
Jesus.waterToWine = function() {
document.body.innerHTML = document.body.innerHTML.replace(new RegExp('water', 'gi'), 'wine')
};
Jesus.isDead = function(){ return !!_jesusBody;};
whats the repo
this guy totally deserves a follow

the code is empty lmao
π±
hi
lmao
to use ${} you have to use template literals, which use these quotes ``
but you only have one thing on them, you should just use the variables themselves
bro
ive had this question for a while
well its a syntax error
so there might be some curly bracket missing or something
1 file?
um i dont get what you mean
but in which line is the syntax error
if the bot code is above only the bot works and if the oauth2 bot is above only that works
check line 1
oh that thing has happened to me a couple times
i don't remember exactly why tho
Need little assistance. How to check if channel has perms or not?
you mean the bot's channel permissions?
ΒΏJs?
maybe you had some more double quotes
well now its even more wrong
chage every double quote inside js events to single quote
yes
you can use channel.permissionsFor(someMemberOrUser)
kk

Lorem ipsum dolor sit amet, consecteur adipiscing elit. Etiam non urna ut purus
it's on the opposite side lmfao
i downloaded it from google because i cba to extract mc textures
going to fix the icons later

yup!!

the font scales too
guys i tried to access the user's voice channel with ctx.message.author.voice.voice_channel in discord.py but i got the error nonetype object has no attribute voice channel, can someone please help
sigh
x = #fetch something
x.your_mom
in our case x is none
so it'd be something like nonetype object has no attribute your_mom
@gilded olive i get what the error means but why is the user none when i send the message
i mean the command
is the user in the voice channel?
like a !join cmd?
@gilded olive the user is none not the voice channel
that's pretty obvious why it would return None then
The user must be in the voice channel
@gilded olive i am in the voice channel but the user is none so the error says that a noneobject does not have a voice channel
what
if the user was none you wouldn't be able to access voice, no? but you accessed it and from there tried to access voice_channel
so what should i do to fix it
refers to the author invoking that command, not you (if you did not invoke it)
hey could anyone please help me with setting up my website on the ubuntu vps?
i invoked the command
i've tried watching every tutorial out there but couldn't get it workingg.
and you were in the voice channel?
use nginx to serve your files and that's it
Can I see the code for that command please
k
if user_voice_channel != None:
vc = covid_bot.join_voice_channel(user_voice_channel)
else:
ctx.send('Please join a voice channel first!')```
i think
wait what
user_voice_channel = ctx.author.voice.channel
await user_voice_channel.connect()
if you've got static files you can use nginx and make it serve those files within a few minutes
what orainge said was correct
:>
okay i will find a tutorial
so nginx should be installed on the vps riht
POSTGRESQL
Does anyone know how one would do a sequence with a function/ multiplier rather than an integer increment?
not by default, you have to install it
idk
yeah I understand ofc.
but wghat should i do after the installation?
Can't find any suitable tutorials on the web
sounds like a read the docs moment
guys still getting err for bot's channel permissions. how to check if channel which bot is creating has perm or not? any help is appreciated
your code makes absolutely zero sense
try refactoring that
if you're gonna use async in map() use Promise.all
i mean sure you can map to a bunch of promises
and
yeah
that
well... are you running the function
post your entire snippet
so the for loop isn't executing
or, it is
it doesn't have any items to loop for probably
check for any errors
try putting a console.log above the for loop and see if it executes
i am hosting my bot on replit.io but now it s showing an error
`_http_client.js:152
throw new ERR_INVALID_PROTOCOL(protocol, expectedProtocol);
^
TypeError [ERR_INVALID_PROTOCOL]: Protocol "https:" not supported. Expected "http:"
at new ClientRequest (_http_client.js:152:11)
at request (http.js:46:10)
at Object.get (http.js:50:15)
at Timeout._onTimeout (/home/runner/wall-bot/index.js:13:8)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
code: 'ERR_INVALID_PROTOCOL'
}`
you should try catch inside the for loop, and log the error from the catch, maybe there is an error happening
nvm im blind
didnt see the second snippet
you might not have the right instance of whatever events is
I can make a connection to my MySQL db and then export that connection from the main js to another module right?
where is your mysql db
can I export it as I export the client/args/message etc?
hosted?
localhost?
yh
can someone help?
which language
python
I mean... I already made a connection at the main but I want to use that connection on another module to add it in a command
js
i just need the dpy equivalen of raw_input
node.js?
Replace https with http
Also wdym replit.io
That's not the official domain
where
im super late, but ye i am returning some stuff
https://appname.username.repl.co?
you probably passed a url to http.get() that used https protocol change that
also can ye send thy code
const http = require('http'); const express = require('express'); const app = express(); var server = require('http').createServer(app); app.get("/", (request, response) => { console.log(Date.now() + " Ping Received"); response.sendStatus(200); }); const listener = server.listen(process.env.PORT, function() { console.log('Your app is listening on port ' + listener.address().port); }); setInterval(() => { http.get('https://appname.user.repl.co'); }, 280000);
what?
You're trying to make it 24/7?
ya
I got a tutorial
Wait
Hosting discord.js bots on repl.it ! This tutorial shows how you can host your discord bots on repl.it if they are built in node.js irrespective of whatever library you used. This tutorial is applicable for all discord.js and Eris bots. Just to ease things we'll be using the end product of this tutorial . What we'll be doing? Creat...
U using repl.it?
Use uptimerobot
It's way better
In that tutorial they use uptimerobot
They just tell u how to make a server with express
Or buy hacker plan if you really need good hosting
And link it to index.js
i am using
where is the error
i use it in discord.py 
used
see in code
and also can you send your code
i sent
On the second last line is the error
Change the protocol to HTTP
If u already made a server just put the link in uptimerobot
i not made like in your sent link
i will try
Is there really any point in using Eris
Idk
What do you mean
for ts, what is the difference bw private member and using js' #member??
If u see a web tab u should take the link from there
And put it in uptimerobot
Make it ping every 10-15 mins
I know a lot of bots in the past used it for memory/performance reasons, but now with intents, the performance burden is less for both libs.
I think they're the same, but I may be wrong.
Some people prefer using Eris just because it makes them "independent"
ig it comes down to how they treat their users and how open the libraries are
djs knows that their average user is a moron so they babify everything
Yes
llmao
i replied to the wrong message
oops
It's a library you use to interact with discord api
That's the point
lol
i don't know if i am the average user of djs
they both do that
You only asked for the point
than y ts, not compile the private member to #member in js? My target is set to ES2017
You didnt ask for the comparison
and Eris has less utils and helper methods, so you have to find ways to do stuff yourself
unlike Discord.js which has a method for every fucking thing
ourcord
raw ws
Eris feels more like a do-it-yourself job but with less advantages unless you don't want Discord.js doing most things for you. Like sorting a collection of members in Eris doesn't provide a sort method, so you have to map it to an array then do your sorting, yet you can on Discord.js with its Collection object.
Then can you give me the comparison in your eyes
incredibly broken
botghost is for people who wanna spend ten hours making a shit bot than spending two minutes making something that you actually like even if it sucks
ten hours more like ten dollars
Never used eris, only read reviews from weebs
botghost is for people who want to brag about knowing programming but aren't able to write a for loop
so a skid
ding
mmlol
Eris collection.filter() returns an array instead of a collection
that's one weird thing I noticed when using it
uhh lite why are you whitename
White names are superior to green names
you can ask the same to cry 
LMFAO
hi
inb4 taken out of context
npm install mysql
use this command
create a folder for it inside your bot folder
bruh...
?
if(db.fetch(`mesajsayi_${message.author.id}`) > 5) {
db.delete(`mesajsayi_${message.author.id}`)
const botdm124 = new Discord.RichEmbed()
.setTitle(` **Tek seferlik, Robot olmadΔ±ΔΔ±nΔ± doΔrulaman gerekiyor** `)
.setColor('#0008FF')
.setThumbnail(client.user.avatarURL)
.setDescription(`\`\`\`CortexciΔi kΓΆtΓΌ robotcuklardan koruman gerekiyor UwU\`\`\`\n > **Destek Sunucusuna KatΔ±larak:**\n\n !!rozetlerim - 2 Adet rozet hediye.\n Cortex artΔ±k daha insansΔ± konuΕacak! (konuΕtuΔunca geliΕir)\n !!sunucutanΔ±t - Komutuna eriΕim saΔla!\n Γcretsiz, Spotify, Deezer, Youtube, Cortex Premium'unu al!\n\n > **Cortex Destek Sunucusuna katΔ±l :** https://discord.gg/xxxxxxxxxx`)
.setFooter("Neden bΓΆyle bir mesaj geldi?\nCortex dakikada 150 farklΔ± kiΕi ile konuΕuyor. Cortex'in bir sabrΔ± var :3", client.user.avatarURL)
message.channel.send(botdm124)
//.then(c => c.delete(30 * 1000))
}```
"db.delete" works but the embed does not come (discord.js v11)
why are you using v11
ok...? port it...?
v11 will break early 2021
break?
yo
yes since discord changed their domain
it's running on gateway v5 which is deprecated
how do I send a file in atttachment using json ?
...using JSON?
Discord has different gateway versions?
yes
Does v12 reduce ram usage?
embed : {
title: "Blah Blaht",
description: `\`\`\`${data}\`\`\``,
color: 'RANDOM'
},
files: []
});```
idk i never used djs
add file with a name of the file
dfk what you meant but maybe Buffer.from(some_json_data);
how can i see the error
nah just how to send an attahment without using new Discord.Attachment
dw ill make it work, don't really see you understand my issue 
there is no error because
you can send it as a buffer array
ig
what is your issue?
All I am asking is to how to name an attahcment
channel.send({
files: [{ name: "image.png", attachment: buffer }]
});```
thank you
i want to do that activity changes every 30 sec and instead of putring things in on_ready put it in
async def activity(bot):
commands.Bot(activity=activity)?
it is possible?
Lol
ask shivaco the python guy
just trying to export my db connection to a another js file so I don't have to make connections everytime I run a command, but it just dsnt work
But like
async def activity(bot):
return activity(#smthng)
await asyncio.sleep(60)
....
@inner roost see https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html
ik but just want to see if it is possible lol
go to the doc link and read it
ik ab tasks ;-;
idk, just question :> sorry
JSON good
yo is there any way to not show attachment appear as an attachment and just add it as a link ?
or show attachment inside an embed ?
<url>
like this ? fields: [{ name: "Download", value: "[Click Here](attachment://message.txt)" }]

you have to send the message somewhere and get the attachment URL
and then send another message to the correct channel with the attachment URL
oof

is there any way to send embed before attachment ?
I don't think so, embeds always show up later
You need to send the attachment after sending an embed
hmm k
which takes 2 calls
yeah double quota usage
xxx: OK, so, our build engineer has left for another company. The dude was literally living inside the terminal. You know, that type of a guy who loves Vim, creates diagrams in Dot and writes wiki-posts in Markdown... If something - anything - requires more than 90 seconds of his time, he writes a script to automate that.
xxx: So we're sitting here, looking through his, uhm, "legacy"
xxx: You're gonna love this
xxx: smack-my-bitch-up.sh - sends a text message "late at work" to his wife (apparently). Automatically picks reasons from an array of strings, randomly. Runs inside a cron-job. The job fires if there are active SSH-sessions on the server after 9pm with his login.
xxx: kumar-asshole.sh - scans the inbox for emails from "Kumar" (a DBA at our clients). Looks for keywords like "help", "trouble", "sorry" etc. If keywords are found - the script SSHes into the clients server and rolls back the staging database to the latest backup. Then sends a reply "no worries mate, be careful next time".
xxx: hangover.sh - another cron-job that is set to specific dates. Sends automated emails like "not feeling well/gonna work from home" etc. Adds a random "reason" from another predefined array of strings. Fires if there are no interactive sessions on the server at 8:45am.
xxx: (and the oscar goes to) fucking-coffee.sh - this one waits exactly 17 seconds (!), then opens a telnet session to our coffee-machine (we had no frikin idea the coffee machine is on the network, runs linux and has a TCP socket up and running) and sends something like sys brew. Turns out this thing starts brewing a mid-sized half-caf latte and waits another 24 (!) seconds before pouring it into a cup. The timing is exactly how long it takes to walk to the machine from the dudes desk.
xxx: holy sh*t I'm keeping those
@quartz kindle stop with the hypotheticals
Lmfao
@tight heath hey come here
hello
about that http lib you suggested
it appears i'm sending busted data with it
shut up
async initDM(id: string) {
const res = await this.client.path(USERS+"/@me/channels")
.body({ recepent_id: id }, "json")
.send()
if (res.statusCode === 200) return await res.json()
else console.log(await res.text())
}
this.client is a centra instance
i am confused
okay
what's a recepent_id
do you mean recipient
also you're using centra right?
also @aero/centra changes behavior so you can just do
res.json
instead of
await res.json()
also .path() etc mutate in-place
i dunno how good a client instance is
i think there was a bug in centra that i fixed in my fork with that
hm.
oh shit
i figured out my issue
it was POST and i didn't set it 
kinda odd how it redirected to google for a 400
the advertising π©
i can also just not help you if you prefer that
i said i would switch
ew centra
How to set a global database value for all servers and users? I want to make a botstatus command to change to maintenance status if it's in maintenance
I tried : let botstatus = db.get(`botstatus`) if(!args[0] === "set") { db.set(`botstatus`, args[0]) } if (botstatus === "1") message.channel.send('Maintenance') if(botstatus === "2") message.channel.send('Running')
And it didn't work
Halp
!args[0] === "set" That's not correct - !args[0] turns args[0] into a boolean value, so you are comparing true or false to the string "set" (false === "set"), which will always equal false and the code inside the if statement will never execute
Oh
I meant args[0] without exclamation
Point
And even if I remove the thing
It doesn't work
did you try?
If args[0] is "set", and you do db.set(`botstatus`, args[0]), then "botstatus" will be always set to the string "set"
sure
?
thats a bad way of doing it, but i guess it works?
i assume he legit counted how many characters are in the message (including his prefix + commandname + sub-arguments)
oh
no
dude
i just wanna know if it works and how is it a bad way, any better way i can do this??
oh jesus
yup he does
i do
tbh i wouldn't try to mediate a minimum number of characters
do i need all in one listner?
yes
otherwise it'll be very slow
But for that i need do to else if
Anything but not cmd handler
wdym antyhing BUT command handler?
if you have 20 commands and 20 message listeners then everytime a new message is sent 20 functions will be called, each to check if the message matches a command
your options are either a massive else if chain or a switch
command handlers are the best option by FAR
i need else if chain not handlers
why
you need a command handler not stubbornness
handlers are complex to undersant
a command handler is easier to use and recommended
literally read this guide https://discordjs.guide/command-handling/
realize there are plenty of documented command handlers
i have a 600 line code if i change it now it'll take megazega billion years
your 600 line code will turn into 4k in a few days
no they are not. You are basically putting all your commands in a hash map and in the message event you get the command and execute it
oh nvm its 792 lines
well, if you followed the guide you should have at LEAST a bit of JS common knownledge to start with
thats what the guide is there for, to teach you on how to do it
different files aren't required, but are recommended for readability
this is so bad tim came
792 lines? im splitting a 3500 line file into 90 files lmao
keep in mind that a giant if else is the reason why yandere simulator runs like cyberpunk but has the graphics of tetris
can someone solve this problem
you didn't even tell us the problem
Its my first time scripting a discord bot so....
Lol
you are bypassing the report command
the bot will respond to ANY message with less than 11 characters
Command handling:
+ Readability
+ Able to reload the commands without restarting the bot
+ looks a lot better
+ structure and dynamic importing commands
Else/if
+ you get probably 3 or 4ms more since requiring other files are "less performant"
HOLY SHIT YOU R RIGHT
then suggest a solution...
π€¦ββοΈ
i wish Js was like lua :(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
@opal plank requiring at boot time and storing the result of that will negate the con of losing a few ms
so you would actually gain speed
i mean, you finally figured out the problem, shouldnt be hard to also figure out a solution no? its just basic logic
hmmmm still, requiring multiple files are a lot "slower" than not dynamically importing them. So not quite, but the performance loss is negligible, we talking less than 2ms here
monolithic code is probably the most performant of all, the issue is, well, its monolithic 
i prefer my code Palaeolithic
cloudflare workers
hmmm i wrote new code ill check if it works
just put your code in a database and reload it it by fetching the commands from the database 
π±
code your bot in C then compile it with movfuscator :^)
tell users to run it on their machine instead
the only good copypasta
i legit cannot think of anything stupid'er than what i recommended
how can i make a bot ?
dynamic json command handler
Code you own language in binary π±


js...
how to make but ?
store your commands in a discord channel
learn js
@toxic glade
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
or just any lang
:scream:
ah
a butt? a lot of injections
why are you spamming
hmmm thats on par with my idea
he wants to make a but, not a bot
π³
hmmm, idk if he's old enough to be explained how to generate buts in 9 months
the second if will never run
else if else if else if else if else if else if else if else if
idk ab js
thx
else if else if else if else if else if else if else if else ifelse if else if else if else if else if else if else if else ifelse if else if else if else if else if else if else if else ifelse if else if else if else if else if else if else if else if
use a command handler


Lol
thats open source technically
i'd recommend else if's over COmmand to be completely honest
i started off with a base handler
JSON.parse(require("fs").readFileSync(`./commands/${args[0]}`)).run(message)```/s
Lol
then i built on it
run message 
hmm
oh RIGHT lol
hmm
u gotta eval it
i know and dont care
i also want
try {
require(`./commands/${args[0]}`).run(message);
}
catch (e) { return; }```


commands = new Map();
postgres.query('SELECT * FROM commands').then(e => e.rows.forEach(e => commands.set(e.name, eval(e.code))));```
Beat that scrubs. I got all of it. global variables, obfuscation, evaluation, gg ez no re
a solid 5/7
i can make a better one
i wonder if this disgrace of code would even run
commands = new Map()
r = require('./commands/index')
Object.keys(r).forEach(e => {
commands.set(e, r[e])
})```
can you even require an eval?
if you have an index file, you can require the directory directly
im really not sure if you can even declare something like that
commands/index is js module.exports = { help: require('./help'), ping: require('./ping'), } etc

.find() but always return false, just so you can walk through the array 
i like when development's like this
all have rare badge
purposefully retarded

commands = new Map(Object.entries(require("./commands")));
compaction
the badge is no longer possible to get.
Pokemon Code
we dont give code
we help
spoonfeeding code is against rules here
not give
ohk
how old are you @toxic glade ?
15
what a terrible name
commands = new Map([...await postgres.query('SELECT * FROM commands').rows])```

process.commands = new Map([...await postgres.query('SELECT * FROM commands').rows])
process gang
hello
hmm
process is really fucking convenient
process.ENV.commands = new Map([...await postgres.query('SELECT * FROM commands').rows])```
Beat that
\u006e\u006f
here's your pokemon code

looks feature complete
yea ikr
@misty sigil can you beat this one ? #development message
xD
hello, i use BDFD and y can change the programation to Javascript how can make a play music command?? never i used Javascript

i'll claim the crown of the stupidestesdes here then
oh no
sorry i speak only spanish
you have to rewrite the whole thing
me also
in javascript
liar you just spoke english
ok back to stupid command handlers
π
global.commands = new Map(Object.entries(require(require("zlib").inflateSync(require("zlib").deflateSync(Buffer.from("./commands"))).toString())))
:D
you discovered me
:)
zlib triggers my vietnam war flashbacks
i was never in a vietnam war
if only i could slap you right now....
erwin can't beat that
i have a better one
oh no
bruh, mine uses fucking ENV to store it
it's possible make a music player on Javascript?
how can u beat that?
only the best devs can make the worst code
yes
if you use nodejs and not bdfd
thats where you wrong kiddo. Been here far too long to be proven otherwise
lol
im scared, what is tim going to come up with
const { CommandoClient } = require('discord.js-commando');
const path = require('path');
Dbd.js 
I mainly use BDFD only now I want to use a little more Javascript
const path = require('path');```
no one uses dbd.js 
@solemn latch remember, this was posted here, UNIRONICALLY BTW https://pastebin.com/SNMA66Fv
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
.registerDefaultTypes()
.registerGroups([
['first', 'Your First Command Group'],
['second', 'Your Second Command Group'],
])
.registerDefaultGroups()
.registerDefaultCommands()
.registerCommandsIn(path.join(__dirname, 'commands'));```
LOL
BDFD
hmm
i use BDFD
bdfd? more like badfd
i dont even know what bdfd is








