|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from typing import TYPE_CHECKING |
| 4 | + |
| 5 | +from twitchio.ext import commands |
| 6 | + |
| 7 | +from bot import LueComponent |
| 8 | +from utils import const |
| 9 | + |
| 10 | +if TYPE_CHECKING: |
| 11 | + from bot import LueBot |
| 12 | + |
| 13 | + |
| 14 | +class MiscellaneousCommands(LueComponent): |
| 15 | + """Miscellaneous commands. |
| 16 | +
|
| 17 | + Commands that are likely to be removed in future. |
| 18 | + """ |
| 19 | + |
| 20 | + @commands.command() |
| 21 | + async def erdoc(self, ctx: commands.Context) -> None: |
| 22 | + """Link to my Elden Ring notes.""" |
| 23 | + await ctx.send( # cspell: disable-next-line |
| 24 | + "My notes with everything Elden Ring related: " |
| 25 | + "docs.google.com/document/d/19vTJVS7k1zdmShOAcO41KBWepfybMsTprQ208O7HpLU" |
| 26 | + ) |
| 27 | + |
| 28 | + @commands.command() |
| 29 | + async def run(self, ctx: commands.Context) -> None: |
| 30 | + """Explanation of my first Sekiro hitless run.""" |
| 31 | + msg = ( |
| 32 | + "All Memories & Unique MiniBosses (so no repetitions). " |
| 33 | + "The idea: I have to learn and practice all boss move-sets. " |
| 34 | + "Even load Inner Father, Fire Isshin and Emma save-file. " |
| 35 | + "Almost Charmless (take it back pre-demon). Mostly Sword+Shuriken. Somewhat loop-less. " |
| 36 | + "For more look !notes." |
| 37 | + ) |
| 38 | + await ctx.send(msg) |
| 39 | + |
| 40 | + @commands.command(aliases=["sekironotes", "notes", "skdoc"]) |
| 41 | + async def sekirodoc(self, ctx: commands.Context) -> None: |
| 42 | + """Link to my Sekiro notes.""" |
| 43 | + await ctx.send( # cspell: disable-next-line |
| 44 | + "My notes with everything Sekiro related: " |
| 45 | + "docs.google.com/document/d/1rjp7lhvP0vwwlO7bC7TyFAjKcGDovFuo2EYUaX66QiA" |
| 46 | + ) |
| 47 | + |
| 48 | + @commands.group(invoke_fallback=True) |
| 49 | + async def gunfort(self, ctx: commands.Context) -> None: |
| 50 | + """Commands to count my successful and failed Yolo Gunfort attempts.""" |
| 51 | + query = "SELECT value FROM ttv_counters WHERE name = $1;" |
| 52 | + success: int = await self.bot.pool.fetchval(query, "gunfort_success") |
| 53 | + query = "SELECT value FROM ttv_counters WHERE name = $1;" |
| 54 | + attempts: int = await self.bot.pool.fetchval(query, "gunfort_attempts") |
| 55 | + |
| 56 | + stats = f" Success Rate: {success/attempts:.1%} (over {attempts} attempts)" |
| 57 | + await ctx.send(f"{const.STV.science} Yolo Gunfort {stats}") |
| 58 | + |
| 59 | + @commands.is_owner() |
| 60 | + @gunfort.command() |
| 61 | + async def no(self, ctx: commands.Context) -> None: |
| 62 | + """Count a failed Yolo Gunfort attempt in.""" |
| 63 | + query = "SELECT value FROM ttv_counters WHERE name = $1;" |
| 64 | + success: int = await self.bot.pool.fetchval(query, "gunfort_success") |
| 65 | + query = "UPDATE ttv_counters SET value = value + 1 WHERE name = $1 RETURNING value;" |
| 66 | + attempts: int = await self.bot.pool.fetchval(query, "gunfort_attempts") |
| 67 | + |
| 68 | + stats = f" Success Rate: {success/attempts:.1%} (over {attempts} attempts)" |
| 69 | + await ctx.send(f"Failed yolo gunfort? {const.STV.classic} {stats}") |
| 70 | + |
| 71 | + @commands.is_owner() |
| 72 | + @gunfort.command() |
| 73 | + async def yes(self, ctx: commands.Context) -> None: |
| 74 | + """Count a successful Yolo Gunfort attempt in.""" |
| 75 | + query = "UPDATE ttv_counters SET value = value + 1 WHERE name = $1 RETURNING value;" |
| 76 | + success: int = await self.bot.pool.fetchval(query, "gunfort_success") |
| 77 | + query = "UPDATE ttv_counters SET value = value + 1 WHERE name = $1 RETURNING value;" |
| 78 | + attempts: int = await self.bot.pool.fetchval(query, "gunfort_attempts") |
| 79 | + |
| 80 | + stats = f" Success Rate: {success/attempts:.1%} (over {attempts} attempts)" |
| 81 | + await ctx.send(f"Yolo Gunfort is easy {const.STV.EZdodge} {stats}") |
| 82 | + |
| 83 | + |
| 84 | +async def setup(bot: LueBot) -> None: |
| 85 | + """Load LueBot extension. Framework of twitchio.""" |
| 86 | + await bot.add_component(MiscellaneousCommands(bot)) |
0 commit comments