chore: removes some debug statements

removes some debug statments that I accidentally left in

task: none
This commit is contained in:
Yoruio
2022-07-11 20:56:09 -06:00
parent b89dcbec9c
commit a181483d0d
2 changed files with 7 additions and 12 deletions

View File

@@ -26,7 +26,7 @@ if USE_PLEX and plex_configured:
print('Logged into plex!') print('Logged into plex!')
except Exception as e: except Exception as e:
# probably rate limited. # probably rate limited.
print('Error with plex login. Please check username and password and Plex server name or setup plex in the bot.') print('Error with plex login. Please check username and password and Plex server name or setup plex in the bot. If you have restarted the bot multiple times recently, this is most likely due to being ratelimited on the Plex API. Try again in 10 minutes.')
print(f'Error: {e}') print(f'Error: {e}')
else: else:
print(f"Plex {'disabled' if not USE_PLEX else 'not configured'}. Skipping Plex login.") print(f"Plex {'disabled' if not USE_PLEX else 'not configured'}. Skipping Plex login.")
@@ -48,8 +48,12 @@ class app(commands.Cog):
print('Named by lordfransie') print('Named by lordfransie')
print(f'Logged in as {self.bot.user} (ID: {self.bot.user.id})') print(f'Logged in as {self.bot.user} (ID: {self.bot.user.id})')
print('------') print('------')
# TODO: Make these debug statements work. roles are currently empty arrays if no roles assigned.
if plex_roles is None: if plex_roles is None:
print('Configure Plex roles to enable auto invite to Plex after a role is assigned.') print('Configure Plex roles to enable auto invite to Plex after a role is assigned.')
if jellyfin_roles is None:
print('Configure Jellyfin roles to enable auto invite to Jellyfin after a role is assigned.')
async def getemail(self, after): async def getemail(self, after):
email = None email = None
@@ -148,7 +152,6 @@ class app(commands.Cog):
@commands.Cog.listener() @commands.Cog.listener()
async def on_member_update(self, before, after): async def on_member_update(self, before, after):
print(type(after))
if plex_roles is None and jellyfin_roles is None: if plex_roles is None and jellyfin_roles is None:
return return
roles_in_guild = after.guild.roles roles_in_guild = after.guild.roles
@@ -213,8 +216,6 @@ class app(commands.Cog):
username = await self.getusername(after) username = await self.getusername(after)
print("Username retrieved from user") print("Username retrieved from user")
if username is not None: if username is not None:
after.send("BREAKPOINT")
print("BREAKPOINT")
await embedinfo(after, "Got it we will be creating your Jellyfin account shortly!") await embedinfo(after, "Got it we will be creating your Jellyfin account shortly!")
password = jelly.generate_password(16) password = jelly.generate_password(16)
if jelly.add_user(JELLYFIN_SERVER_URL, JELLYFIN_API_KEY, username, password, jellyfin_libs): if jelly.add_user(JELLYFIN_SERVER_URL, JELLYFIN_API_KEY, username, password, jellyfin_libs):
@@ -310,7 +311,6 @@ class app(commands.Cog):
table.set_cols_align(["c", "c", "c", "c"]) table.set_cols_align(["c", "c", "c", "c"])
header = ("#", "Name", "Email", "Jellyfin") header = ("#", "Name", "Email", "Jellyfin")
table.add_row(header) table.add_row(header)
print(all)
for index, peoples in enumerate(all): for index, peoples in enumerate(all):
index = index + 1 index = index + 1
id = int(peoples[1]) id = int(peoples[1])

9
run.py
View File

@@ -13,8 +13,6 @@ import app.bot.helper.jellyfinhelper as jelly
from app.bot.helper.message import * from app.bot.helper.message import *
maxroles = 10 maxroles = 10
print(f"Discord Bot Token: {Discord_bot_token}")
if switch == 0: if switch == 0:
print("Missing Config.") print("Missing Config.")
sys.exit() sys.exit()
@@ -23,13 +21,13 @@ print(f"V {MEMBARR_VERSION}")
class Bot(commands.Bot): class Bot(commands.Bot):
def __init__(self) -> None: def __init__(self) -> None:
print("bot init") print("Initializing Discord bot")
intents = discord.Intents.default() intents = discord.Intents.default()
intents.members = True intents.members = True
super().__init__(command_prefix=".", intents=intents) super().__init__(command_prefix=".", intents=intents)
async def on_ready(self): async def on_ready(self):
print("bot is online.") print("Bot is online.")
for guild in self.guilds: for guild in self.guilds:
print("Syncing commands to " + guild.name) print("Syncing commands to " + guild.name)
self.tree.copy_global_to(guild=guild) self.tree.copy_global_to(guild=guild)
@@ -127,9 +125,7 @@ async def jellyroleadd(interaction: discord.Interaction, role: discord.Role):
return return
jellyfin_roles.append(role.name) jellyfin_roles.append(role.name)
print (f"new jellyfin roles: {jellyfin_roles}")
saveroles = ",".join(jellyfin_roles) saveroles = ",".join(jellyfin_roles)
print (f"saveroles: {saveroles}")
confighelper.change_config("jellyfin_roles", saveroles) confighelper.change_config("jellyfin_roles", saveroles)
await interaction.response.send_message("Updated Jellyfin roles. Bot is restarting. Please wait a few seconds.", ephemeral=True) await interaction.response.send_message("Updated Jellyfin roles. Bot is restarting. Please wait a few seconds.", ephemeral=True)
print("Jellyfin roles updated. Restarting bot.") print("Jellyfin roles updated. Restarting bot.")
@@ -280,5 +276,4 @@ async def disablejellyfin(interaction: discord.Interaction):
bot.tree.add_command(plex_commands) bot.tree.add_command(plex_commands)
bot.tree.add_command(jellyfin_commands) bot.tree.add_command(jellyfin_commands)
print("running bot")
bot.run(Discord_bot_token) bot.run(Discord_bot_token)