Changed where submission views live.
This commit is contained in:
@@ -3,6 +3,9 @@ Bot command to post the highscores
|
||||
"""
|
||||
|
||||
from nextcord.ext import commands
|
||||
import nextcord
|
||||
|
||||
from cogs.submission.submission_views import SubmissionButton # pylint: disable=import-error
|
||||
from highscores import highscores_config # pylint: disable=import-error
|
||||
from highscores import highscores_data # pylint: disable=import-error
|
||||
from utilities.data_storage import save_highscores_data # pylint: disable=import-error
|
||||
@@ -15,6 +18,11 @@ class PostHighscores(commands.Cog, name="Post Highscores"):
|
||||
def __init__(self, bot: commands.Bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_ready(self):
|
||||
"""Called when cog is loaded"""
|
||||
self.bot.add_view(SubmissionButton())
|
||||
|
||||
@commands.command(name="post-scores")
|
||||
async def post_highscores(self, ctx: commands.Context):
|
||||
"""
|
||||
@@ -29,12 +37,13 @@ class PostHighscores(commands.Cog, name="Post Highscores"):
|
||||
print(f"Printing out highscores information in channel {highscore_channel_id}")
|
||||
channel = self.bot.get_channel(highscore_channel_id)
|
||||
|
||||
error_response = 'Registered Highscores channel does not exist or was never registered. \
|
||||
error_response = 'Registered Highscores channel does not exist or was never registered. \n\
|
||||
Register with "?register" command.'
|
||||
assert channel is not None, await ctx.send(error_response)
|
||||
|
||||
for boss in highscores_config["bosses"]:
|
||||
await send_highscore_message(channel, boss["boss"])
|
||||
message: nextcord.Message = await send_highscore_message(channel, boss["boss"])
|
||||
await message.edit(view=SubmissionButton())
|
||||
|
||||
save_highscores_data(highscores_data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user