···4455Current features:
6677-- [Markov chain](https://en.wikipedia.org/wiki/Markov_chain) for a "smart" chatbot
77+- [Markov chain](https://en.wikipedia.org/wiki/Markov_chain) for a "smart"
88+ chatbot
89910## Pre-reqs
1011···2425### [Markov](src/bingus/cogs/markov.py)
25262627A markov chain is an incredibly simple model where it decides the next token
2727-based on previous knowledge of what tokens the current token has been proceeded by.
2828+based on previous knowledge of what tokens the current token has been proceeded
2929+by.
28302931#### Markov Commands
30323133> **\*** = Requires being bot owner
32343333-- `/markov`: Make bingus try and reply to a prompt passed, use this to bypass the 80% change that bingus
3434- usually has to reply
3535-- `/scan_history`*: Scan the history of the current channel and add it to the chain. Since Bingus only learns
3636- from*new\* messages while he's active, you may need to do this when restarting him. This command can take a while depending on the number of messages.
3737-- `/dump_chain`\*: Dumps the entire underlying markov chain as a JSON file and sends it
3838-- `/load_chain`\*: Loads a markov chain JSON (as generated by `/dump_chain`) additively
3535+- `/markov`: Make bingus try and reply to a prompt passed, use this to bypass
3636+ the 80% change that bingus usually has to reply
3737+- `/scan_history`*: Scan the history of the current channel and add it to the
3838+ chain. Since Bingus only learns from*new\* messages while he's active, you may
3939+ need to do this when restarting him. This command can take a while depending
4040+ on the number of messages.
4141+- `/dump_chain`\*: Dumps the entire underlying markov chain as a JSON file and
4242+ sends it
4343+- `/load_chain`\*: Loads a markov chain JSON (as generated by `/dump_chain`)
4444+ additively
3945- `/weights`: Dump the weights of the specified token to other tokens
40464147#### Markov Config
42484343-- `REPLY_CHANNELS`: A _comma-delimited_ list of channel IDs that the bot should have
4444- have a chance to reply to messages in. The bot still learns from all channels in realtime, but
4545- these channels it'll have an 80% of replying to any message
4949+- `REPLY_CHANNELS`: A _comma-delimited_ list of channel IDs that the bot should
5050+ have have a chance to reply to messages in. The bot still learns from all
5151+ channels in realtime, but these channels it'll have an 80% of replying to any
5252+ message
46534747-- `BRAIN_FILE`: Path to file where the chain will be persisted. This file will automatically be created
4848- if it doesn't exist already. The file itself is msgpack compressed with brotli,
4949- so it's recommended to give it a `msgpackz` extension. By default it will be set to `$PWD/brain.msgpackz`
5454+- `BRAIN_FILE`: Path to file where the chain will be persisted. This file will
5555+ automatically be created if it doesn't exist already. The file itself is
5656+ msgpack compressed with brotli, so it's recommended to give it a `msgpackz`
5757+ extension. By default it will be set to `$PWD/brain.msgpackz`
50585159## Adding Cogs
52605361To start, you can run `poetry run add_cog`.
54625555-Follow the steps and you'll get a new cog in `src/bingus/cogs`. Here is where you can add
5656-commands, event listeners, etc.
6363+Follow the steps and you'll get a new cog in `src/bingus/cogs`. Here is where
6464+you can add commands, event listeners, etc.
57655858-See the file generated for some simple examples, review the [PyCord docs](https://guide.pycord.dev/introduction) for more help and information.
6666+See the file generated for some simple examples, review the
6767+[PyCord docs](https://guide.pycord.dev/introduction) for more help and
6868+information.
59696070### Utilities
61716272#### Requiring Owner
63736464-To require the calling user to be a bot owner for slash commands, you can
6565-use [permissions.require_owner](src/bingus/lib/permissions.py). Simply put this as
6666-a decorator **above** the slash command one like so:
7474+To require the calling user to be a bot owner for slash commands, you can use
7575+[permissions.require_owner](src/bingus/lib/permissions.py). Simply put this as a
7676+decorator **above** the slash command one like so:
67776878```py
6979from ..lib.permissions import require_owner
···7585 await ctx.respond("Hello Owner!")
7686```
77877878-This will print an ephemeral error message to all non-owner users and "Hello Owner!" otherwise.
8888+This will print an ephemeral error message to all non-owner users and "Hello
8989+Owner!" otherwise.
79908091### Best Practices
81928282-Generally you'll want to make all state, config, etc. locallized to your cog file. That
8383-way we can easily disable it if needed and nothing will break.
9393+Generally you'll want to make all state, config, etc. locallized to your cog
9494+file. That way we can easily disable it if needed and nothing will break.
84958596#### Cog Config
86978798For simplicity we'll just use env vars for config.
88998989-Try to documents these options within this README file under the [The individual cogs docs](#cog-docs).
9090-Create a third-level heading with your cog's name, and a link to its source code.
100100+Try to documents these options within this README file under the
101101+[The individual cogs docs](#cog-docs). Create a third-level heading with your
102102+cog's name, and a link to its source code.
9110392104#### Formatting
93105