Code Monkey home page Code Monkey logo

taro-bot's Introduction

๐Ÿธ contact me for a copy of my CV (not listed publicly for privacy reasons).
i dabble in pharmacology and biochemistry in my free time. feel free to say hi :)

wakatime Last Online Total Beats

taro-bot's People

Contributors

5ht2 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

toxicaven

taro-bot's Issues

TTS Support

Refactor to modules

I started on this but can't be bothered to finish now given how big the codebase is atm

image

Ability for a plugin to save a config

This could be done in two ways:

  1. Register a json file for each plugin alongside the config.json (this would need to explicitly disallow naming your plugin "config" and/or throw an error if multiple plugins have the same name)
  • Pros:
    Allows for keeping multiple versions easily (i.e., with plugin versions). Maybe have a compatibleVersions field plugins can check to keep configs backwards compatible.
  • Cons:
    Multiple files. Takes a tiny bit of extra work to do.
  1. Register a new entry in the existing config with a map.
  • Pros:
    Easy to do.
  • Cons:
    Look at 1.'s pros section.

Plugins are able to panic during loading, causing a bot load failure

This shouldn't be possible, plugin loading should be safe. A plugin will be skipped if it fails to compile currently, but that's it.

We don't want plugin loading to be un-safe because plugins will be loaded during runtime dynamically (#8) in the future, and not just during bot loading.

This should be fixed ASAP.

Optimize `c.GuildConfigs` usage

Now that Go 1.18 has been released, it's fixed my previous issues with mutexes in maps. This means I can get rid of the for loop in GuildContext (which is used everywhere).

Separate existing bot features into plugins

  • #11
  • Allow registering a custom handler for c.AddHandler
  • Move Starboard to a plugin
    • Separate channel starboard commands into it's own command
  • Move Topics to a plugin
    • Separate channel topic commands into it's own command
  • Move responseutil somewhere else

Allow editing a command to re-run it

When a command is executed

  • Add it's message ID to a cache, and it's response ID to a cache, as well as the epoch milli when it was executed
    • Everything is supposed to return a message ID but not always - maybe allow -1 as a default to skip?
  • Have an edit message register to check for caches
  • After 30 seconds, remove from the cache on a timer. Should this be locked on a mutex? I don't want to block commands but checking a map for an entry is fast.
  • I feel like executing a command should also force a 30 second check

(cmd) Permission system panics in DMs

Easy fix oops

if HasAdminCached(c.E.GuildID, c.E.Member.RoleIDs, c.E.Author) {

2022/10/17 04:05:59 HasAdminCached: found 995142503391047770
2022/10/17 04:06:12 panic: goroutine 76807 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x68
github.com/5HT2/taro-bot/util.LogPanic()
	/taro-bot/util/builtin.go:20 +0x30
panic({0x991220, 0xe40bf0})
	/usr/local/go/src/runtime/panic.go:838 +0x20c
github.com/5HT2/taro-bot/cmd.UserHasPermission({0x4000eb9800, {0xffff6d8b6d5e, 0xb}, {0x4000a78254, 0x4}, {0x4000055370, 0x0, 0x1}}, 0x4, 0xdcf74d59784305a)
	/taro-bot/cmd/permissions.go:91 +0x58
github.com/5HT2/taro-bot/cmd.HasPermission({0x4000eb9800, {0xffff6d8b6d5e, 0xb}, {0x4000a78254, 0x4}, {0x4000055370, 0x0, 0x1}}, 0x4)
	/taro-bot/cmd/permissions.go:82 +0x154
github.com/5HT2/taro-bot/plugins/hrtgen.DoseCommand({0x4000eb9800, {0xffff6d8b6d5e, 0xb}, {0x4000a78254, 0x4}, {0x4000055370, 0x0, 0x1}})
	/taro-bot/plugins/hrtgen/hrtgen.go:57 +0x8c
github.com/5HT2/taro-bot/cmd.CommandHandlerWithCommand(0x4000eb9800, {0x4000a78254, 0x4}, {0x4000055370?, 0x0?, 0x1?})
	/taro-bot/cmd/util.go:47 +0x228
github.com/5HT2/taro-bot/cmd.CommandHandler(0x4000eb9800)
	/taro-bot/cmd/util.go:20 +0x94
created by main.main.func1
	/taro-bot/main.go:52 +0x64

2022/10/17 04:06:15 HasAdminCached: found 995142503391047770

Loading and automatic updating of plugins from external sources / github repos

Blocked by: #8, #16, #24, #25, #35.

The way I want to accomplish this is:

  • A plugin-name/meta.json file in it's source folder should contain
    • Plugin name
    • Source repo
    • Version
    • Updating URL
    • Current version

Version checking would check updating URL's version, and see if it's larger than ours (regex, format to int).

  • Remove -plugindir and force them to a standard path, update docs accordingly

After initial plugin loading,

  • Display a message in OPERATOR_CHANNEL and ping OPERATOR_ID if plugin updates are available, and if we want to reload them
  • The plugin command should also show if updates are available

Hot reloading of plugins

This is totally doable, my only concerns lie with the Docker version

  • I want plugins to not be reliant on http-bash-requests (for obvious reasons).
  • Calling os.Exec from Docker would theoretically work, but this poses new problems
    • The Dockerfile is mounting the config dir to /taro-files, which only contains the config folder
    • /taro-bot contains a copy of files in the image
    • We want to allow the mounted folder to be git pulled to allow easy updates, without fucking up user-level permissions when Docker is run as root

I propose mounting the entire directory taro is built from, and moving config there? Rather than keeping a second mount for config.
You're already intended to build taro yourself, as I don't provide prebuilt images, so keeping a copy of the git repo to allow plugin updates would be entirely optional but required for git pulling plugins.

Plugin command

Being able to

  • List loaded plugins
  • List all (available) plugins
  • Manage reloading (#8)
  • Manage downloading, potentially
  • Show errors with reloading

Choose which plugins to load

A slight improvement to plugin loading:

  • Being able to choose which plugins to load
  • Default to a set list
  • Being able to choose "all"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.