Compare commits

...

5 commits

Author SHA1 Message Date
08ad1fe902
fix(suggestions): pylint fixes
All checks were successful
Pylint / Pylint (push) Successful in 1m6s
2023-09-24 20:50:43 -04:00
3eb57fda4b
fix(sugoncredit): pylint fixes 2023-09-24 20:50:38 -04:00
a5cf3190d9
fix(shortmute): pylint fixes 2023-09-24 20:46:43 -04:00
634226f0d3
fix(musicdownloader): pylint fixes 2023-09-24 20:45:28 -04:00
da840a2517
fix(exportchannels): pylint fixes 2023-09-24 20:45:00 -04:00
6 changed files with 13 additions and 16 deletions

View file

@ -1,6 +1,6 @@
import discord
import asyncio import asyncio
import os import os
import discord
from redbot.core import Config, checks, commands, data_manager from redbot.core import Config, checks, commands, data_manager
class ExportChannels(commands.Cog): class ExportChannels(commands.Cog):

View file

@ -148,7 +148,7 @@ class MusicDownloader(commands.Cog):
msg = ctx.send msg = ctx.send
message = await msg("YouTube Downloader started!") message = await msg("YouTube Downloader started!")
try: try:
ytdlp_output = youtube_download(self, url, data_path, message) ytdlp_output = youtube_download(self, url, data_path)
except (utils.DownloadError, utils.ExtractorError): except (utils.DownloadError, utils.ExtractorError):
await message.edit(content="Please provide a link to YouTube and not another site.\nThe site you've linked to is known for using DRM protection, so MusicDownloader cannot download from it.") await message.edit(content="Please provide a link to YouTube and not another site.\nThe site you've linked to is known for using DRM protection, so MusicDownloader cannot download from it.")
return return

View file

@ -124,7 +124,7 @@ class Shortmute(commands.Cog):
self.config = Config.get_conf(None, cog_name='Shortmute', identifier=25781647388294) self.config = Config.get_conf(None, cog_name='Shortmute', identifier=25781647388294)
@ui.button(label="Yes", style=discord.ButtonStyle.success) @ui.button(label="Yes", style=discord.ButtonStyle.success)
async def shortmute_button_yes(self, button: ui.Button, interaction: discord.Interaction): # pylint: disable=arguments-differ async def shortmute_button_yes(self, button: ui.Button, interaction: discord.Interaction): # pylint: disable=unused-argument
disable_dateutil() disable_dateutil()
target: discord.Member = self.passed_info['target'] target: discord.Member = self.passed_info['target']
readable_duration = self.passed_info['readable_duration'] readable_duration = self.passed_info['readable_duration']
@ -159,7 +159,7 @@ class Shortmute(commands.Cog):
await channel_obj.send(embed=logging_embed) await channel_obj.send(embed=logging_embed)
@ui.button(label="No", style=discord.ButtonStyle.danger) @ui.button(label="No", style=discord.ButtonStyle.danger)
async def shortmute_button_no(self, button: ui.Button, interaction: discord.Interaction): # pylint: disable=arguments-differ async def shortmute_button_no(self, button: ui.Button, interaction: discord.Interaction): # pylint: disable=unused-argument
message: discord.Message = await self.passed_info['interaction'].edit_original_response(content="Command cancelled.", view=None, embed=None) message: discord.Message = await self.passed_info['interaction'].edit_original_response(content="Command cancelled.", view=None, embed=None)
await message.delete(delay=3) await message.delete(delay=3)
@ -267,7 +267,7 @@ class Shortmute(commands.Cog):
current_list = await self.config.guild(ctx.guild).blacklisted_users() current_list = await self.config.guild(ctx.guild).blacklisted_users()
already_in_list = [] already_in_list = []
for user_id in current_list: for user_id in current_list:
user_obj = await Bot.fetch_user(user_id) user_obj = await Bot.fetch_user(user_id) # pylint: disable=no-value-for-parameter
if user_obj: if user_obj:
already_in_list.append(user_obj.mention) already_in_list.append(user_obj.mention)
if already_in_list: if already_in_list:

View file

@ -8,5 +8,5 @@ async def setup(bot):
async def teardown(bot): async def teardown(bot):
# We're removing the commands here to ensure they get unloaded properly when the cog is unloaded. # We're removing the commands here to ensure they get unloaded properly when the cog is unloaded.
bot.tree.remove_command("approve_context", type=discord.AppCommandType.message) bot.tree.remove_command("approve_context", type=discord.AppCommandType.message) # pylint: disable=undefined-variable
bot.tree.remove_command("deny_context", type=discord.AppCommandType.message) bot.tree.remove_command("deny_context", type=discord.AppCommandType.message) # pylint: disable=undefined-variable

View file

@ -44,7 +44,6 @@ class Suggestions(commands.Cog):
def check_discrim(self, user: discord.User): def check_discrim(self, user: discord.User):
if user.discriminator == "0": if user.discriminator == "0":
return user.name return user.name
else:
return f"{user.name}#{user.discriminator}" return f"{user.name}#{user.discriminator}"
async def red_delete_data_for_user(self, *, requester, user_id: discord.User.id): async def red_delete_data_for_user(self, *, requester, user_id: discord.User.id):
@ -611,6 +610,7 @@ class Suggestions(commands.Cog):
) )
return nmsg return nmsg
# pylint: disable=protected-access
class SuggestionApproveModal(discord.ui.Modal, title="Approving suggestion..."): class SuggestionApproveModal(discord.ui.Modal, title="Approving suggestion..."):
def __init__(self, message): def __init__(self, message):
super().__init__() super().__init__()

View file

@ -16,14 +16,14 @@ class SugonCredit(commands.Cog):
"""Checks an account's balance.""" """Checks an account's balance."""
bank_name = await bank.get_bank_name(ctx.guild) bank_name = await bank.get_bank_name(ctx.guild)
currency_name = await bank.get_currency_name(ctx.guild) currency_name = await bank.get_currency_name(ctx.guild)
if user == None: if user is None:
bal = await bank.get_balance(ctx.author) bal = await bank.get_balance(ctx.author)
target = ctx.author target = ctx.author
else: else:
bal = await bank.get_balance(user) bal = await bank.get_balance(user)
target = user target = user
output_bal = (f'{bal:,}') output_bal = (f'{bal:,}')
if bal == 1 or bal == -1: if bal in (1, -1):
embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {output_bal} {currency_name}.") embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {output_bal} {currency_name}.")
else: else:
embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {output_bal} {currency_name}s.") embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {output_bal} {currency_name}s.")
@ -49,15 +49,13 @@ class SugonCredit(commands.Cog):
output_max_bal = (f'{max_bal:,}') output_max_bal = (f'{max_bal:,}')
if new_bal > max_bal: if new_bal > max_bal:
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to above {output_max_bal}. Please try again!") await ctx.send(content=f"You are attempting to set {target.mention}'s balance to above {output_max_bal}. Please try again!")
return
elif new_bal < 0: elif new_bal < 0:
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!") await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!")
return
elif ctx.guild.id == 204965774618656769: elif ctx.guild.id == 204965774618656769:
logging_channel: discord.TextChannel = self.bot.get_channel(1082495815878189076) logging_channel: discord.TextChannel = self.bot.get_channel(1082495815878189076)
await bank.deposit_credits(target, amount=amount) await bank.deposit_credits(target, amount=amount)
await ctx.send(content=f"{target.mention} now has {output_amount} more SugonCredit, with a total of {output_new_bal}!") await ctx.send(content=f"{target.mention} now has {output_amount} more SugonCredit, with a total of {output_new_bal}!")
if amount == 1 or amount == -1: if amount in (1, -1):
await target.send(content=f"You gained {output_amount} SugonCredit! Good work community member! You now have {output_new_bal} SugonCredits.", file=image) await target.send(content=f"You gained {output_amount} SugonCredit! Good work community member! You now have {output_new_bal} SugonCredits.", file=image)
else: else:
await target.send(content=f"You gained {output_amount} SugonCredits! Good work community member! You now have {output_new_bal} SugonCredits.", file=image) await target.send(content=f"You gained {output_amount} SugonCredits! Good work community member! You now have {output_new_bal} SugonCredits.", file=image)
@ -86,12 +84,11 @@ class SugonCredit(commands.Cog):
output_new_bal = (f'{new_bal:,}') output_new_bal = (f'{new_bal:,}')
if new_bal < 0: if new_bal < 0:
await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!") await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 0. Please try again!")
return
elif ctx.guild.id == 204965774618656769: elif ctx.guild.id == 204965774618656769:
await bank.withdraw_credits(target, amount=amount) await bank.withdraw_credits(target, amount=amount)
logging_channel: discord.TextChannel = self.bot.get_channel(1082495815878189076) logging_channel: discord.TextChannel = self.bot.get_channel(1082495815878189076)
await ctx.send(content=f"{target.mention} now has {output_amount} less SugonCredit, with a total of {output_new_bal}!\nIf this is a punishment, do better Galaxy Player! Re-education mods will be sent to your DM's if your SugonCredit drops to a substantially low amount!") await ctx.send(content=f"{target.mention} now has {output_amount} less SugonCredit, with a total of {output_new_bal}!\nIf this is a punishment, do better Galaxy Player! Re-education mods will be sent to your DM's if your SugonCredit drops to a substantially low amount!")
if amount == 1 or amount == -1: if amount in (1, -1):
await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {output_amount} SugonCredit has been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!", file=image) await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {output_amount} SugonCredit has been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!", file=image)
else: else:
await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {output_amount} SugonCredits have been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!", file=image) await target.send(content=f"__MESSAGE FROM THE MINISTRY OF THE MEGA BASE__\n\n(我们的) {output_amount} SugonCredits have been taken from your account. Citizen, do not continue to preform bad actions! Glory to the Galaxy Communist Party!", file=image)