The world's most clever kitty cat
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve NixOS Module

Ben C 3848b41e 97676be4

+8 -14
+4 -10
README.md
··· 19 19 20 20 Minimal needed is an env var called `TOKEN` that contains the bot's token. 21 21 22 - Cogs may have additional options, these variables **should** be prefix with the 23 - cog's name 24 - 25 - ex: Cog `Math` may have `Math.TEMP_UNIT=fahrenheit`. 26 - 27 22 ## Cog Docs 28 23 29 24 ### [Markov](src/bingus/cogs/markov.py) ··· 38 33 - `/markov`: Make bingus try and reply to a prompt passed, use this to bypass the 80% change that bingus 39 34 usually has to reply 40 35 - `/scan_history`*: Scan the history of the current channel and add it to the chain. Since Bingus only learns 41 - 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. 36 + 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. 42 37 - `/dump_chain`\*: Dumps the entire underlying markov chain as a JSON file and sends it 43 38 - `/load_chain`\*: Loads a markov chain JSON (as generated by `/dump_chain`) additively 44 39 - `/weights`: Dump the weights of the specified token to other tokens 45 40 46 41 #### Markov Config 47 42 48 - - `Markov.REPLY_CHANNELS`: A _comma-delimited_ list of channel IDs that the bot should have 43 + - `REPLY_CHANNELS`: A _comma-delimited_ list of channel IDs that the bot should have 49 44 have a chance to reply to messages in. The bot still learns from all channels in realtime, but 50 45 these channels it'll have an 80% of replying to any message 51 46 52 - - `Markov.BRAIN_FILE`: Path to file where the chain will be persisted. This file will automatically be created 47 + - `BRAIN_FILE`: Path to file where the chain will be persisted. This file will automatically be created 53 48 if it doesn't exist already. The file itself is msgpack compressed with brotli, 54 49 so it's recommended to give it a `msgpackz` extension. By default it will be set to `$PWD/brain.msgpackz` 55 50 ··· 89 84 90 85 #### Cog Config 91 86 92 - For simplicity we'll just use env vars for config. Prefix any env vars your cog will 93 - read with the cog's name and a `.` (example: `Markov` cog can have a var called `Markov.REPLY_CHANNELS`). 87 + For simplicity we'll just use env vars for config. 94 88 95 89 Try to documents these options within this README file under the [The individual cogs docs](#cog-docs). 96 90 Create a third-level heading with your cog's name, and a link to its source code.
+2 -2
flake.nix
··· 23 23 }; 24 24 }; 25 25 26 - outputs = inputs @ { flakelight, ... }: 27 - flakelight ./. ({ lib, ... }: { 26 + outputs = inputs @ {flakelight, ...}: 27 + flakelight ./. ({lib, ...}: { 28 28 inherit inputs; 29 29 systems = lib.systems.flakeExposed; 30 30 pname = "bingus";
nix/packages/bingus-env.nix nix/packages/bingus.nix
+2 -2
src/bingus/cogs/markov.py
··· 16 16 def __init__(self, bot: discord.bot.Bot): 17 17 self.bot = bot 18 18 self.reply_channels = [ 19 - int(x) for x in os.getenv("Markov.REPLY_CHANNELS", "0").split(",") 19 + int(x) for x in os.getenv("REPLY_CHANNELS", "0").split(",") 20 20 ] 21 - self.chain_file = Path(os.getenv("Markov.BRAIN_FILE", "brain.msgpackz")) 21 + self.chain_file = Path(os.getenv("BRAIN_FILE", "brain.msgpackz")) 22 22 if self.chain_file.is_file(): 23 23 print(f"Attempting load from {self.chain_file}...") 24 24 try: