Format Python code with psf/black push

github-actions 2 years ago
parent b7417c54cf
commit 7c3b652a2a

@ -218,7 +218,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
# Check moderation service for each guild
for guild in self.bot.guilds:
print("Checking moderation service for guild "+guild.name)
print("Checking moderation service for guild " + guild.name)
await self.check_and_launch_moderations(guild.id)
await self.bot.sync_commands(
@ -628,7 +628,6 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
self.redo_users[after.author.id].prompt = after.content
async def check_and_launch_moderations(self, guild_id, alert_channel_override=None):
# Create the moderations service.
print("Checking and attempting to launch moderations service...")
@ -636,7 +635,9 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
self.moderation_queues[guild_id] = asyncio.Queue()
moderations_channel = await self.bot.fetch_channel(
self.get_moderated_alert_channel(guild_id) if not alert_channel_override else alert_channel_override
self.get_moderated_alert_channel(guild_id)
if not alert_channel_override
else alert_channel_override
)
self.moderation_tasks[guild_id] = asyncio.ensure_future(
@ -649,6 +650,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
return moderations_channel
return None
@discord.Cog.listener()
async def on_message(self, message):
# Get the message from context
@ -1372,10 +1374,14 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
# Create the moderations service.
self.set_guild_moderated(ctx.guild_id)
moderations_channel = await self.check_and_launch_moderations(ctx.guild_id,self.moderation_alerts_channel if not alert_channel_id else alert_channel_id)
moderations_channel = await self.check_and_launch_moderations(
ctx.guild_id,
self.moderation_alerts_channel
if not alert_channel_id
else alert_channel_id,
)
self.set_moderated_alert_channel(ctx.guild_id, moderations_channel.id)
await ctx.respond("Moderations service enabled")
elif status == "off":
@ -1496,6 +1502,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
def check_guild_moderated(self, guild_id):
return guild_id in MOD_DB and MOD_DB[guild_id]["moderated"]
def get_moderated_alert_channel(self, guild_id):
return MOD_DB[guild_id]["alert_channel"]
@ -1508,9 +1515,13 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"):
MOD_DB[guild_id] = {"moderated": status, "alert_channel": 0}
MOD_DB.commit()
return
MOD_DB[guild_id] = {"moderated": status, "alert_channel": self.get_moderated_alert_channel(guild_id)}
MOD_DB[guild_id] = {
"moderated": status,
"alert_channel": self.get_moderated_alert_channel(guild_id),
}
MOD_DB.commit()
class ConversationView(discord.ui.View):
def __init__(self, ctx, converser_cog, id, custom_api_key=None):
super().__init__(timeout=3600) # 1 hour interval to redo.

Loading…
Cancel
Save