Compare commits

...

2 commits

Author SHA1 Message Date
944204a441
fix(moderation): changed self.servers to self.client.servers
All checks were successful
Pylint / Pylint (push) Successful in 50s
2023-09-24 16:20:33 -04:00
2d39b773f4
fix(main): fixed pylint warning 2023-09-24 13:26:08 -04:00
2 changed files with 10 additions and 10 deletions

View file

@ -20,8 +20,8 @@ db = os.getenv('DB')
required_role_id = os.getenv('REQUIRED_ROLE_ID') required_role_id = os.getenv('REQUIRED_ROLE_ID')
class Moderation(commands.Cog): class Moderation(commands.Cog):
def __init__(self, bot): def __init__(self, client):
self.bot = bot self.client: revolt.Client = client
disable_dateutil() disable_dateutil()
def mysql_connect(self): def mysql_connect(self):
@ -66,7 +66,7 @@ class Moderation(commands.Cog):
return return
async def tempban_handler(self): async def tempban_handler(self):
for server in self.servers: for server in self.client.servers:
database = Moderation.mysql_connect(self) database = Moderation.mysql_connect(self)
cursor = database.cursor() cursor = database.cursor()
bans = await server.fetch_bans() bans = await server.fetch_bans()

14
main.py
View file

@ -57,21 +57,21 @@ class Client(commands.CommandsClient):
else: else:
print(f"{message.author.name}#{message.author.discriminator} ({message.author.id}): {message.content}\n ⤷ Deleted from Direct Messages\n Message ID: {message.id}") print(f"{message.author.name}#{message.author.discriminator} ({message.author.id}): {message.content}\n ⤷ Deleted from Direct Messages\n Message ID: {message.id}")
async def on_message_update(self, before: revolt.Message, message: revolt.Message): async def on_message_update(self, before: revolt.Message, after: revolt.Message):
if isinstance(message.author, revolt.Member): if isinstance(after.author, revolt.Member):
if message.author.bot is True: if after.author.bot is True:
return return
message_link = f"{app_url}/server/{message.server.id}/channel/{message.channel.id}/message/{message.id}" message_link = f"{app_url}/server/{after.server.id}/channel/{after.channel.id}/message/{after.id}"
embeds = [CustomEmbed(description=f"## Message Edited in {message.channel.mention}\n**Author:** {message.author.name}#{message.author.discriminator} ({message.author.id})\n**Message ID:** [{message.id}]({message_link})", colour="#5d82d1"), CustomEmbed(title="Old Content", description=before.content, colour="#5d82d1"), CustomEmbed(title="New Content", description=message.content, colour="#5d82d1")] embeds = [CustomEmbed(description=f"## Message Edited in {after.channel.mention}\n**Author:** {after.author.name}#{after.author.discriminator} ({after.author.id})\n**Message ID:** [{after.id}]({message_link})", colour="#5d82d1"), CustomEmbed(title="Old Content", description=before.content, colour="#5d82d1"), CustomEmbed(title="New Content", description=after.content, colour="#5d82d1")]
channel = self.get_channel(message_logging_channel) channel = self.get_channel(message_logging_channel)
try: try:
await channel.send(embed=embeds[0]) await channel.send(embed=embeds[0])
await channel.send(embed=embeds[1]) await channel.send(embed=embeds[1])
await channel.send(embed=embeds[2]) await channel.send(embed=embeds[2])
except LookupError: except LookupError:
print("Message logging channel not found for server ID: " + message.server.id) print("Message logging channel not found for server ID: " + after.server.id)
else: else:
print(f"{message.author.name}#{message.author.discriminator} ({message.author.id}): {before.content}\n ⤷ Edited in Direct Messages\n New Content: {message.content}") print(f"{after.author.name}#{after.author.discriminator} ({after.author.id}): {before.content}\n ⤷ Edited in Direct Messages\n New Content: {after.content}")
@commands.command() @commands.command()
async def ping(self, ctx: commands.Context): async def ping(self, ctx: commands.Context):