From 4f269119f58d7bb2200964b6dace6fc9c6a55b76 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh <102361830+SeaswimmerTheFsh@users.noreply.github.com> Date: Sat, 1 Jul 2023 11:01:39 -0400 Subject: [PATCH] added a new env variable and added functionality to edited message logs --- .env.example | 3 ++- main.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index c67c78a..0c527d5 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,8 @@ TOKEN=token-goes-here PREFIX=! MESSAGE_LOGGING_CHANNEL=channel-id -# Only change the API URL if you're using a selfhosted Revolt instance. +# Only change these URLs if you're using a selfhosted Revolt instance. +APP_URL=https://app.revolt.chat API_URL=https://api.revolt.chat # Moderation Database DB_HOST=localhost diff --git a/main.py b/main.py index 6b96e59..dca09a8 100644 --- a/main.py +++ b/main.py @@ -17,6 +17,7 @@ token = os.getenv('TOKEN') api_url = os.getenv('API_URL') prefix = os.getenv('PREFIX') message_logging_channel = os.getenv('MESSAGE_LOGGING_CHANNEL') +app_url = os.getenv('APP_URL') class Client(commands.CommandsClient): """This class contains all of the commands/methods required for core functionality. Everything else will be relegated to cogs (eventually).""" @@ -51,7 +52,8 @@ class Client(commands.CommandsClient): if isinstance(message.author, revolt.Member): if message.author.bot is True: return - 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}", colour="#5d82d1"), CustomEmbed(title="Old Content", description=before.content, colour="#5d82d1"), CustomEmbed(title="New Content", description=message.content, colour="#5d82d1")] + message_link = f"{app_url}/server/{message.server.id}/channel/{message.channel.id}/message/{message.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")] channel = self.get_channel(message_logging_channel) try: await channel.send(embed=embeds[0])