Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit ffe8ca1

Browse files
authored
Merge pull request #2 from DirectiveAthena/v0.1.1
Typo fixes
2 parents 33039e4 + 1fb6c8e commit ffe8ca1

File tree

11 files changed

+24
-31
lines changed

11 files changed

+24
-31
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# - Code -
1414
# ----------------------------------------------------------------------------------------------------------------------
1515
def version_handler() -> str:
16-
version = 0,1,0
16+
version = 0,1,1
1717
version_str = ".".join(str(i) for i in version)
1818

1919
with open("src/AthenaTwitchBot/_info/_v.py", "w") as file:

src/AthenaTwitchBot/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# ----------------------------------------------------------------------------------------------------------------------
22
# - Package Imports -
33
# ----------------------------------------------------------------------------------------------------------------------
4-
from AthenaTwitchBot.decorators.command import commandmethod
5-
from AthenaTwitchBot.decorators.frequentoutput import frequentoutputmethod
4+
from AthenaTwitchBot.decorators.command import command_method
5+
from AthenaTwitchBot.decorators.frequentoutput import frequent_output_method
66

77
from AthenaTwitchBot.models.twitch_bot import TwitchBot
88
from AthenaTwitchBot.models.twitch_bot_protocol import TwitchBotProtocol

src/AthenaTwitchBot/_info/_v.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def _version():
2-
return '0.1.0'
2+
return '0.1.1'

src/AthenaTwitchBot/decorators/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# ----------------------------------------------------------------------------------------------------------------------
1212
# - Code -
1313
# ----------------------------------------------------------------------------------------------------------------------
14-
def commandmethod(name:str):
14+
def command_method(name:str):
1515
def decorator(fnc):
1616
def wrapper(*args, **kwargs):
1717
return fnc(*args, **kwargs)

src/AthenaTwitchBot/decorators/frequentoutput.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# ----------------------------------------------------------------------------------------------------------------------
1212
# - Code -
1313
# ----------------------------------------------------------------------------------------------------------------------
14-
def frequentoutputmethod(delay:int=3600): # defult is every hour
14+
def frequent_output_method(delay:int=3600): # default is every hour
1515
"""
1616
Create a method that runs every couple of seconds.
1717
The delay parameter is defined in seconds
@@ -25,7 +25,7 @@ def wrapper(*args, **kwargs):
2525

2626
# store attributes for later use by the bot
2727
# to be used by the protocol to assign it top an async call loop
28-
wrapper.is_frequent_ouput = True
28+
wrapper.is_frequent_output = True # typo caught by NoirPi
2929
wrapper.delay = delay
3030
return wrapper
3131
return decorator

src/AthenaTwitchBot/functions/twitch_irc_messages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# ----------------------------------------------------------------------------------------------------------------------
44
# General Packages
55
from __future__ import annotations
6-
import asyncio
76

87
# Custom Library
98

src/AthenaTwitchBot/functions/twitch_message_constructors.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# General Packages
55
from __future__ import annotations
66
from typing import Callable
7-
from datetime import datetime
8-
import time
97

108
# Custom Library
119
from AthenaColor import StyleNest, ForeNest, HEX
@@ -71,13 +69,13 @@ def twitch_message_constructor_tags(message_bytes:bytearray, bot_name:str) -> Tw
7169
# with tags enabled, we know that the first element of the list above contains all the user's tags
7270
# This enables us to loop them and assign them to the message
7371
# This is done to make them accessible to the command parsing
74-
# The second part of the split message is the user definement. The user id is found in the tags
72+
# The second part of the split message is the user definition. The user id is found in the tags
7573
# IRC message string is found next
76-
# The channel from which it is sent is also recieved.
77-
# When the bot is only installed in one channel, this isn't usefull, but if a bot is used in multiple channels
78-
# this is part of the usefull known context
74+
# The channel from which it is sent is also received.
75+
# When the bot is only installed in one channel, this isn't useful, but if a bot is used in multiple channels
76+
# this is part of the usefully known context
7977
# Finally all text should be clumped together again, to be searched though for a custom command
80-
# This is to be done by the protocol class, not the message constructir
78+
# This is to be done by the protocol class, not the message constructor
8179

8280
tags, user, irc_message, channel, *text = content
8381
twitch_message:TwitchMessage = TwitchMessage(
@@ -95,7 +93,7 @@ def twitch_message_constructor_tags(message_bytes:bytearray, bot_name:str) -> Tw
9593
try:
9694
TAG_MAPPING[tag_name](tm=twitch_message,tag_value=tag_value)
9795
except KeyError:
98-
print(StyleNest.Bold(ForeNest.Maroon(f"Unkown tag of '{tag_name}' found. Please create a bug report on the git repo")))
96+
print(StyleNest.Bold(ForeNest.Maroon(f"Unknown tag of '{tag_name}' found. Please create a bug report on the git repo")))
9997
pass
10098

10199
return twitch_message

src/AthenaTwitchBot/models/twitch_bot.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
# ----------------------------------------------------------------------------------------------------------------------
44
# General Packages
55
from __future__ import annotations
6-
import asyncio
76
from dataclasses import dataclass, field, InitVar
87
from typing import Callable
98
import inspect
109

1110
# Custom Library
12-
import AthenaLib
13-
import AthenaColor
1411

1512
# Custom Packages
1613

@@ -25,9 +22,9 @@ class TwitchBot:
2522
prefix:str
2623

2724
# Twitch-specific capabilities : https://dev.twitch.tv/docs/irc/capabilities
28-
twitch_capibility_commands:bool=False
29-
twitch_capibility_membership:bool=False
30-
twitch_capibility_tags:bool=True # only one that has the default set to true, as this is required to make reply's work
25+
twitch_capability_commands:bool=False
26+
twitch_capability_membership:bool=False
27+
twitch_capability_tags:bool=True # only one that has the default set to true, as this is required to make reply's work
3128

3229
predefined_commands:InitVar[dict[str: Callable]]=None # made part of init if someone wants to feel the pain of adding commands manually
3330

@@ -49,12 +46,12 @@ def __new__(cls, *args, **kwargs):
4946
# Which is to be used in the commands tuple
5047
obj = super(TwitchBot, cls).__new__(cls,*args,**kwargs)
5148

52-
# loop over the bot's metods and parse the different methods
49+
# loop over the bots methods and parse the different methods
5350
for k,v in cls.__dict__.items():
5451
if inspect.isfunction(v):
5552
if "is_command" in (attributes := [attribute for attribute in dir(v) if not attribute.startswith("__")]):
5653
cls.commands[v.command_name] = v
57-
elif "is_frequent_ouput" in attributes:
54+
elif "is_frequent_output" in attributes:
5855
cls.frequent_outputs.append((v,v.delay))
5956

6057
return obj

src/AthenaTwitchBot/models/twitch_bot_protocol.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class TwitchBotProtocol(asyncio.Protocol):
3131
message_constructor:Callable = field(init=False)
3232

3333
def __post_init__(self):
34-
if self.bot.twitch_capibility_tags:
34+
if self.bot.twitch_capability_tags:
3535
self.message_constructor = twitch_message_constructor_tags
3636
else:
3737
raise NotImplementedError("This needs to be created")
3838

3939
# ----------------------------------------------------------------------------------------------------------------------
40-
# - Protocol neseccary -
40+
# - Protocol necessary -
4141
# ----------------------------------------------------------------------------------------------------------------------
4242
def connection_made(self, transport: asyncio.transports.Transport) -> None:
4343
self.transport = transport
@@ -47,7 +47,7 @@ def connection_made(self, transport: asyncio.transports.Transport) -> None:
4747
self.transport.write(messages.join(channel=self.bot.channel))
4848
self.transport.write(messages.request_tags)
4949

50-
# add frequent_ouput methods to the coroutine loop
50+
# add frequent_output methods to the coroutine loop
5151
loop = asyncio.get_running_loop()
5252
for callback, delay in self.bot.frequent_outputs:
5353
coro = loop.create_task(self.frequent_output_call(callback,delay))
@@ -82,7 +82,7 @@ def data_received(self, data: bytearray) -> None:
8282
self.bot.commands[user_cmd](
8383
self=self.bot,
8484
# Assign a context so the user doesn't need to write the transport messages themselves
85-
# A user opnly has to write the text
85+
# A user only has to write the text
8686
context=TwitchMessageContext(
8787
message=twitch_message,
8888
transport=self.transport

src/AthenaTwitchBot/models/twitch_bot_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@dataclass(slots=True,eq=False,order=False,kw_only=True)
1919
class Server:
2020
bot: TwitchBot
21-
socket:socket.socket=None
21+
socket:socket.socket=field(default_factory=socket.socket)
2222

2323
# non init slots
2424
server:asyncio.AbstractServer = field(init=False)

0 commit comments

Comments
 (0)