Skip to content

Commit

Permalink
Merge pull request #14 from DezBirdss/deepsource-autofix-f6d39fc0
Browse files Browse the repository at this point in the history
refactor: use identity check for comparison to a singleton
  • Loading branch information
bugsbirb authored Apr 12, 2024
2 parents d5d7cfa + 34328d6 commit e79b86c
Show file tree
Hide file tree
Showing 24 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Cogs/Configuration/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ async def callback(self, interaction: discord.Interaction):
discord.SelectOption(label="Enabled"),
discord.SelectOption(label="Disabled")]
infractiontypescount = len(infractiontyperesult['types'])
if infractiontypescount == None:
if infractiontypescount is None:
infractiontypess = "0"
channels = []
if (
Expand Down
2 changes: 1 addition & 1 deletion Cogs/Configuration/Views/CustomCommandsView.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def on_submit(self, interaction: discord.Interaction):
return


if result.get('embed', False) == True:
if result.get('embed', False) is True:
embed_title = result.get('title', None)
embed_description = result.get('description', None)
color_value = result.get('color', None)
Expand Down
12 changes: 6 additions & 6 deletions Cogs/Configuration/Views/applicationsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ async def callback(self, interaction: discord.Interaction):
view = AccepButtons()
option_result = await options.find_one({'guild_id': interaction.guild.id})
if option_result:
if option_result.get('acceptbuttons', False) == False:
if option_result.get('acceptbuttons', False) is False:
view.AcceptButtons.style = discord.ButtonStyle.red

elif option_result.get('acceptbuttons', False) == True:
elif option_result.get('acceptbuttons', False) is True:
view.AcceptButtons.style = discord.ButtonStyle.green
await interaction.response.send_message(view=view, ephemeral=True)
elif color == ('Thread Discussion'):
view = ResultThread()
option_result = await options.find_one({'guild_id': interaction.guild.id})
if option_result:
if option_result.get('threaddiscussion', False) == False:
if option_result.get('threaddiscussion', False) is False:
view.AcceptButtons.style = discord.ButtonStyle.red

elif option_result.get('threaddiscussion', False) == True:
elif option_result.get('threaddiscussion', False) is True:
view.AcceptButtons.style = discord.ButtonStyle.green
await interaction.response.send_message(view=view, ephemeral=True)

Expand Down Expand Up @@ -126,7 +126,7 @@ def __init__(self):
@discord.ui.button(label="Accept/Deny Buttons", style=discord.ButtonStyle.green)
async def AcceptButtons(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('acceptbuttons', False) == False:
if optionresult.get('acceptbuttons', False) is False:
self.AcceptButtons.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'acceptbuttons': True}}, upsert=True)
else:
Expand All @@ -141,7 +141,7 @@ def __init__(self):
@discord.ui.button(label="Application Thread Discussion", style=discord.ButtonStyle.green)
async def AcceptButtons(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('threaddiscussion', False) == False:
if optionresult.get('threaddiscussion', False) is False:
self.AcceptButtons.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'threaddiscussion': True}}, upsert=True)
else:
Expand Down
6 changes: 3 additions & 3 deletions Cogs/Configuration/Views/feedbackview.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(self):
@discord.ui.button(label="Multiple Feedback", style=discord.ButtonStyle.red)
async def bybuttontoggle(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('multiplefeedback', False) == False:
if optionresult.get('multiplefeedback', False) is False:
self.bybuttontoggle.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'multiplefeedback': True}}, upsert=True)
else:
Expand Down Expand Up @@ -122,10 +122,10 @@ async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(title='Multiple Feedbacks', description="Allows you give someone feedback more then once.", color=discord.Colour.dark_embed())

if option_result:
if option_result.get('multiplefeedback', False) == False:
if option_result.get('multiplefeedback', False) is False:
view.bybuttontoggle.style = discord.ButtonStyle.red

elif option_result.get('multiplefeedback', False) == True:
elif option_result.get('multiplefeedback', False) is True:
view.bybuttontoggle.style = discord.ButtonStyle.green

await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
Expand Down
20 changes: 10 additions & 10 deletions Cogs/Configuration/Views/infractionsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(title='Infraction Issuer Button', color=discord.Colour.dark_embed())
embed.set_image(url="https://cdn.discordapp.com/attachments/1119278150086570045/1218941681752080485/image.png?ex=66097ee7&is=65f709e7&hm=f3ca0f7f9706bc4e2f50e1fa33b21ca0005f324abeb6b66b7f8b226b64e15bdd&")
if option_result:
if option_result.get('infractedbybutton', False) == False:
if option_result.get('infractedbybutton', False) is False:
view.bybuttontoggle.style = discord.ButtonStyle.red

elif option_result.get('infractedbybutton', False) == True:
elif option_result.get('infractedbybutton', False) is True:
view.bybuttontoggle.style = discord.ButtonStyle.green

await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
Expand All @@ -124,10 +124,10 @@ async def callback(self, interaction: discord.Interaction):
view = ShowIssuer()
embed = discord.Embed(title='Show Issuer', description="If you disable this, the infraction will be annonymous which doesn't work with customisation embeds and it removes the embed author so if the `Infraction Issuer Button` is enabled the button will still appear.", color=discord.Colour.dark_embed())
if option_result:
if option_result.get('showissuer', True) == False:
if option_result.get('showissuer', True) is False:
view.issuer.style = discord.ButtonStyle.red

elif option_result.get('showissuer', True) == True:
elif option_result.get('showissuer', True) is True:
view.issuer.style = discord.ButtonStyle.green

await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
Expand All @@ -137,10 +137,10 @@ async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(title='Notify On Void', description="", color=discord.Colour.dark_embed())
embed.set_image(url="https://cdn.discordapp.com/attachments/1119278150086570045/1218950005952352286/image.png?ex=660986a8&is=65f711a8&hm=cff17f86c88e52d800d03451cc58a295e5868465cfa1b1262cc318e0d7247058&")
if option_result:
if option_result.get('onvoid', False) == False:
if option_result.get('onvoid', False) is False:
view.void.style = discord.ButtonStyle.red

elif option_result.get('onvoid', False) == True:
elif option_result.get('onvoid', False) is True:
view.void.style = discord.ButtonStyle.green

await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
Expand All @@ -157,7 +157,7 @@ def __init__(self):
@discord.ui.button(label="Issuer Button Display", style=discord.ButtonStyle.red)
async def bybuttontoggle(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('infractedbybutton', False) == False:
if optionresult.get('infractedbybutton', False) is False:
self.bybuttontoggle.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'infractedbybutton': True}}, upsert=True)
else:
Expand All @@ -172,7 +172,7 @@ def __init__(self):
@discord.ui.button(label="Show Issuer", style=discord.ButtonStyle.green)
async def issuer(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('showissuer', True) == False:
if optionresult.get('showissuer', True) is False:
self.issuer.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'showissuer': True}}, upsert=True)
else:
Expand All @@ -187,7 +187,7 @@ def __init__(self):
@discord.ui.button(label="Notify on Void", style=discord.ButtonStyle.red)
async def void(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('onvoid', False) == False:
if optionresult.get('onvoid', False) is False:
self.void.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'onvoid': True}}, upsert=True)
else:
Expand Down Expand Up @@ -468,7 +468,7 @@ async def refreshembed(self, interaction: discord.Interaction):
infchannelmsg = channel.mention

infractiontypescount = len(infractiontyperesult['types'])
if infractiontypescount == None:
if infractiontypescount is None:
infractiontypess = "0"
embed = discord.Embed(title="<:Infraction:1223063128275943544> Infractions Module", color=discord.Color.dark_embed())
embed.add_field(name="<:settings:1207368347931516928> Infractions Configuration", value=f"{replytop}**Enabled:** {modulemsg}\n{replymiddle}**Infraction Channel:** {infchannelmsg}\n{replybottom}**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)
Expand Down
18 changes: 9 additions & 9 deletions Cogs/Configuration/Views/promotionsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,21 @@ async def callback(self, interaction: discord.Interaction):
view = AutoRole()
embed = discord.Embed(title='Auto Role', description="If you **disable** this it will no longer give the user the rank automatically.", color=discord.Colour.dark_embed())
if option_result:
if option_result.get('Auto Role', True) == False:
if option_result.get('Auto Role', True) is False:
view.bybuttontoggle.style = discord.ButtonStyle.red

elif option_result.get('Auto Role', True) == True:
elif option_result.get('Auto Role', True) is True:
view.bybuttontoggle.style = discord.ButtonStyle.green

await interaction.response.send_message(embed=embed, view=view, ephemeral=True)

elif selected_option == 'Show Issuer':
view = PShowIssuer()
embed = discord.Embed(title='Show Issuer', description="If you **disable** this it will make all promotions annonymous. This doesn't work with customisation embeds and it removes the embed author so if the `Promotion Issuer Button` is enabled the button will still appear.", color=discord.Colour.dark_embed())
if option_result.get('pshowissuer', True) == False:
if option_result.get('pshowissuer', True) is False:
view.bybuttontoggle.style = discord.ButtonStyle.red

elif option_result.get('pshowissuer', True) == True:
elif option_result.get('pshowissuer', True) is True:
view.bybuttontoggle.style = discord.ButtonStyle.green

await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
Expand All @@ -230,10 +230,10 @@ async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(title='Promotion Issuer Button', description="", color=discord.Colour.dark_embed())
embed.set_image(url="https://cdn.discordapp.com/attachments/1119278127772860489/1218957171560153098/image.png?ex=66098d54&is=65f71854&hm=dfa18ebbb548fc18cf2c4f640d28ff29e392d42e208ed8574ba04e5ebbcbef0f&")
if option_result:
if option_result.get('promotionissuer', False) == False:
if option_result.get('promotionissuer', False) is False:
view.bybuttontoggle.style = discord.ButtonStyle.red

elif option_result.get('promotionissuer', False) == True:
elif option_result.get('promotionissuer', False) is True:
view.bybuttontoggle.style = discord.ButtonStyle.green

await interaction.response.send_message(embed=embed, view=view, ephemeral=True)
Expand All @@ -245,7 +245,7 @@ def __init__(self):
@discord.ui.button(label="Autorole", style=discord.ButtonStyle.green)
async def bybuttontoggle(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('autorole', True) == False:
if optionresult.get('autorole', True) is False:
self.bybuttontoggle.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'autorole': True}}, upsert=True)
else:
Expand All @@ -259,7 +259,7 @@ def __init__(self):
@discord.ui.button(label="Show Issuer", style=discord.ButtonStyle.green)
async def bybuttontoggle(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('pshowissuer', True) == False:
if optionresult.get('pshowissuer', True) is False:
self.bybuttontoggle.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'pshowissuer': True}}, upsert=True)
else:
Expand All @@ -274,7 +274,7 @@ def __init__(self):
@discord.ui.button(label="Issuer Button Display", style=discord.ButtonStyle.red)
async def bybuttontoggle(self, interaction: discord.Interaction, button: discord.ui.Button):
optionresult = await options.find_one({'guild_id': interaction.guild.id})
if optionresult.get('promotionissuer', False) == False:
if optionresult.get('promotionissuer', False) is False:
self.bybuttontoggle.style = discord.ButtonStyle.green
await options.update_one({'guild_id': interaction.guild.id}, {'$set': {'promotionissuer': True}}, upsert=True)
else:
Expand Down
2 changes: 1 addition & 1 deletion Cogs/Events/messagevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def on_message(self, message):
return
module = await modules.find_one({'guild_id': message.guild.id})
if module:
if module.get('Quota', False) == False:
if module.get('Quota', False) is False:
return
else:
return
Expand Down
2 changes: 1 addition & 1 deletion Cogs/Events/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def on_member_join(self, member: discord.Member):
modulesresult = await modules.find_one({'guild_id': member.guild.id})
if modulesresult is None:
return
if modulesresult.get('welcome', False) == False:
if modulesresult.get('welcome', False) is False:
return
result = await welcome.find_one({'guild_id': member.guild.id})
if result.get('welcome_channel', None) is None:
Expand Down
Loading

0 comments on commit e79b86c

Please sign in to comment.