A scriptable discord bot (WIP)

Overview

Status

This project is currently a VERY EARLY WORK IN PROGRESS.

Contact me on discord for more details: Jonas747#0001 (105487308693757952)

BotLoader (or loader)

What is BotLoader?

BotLoader is a discord bot where the server admins can program the bot through typescript, it takes care of all the low level things and provides an api for things such as storage, commands, timers and so on.

In the future you could imagine a steam workshop like marketplace of modules you could add to the server. Want a leveling system? There will probably be multiple available on the marketplace and if none suit your needs you can modify an existing one to do exactly what you want, without having to worry about things like the ever changing discord API, the pain of running and scaling bots and all the low level stuff.

BotLoader will provide a simple high level API that will strive to be backwards compatible where possible (of course this can't be a 100% guarantee as discord's changes aren't always backwards compatible themselves).

Technical details

At the core it uses deno, which is a layer above v8 that's secure by default, meaning we don't have to worry about all the different knobs on v8.

Project layout

  • cmd
    • bot: the bot itself, currently its the entire thing but in the future it may be split up
    • webapi: the frontend API
  • components
    • configstore: the core configuration store for BotLoader, currently this only handles storing scripts and link themselves, there will probably be something else for custom user storage through scripts.
    • runtime: the bot runtime, essentially this is what provides all the functions to interact with the outside world
    • vm: manages a single v8 isolate
    • vmthread: manages a thread, running vm's on it
    • isolatecell: provides a safe way to manage enter and exit states of v8 isolates
    • rs2ts: Generates typescript types from rust structs
    • scriptscheduler: Provides various timers for triggering scripts

Script packs and guild scripts

The current plan is as follows:

  • 1x v8 isolate to run standalone guild scripts, that is 1 isolate in total for all the standalone guild scripts
  • 1x v8 isolate per script pack

This way, bugs in script packs wont affect other vm's and so on. Failures are somewhat isolated.

This also makes it easier to namespace certain things

Comments
  • feat: timeouts

    feat: timeouts

    Implements timeouts, or communicationDisabledUntil, for Discord Member, plus a helper method so that people don't have to type out that really long property name.

    opened by devnote-dev 2
  • Support for modals

    Support for modals

    This is on hold as there seems to be a bug somewhere when we forward the interaction create event for the modal submit without a message object (such as modals from commands), the bot panics because of a deserialization fault for the interaction create event.

    opened by jonastar 1
  • Add more channel API functions

    Add more channel API functions

    • PermissionResolvable type is no longer an array (but all functions that used it were updated to take an array of them, so no breaking changes effectively)
    • Current PermissionOverwrite interface was renamed to IPermissionOverwrite
    • Added PermissionOverwrite class that implements IPermissionOverwrite, it has helpers for creating permission overwrites
    • Added Discord.(editChannel, createChannel, deleteChannel, editChannelPermission, deleteChannelPermission)
    opened by jonastar 0
  • Plugins part 1: base work and design

    Plugins part 1: base work and design

    This is part 1 of plugins, I've decided to split it up into multiple pull requests to avoid dropping a massive pull request at some point breaking the whole thing.

    This is only the base work and some DB design, plugins are still far away from actually being implemented.

    opened by jonastar 0
  • Revamp discord models

    Revamp discord models

    Currently, all discord-related structures, are auto-generated interfaces and types.

    This has a couple of limitations:

    • I can't add docs to any of them
    • I can't attach helper methods to any of them. For example, I can't attach an avatarUrl method to the user object.

    This is why I'm converting a large portion of these auto-generated interfaces into manually made classes that we manually construct from the interfaces.

    We will still keep the autogenerated structures around in the internal namespace, it's a bit extra work but this gives us compile-time errors if any fields are incorrect AND pretty structures.

    You can see an example of this in action below for the Message class, the only one implemented in this system currently.

    This should be a non-breaking change.

    Implementation notes:

    • I'm not using Object.assign as we wouldn't get compile-time errors when the class fields mismatch the generated interface, leading to potential accidents.
    opened by jonastar 0
  • Singular persistent variables

    Singular persistent variables

    Personally when writing scripts i find myself creating storage buckets that holds just a single variable. Handling the key then is sort of error prone and you end up having a variable for the key, this is all a bit cumbersome so the goal of this is to fix that.

    image

    opened by jonastar 0
  • Initial message component support

    Initial message component support

    This adds initial support for message components, currently this is very simplistic support but it works and we can build on top of it in the future.

    Custom Id's are a big question, discord limit's them to 100 characters (i'm guessing codepoints) and were probably gonna reserve 20 of that budget for internal purposes (tracking the origin of the component, with plugin id and various flags) which leaves 80 characters for users to use.

    Additionally for custom Id's we have machinery for giving them a "name" and arbitrary json encoded data, these combined have to make up less than 80 unicode codepoints.

    opened by jonastar 0
  • Cleanup unused interval timers

    Cleanup unused interval timers

    We need to set up a system for cleaning up unused interval timers, how we will do it is simply removing timers with no script contributes pointing to them.

    opened by jonastar 0
  • Create

    Create "core" plugin handling built in bot commands

    Instead of implementing builtin commands in rust and effectively having 2 command systems, we can implement the builtin commands in a "core" plugin that's always enabled on all servers.

    This creates a dogfooding situation where we give all the api's a real world test pretty early on, increasing the quality of the API's and stability as a side effect.

    This core plugin does need some exceptions to normal plugins though:

    • its command will be global
    • It will have access to script management API's (maybe we should make these public anyways? similar to the webapi?)
    opened by jonastar 0
  • Tracking issue: discord API integration

    Tracking issue: discord API integration

    Note: not all of these are going to be added, this is just a working list to help keep tack of everything and i'll be removing things from the list i see as uneeded/unfit

    Channels:

    • [x] Delete/Close Channel
    • [x] Edit Channel
    • [x] Get Channel Messages
    • [x] Get Channel Message
    • [x] Create Message
    • [x] Crosspost Message
    • [x] Create Reaction
    • [x] Delete Own Reaction
    • [x] Delete User Reaction
    • [x] Get Reactions
    • [x] Delete All Reactions
    • [x] Delete All Reactions for Emoji
    • [x] Edit Message
    • [x] Delete Message
    • [x] Bulk Delete Messages
    • [x] Edit Channel Permissions
    • [ ] Get Channel Invites
    • [ ] Create Channel Invite
    • [x] Delete Channel Permission
    • [x] Get Pinned Messages
    • [x] Pin Message
    • [x] Unpin Message
    • [ ] Start Thread with Message
    • [ ] Start Thread without Message
    • [ ] Join Thread
    • [ ] Add Thread Member
    • [ ] Leave Thread
    • [ ] Remove Thread Member
    • [ ] Get Thread Member
    • [ ] List Thread Members
    • [ ] List Active Threads
    • [ ] List Public Archived Threads
    • [ ] List Private Archived Threads
    • [ ] List Joined Private Archived Threads

    Emojis:

    • [ ] List Guild Emojis
    • [ ] Get Guild Emoji
    • [ ] Create Guild Emoji
    • [ ] Modify Guild Emoji
    • [ ] Delete Guild Emoji

    Guild:

    • [x] Get Guild
    • [ ] Get Guild Preview
    • [ ] Modify Guild
    • [ ] Delete Guild
    • [x] Get Guild Channels
    • [x] Create Guild Channel
    • [ ] Modify Guild Channel Positions
    • [ ] List Active Threads
    • [x] Get Guild Member
    • [ ] List Guild Members
    • [ ] Search Guild Members
    • [x] Modify Guild Member
    • [ ] Modify Current Member
    • [ ] Modify Current User Nick
    • [x] Add Guild Member Role
    • [x] Remove Guild Member Role
    • [x] Remove Guild Member
    • [x] Get Guild Bans
    • [x] Get Guild Ban
    • [x] Create Guild Ban
    • [x] Remove Guild Ban
    • [x] Get Guild Roles
    • [ ] Create Guild Role
    • [ ] Modify Guild Role Positions
    • [ ] Modify Guild Role
    • [ ] Delete Guild Role
    • [ ] Get Guild Prune Count
    • [ ] Begin Guild Prune
    • [ ] Get Guild Voice Regions
    • [ ] Get Guild Invites
    • [ ] Get Guild Widget
    • [ ] Get Guild Vanity URL
    • [ ] Get Guild Widget Image
    • [ ] Modify Current User Voice State
    • [ ] Modify User Voice State

    Events:

    • [ ] List Scheduled Events for Guild
    • [ ] Create Guild Scheduled Event
    • [ ] Get Guild Scheduled Event
    • [ ] Modify Guild Scheduled Event
    • [ ] Delete Guild Scheduled Event
    • [ ] Get Guild Scheduled Event Users

    Misc:

    • [ ] Get Guild Audit Log
    • [ ] Get Invite
    • [ ] Delete Invite

    Stage channels:

    • [ ] Create Stage Instance
    • [ ] Get Stage Instance
    • [ ] Modify Stage Instance
    • [ ] Delete Stage Instance

    Stickers:

    • [ ] Get Sticker
    • [ ] List Nitro Sticker Packs
    • [ ] List Guild Stickers
    • [ ] Get Guild Sticker
    • [ ] Create Guild Sticker
    • [ ] Modify Guild Sticker
    • [ ] Delete Guild Sticker

    Webhooks:

    Don't think i'll add any webhook endpoints, we'll see in the future

    opened by jonastar 0
Owner
null
A Discord bot focused on addressing the inherent problems with Discord, to allow a more socialist/anarchist organization of servers.

ACABot A Discord bot focused on addressing the inherent problems with Discord, to allow a more socialist/anarchist organization of servers (or "guilds

null 4 May 3, 2022
A rust(serenity) based discord bot for the hacksquad discord server

A Discord Bot for Hacksquad How to Deploy? Requirements Docker Docker Compose Steps To Run Copy the docker-compose.yml and .env.example files to your

HackSquad 5 Jan 4, 2023
Rewrite of the Discord Bot used for Managing the Infinity Bot List Servers.

Arcadia Rewrite of the Discord Bot used for Managing the Infinity Bot List Servers. Contributing Always run fmt.sh before making a Pull Request! MacOS

InfinityBotList 3 Dec 15, 2022
A simple bot for discord.

Rusky Um simples bot para o discord! ?? Executando ⚠️ Antes de tudo você precisa do Rust Instalado você pode instalar clicando aqui Preparando Primeir

Rusky 3 Aug 12, 2022
A Discord bot for lichess and Rosen related things

liro Liro is a Discord bot that follows in the footsteps of Lichess-discord-bot, without necessarily aiming to replace it. The main pain point that th

Sebastian Lauwers 5 Feb 16, 2022
Hi I'm Sophy, a discord bot in devlopment, soon I'll be available to help everyone (❁´◡`❁)

Sophy Bot Hi I'm Sophy, a discord bot in devlopment, soon I'll be available to help everyone (❁´◡`❁) Contribution Do you like me and want to help me?

Far Dragi 0 May 30, 2022
A Discord bot for sending GeoGuessr challenge links that uses the GeoGuessr API written in rust.

GeoGuessr-bot-rs This is a simple implementation of a discord bot that send GeoGuessr-challenge links on demand. Features: Slash-commands Lightning-fa

Luukas Pörtfors 6 Nov 18, 2022
🦴🤖 // A Discord bot about collecting all the Borpa

?? ?? Borpa Bot Borpa Bot is a Discord bot about collecting all the Borpa possible. If you dont know what a Borpa is you can find it here Crate Descri

mellowmarshe 1 Dec 19, 2021
🦜 A hassle-free, highly performant, host it yourself Discord music bot built with Serenity in Rust. Powered by youtube-dl and Genius.

?? A hassle-free, highly performant and fast evolving Discord music bot built with Serenity in Rust. Deployment Usage Just create a bot account, copy

Miguel Mano 82 Dec 14, 2022
The best discord bot to annoy @a3mat

A3mat v pomoyke The best discord bot to annoy @a3mat Usage: This command moves pinged users n times: move <number> [users...] This command moves ping

null 1 Dec 31, 2021
A Discord bot to send updates on queries in tori.fi

torimies-rs How the bot works? The bot works by making requests to the undocumented (and very bad) tori.fi api endpoint. The users can add and remove

Luukas Pörtfors 19 Dec 29, 2022
A Discord bot for control and decentralization of threads management

Threadripper-bot A Discord bot for control and decentralization of threads management About Threadripper aims to serve some extra utilities to take be

S0ra 15 Dec 27, 2022
A small in-house bot of the TTC Discord Server

Welcome to The Terminal cafe Support Bot Repository Hello, hope you are having a nice day. This is the official repository for The Terminal Cafe Suppo

null 5 Jul 4, 2022
A Discord bot to send updates on queries in tori.fi

torimies-rs How the bot works? The bot works by making requests to the undocumented (and very bad) tori.fi api endpoint. The users can add and remove

Testausserveri ry 19 Dec 29, 2022
A discord bot that safely executes whatever rust you throw at it. Remote code execution as a service

RustBot Bot is still under development and not ready for production use RustBot is a discord bot that executes whatever rust code you throw at it. In

Conner Bradley 7 Jan 3, 2022
An experimental Discord bot using Serenity.

VoidBot An experimental Discord bot using Serenity. Environment Variables Can be set with a .env file. DISCORD_TOKEN: The token for your bot. (require

null 1 May 21, 2022
Yet another multi-purpose discord bot

virus yet another multi-purpose discord bot

miten 2 Jan 11, 2022
sentry - yet another multi-purpose discord bot

sentry - yet another multi-purpose discord bot

miten 1 Feb 17, 2022
This is a Discord bot written in Rust to translate to and from the Bottom Encoding Standard using bottom-rs and Serenity.

bottom-bot This is a Discord bot written in Rust to translate to and from the Bottom Encoding Standard using bottom-rs and Serenity. Ever had this pro

Bottom Software Foundation 11 Dec 10, 2022