Fix database_setup and main lint smells.

This commit is contained in:
2024-05-22 16:33:09 -04:00
parent 1fd1be5576
commit e485c119f6
4 changed files with 26 additions and 18 deletions
+14 -9
View File
@@ -1,3 +1,5 @@
"""Main file for bot."""
import logging
import os
import sys
@@ -27,7 +29,13 @@ logger.addHandler(handler)
@hydra.main(config_path="conf", config_name="config")
def main(cfg: DakinyConfig):
def main(cfg: DakinyConfig) -> None:
"""
Builds and runs bot.
Args:
cfg (DakinyConfig): Passed in hydra configuration.
"""
# Allows privledged intents for monitoring members joining, roles editing, and role assignments
# These need to be enabled in the developer portal as well
intents = nextcord.Intents.default()
@@ -35,9 +43,6 @@ def main(cfg: DakinyConfig):
# Required in order to read messages (eg. prefix commands)
intents.message_content = True
# To enable the guilds priveleged intent:
# intents.guilds = True
# To enable the members priveleged intent:
intents.members = True
@@ -49,15 +54,15 @@ def main(cfg: DakinyConfig):
bot.load_extension(f"cogs.{folder}")
@bot.listen()
async def on_ready():
"""When Discord is connected"""
assert bot.user is not None
create_database # pylint: disable=pointless-statement
async def on_ready() -> None:
"""When Discord is connected."""
assert bot.user is not None # noqa: S101 documentation does this
create_database # noqa: B018
bot.add_view(NominateView(cfg, bot.get_guild(cfg.params.guild_id)))
bot.add_view(NominateHighCouncilView(cfg, bot.get_guild(cfg.params.guild_id)))
bot.add_view(VoteView(cfg, bot.get_guild(cfg.params.guild_id)))
bot.add_view(VoteHighcouncilView(cfg, bot.get_guild(cfg.params.guild_id)))
print(f"{bot.user.name} has connected to Discord!")
print(f"{bot.user.name} has connected to Discord!") # noqa: T201 TODO make logging to print my stuff to console
# Run Discord bot
bot.run(bot.config.params.discord_token)