Segfault (v4.2.0α) is a Discord bot written in TypeScript using Discord.JS for the Thinking with Portals' Discord.
Designed for the Thinking with Portals' Discord server, Segfault is a custom-built Discord bot platform. It is designed to be expanded upon by others.
Unlike other Discord bots, Segfault has 2 goals in mind:
As opposed to bigger bots which are designed to handle 100s of guilds at the same time, or smaller bots which are only run in a single server, Segfault is designed with managed a couple at the same time. Like a group of servers, which may share the same admin.
Segfault at its core has been designed to make designing custom behaviour as easy as possible. Segfault uses a system called "Modules" to allow developers to implement commands, interactions, guild-specific behaviour, and in future, just about anything people want from Discord bots.
Currently, this is a very basic version of Segfault, and lacks most planned features.
- Enable/Disable – While there is logic handling guild-specific behaviour, there's no actual system behind enabling/disabling Modules for guilds.
- Implementation of Events – Modules can define their own events (e.g., a moderation Module might add its own Events to log deleted messages).
- Loadable Modules – While a system already exists to reload Modules (and also scan directories for new Modules), this system isn't particularly useful for those without access to the machine on which Segfault is running on to add those files. The plan here is to add a way that Modules can be added from Discord.
- Sandboxed Modules – Currently Modules run on the same "machine" as the
rest of the bot. For safety and security reasons (namely running unknown
Modules), the plan is make Modules sandboxed in a VM and only expose certain
interfaces.
- Tag System – Furthermore, from these last two points, is Tags. Currently Module Tags go unused. The idea for them being that servers can search loaded Modules for ones to enable by Tags. As well as Tags potentially being used to determine Module behaviour/intents (escape Sandboxes, connect to the internet, etc.).
- Separation of CoreLib – CoreLib is the poorly named library which Segfault uses to actually do stuff. This might be of some use to people (although perhaps unlikely, mostly it's wrappers for Discord.JS), so the plan is to actually turn it into a separate library, instead of a high-integrated mess.
- Help – A Module that'll actually shows the
IInfo
object that Modules have. - Browser – A Module that'll allow guild admin to enable/disable loaded Modules in their guild.
- Config – A Module that'll let users configure Modules/Commands.
- Moderation – A Module that'll (hopefully) be similar to larger bots similar methods of moderation, as to showcase Events (when added).
- Flag Content – A Module that'll allow users to flag messages or users, so they can discretely notify admin.
- Give Role – A Module that'll allow server admin to add "Role React"
messages,
Commands(added!), and perhaps other methods. Pin Message – A Module to allow allowed users to post embeds to predetermined channels.(added!)
We've got a command that links two channels, a command that gives roles, and a few other things in the works!
Well, it shouldn't be too hard to do the rest now!
...Hopefully
Currently in-code documentation is lacking to say the least, however, it should
be (cursed words) "self-explanatory". If you do need some assistance reading
it, try contacting Wii2 on Discord (Wii2#9999
), they might know.
TypeScript with pnpm as package manager. Programmed in VSCode with Prettier, ESLint, & TSLint. Runs directly in TS-Node.
-
Pull repo.
-
Install ESLint & Prettier (and optionally a
JSON5 syntax highlighter
) for VSCode. -
Run
pnpm
in directory. This should set up pnpm. -
Run
pnpm install
to pull all dependencies. -
Open
config.json5.example
and, well, configure it. Resave it asconfig.json5
. -
Run
pnpm ts-node -R
to start Segfault. It should run first-time set up things (the-R
forces the bot to sync commands with Discord).