Midnight Pub

Oh god, Python! ...I mean the programming language.

~impulse

So funny story, a couple days ago I was sitting down in class, we were allowed to use our phones for the moment, and I was chatting on a particular Discord server.

Now I know, Discord is kind of terrible, but it would be too much of a hassle to get all my friends to move over to Matrix. That, plus the servers we've created have a lot of history we would rather not lose.

But this particular server was one I frequent quite a bit, it was the "Minecraft Computer Mods" Discord. It's a server for these Minecraft mods that add computers to the game, typically programmed with Lua.

Yeah, I'm THAT kind of nerd. But to be fair, if it wasn't for discovering this, I would still be fiddling with my TI-83+.

Anyway, I got this Discord bot that I haven't touched in a while. Why? Because the code is terrible and I don't know Node.js (or even just JavaScript) for the life of me.

I was chatting, saying "Damn, I wish I could program a Discord bot in Lua, that would make my life a lot easier."

Then, I was introduced to Luvit.io, which is like Node.js, but for Lua! Then I was introduced to Discordia, which is a Discord library made for it.

I was ecstatic at first, finally, a library I can actually use easily! I manage to set up a small little Discord bot with it, and everything is going well, except there is a slight problem.

No slash commands.

The library seemed a bit outdated, to say the least.

I made an offhand comment in the Discord, until another user named Sky that frequents the server often as well, informed me that Discordia was TERRIBLE, just all around. Not only is it outdated, but it isn't asynchronous, so when multiple people start trying to use it, it will slow down like HELL.

Sky then introduced me to discord.py, like the Python shill he is.

I should probably explain, I have a deep-seeded hate for Python, but I don't even remember why at this point. I only remember a lot of headaches, but those are constant.

And since Python's syntax is similar enough to Lua's, looks like I don't got much of a choice. I'm learning Python again.

Wish me luck.


tetris
No slash commands.

Check how the API is implemented in the library. Maybe it's just a bunch of POST requests, which you could extend/manipulate to inject/force slash commands

reply

contrarian

Have you ever tried a Discord bridge?

reply

impulse

Eh, wouldn't be able to use bots. There are a couple that I use frequently for a lot of stuff.

reply

inquiry

My wanting to rant a bit about the Tower of Babel of programming languages received a steam-releasing chuckle infusion when I chanced upon this:

https://babeljs.io/

I mean, of *course* it has to do with Javascript. Of *course*.

But, anyway, so happy to finally see the word "Lua" in someone else's posts. That made me so happy I nearly flung open the front door to scream an ecstatic "SOMEONE ELSE MENTIONED LUA!!! SOMEONE ELSE MENTIONED LUA!!!" to the neighborhood.

Can't say I ever hated Python, but I *was* surprised how prevalent it became way back when. And, of course, every time I see a job listing I mostly like, it requires Python expertise that I'll likely never have. Yes, could easily learn it, but can't lie my way into a job requiring expertise, and will likely never have expertise therein without learning it being a matter of living/employment.

reply

impulse

Honestly, maybe it's a good thing I haven't learned Javascript, it's incredibly broken and filled with unneeded features, or so I've heard anyway.

Regarding Lua, I think we can both agree it's immensely underrated, look at all the cool things you can do with tables and metatables! Oh and uh, coroutines are there too.

We don't talk about coroutines, they scare me.

I do really need to learn them though, they can be immensely useful for a lot of different things.

I think I may have hated Python because of the immense amount of libraries it had, and I had no idea which ones were the best to use.

Not sure, but I remember a lot of frustration.

reply

tatterdemalion

JS the language has a few 'wat.' moments, but overall, people don't complain about JS because of the language, they complain because of the ecosystem.

reply

impulse

What exactly is the problem with the ecosystem?

reply

tatterdemalion

The lack of a standard library means that projects tend to pull in too many dependencies, and too many common idioms are implemented as "micro-dependencies", like IsOdd or leftPad. The deep dependency graphs can make it impractical to audit all dependencies, and cause security or reliability issues. This problem also exists in a lot of other language ecosystems today, but it's worse in JavaScript.

It's also the case that in web front-end programming, there tends to be a high churn rate of frameworks that often appears to be driven by fashion and/or resume building rather than technical needs.

reply

impulse

Sounds like a big mess... Might mess with node.js again, but I'm not too sure.

reply

nsilvestri

As an ex-JS hater, give it a try! It gets a bad rep, but that's mostly from people who either don't form their own opinions because they don't have a lot of experience programming, or people who form their own opinions because they have too much experience programming. In the middle is a easy to write language with an enormous ecosystem that is so portable you can run it on any refrigerator that comes with Chrome! (oh, right, that might be one of the bad things)

reply

impulse

Might give it another try then, I'll take a look.

reply