TimboKZ / discord-spoiler-bot

🗣️🛑 Spoiler support for Discord
https://www.npmjs.com/package/discord-spoiler-bot
MIT License
61 stars 19 forks source link

Support external bot instances #3

Closed vegeta897 closed 7 years ago

vegeta897 commented 7 years ago

If there's anyone out there like me, they are using this bot as a sort of addon to their existing bot. But since this bot spawns its own discord.js session, my bot now has 2 sessions going.

I know I could just require your GifGenerator module and write my own version of SpoilerBot.js, but that feels redundant and a waste of some finely written code. My idea is that you could include an existing bot object as an optional config parameter, and that would be used to perform its functions instead of a new instance.

The rub is that my bot uses a different node bot library, discord.io, so I couldn't expect you to include support for injecting a discord.io instance as well as a discord.js instance.

So: I'm asking for your permission to create and publish my own fork of this package on npm, a fork that uses discord.io and supports loading an external instance of it.

TimboKZ commented 7 years ago

That's a good idea, what do you think about adding an instance of Discord.Client as an optional parameter for connect()?

vegeta897 commented 7 years ago

That sounds logical, I like it.

vegeta897 commented 7 years ago

I was asking about a separate package because my bot uses discord.io, not discord.js, so I don't have a discord.js instance to inject. Asking you to support both libraries seems too out of scope, does it not?

TimboKZ commented 7 years ago

Normally it would be, yes, but this time I'm only using a couple of functions from Discord.js and I believe creating 2 similar packages with minor differences would cause confusion. I'll take a look at it at some point today.

vegeta897 commented 7 years ago

No problem, I understand. Worst case scenario, I could just create an object that has the proper method signatures that wraps my discord.io instance.

And also, thanks!

TimboKZ commented 7 years ago

Always welcome. Looking at discord.io right now - I wonder, is there any particular reason you prefer discord.io over Discord.js? The API of the latter looks a bit more robust to me.

vegeta897 commented 7 years ago

I prefer the low-level simplicity and flatness which allows me to design my own robustness (something I enjoy doing), and it being a single-file library. Discord.js is certainly robust but it's robustness that I don't really want or need.

By the way, if you prefer to chat I'm vegeta897#7583 on Discord.

TimboKZ commented 7 years ago

Added in version 2.0.0 (#4).