Skip to content

Commit

Permalink
Better error handling and simple fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bugsbirb committed Feb 16, 2024
1 parent 8aaa53f commit 4273563
Show file tree
Hide file tree
Showing 21 changed files with 96 additions and 35 deletions.
1 change: 0 additions & 1 deletion Cogs/Configuration/Views/Customationview.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,5 +357,4 @@ async def Finish(self, interaction: discord.Interaction, button: discord.ui.Butt
}
Customisation.update_one(filter, {"$set": embed_data}, upsert=True)
embed = discord.Embed(title=f"{greencheck} Customisation Saved", description="Your embed has been saved." ,color=discord.Colour.brand_green())

await interaction.response.edit_message(content=None, embed=embed, view=None)
5 changes: 4 additions & 1 deletion Cogs/Configuration/Views/Utilityview.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ async def refreshembed(interaction):
embed = discord.Embed(title="<:Pen:1126527802255085628> Utilties Module", description=f"**Enabled:** {modulemsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", color=discord.Color.dark_embed())
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
5 changes: 4 additions & 1 deletion Cogs/Configuration/Views/applicationsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,7 @@ async def refreshembed(interaction):
inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
7 changes: 5 additions & 2 deletions Cogs/Configuration/Views/connectionrolesview.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@ async def refreshembed(interaction):
modulemsg = 'False'
embed = discord.Embed(title="<:Role:1162074735803387944> Connection Roles Module", description=f"**Enabled:** {modulemsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", color=discord.Color.dark_embed())
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
5 changes: 4 additions & 1 deletion Cogs/Configuration/Views/feedbackview.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,8 @@ async def refreshembed(interaction):
embed.add_field(name="<:settings:1207368347931516928> Staff Feedback Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replybottom:1207366623913316363>**Feedback Channel:** {feedbackchannelmsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")

7 changes: 5 additions & 2 deletions Cogs/Configuration/Views/forumsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,8 @@ async def refreshembed(interaction):
modulemsg = f"{moduleddata['Forums']}"
embed = discord.Embed(title="<:forum:1162134180218556497> Forum Utilites", description=f"**Enabled:** {modulemsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", color=discord.Color.dark_embed())
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
6 changes: 4 additions & 2 deletions Cogs/Configuration/Views/infractionsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,7 @@ async def refreshembed(self, interaction):
embed.add_field(name="<:settings:1207368347931516928> Infractions Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replymiddle:1207366662916014100>**Infraction Channel:** {infchannelmsg}\n<:replybottom:1207366623913316363>**Infraction Types [{infractiontypescount}/15]** {infractiontypess}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)

await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
9 changes: 7 additions & 2 deletions Cogs/Configuration/Views/loaview.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ async def refreshembed(interaction):
embed = discord.Embed(title="<:LOA:1164969910238203995> LOA Module", color=discord.Color.dark_embed())
embed.add_field(name="<:settings:1207368347931516928> LOA Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replymiddle:1207366662916014100>**LOA Channel:** {loachannelmsg}\n<:replybottom:1207366623913316363>**LOA Role:** {loarolemsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")



7 changes: 5 additions & 2 deletions Cogs/Configuration/Views/modmailview.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ async def refreshembed(interaction):
embed = discord.Embed(title="<:messagereceived:1201999712593383444> Modmail", color=discord.Color.dark_embed())
embed.add_field(name="<:settings:1207368347931516928> Modmail Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replymiddle:1207366662916014100>**Modmail Category:** {modmailcategorys}\n<:replymiddle:1207366662916014100>**Modmail Pings:** {modmailroles}\n<:replybottom:1207366623913316363>**Transcript Channel:** {transcriptschannels}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)")
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")

5 changes: 4 additions & 1 deletion Cogs/Configuration/Views/partnershipsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ async def refreshembed(interaction):

embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
5 changes: 4 additions & 1 deletion Cogs/Configuration/Views/promotionsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,7 @@ async def refreshembed(interaction):
embed.add_field(name="<:settings:1207368347931516928> Promotions Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replybottom:1207366623913316363>**Promotion Channel:** {promochannelmsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
8 changes: 5 additions & 3 deletions Cogs/Configuration/Views/quotaview.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ async def refreshembed(interaction):
embed = discord.Embed(title="<:Messages:1148610048151523339> Message Quota Module", color=discord.Color.dark_embed())
embed.add_field(name="<:settings:1207368347931516928> Message Quota Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replybottom:1207366623913316363>**Quota:** {messagecountmsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)

embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
5 changes: 4 additions & 1 deletion Cogs/Configuration/Views/reportview.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,7 @@ async def refreshembed(interaction):
embed.add_field(name="<:settings:1207368347931516928> Reports Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replymiddle:1207366662916014100>**Reports Channel:** {partnershipchannelmsg}\n<:replybottom:1207366623913316363>**Reports Moderator Role:** {reprolemsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
6 changes: 5 additions & 1 deletion Cogs/Configuration/Views/staffpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,8 @@ async def refreshembed(interaction):
embed = discord.Embed(title="<:staffdb:1206253848298127370> Staff Database & Panel", description=f"**Enabled:** {modulemsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", color=discord.Color.dark_embed())
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")

5 changes: 4 additions & 1 deletion Cogs/Configuration/Views/suggestionview.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@ async def refreshembed(interaction):
embed.add_field(name="<:settings:1207368347931516928> Suggestions Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replybottom:1207366623913316363>**Suggestion Channel:** {suggestionchannelmsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
7 changes: 5 additions & 2 deletions Cogs/Configuration/Views/suspensionsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@ async def refreshembed(interaction):
embed = discord.Embed(title="<:Suspensions:1167093139845165229> Suspension Module", color=discord.Color.dark_embed())
embed.add_field(name="<:settings:1207368347931516928> Suspension Configuration", value=f"<:replytop:1207366581735129118>**Enabled:** {modulemsg}\n<:replybottom:1207366623913316363>**Suspension Channel:** Infraction Channel\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", inline=False)
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
7 changes: 5 additions & 2 deletions Cogs/Configuration/Views/tagsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,8 @@ async def refreshembed(interaction):
modulemsg = f"{moduleddata['Tags']}"
embed = discord.Embed(title="<:tag:1162134250414415922> Tags Module", description=f"**Enabled:** {modulemsg}\n\n<:Tip:1167083259444875264> If you need help either go to the [support server](https://discord.gg/36xwMFWKeC) or read the [documentation](https://docs.astrobirb.dev)", color=discord.Color.dark_embed())
embed.set_thumbnail(url=interaction.guild.icon)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
await interaction.message.edit(embed=embed)
embed.set_author(name=interaction.guild.name, icon_url=interaction.guild.icon)
try:
await interaction.message.edit(embed=embed)
except discord.Forbidden:
print("Couldn't edit module due to missing permissions.")
3 changes: 2 additions & 1 deletion Cogs/Modules/infractions.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ async def infract(self, ctx, staff: discord.Member, action, reason: str, notes:
if consent_data['infractionalert'] == "Enabled":
try:
await staff.send(f"<:SmallArrow:1140288951861649418> From **{ctx.guild.name}**", embed=embed)
except discord.Forbidden:
except:
print(f"Couldn't send infraction alert to {staff.display_name} in {ctx.guild.name}")
pass
else:
pass
Expand Down
7 changes: 6 additions & 1 deletion Cogs/Modules/promotions.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ async def promote(self, ctx, staff: discord.Member, new: discord.Role, reason: s
await ctx.send(f"{no} **{ctx.author.display_name},** I don't have permission to view that channel.")
return
if consent_data['PromotionAlerts'] == "Enabled":
await staff.send(f"🎉 You were promoted **@{ctx.guild.name}!**", embed=embed)
try:
await staff.send(f"🎉 You were promoted **@{ctx.guild.name}!**", embed=embed)
except:
print(f"{staff.display_name} has DMs disabled")
pass

else:
pass
else:
Expand Down
3 changes: 1 addition & 2 deletions Cogs/Modules/stafffeedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ async def feedback2(self, ctx, staff: discord.Member, rating: Literal['1/10', '2
if staff == ctx.author:
await ctx.send(f"{no} **{ctx.author.display_name}**, you cannot rate yourself.")
return
staff_role_data = await scollection.find_one({'guild_id': ctx.guild.id})
staff_role_id = staff_role_data['staffrole']



has_staff_role = await self.staffcheck(ctx, staff)
Expand Down
Loading

0 comments on commit 4273563

Please sign in to comment.