Changed send_highscore_message to take guild rather than channel.
This commit is contained in:
@@ -120,7 +120,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
stmt = select(CategoryGroup).where(CategoryGroup.GroupId.in_(group_ids))
|
||||
|
||||
for group in session.scalars(stmt):
|
||||
await send_highscore_message(session, interaction.guild.get_channel(group.ChannelId), group)
|
||||
await send_highscore_message(session, interaction.guild, group)
|
||||
|
||||
await interaction.send(f'User "{user_name}" was removed from all tables.', ephemeral=True)
|
||||
|
||||
@@ -163,7 +163,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
session.delete(session.scalar(stmt))
|
||||
session.commit()
|
||||
|
||||
await send_highscore_message(session, interaction.guild.get_channel(group.ChannelId), group)
|
||||
await send_highscore_message(session, interaction.guild, group)
|
||||
await interaction.response.send_message(
|
||||
f'User "{user_name}" removed from "{category_name}".', ephemeral=True
|
||||
)
|
||||
@@ -194,7 +194,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
session.delete(score)
|
||||
session.commit()
|
||||
|
||||
await send_highscore_message(session, interaction.guild.get_channel(group.ChannelId), group)
|
||||
await send_highscore_message(session, interaction.guild, group)
|
||||
await interaction.response.send_message(
|
||||
f'User "{user_name}" removed from all categories in {group.GroupName}.', ephemeral=True
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -63,7 +63,7 @@ class UpdateUsernameVerifyView(nextcord.ui.View):
|
||||
stmt = select(CategoryGroup).where(CategoryGroup.GroupId.in_(group_ids))
|
||||
|
||||
for group in session.scalars(stmt):
|
||||
await send_highscore_message(session, interaction.guild.get_channel(group.ChannelId), group)
|
||||
await send_highscore_message(session, interaction.guild, group)
|
||||
|
||||
content = interaction.message.content
|
||||
content += f"\nApproved by <@{interaction.user.id}>."
|
||||
|
||||
Reference in New Issue
Block a user