Improved type-hinting and overall sanity checks implemented.

This commit is contained in:
kku
2024-12-16 20:34:37 +01:00
parent 5c763fc02e
commit c05cf64ae0
14 changed files with 193 additions and 165 deletions

14
main.py
View File

@@ -1,4 +1,6 @@
import logging
import sys
from logging import Logger
from discord import Activity, ActivityType
from libbot import config_get
@@ -13,7 +15,7 @@ logging.basicConfig(
datefmt="[%X]",
)
logger = logging.getLogger(__name__)
logger: Logger = logging.getLogger(__name__)
try:
import uvloop # type: ignore
@@ -24,11 +26,11 @@ except ImportError:
@client.event
async def on_ready():
async def on_ready() -> None:
logger.info("Logged in as %s", client.user)
activity_type = await config_get("type", "status")
activity_message = await config_get("message", "status")
activity_type: str = await config_get("type", "status")
activity_message: str = await config_get("message", "status")
if activity_type == "playing":
await client.change_presence(
@@ -62,7 +64,7 @@ async def on_ready():
)
def main():
def main() -> None:
client.load_extension("cogs")
try:
@@ -70,7 +72,7 @@ def main():
client.run(sync_config_get("bot_token", "bot"))
except KeyboardInterrupt:
scheduler.shutdown()
exit()
sys.exit()
if __name__ == "__main__":