wi1-bot 2.0.2__py3-none-any.whl → 2.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wi1_bot/discord/bot.py CHANGED
@@ -1,7 +1,6 @@
1
1
  import asyncio
2
2
  import logging
3
3
  import traceback
4
- from typing import Any
5
4
 
6
5
  import discord
7
6
  from discord.ext import commands
@@ -21,12 +20,14 @@ sonarr = Sonarr(config["sonarr"]["url"], config["sonarr"]["api_key"])
21
20
 
22
21
 
23
22
  @bot.check
24
- async def check_channel(ctx: commands.Context[Any]) -> bool:
23
+ async def check_channel(ctx: commands.Context[commands.Bot]) -> bool:
25
24
  return ctx.channel.id == config["discord"]["channel_id"]
26
25
 
27
26
 
28
27
  @bot.event
29
- async def on_command_error(ctx: commands.Context[Any], error: commands.CommandError) -> None:
28
+ async def on_command_error(
29
+ ctx: commands.Context[commands.Bot], error: commands.CommandError
30
+ ) -> None:
30
31
  match error:
31
32
  case commands.CommandNotFound() | commands.CheckFailure():
32
33
  pass
@@ -63,13 +64,13 @@ async def on_ready() -> None:
63
64
 
64
65
 
65
66
  @bot.before_invoke
66
- async def before_invoke(ctx: commands.Context[Any]) -> None:
67
+ async def before_invoke(ctx: commands.Context[commands.Bot]) -> None:
67
68
  logger.info(f"got command from {ctx.message.author}: {ctx.message.content}")
68
69
 
69
70
 
70
71
  @bot.command(name="downloads", aliases=["queue", "q"], help="see the status of movie downloads")
71
72
  @commands.cooldown(1, 10)
72
- async def downloads_cmd(ctx: commands.Context[Any]) -> None:
73
+ async def downloads_cmd(ctx: commands.Context[commands.Bot]) -> None:
73
74
  async with ctx.typing():
74
75
  queue = radarr.get_downloads() + sonarr.get_downloads()
75
76
 
@@ -84,7 +85,7 @@ async def downloads_cmd(ctx: commands.Context[Any]) -> None:
84
85
 
85
86
  @bot.command(name="quota", help="see your used space on the plex")
86
87
  @commands.cooldown(1, 60, commands.BucketType.user)
87
- async def quota_cmd(ctx: commands.Context[Any]) -> None:
88
+ async def quota_cmd(ctx: commands.Context[commands.Bot]) -> None:
88
89
  async with ctx.typing():
89
90
  used = (
90
91
  radarr.get_quota_amount(ctx.message.author.id)
@@ -98,17 +99,14 @@ async def quota_cmd(ctx: commands.Context[Any]) -> None:
98
99
 
99
100
  pct = used / maximum * 100 if maximum != 0 else 100
100
101
 
101
- msg = (
102
- f"you have added {used:.2f}/{maximum:.2f} GB ({pct:.1f}%) of useless crap"
103
- " to the plex"
104
- )
102
+ msg = f"you have added {used:.2f}/{maximum:.2f} GB ({pct:.1f}%) of useless crap to the plex"
105
103
 
106
104
  await reply(ctx.message, msg)
107
105
 
108
106
 
109
107
  @bot.command(name="quotas", help="see everyone's used space on the plex")
110
108
  @commands.cooldown(1, 60)
111
- async def quotas_cmd(ctx: commands.Context[Any]) -> None:
109
+ async def quotas_cmd(ctx: commands.Context[commands.Bot]) -> None:
112
110
  if "quotas" not in config["discord"]:
113
111
  await reply(ctx.message, "quotas are not implemented here")
114
112
  return
@@ -139,7 +137,7 @@ async def quotas_cmd(ctx: commands.Context[Any]) -> None:
139
137
 
140
138
  @bot.command(name="addtag", help="add a user tag")
141
139
  @commands.has_role("plex-admin")
142
- async def addtag_cmd(ctx: commands.Context[Any], name: str, user: discord.Member) -> None:
140
+ async def addtag_cmd(ctx: commands.Context[commands.Bot], name: str, user: discord.Member) -> None:
143
141
  tag = f"{name}: {user.id}"
144
142
 
145
143
  radarr.create_tag(tag)
@@ -1,6 +1,5 @@
1
1
  import asyncio
2
2
  import logging
3
- from typing import Any
4
3
 
5
4
  from discord.ext import commands
6
5
 
@@ -18,7 +17,7 @@ class MovieCog(commands.Cog):
18
17
  self.radarr = Radarr(config["radarr"]["url"], config["radarr"]["api_key"])
19
18
 
20
19
  @commands.command(name="addmovie", help="add a movie to the plex")
21
- async def addmovie_cmd(self, ctx: commands.Context[Any], *, query: str = "") -> None:
20
+ async def addmovie_cmd(self, ctx: commands.Context[commands.Bot], *, query: str = "") -> None:
22
21
  if not query:
23
22
  await reply(ctx.message, "usage: !addmovie KEYWORDS...")
24
23
  return
@@ -71,7 +70,7 @@ class MovieCog(commands.Cog):
71
70
  await ctx.send(f"hey <@!{config['discord']['admin_id']}> get this guy a tag")
72
71
 
73
72
  @commands.command(name="delmovie", help="delete a movie from the plex")
74
- async def delmovie_cmd(self, ctx: commands.Context[Any], *, query: str = "") -> None:
73
+ async def delmovie_cmd(self, ctx: commands.Context[commands.Bot], *, query: str = "") -> None:
75
74
  if not query:
76
75
  await reply(ctx.message, "usage: !delmovie KEYWORDS...")
77
76
  return
@@ -1,6 +1,5 @@
1
1
  import asyncio
2
2
  import logging
3
- from typing import Any
4
3
 
5
4
  from discord.ext import commands
6
5
 
@@ -19,7 +18,7 @@ class SeriesCog(commands.Cog):
19
18
 
20
19
  @commands.command(name="addshow", help="add a show to the plex")
21
20
  @commands.has_any_role("plex-admin", "plex-shows")
22
- async def addshow_cmd(self, ctx: commands.Context[Any], *, query: str = "") -> None:
21
+ async def addshow_cmd(self, ctx: commands.Context[commands.Bot], *, query: str = "") -> None:
23
22
  if not query:
24
23
  await reply(ctx.message, "usage: !addshow KEYWORDS...")
25
24
  return
@@ -91,7 +90,9 @@ class SeriesCog(commands.Cog):
91
90
 
92
91
  @commands.command(name="delshow", help="delete a show from the plex")
93
92
  @commands.has_any_role("plex-admin", "plex-shows")
94
- async def delshow_command(self, ctx: commands.Context[Any], *, query: str = "") -> None:
93
+ async def delshow_command(
94
+ self, ctx: commands.Context[commands.Bot], *, query: str = ""
95
+ ) -> None:
95
96
  if not query:
96
97
  await reply(ctx.message, "usage: !delshow KEYWORDS...")
97
98
  return
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from typing import Any, cast
2
3
 
3
4
  from mongoengine import Document, connect
@@ -23,7 +24,7 @@ class TranscodeItem(Document):
23
24
 
24
25
  class TranscodeQueue:
25
26
  def __init__(self) -> None:
26
- connect("wi1_bot", connect=False)
27
+ connect("wi1_bot", connect=True, host=os.environ.get("MONGODB_CONNECTION_STRING", None))
27
28
 
28
29
  def add(
29
30
  self,
wi1_bot/webhook.py CHANGED
@@ -103,6 +103,11 @@ def index() -> Any:
103
103
  return "", 200
104
104
 
105
105
 
106
+ @app.route("/health", methods=["GET"])
107
+ def health() -> Any:
108
+ return "OK", 200
109
+
110
+
106
111
  def start() -> None:
107
112
  logger.info("starting webhook listener")
108
113
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wi1-bot
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: Discord bot for Radarr/Sonarr integration
5
5
  Project-URL: Homepage, https://github.com/wthueb/wi1-bot
6
6
  Author-email: William Huebner <wilhueb@gmail.com>
@@ -1,7 +1,7 @@
1
1
  wi1_bot/__init__.py,sha256=dYlvBffClqwInBRSxSAoJHuujuh4yuPderFR4n7Odko,161
2
2
  wi1_bot/config.py,sha256=ndL3BxiOpXiDQGYNEIPtuusekS25miPFQrEphINxnsQ,2226
3
3
  wi1_bot/push.py,sha256=6EwQ1eXcJnQimAi0dOm1_t7Am056zob-1-EOkytGZWg,783
4
- wi1_bot/webhook.py,sha256=xTN_-Ivdt1ANJFWkhF4W8csyqwfBNH33d-eWbsWOPS4,3482
4
+ wi1_bot/webhook.py,sha256=VtTInHBmmLHtCCXViQylyY0LuxXVdb34dmsBkipXZ-k,3565
5
5
  wi1_bot/arr/__init__.py,sha256=-6UE81yY6OhD6-nbLindChE_HlwsNRuL8JijUmo_Q6k,149
6
6
  wi1_bot/arr/download.py,sha256=02AYFglnFdWSG8xj_TaJc6l2wjybyhUW6F97CnoyUFw,1381
7
7
  wi1_bot/arr/episode.py,sha256=0K_auUYwkBBd_Ludc4-4z7lSW8HRQ3mchFQ7FR10JSU,1041
@@ -10,21 +10,21 @@ wi1_bot/arr/radarr.py,sha256=jxgNuCZY7aGMWK3nTLt8KLntiYcLaAF7g9dJoThsCvc,5721
10
10
  wi1_bot/arr/sonarr.py,sha256=OouuorRHBMFAOy5oDeJZ5H6WZ-95-N01EHtpOTVMTCo,5970
11
11
  wi1_bot/arr/util.py,sha256=y4_Dotm-pSJJT8xvPWy7ZoGMGVI-YOU4zK2LNTSoTB0,1025
12
12
  wi1_bot/discord/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- wi1_bot/discord/bot.py,sha256=VEoe7ST9X7PYnFL5yj1x9hodeAYLMGcjWlPkZSE-ujI,4924
13
+ wi1_bot/discord/bot.py,sha256=qLM0GK4oaBzui_OBTA3X3XcC55gbng3qjU7GFz3Y6xo,4931
14
14
  wi1_bot/discord/helpers.py,sha256=7Qr5Kr8H2CQoLiGG7Oqh388jqUCMJH0EBvF8fC-IbJo,2300
15
15
  wi1_bot/discord/cogs/__init__.py,sha256=9nA47jEyuGG7s1UJYz5SJASJcs0Xa3M1rNz9BiyCico,95
16
- wi1_bot/discord/cogs/movie.py,sha256=Gr8xbsdNDlKkOb7boiTE5n3YHz7FR0ajSRANV8EM3XY,3950
17
- wi1_bot/discord/cogs/series.py,sha256=bPA3LtuK78qkYvyN38ZdNQ_6I3j4qVN9L5JHV8KX_GA,4597
16
+ wi1_bot/discord/cogs/movie.py,sha256=YCDEjswEI35P1dBuuCDGikgR6yPagIIZkx50MzTbRFU,3945
17
+ wi1_bot/discord/cogs/series.py,sha256=k0fiC9cluSiedlRkpNdzIuBo59ZmfvbNWPqViS5PCL8,4606
18
18
  wi1_bot/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  wi1_bot/scripts/add_tag.py,sha256=mWwo8egk2Y5XRiQCpfkA11-3rcxZoD0JOJKxV0LguLk,586
20
20
  wi1_bot/scripts/rescan.py,sha256=97oGK1Gr3jBjfX-Eil4C0hDIwtpZ34E_rwTYCI8Z7r4,1474
21
21
  wi1_bot/scripts/start.py,sha256=TfEKCxS_95L5ZTi8OY45ywsgNnKlsqLDN6YesowifvM,2527
22
22
  wi1_bot/scripts/transcode_item.py,sha256=21MeeIZ9wIRhAY-FOEgOdPsg6YOLlSUj59r8NkTfixw,1155
23
23
  wi1_bot/transcoder/__init__.py,sha256=B4xr82UtIFc3tyy_MEZdZKMukYW0yejPnfsGowaTIM0,105
24
- wi1_bot/transcoder/transcode_queue.py,sha256=W7r2I7OD8QuxseCEb7_ddOvYXiBBLmKLvCs2IgJJ92I,1856
24
+ wi1_bot/transcoder/transcode_queue.py,sha256=ixENVEfHeXqKFHIJaNHFZ_i5ctqnSQgqDwimi4rec_Y,1921
25
25
  wi1_bot/transcoder/transcoder.py,sha256=bU2oKQckBWWppJOH9W8vk_ql2uz3qs8O63wAYKH1bbk,9978
26
- wi1_bot-2.0.2.dist-info/METADATA,sha256=Oy614tRy_DoW7yAi7dKmIFtMFXP714GZ1iYm_Vr-P6U,3699
27
- wi1_bot-2.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
- wi1_bot-2.0.2.dist-info/entry_points.txt,sha256=pF5EawAQsUNMHs5exynpNdRq9g4dODg-RaPkx2MyYLU,184
29
- wi1_bot-2.0.2.dist-info/licenses/LICENSE,sha256=6V4_mQoPoLJl77_WMsQRQMDG2mnIhDUdfCmMkqM9Qwc,1072
30
- wi1_bot-2.0.2.dist-info/RECORD,,
26
+ wi1_bot-2.0.4.dist-info/METADATA,sha256=glPVd0NDc2IpVRC3IP3X1aAZMRFYOkOYSt3U7Vy9DCk,3699
27
+ wi1_bot-2.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
+ wi1_bot-2.0.4.dist-info/entry_points.txt,sha256=pF5EawAQsUNMHs5exynpNdRq9g4dODg-RaPkx2MyYLU,184
29
+ wi1_bot-2.0.4.dist-info/licenses/LICENSE,sha256=6V4_mQoPoLJl77_WMsQRQMDG2mnIhDUdfCmMkqM9Qwc,1072
30
+ wi1_bot-2.0.4.dist-info/RECORD,,