Skip to content

Commit

Permalink
Merge pull request #79 from Conner-Anderson/dev
Browse files Browse the repository at this point in the history
Update to 0.3.0
  • Loading branch information
Conner-Anderson authored Aug 5, 2023
2 parents ddcffa9 + f3043a7 commit 3de8cc9
Show file tree
Hide file tree
Showing 26 changed files with 1,822 additions and 1,473 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__pycache__
.env
venv
plots
discord_hvz/plots
credentials.json
token.json
hvzdb.db
Expand Down
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,37 @@

All noteable changes to this project will be documented in this file.

### 0.2.1 Minor Release
### 0.3.0 Minor Version Release

#### Features

- Added modal chatbots. These are chatbots that appear as pop-up windows within Discord with a list of questions and fill-in dialogues.
They are an alternative to direct-message chatbots that register players and log tags.
Their requirements are more restrictive, but they are quicker to use: especially on mobile.
See the updated chatbot documentation for details.
- The default tag_logging chatbot script is now modal.

#### Bug Fixes
- Fixed error when no `beginning` or `ending` field is provided in a chatbot script. Now uses default text.

#### Minor Changes

- The location and name of the database file can now be specified in config.yml
- Updated the underlying libraries to stay up-to-date with Discord API changes
- Improved general error handling regarding the chatbot
- Under-the-hood reorganization for easier to navigate code. This is the biggest risk of bugs.

#### Breaking Changes

<font color="yellow"> No breaking changes, but there are notes: </font>

- Since the database file location and name can be specified in `config.yml`, old configs will be missing the `database_path` field.
The bot will still load `hvzdb.db` files from the original location, but this is depreciated.
You may wish to copy the notes and field from the new `config.yml`
- Since the core code has been reorganized, there is a new installation method for the Advanced Install. See the [documentation](https://conner-anderson.github.io/discord-hvz-docs/0.3.0/installation/#updating).
Specifically, do not merely copy the new files atop the old.

### 0.2.1 Patch Release

#### Features

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
![MIT](https://img.shields.io/github/license/conner-anderson/discord-hvz)
# Discord-HvZ

A Discord bot written in Python designed to help run a Humans vs. Zombies game. Information about HvZ: https://humansvszombies.org/
A Discord bot written in Python designed to help run a Humans vs. Zombies game. Information about HvZ: https://en.wikipedia.org/wiki/Humans_vs._Zombies
This is *not* a typical Discord bot that runs on many servers at once: you run it for your own server.
In theory, this gives you extra control.

For *lots* more information, go to the documentation site:

## [Documentation](https://conner-anderson.github.io/discord-hvz-docs/)

## Version 0.2.1 Released
## Version 0.3.0 Released

This is the third official release and includes moderate changes based on real game testing at LeTourneau University. See the changelog in [Releases](https://github.com/Conner-Anderson/discord-hvz/releases).
This is the third official release and includes moderate changes based on real game testing at LeTourneau University. See the changelog in [Releases](https://github.com/Conner-Anderson/discord-hvz/releases).
Note: This version has not yet been tested in a real game. This will be done this fall (2023).



Expand Down
8 changes: 3 additions & 5 deletions chatbotprocessors/default_question_processors.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
from __future__ import annotations
from typing import Dict, List
from utilities import make_tag_code
from discord_hvz.utilities import make_tag_code
from datetime import datetime, timedelta
from dateutil import parser
from config import config
from discord_hvz.config import config

from loguru import logger

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from discord_hvz import HVZBot
from hvzdb import HvzDb
from discord_hvz.main import HVZBot
import sqlalchemy

"""
Expand Down
9 changes: 4 additions & 5 deletions chatbotprocessors/default_script_processors.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from __future__ import annotations
from typing import Dict, List, Any
from typing import Dict, Any
from datetime import datetime
from utilities import make_tag_code
from discord_hvz.utilities import make_tag_code
from loguru import logger
from config import config
from discord_hvz.config import config

from typing import TYPE_CHECKING
if TYPE_CHECKING:
# This avoids circular imports while still allowing type checking for these items
from discord_hvz import HVZBot
from hvzdb import HvzDb
from discord_hvz.main import HVZBot
import discord

# A starting function returns None. An ending function must return a dict[str, Any] (a dictionary that maps database
Expand Down
125 changes: 0 additions & 125 deletions config.py

This file was deleted.

12 changes: 11 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ registration: true
tag_logging: true

# If true, the OZ's identity will not be included in tag announcements.
silent_oz: false
#silent_oz: false

# Will the database be automatically exported to a Google Sheet? Requires some setup.
# Turn this off if you're having trouble with Google Sheets
Expand Down Expand Up @@ -82,3 +82,13 @@ database_tables:
report_time: DateTime
revoked_tag: String

# The path to the game database file. If it does not exist, the bot will create it.
# Regardless of which system you are on, use '/' forward slashes in the path.
# The bot will search for the file in the top directory: the one that contains config.yml, .env, etc.
# If the path is a file, it must end in '.db'
# If the path is a folder, the file "game_database.db" will be created inside it. Example: "my_database_folder"
# For a file in the top directory (default), use "name_of_my_database.db"
# For a file in a directory within the top directory, use "my_database_folder/my_database_name.db"
# To start your path at the root of the drive, start with a '/'. Example: "/Users/JohnDoe/Documents/discord-hvz/cool_database.db"
database_path: "game_database.db"

2 changes: 1 addition & 1 deletion discord_hvz.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dateutil_path = os.path.dirname(pkgutil.get_loader("dateutil").path)


a = Analysis(
['discord_hvz.py'],
['discord_hvz/main.py'],
pathex=[],
binaries=[],
datas=[(dateutil_path, 'dateutil')],
Expand Down
4 changes: 4 additions & 0 deletions discord_hvz/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .main import main

if __name__ == "__main__":
main()
4 changes: 4 additions & 0 deletions discord_hvz/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .main import main

# A file that is run when the module is run as a module.
main()
8 changes: 3 additions & 5 deletions buttons.py → discord_hvz/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from discord.ext import commands
from loguru import logger

from config import config
from .config import config

if typing.TYPE_CHECKING:
from discord_hvz import HVZBot
from main import HVZBot

log = logger

Expand Down Expand Up @@ -193,9 +193,7 @@ def add_postable(self, button: HVZButton) -> None:
if self.readied:
logger.error('Cannot add a postable button after on_ready has been called.')
return
if not isinstance(button, HVZButton):
logger.error(f'Cannot add postable button to HVZButtonCog. Its type is: {type(button)}')
return

self.postable_buttons.append(button)


Expand Down
5 changes: 5 additions & 0 deletions discord_hvz/chatbot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# A module that provides chatbot functionality to a Discord bot.
# A chatbot is a query and response conversation between the bot and a user
# designed to gather tabular information from them.

from .chatbot import ChatBotManager, setup
Loading

0 comments on commit 3de8cc9

Please sign in to comment.