Skip to content

Commit

Permalink
Return button for promote and infract and smth el
Browse files Browse the repository at this point in the history
  • Loading branch information
bugsbirb committed Feb 20, 2024
1 parent e656e57 commit 6650ecb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 9 additions & 2 deletions Cogs/Configuration/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ async def callback(self, interaction: discord.Interaction):
else:
scollection.insert_one(data)
await refreshembed(interaction)
await interaction.response.edit_message(content=None)
try:
await interaction.response.edit_message(content=None)
except:
print('Error editing staff role config message')
except Exception as e:
print(f"An error occurred: {str(e)}")
print(f"Select Roles {selected_role_ids}")
Expand All @@ -143,7 +146,10 @@ async def callback(self, interaction: discord.Interaction):

arole.update_one({'guild_id': interaction.guild.id}, {'$set': data}, upsert=True)
await refreshembed(interaction)
await interaction.response.edit_message(content=None)
try:
await interaction.response.edit_message(content=None)
except:
print('Error editing admin role config message')
print(f"Select Roles {selected_role_ids}")


Expand Down Expand Up @@ -837,5 +843,6 @@ async def refreshembed(interaction):
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)


async def setup(client: commands.Bot) -> None:
await client.add_cog(ConfigCog(client))
11 changes: 7 additions & 4 deletions Cogs/Modules/adminpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,10 @@ async def Promote(
)
return

view = PromotionRoleView(self.user, self.guild, self.author)
view = Return(self.user, self.guild, self.author)
view.add_item(PromotionRole(self.user, self.guild, self.author))
await interaction.response.edit_message(view=view)

@discord.ui.button(
label="Infract",
style=discord.ButtonStyle.grey,
Expand Down Expand Up @@ -915,7 +916,8 @@ async def Infract(
)
return

view = InfractionOptionView(self.user, self.guild, self.author)
view = Return(self.user, self.guild, self.author)
view.add_item(InfractionOption(self.user, self.guild, self.author))
await interaction.response.edit_message(view=view)

@discord.ui.button(
Expand Down Expand Up @@ -1084,8 +1086,9 @@ def __init__(self, user, guild, author):
label="Return",
style=discord.ButtonStyle.grey,
emoji="<:Return:1166514220960063568>",
row=2
)
async def Return(self, interaction: discord.Interaction, button: discord.ui.Button):
async def Return77(self, interaction: discord.Interaction, button: discord.ui.Button):
if interaction.user.id != self.author.id:
embed = discord.Embed(
description=f"**{interaction.user.global_name},** this is not your view!",
Expand Down

0 comments on commit 6650ecb

Please sign in to comment.