Changed send_highscore_message to take guild rather than channel.

This commit is contained in:
alwayscompiling
2022-12-08 13:02:39 -05:00
parent a9b889234a
commit f468a028d0
4 changed files with 12 additions and 29 deletions
+2 -11
View File
@@ -55,9 +55,7 @@ class RefreshCog(commands.Cog, name="Refresh Cog"):
)
group = session.scalar(stmt)
channel = interaction.guild.get_channel(group.ChannelId)
message: nextcord.Message = await send_highscore_message(session, channel, group)
message: nextcord.Message = await send_highscore_message(session, interaction.guild, group)
await message.edit(view=SubmissionCreateButton(self._bot))
await interaction.response.send_message(f"Updated table {group.GroupName}!", ephemeral=True)
@@ -88,14 +86,7 @@ class RefreshCog(commands.Cog, name="Refresh Cog"):
await interaction.response.defer(ephemeral=True)
for group in session.scalars(stmt):
channel = interaction.guild.get_channel(group.ChannelId)
# Error checking for registered highscore channel
error_response = "Registered Highscores channel does not exist or was never registered. "
error_response += 'Use "/register" to register channels.'
assert channel is not None, await interaction.response(error_response, ephemeral=True)
message: nextcord.Message = await send_highscore_message(session, channel, group)
message: nextcord.Message = await send_highscore_message(session, interaction.guild, group)
await message.edit(view=SubmissionCreateButton(self._bot))
await interaction.send(f"Posted all groups in {interaction.guild.name}'s highscores.", ephemeral=True)