Skip to content

Commit

Permalink
Fix timings (#17)
Browse files Browse the repository at this point in the history
* fix

* add help command

* changelog

* bump new version

---------

Co-authored-by: Katze719 <katze719@users.noreply.github.com>
  • Loading branch information
Katze719 and Katze719 committed May 20, 2024
1 parent c4761f3 commit 4b98f1f
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 7 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Version 4.7.0-experimental.1 - 2024-05-20

### Added
- Implementierung des Befehls `/help`, um eine Liste aller verfügbaren Befehle anzuzeigen.

### Changes
- Anpassung des PDF-Parsing-Algorithmus zur Verbesserung der Genauigkeit
- Anpassungen in der Readme-Datei

---

Version 4.6.0-experimental.1 - 2024-05-13

### Added
Expand Down
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ current username + password:
- username: bsz-et-2324
- password: schulleiter#23

## Using the Bot
## Usage

invite the bot to your discord via https://discord.com/oauth2/authorize?client_id=1150762234620944464&permissions=8&scope=bot

and activate him with `/activate`
and type `/activate` in your discord server to activate the bot

## Self-Hosting with Docker-Compose

Expand Down Expand Up @@ -41,6 +41,35 @@ docker pull ghcr.io/katze719/bszet_it_bot:latest
docker-compose up -d
```

# Commands

## Admin Commands

| Command | Description |
|-------------------------------------------|--------------------------------------------------|
| `/activate` | Activates the bot |
| `/deactivate` | Deactivates the bot |
| `/deactivate_experimental_features` | Deactivates experimental features |
| `/activate_experimental_features` | Activates experimental features |
| `/set <variable_name> <value>` | Sets the specified variable to the given value |
| `/reset` | Resets all variables to their default values |

## User Commands

| Command | Description | Requires Experimental Features to be on |
|-----------------------------------------|------------------------------------------------|--------------------------------|
| `/help` | Displays a help message | false |
| `/ping` | Checks the bot's responsiveness | false |
| `/plan` | Retrieves the current plan | false |
| `/get <variable_name>` | Retrieves the value of the specified variable | false |
| `/status` | Checks if the bot is currently active | false |
| `/feedback <message>` | Submits user feedback | false |
| `/print_parsed_table_experimental` | Displays the parsed table | true |
| `/news_experimental` | Retrieves the latest news | true |




## Dev Setup

1. Setup venv
Expand Down
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
USERNAME = "bsz-et-2324"
PASSWORD = "schulleiter#23"

CURRENT_VERSION = "v4.6.0-experimental.1"
CURRENT_VERSION = "v4.7.0-experimental.1"
CURRENT_VERSION_FILE = f"{os.getenv('SETTINGS_VOLUME')}/version.txt"

if __name__ == '__main__':
Expand Down
3 changes: 2 additions & 1 deletion bsz_bot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .tasks import setup_tasks
from .core import BSZ_BOT
from .commands import ping, plan, get, set, reset, changelog, activate, deactivate, status, print_parsed_table_beta, activate_beta_features, deactivate_beta_features, news, feedback
from .commands import ping, plan, get, set, reset, changelog, activate, deactivate, status, print_parsed_table_beta, activate_beta_features, deactivate_beta_features, news, feedback, help
from .helpers import Plan, log, send_update_info

BSZ_BOT.tree.add_command(deactivate_beta_features)
Expand All @@ -15,5 +15,6 @@
BSZ_BOT.tree.add_command(ping)
BSZ_BOT.tree.add_command(plan)
BSZ_BOT.tree.add_command(news)
BSZ_BOT.tree.add_command(help)
BSZ_BOT.tree.add_command(get)
BSZ_BOT.tree.add_command(set)
3 changes: 2 additions & 1 deletion bsz_bot/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
from .activate_beta_features import activate_beta_features
from .deactivate_beta_features import deactivate_beta_features
from .news import news
from .feedback import feedback
from .feedback import feedback
from .help import help
30 changes: 30 additions & 0 deletions bsz_bot/commands/help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import discord
from ..helpers import *

commands_info = [
{"command": "/help", "description": "Prints a list of available commands", "experimental": False, "admin": False},
{"command": "/activate", "description": "Activates the bot", "experimental": False, "admin": True},
{"command": "/deactivate", "description": "Deactivates the bot", "experimental": False, "admin": True},
{"command": "/deactivate_experimental_features", "description": "Deactivates experimental features", "experimental": False, "admin": True},
{"command": "/activate_experimental_features", "description": "Activates experimental features", "experimental": False, "admin": True},
{"command": "/set <variable_name> <value>", "description": "Sets the specified variable to the given value", "experimental": False, "admin": True},
{"command": "/reset", "description": "Resets all variables to their default values", "experimental": False, "admin": True},
{"command": "/ping", "description": "Checks the bot's responsiveness", "experimental": False, "admin": False},
{"command": "/plan", "description": "Retrieves the current plan", "experimental": False, "admin": False},
{"command": "/get <variable_name>", "description": "Retrieves the value of the specified variable", "experimental": False, "admin": False},
{"command": "/status", "description": "Checks if the bot is currently active", "experimental": False, "admin": False},
{"command": "/feedback <message>", "description": "Submits user feedback", "experimental": False, "admin": False},
{"command": "/print_parsed_table_experimental", "description": "Displays the parsed table", "experimental": True, "admin": False},
{"command": "/news_experimental", "description": "Retrieves the latest news", "experimental": True, "admin": False},
]

@discord.app_commands.command(name="help", description="Print a list of available commands.")
async def help(ctx : discord.Interaction):
embed = simple_embed("Available Commands", "Here is a list of all available commands:")

for info in commands_info:
experimental_note = " (Experimental)" if info["experimental"] else ""
admin_note = " (Admin only)" if info["admin"] else ""
embed.add_field(name=f"{info['command']}{admin_note}{experimental_note}", value=f"{info['description']}", inline=False)

await ctx.response.send_message(embed=embed, ephemeral=True)
4 changes: 2 additions & 2 deletions bsz_bot/tasks/check_parsed_plan_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ async def wait_until(hour, minute):
@tasks.loop(hours=24)
async def get_news():
logger.info("sending dayly info")

if datetime.today().weekday() > 4:
if datetime.today().weekday() == 4 or datetime.today().weekday() == 5:
return

for guild in BSZ_BOT.guilds:
Expand Down

0 comments on commit 4b98f1f

Please sign in to comment.