added a new env variable and added functionality to edited message logs

This commit is contained in:
SeaswimmerTheFsh 2023-07-01 11:01:39 -04:00
parent baeab865f6
commit 4f269119f5
2 changed files with 5 additions and 2 deletions

View file

@ -1,7 +1,8 @@
TOKEN=token-goes-here TOKEN=token-goes-here
PREFIX=! PREFIX=!
MESSAGE_LOGGING_CHANNEL=channel-id 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 API_URL=https://api.revolt.chat
# Moderation Database # Moderation Database
DB_HOST=localhost DB_HOST=localhost

View file

@ -17,6 +17,7 @@ token = os.getenv('TOKEN')
api_url = os.getenv('API_URL') api_url = os.getenv('API_URL')
prefix = os.getenv('PREFIX') prefix = os.getenv('PREFIX')
message_logging_channel = os.getenv('MESSAGE_LOGGING_CHANNEL') message_logging_channel = os.getenv('MESSAGE_LOGGING_CHANNEL')
app_url = os.getenv('APP_URL')
class Client(commands.CommandsClient): class Client(commands.CommandsClient):
"""This class contains all of the commands/methods required for core functionality. Everything else will be relegated to cogs (eventually).""" """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 isinstance(message.author, revolt.Member):
if message.author.bot is True: if message.author.bot is True:
return 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) channel = self.get_channel(message_logging_channel)
try: try:
await channel.send(embed=embeds[0]) await channel.send(embed=embeds[0])