Skip to content

Commit

Permalink
Informational logging for OC channel edits
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhsm committed Jan 3, 2024
1 parent d6cfd88 commit c706b10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions dictator/cogs/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,33 @@
from get_version import get_dictator_version

import random
import logging


class System(commands.Cog):
def __init__(self, dictator: commands.Bot) -> None:
self.dictator = dictator
logging.basicConfig(level=logging.INFO)

@commands.Cog.listener()
async def on_message(self, message: discord.Message):
if not message.channel.id == OC_CHANNEL_ID:
return

logging.info(f"Message sent in OC channel ({message.id})")

if not message.webhook_id:
return

logging.info(f"Message sent by webhook ({message.id})")

if message.embeds:
await message.edit(suppress=True)
logging.info(f"Message edited ({message.id})")
return

logging.info(f"Message not edited ({message.id})")


@app_commands.command()
async def ping(self, interaction: discord.Interaction) -> None:
Expand Down
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ PLAYER_LIST_PASSWORD=

#OC_GRAPHQL_ENDPOINT=
#OC_ANALYSIS_PERIOD_MONTHS=
#OC_FORECAST_MONTH_DAY=
#OC_FORECAST_MONTH_DAY=

0 comments on commit c706b10

Please sign in to comment.