Skip to content

Commit

Permalink
👗More renaming to IrenesBot
Browse files Browse the repository at this point in the history
  • Loading branch information
Aluerie committed Mar 10, 2025
1 parent 6080b8a commit 43c916c
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 77 deletions.
4 changes: 2 additions & 2 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import aiohttp
import click

from bot import LueBot, setup_logging
from bot import IreBot, setup_logging
from utils.database import create_pool

try:
Expand All @@ -33,7 +33,7 @@ async def start_the_bot() -> None:
async with (
aiohttp.ClientSession() as session,
pool as pool,
LueBot(session=session, pool=pool) as luebot,
IreBot(session=session, pool=pool) as luebot,
):
await luebot.start()

Expand Down
6 changes: 3 additions & 3 deletions bot/bases/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if TYPE_CHECKING:
import twitchio

from ..bot import LueBot
from ..bot import IreBot


__all__ = ("LueComponent",)
Expand All @@ -22,8 +22,8 @@
class LueComponent(commands.Component):
"""Base component to use with LueBot."""

def __init__(self, bot: LueBot) -> None:
self.bot: LueBot = bot
def __init__(self, bot: IreBot) -> None:
self.bot: IreBot = bot

@property
def aluerie(self) -> twitchio.PartialUser:
Expand Down
4 changes: 2 additions & 2 deletions bot/bases/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
if TYPE_CHECKING:
import datetime

from ..bot import LueBot
from ..bot import IreBot

class HasBotAttribute(Protocol):
bot: LueBot
bot: IreBot


log = logging.getLogger(__name__)
Expand Down
13 changes: 5 additions & 8 deletions bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,25 @@ class LoadTokensQueryRow(TypedDict):
refresh: str


__all__ = ("LueBot",)
__all__ = ("IreBot",)

log = logging.getLogger(__name__)


class LueBot(commands.Bot):
"""Main class for AlueBot.
class IreBot(commands.Bot):
"""Main class for IreBot.
Essentially subclass over TwitchIO's Client.
Used to interact with the Twitch API, EventSub and more.
Includes TwitchIO's `ext.commands` extension to organize components/commands framework.
Note on the name
----
This class is named "LueBot" and not "AlueBot" just so when coding I don't confuse myself
with a quick glance value (my personal discord bot is named "AluBot").
The name `AlueBot` is used mainly for display purposes here:
The name `IrenesBot` is used mainly for display purposes here:
* the bot's twitch account user name (just so it's clear that it's Aluerie's bot);
* the bot's Steam account's display name;
Name `LueBot` is pretty much used elsewhere:
Name `IreBot` is pretty much used elsewhere:
* the GitHub repository name and `README.md` file.
* class name;
* folder name;
Expand Down
6 changes: 3 additions & 3 deletions bot/exc_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import discord

from .bot import LueBot
from .bot import IreBot


log = logging.getLogger("exc_manager")
Expand All @@ -29,8 +29,8 @@ class ExceptionManager:
"errors_cache",
)

def __init__(self, bot: LueBot, *, cooldown: datetime.timedelta = datetime.timedelta(seconds=5)) -> None:
self.bot: LueBot = bot
def __init__(self, bot: IreBot, *, cooldown: datetime.timedelta = datetime.timedelta(seconds=5)) -> None:
self.bot: IreBot = bot
self.cooldown: datetime.timedelta = cooldown

self._lock: asyncio.Lock = asyncio.Lock()
Expand Down
4 changes: 2 additions & 2 deletions examples/beta/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from utils import const

if TYPE_CHECKING:
from bot import LueBot
from bot import IreBot


class BetaCog(LueComponent):
Expand All @@ -23,7 +23,7 @@ class BetaCog(LueComponent):
Used to test random code snippets.
"""

def __init__(self, bot: LueBot) -> None:
def __init__(self, bot: IreBot) -> None:
super().__init__(bot)
self.beta_test.start()

Expand Down
2 changes: 1 addition & 1 deletion examples/beta/beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ async def beta(self, ctx: commands.Context) -> None:
pass


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
if __name__ in bot.extensions:
await bot.add_component(BetaTest(bot))
4 changes: 2 additions & 2 deletions examples/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from bot import LueComponent

if TYPE_CHECKING:
from bot import LueBot
from bot import IreBot


class NewCog(LueComponent):
Expand All @@ -19,6 +19,6 @@ async def new_command(self, ctx: commands.Context) -> None:
await ctx.send("Not implemented yet!")


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(NewCog(bot))
6 changes: 3 additions & 3 deletions ext/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if TYPE_CHECKING:
import twitchio

from bot import LueBot
from bot import IreBot

log = logging.getLogger(__name__)

Expand All @@ -23,7 +23,7 @@ class Alerts(LueComponent):
Mostly, EventSub events that are nice to have a notification in twitch chat for.
"""

def __init__(self, bot: LueBot) -> None:
def __init__(self, bot: IreBot) -> None:
super().__init__(bot)
self.ban_list: set[str] = set()

Expand Down Expand Up @@ -169,6 +169,6 @@ async def subscription(self, subscribe: twitchio.ChannelSubscribe) -> None:
)


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(Alerts(bot))
6 changes: 3 additions & 3 deletions ext/counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
if TYPE_CHECKING:
import twitchio

from bot import LueBot
from bot import IreBot

class FirstRedeemsRow(TypedDict):
"""`first_redeems` Table Columns."""
Expand All @@ -30,7 +30,7 @@ class FirstRedeemsRow(TypedDict):
class Counters(LueComponent):
"""Track some silly number counters of how many times this or that happened."""

def __init__(self, bot: LueBot) -> None:
def __init__(self, bot: IreBot) -> None:
super().__init__(bot)
self.last_erm_notification: datetime.datetime = datetime.datetime.now(datetime.UTC)

Expand Down Expand Up @@ -203,6 +203,6 @@ async def check_first_reward(self) -> None:
await self.bot.error_webhook.send(content=content, embed=embed)


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(Counters(bot))
6 changes: 3 additions & 3 deletions ext/custom_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from utils import const, errors

if TYPE_CHECKING:
from bot import LueBot
from bot import IreBot

class TwitchCommands(TypedDict):
"""`chat_commands` Table Structure."""
Expand All @@ -27,7 +27,7 @@ class CustomCommands(LueComponent):
The information is contained within the database and cache.
"""

def __init__(self, bot: LueBot) -> None:
def __init__(self, bot: IreBot) -> None:
super().__init__(bot)
self.command_cache: dict[str, dict[str, str]] = {}

Expand Down Expand Up @@ -144,6 +144,6 @@ async def cmd_list(self, ctx: commands.Context) -> None:
await ctx.send(", ".join(cache_list))


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(CustomCommands(bot))
4 changes: 2 additions & 2 deletions ext/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from utils import const, guards

if TYPE_CHECKING:
from bot import LueBot
from bot import IreBot

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -99,6 +99,6 @@ async def offline(self, ctx: commands.Context) -> None:
await ctx.send(f"I'll treat {ctx.broadcaster.display_name} as offline now {const.STV.donkSad}")


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(Development(bot))
4 changes: 2 additions & 2 deletions ext/dota/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from .commands import DotaCommands

if TYPE_CHECKING:
from bot import LueBot
from bot import IreBot


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(DotaCommands(bot))
4 changes: 2 additions & 2 deletions ext/dota/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .models import Streamer

if TYPE_CHECKING:
from bot import LueBot
from bot import IreBot

from .enums import RPStatus
from .models import ActiveMatch
Expand All @@ -34,7 +34,7 @@ class DotaCommands(LueComponent):
This functionality is supposed to be an analogy to 9kmmrbot/dotabod features.
"""

def __init__(self, bot: LueBot) -> None:
def __init__(self, bot: IreBot) -> None:
super().__init__(bot)
self.streamer: Streamer = Streamer(self.bot, config.IRENE_STEAM_ID64)
self.debug_mode: bool = True
Expand Down
21 changes: 11 additions & 10 deletions ext/dota/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
if TYPE_CHECKING:
from steam.ext.dota2 import MatchHistoryMatch, MatchMinimal

from bot import LueBot
from bot import IreBot

type ActiveMatch = PlayMatch | WatchMatch

Expand Down Expand Up @@ -51,8 +51,8 @@ class FixMatchHistoryQuery1Row(TypedDict):


class Streamer:
def __init__(self, bot: LueBot, steam_id64: int) -> None:
self.bot: LueBot = bot
def __init__(self, bot: IreBot, steam_id64: int) -> None:
self.bot: IreBot = bot

self.steam_id64: int = steam_id64
self.account_id: int = ID(steam_id64).id
Expand Down Expand Up @@ -182,7 +182,8 @@ async def update(self) -> None:
self.reset("Unknown to the bot Steam Status.")

async def add_completed_match_to_database(
self, history_match: MatchHistoryMatch,
self,
history_match: MatchHistoryMatch,
) -> tuple[MatchMinimal, PlayerMatchOutcome]:
partial_match = self.bot.dota.instantiate_partial_match(history_match.id)
minimal_match = await partial_match.minimal()
Expand Down Expand Up @@ -387,8 +388,8 @@ def last_game_command_response(self) -> str:


class Player:
def __init__(self, bot: LueBot, account_id: int, hero_id: int, player_slot: int) -> None:
self.bot: LueBot = bot
def __init__(self, bot: IreBot, account_id: int, hero_id: int, player_slot: int) -> None:
self.bot: IreBot = bot
self.account_id: int = account_id
self.hero: Hero = Hero.try_value(hero_id)
self.player_slot: int = player_slot
Expand Down Expand Up @@ -438,12 +439,12 @@ class Match(abc.ABC):

def __init__(
self,
bot: LueBot,
bot: IreBot,
is_watch: bool,
*,
unsupported_error: str = "",
) -> None:
self.bot: LueBot = bot
self.bot: IreBot = bot
self.is_watch: bool = is_watch

self.match_id: int | None = None
Expand Down Expand Up @@ -569,7 +570,7 @@ class PlayMatch(Match):

def __init__(
self,
bot: LueBot,
bot: IreBot,
watchable_game_id: str,
account_id: int,
) -> None:
Expand Down Expand Up @@ -695,7 +696,7 @@ class WatchMatch(Match):
* have valid `server_steam_id` in Rich Presence
"""

def __init__(self, bot: LueBot, watching_server: str) -> None:
def __init__(self, bot: IreBot, watching_server: str) -> None:
super().__init__(bot, True)
self.watching_server: str = watching_server
self.server_steam_id: int = convert_id3_to_id64(watching_server)
Expand Down
6 changes: 3 additions & 3 deletions ext/emotes_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if TYPE_CHECKING:
from enum import StrEnum

from bot import LueBot
from bot import IreBot


class EmoteChecker(LueComponent):
Expand All @@ -21,7 +21,7 @@ class EmoteChecker(LueComponent):
Bot will notify me that emote was used so I can make adjustments.
"""

def __init__(self, bot: LueBot) -> None:
def __init__(self, bot: IreBot) -> None:
super().__init__(bot)

@override
Expand Down Expand Up @@ -76,6 +76,6 @@ async def check_emotes(self) -> None:
await self.cross_check_emotes(bttv_emote_list, const.BTTV, 0xD50014)


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(EmoteChecker(bot))
6 changes: 3 additions & 3 deletions ext/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if TYPE_CHECKING:
import twitchio

from bot import LueBot
from bot import IreBot

class KeywordDict(TypedDict):
"""Schema for `self.keywords` elements."""
Expand All @@ -29,7 +29,7 @@ class Keywords(LueComponent):
Mostly used to make a small feeling of a crowd - something like many users are Pog-ing.
"""

def __init__(self, bot: LueBot) -> None:
def __init__(self, bot: IreBot) -> None:
super().__init__(bot)
self.keywords: list[KeywordDict] = [
{
Expand Down Expand Up @@ -62,6 +62,6 @@ async def keywords_response(self, message: twitchio.ChatMessage) -> None:
keyword["dt"] = now


async def setup(bot: LueBot) -> None:
async def setup(bot: IreBot) -> None:
"""Load LueBot extension. Framework of twitchio."""
await bot.add_component(Keywords(bot))
Loading

0 comments on commit 43c916c

Please sign in to comment.