A Markov chain bot using markov-strings.
- Train the bot in a lengthy text channel:
- User:
!mark train
- Markbot:
@User, Finished training from past 76394 messages.
- User:
- Ask the bot to say something:
- User:
!mark
- Markbot:
This Shopko has a Linux release
- User:
First, create a Discord bot application.
- Node.js 12.0+ (Current)
- Installing with build tools is recommended
-
Install Node.js 12.0 or newer.
-
Download this repository using git in a command prompt
git clone https://github.com/charlocharlie/markov-discord.git
or by just downloading and extracting the project zip from GitHub.
-
Open a command prompt in the
markov-discord
folder.# Install Windows build tools (if you didn't install build tools with Node) npm install --global windows-build-tools # NPM install non-development packages npm install # Build the Typescript npm run build
-
Create a file called
config.json
in the project directory with the contents:{ "prefix":"!mark", "game":"\"!mark help\" for help", "token":"k5NzE2NDg1MTIwMjc0ODQ0Nj.DSnXwg.ttNotARealToken5p3WfDoUxhiH" }
Feel free to change the command prefix, game display. Add your bot token.
-
Run the bot:
npm start
- Node.js 12.0+
- Python 2.7 (for erlpack)
- C++ build tools (for erlpack)
# Clone this repository
git clone https://github.com/charlocharlie/markov-discord.git
cd markov-discord
Create a file called config.json
in the project directory with the contents:
{
"prefix":"!mark",
"game":"\"!mark help\" for help",
"token":"k5NzE2NDg1MTIwMjc0ODQ0Nj.DSnXwg.ttNotARealToken5p3WfDoUxhiH",
"role": "Bot users"
}
Feel free to change the command prefix, game display. Add your bot token. Role is optional, if it is set, only the users who have that role can use text generation.
# Install Node.js if you haven't already
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
nvm install node
# NPM install non-development packages
npm install
# If you run into build errors, install the following packages:
sudo apt-get install python -y
sudo apt-get install build-essential -y
# Build the Typescript
npm run build
# Start the program
npm start
-
Install Docker for your OS.
-
Open a command prompts and run:
docker pull charlocharlie/markov-discord docker run --rm -d charlocharlie/markov-discord:latest
-
Install Docker for your OS.
-
Download this repository using git in a command prompt
git clone https://github.com/charlocharlie/markov-discord.git
or by just downloading and extracting the project zip from GitHub.
-
Open a command prompt in the markov-discord folder and run this one-liner:
docker run --rm -e TOKEN=YOUR.BOT.TOKEN -v config:/usr/src/markbot/config -it $(docker build -q .) # Be patient as the build output is suppressed
- Fix crash when fetched messages is empty
- Update docs
- Update dependencies
- Fix @everyone replacement
- Readme updates
- Config loading fix
- Fix min score
- Add generator options to config
- Document Node 12 update
- Convert project to Typescript
- Optimize Docker build (smaller image)
- Load corpus from filesystem to reduce memory load
- Fix MarkovDB not loading on boot
- Fix bot crashing on scheduled regen
- Added Docker deploy functionality.
- Moved config and database to
./config
directory. Existing configs will be migrated. - Config-less support via bot token located in an environment variable.
- Update dependencies.
- Change corpus regen time to 4 AM.
- Fixed bug where
!mark help
didn't work. - Only admins can train.
- The bot responds when mentioned.
- The bot cannot mention @everyone.
- Added version number to help.
- Added
!mark tts
for a quieter TTS response. - Readme overhaul.
- Simpler config loading.
- Huge refactor.
- Added
!mark debug
which sends debug info alongside the message. - Converted the fetchMessages function to async/await (updating the requirement to Node.js 8).
- Updated module versions.
- Added faster unique-array-by-property function
- Added linting and linted the project.
- Added TTS support and random message attachments.
- Deleted messages no longer persist in the database longer than 24 hours.
- Updated training algorithm and data structure.
Thanks to BotMaker-for-Discord which I used as a reference when during development.