Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions discord_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from bot_db import BotDatabase
from datetime import datetime, UTC
from ipaddress import IPv6Address
from semver import compare
from typing import Any, Deque, Dict, Iterator, List, Optional
from ztapi_client import ZeroTierApiClient

Expand Down Expand Up @@ -61,18 +62,31 @@ def format_game_message(game: Dict[str, Any]) -> str:
text += ' ' + str(game['type'])

text += ' ' + str(game['version'])

match game['tick_rate']:
case 20:
text += ''
case 30:
text += ' Fast'
case 40:
text += ' Faster'
case 50:
text += ' Fastest'
case _:
text += ' speed: ' + str(game['tick_rate'])

if compare(game['version'], "1.6.0") == -1:
match game['tick_rate']:
case 20:
text += ''
case 30:
text += ' Fast'
case 40:
text += ' Faster'
case 50:
text += ' Fastest'
case _:
text += ' speed: ' + str(game['tick_rate'])
else:
match game['tick_rate']:
case 20:
text += ''
case 25:
text += ' Fast'
case 30:
text += ' Faster'
case 35:
text += ' Fastest'
case _:
text += ' speed: ' + str(game['tick_rate'])

match game['difficulty']:
case 0:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
aiohttp>=3.11.16
aiosqlite>=0.21.0
discord>=2.0
semver>=3.0.4
Loading