A Discord bot to detect free verses.
The bot joining to your server detects free verses and reports it by a discord message automatically.
Commands can be run by a mention to the bot.
Commands:
@<bot> mecab <text>
- Shows [MeCab][mecab] result about the specified text by a discord message.
When running or deploying this bot, you need to create .env
file in
the project directory by copying .env.template
file
or to set the environment variables.
- in Local
- set the env vars -> they are used (
.env
file is ignored) - prepare
.env
file -> they are loaded bydotenv
gem
- set the env vars -> they are used (
- with Docker Compose
- set the env vars -> they are passed to the container by Docker Compose
and are used there (
.env
file is ignored) - prepare
.env
file -> they are loaded by Docker Compose and are used in the container
- set the env vars -> they are passed to the container by Docker Compose
and are used there (
- heroku
- set the env vars -> they are used
Ruby's version is specified by /.Dockerfile
.
# prepare and run
docker-compose up -d --build
Ruby's version is specified by /.ruby-version
.
For running, these are required:
- MeCab
- In redistribution directory.
- mecab-ipadic-NEologd
- Redis
- It should be running.
- The
REDIS_URL
environment variable should be set.
# prepare
bundle install
# run
bundle exec ruby main.rb
heroku create free-verse-discord-bot
heroku stack:set container
heroku config:set DISCORD_BOT_TOKEN=$DISCORD_BOT_TOKEN
git push heroku master
heroku addons:create heroku-redis:hobby-dev # *1
heroku ps:scale bot=1
*1: This necessity is declared in setup
steps in the heroku.yml
manifest file, but by
this document,
automatic installations triggerd by it seem to be a beta function. So we should
install the add-on manually (or use the beta function by following the steps
in the document).
or use GitHub Integration.
docker run --name freeverse_test ikngtty/freeverse rspec
bundle exec rspec
bundle exec rubocop
Enter this command in Local and we can get our bot's information through Discord REST API.
bundle exec ruby script/inspect.rb