From 343f88850330a5c1e68f45221f370fd81838ebcf Mon Sep 17 00:00:00 2001 From: Mihit Date: Wed, 9 Apr 2025 19:30:28 +1000 Subject: [PATCH] added variables for discord ids to improve readability --- DiscordBot.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/DiscordBot.py b/DiscordBot.py index adaeba5..326759c 100644 --- a/DiscordBot.py +++ b/DiscordBot.py @@ -22,6 +22,13 @@ formatter.default_msec_format = None ch.setFormatter(formatter) logger.addHandler(ch) ########################################## +#Discord ID resource +bot_id = 1094991519812956270 +fiery_eagle_id = 345153972765720577 +dodi_id = 468866369782415360 +torrent_link_channel_id = 862039084683624468 +new_release_tag_channel = 918559776269553756 +########################################## load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') @@ -102,14 +109,14 @@ async def on_ready(): @bot.slash_command() async def update_rss(ctx): - if ctx.user.id == 345153972765720577 or ctx.user.id == 468866369782415360: + if ctx.user.id == fiery_eagle_id or ctx.user.id == dodi_id: update_rss_feed() await ctx.respond("Sucessfully updated RSS feed") @bot.slash_command() async def upload(ctx): - messagechannel = bot.get_channel(862039084683624468) - if ctx.user.id == 345153972765720577 or ctx.user.id == 468866369782415360: + messagechannel = bot.get_channel(torrent_link_channel_id) + if ctx.user.id == fiery_eagle_id or ctx.user.id == dodi_id: files = files_to_upload(".") try: assert len(files) > 0 @@ -127,13 +134,13 @@ async def on_message(message): user_message = str(message.content) - if message.author.id == 1094991519812956270: + if message.author.id == bot_id: return - messagechannel = bot.get_channel(862039084683624468) + messagechannel = bot.get_channel(torrent_link_channel_id) logger.debug(f"{user_message}") - if ("http" in user_message and (message.channel.id == 918559776269553756 or message.author.id == 345153972765720577)): #and 1081399528265089125 in [roles.id for roles in username.roles]) # noqa: E501 + if ("http" in user_message and (message.channel.id == new_release_tag_channel or message.author.id == fiery_eagle_id)): links = user_message.replace("\n", " ") links = links.split(" ") for i in links: