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

Commit 97ec5b7

Browse files
authored
Merge pull request #11 from DirectiveAthena/v0.5.0_Proposal
V0.5.0 proposal
2 parents 9eb52aa + 0b7327b commit 97ec5b7

File tree

5 files changed

+151
-6
lines changed

5 files changed

+151
-6
lines changed

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# - AthenaTwitchBot -
2+
[![pypi](https://img.shields.io/pypi/v/AthenaTwitchBot)](https://pypi.org/project/AthenaTwitchBot/) [![GitHub license](https://img.shields.io/github/license/DirectiveAthena/AthenaTwitchBot)](https://github.com/DirectiveAthena/VerSC-AthenaColor/blob/master/LICENSE) [![Discord](https://img.shields.io/discord/814599159926620160?color=maroon)](https://discord.gg/6JcDbhXkCH) [![Downloads](https://pepy.tech/badge/athenatwitchbot)](https://pepy.tech/project/athenatwitchbot)
3+
4+
---
5+
## Package Details
6+
#### Details and features
7+
- A library to connect to the Twitch IRC system for a chatbot to utilize
8+
- Isn't dependent on 3rd party packages, except for those that have been created by [@AndreasSas](https://github.com/AndreasSas)
9+
- These can be designated by the leading "*Athena*..."
10+
- These packages aren't seen as a 3rd party dependency as they are all made by the "same party"
11+
12+
#### Python Version
13+
- Supported Python versions: **3.10**
14+
- Other older versions of Python are not currently supported.
15+
- These older versions will probably not be supported by [@AndreasSas](https://github.com/AndreasSas) himself, but if you want to contribute to the project and make this package compatible with older versions of Python, Pull requests are always welcome.
16+
17+
---
18+
## Quick Example
19+
The following example is a working bot, but currently only meant as proof of work as the package is still in its early stages of being developed and needs some heavy tuning.
20+
21+
Stay tuned for updates while we work on this on [stream](https://www.twitch.tv/directiveathena) or come hang out in the [discord](https://discord.com/invite/6JcDbhXkCH).
22+
23+
```python
24+
# --- Imports ---
25+
import AthenaTwitchBot # Main import for the bot to work
26+
import AthenaColor # Not needed for the following example, but is a dependency
27+
import AthenaLib # Not needed for the following example, but is a dependency
28+
29+
# --- Twitch bot ---
30+
class newBot(AthenaTwitchBot.TwitchBot):
31+
def __init__(self):
32+
super(newBot, self).__init__(
33+
# Make sure you fill in the fields below
34+
# else the bot will not be able to be authenticated by Twitch
35+
nickname="...", # <--- The registered bot name
36+
oauth_token="...", # <--- the registered bots access token. Don't put this in plain text!
37+
channel="...", # <--- The twitch channel name you want to bind your bot to
38+
prefix="!", # <--- The "default" prefix is an exclamation point, but technically you can assign any string as a prefix
39+
)
40+
41+
# - Command -
42+
# A command is only ran when it is invoked by a user in chat
43+
# In the following case this would be by typing "!ping" in chat
44+
@AthenaTwitchBot.command_method(name="ping")
45+
def command_ping(self, context: AthenaTwitchBot.TwitchMessageContext):
46+
context.reply("pong!") # a "context.reply" function will reply to the user whi invoked the command
47+
48+
# - Task -
49+
# A task is run automatically every "delay" amount of seconds
50+
# In the following case, the method will be run every minute
51+
# The "before" kwarg will
52+
@AthenaTwitchBot.scheduled_task_method(delay=60, before=True)
53+
def task_post_github(self, context: AthenaTwitchBot.TwitchMessageContext):
54+
context.write(f"This bot is made possible by: https://github.com/DirectiveAthena/AthenaTwitchBot")
55+
56+
# --- Main function ---
57+
def main():
58+
AthenaTwitchBot.launch(
59+
bot=newBot(),
60+
ssl=True # set to true to enable ssl connection to Twitch
61+
)
62+
63+
if __name__ == '__main__':
64+
main()
65+
66+
```
67+
68+
---
69+
## Documentation
70+
Full documentation can be found at:
71+
**[directiveathena.com/docu](https://publish.obsidian.md/directiveathena/)** (redirect to Obsidian.md publish site)
72+
(Reminder, the documentation is still under heavy development)
73+
74+
---
75+
## Install
76+
To install the package in your Python environment
77+
78+
```
79+
pip install AthenaTwitchBot --upgrade
80+
```
81+
82+
---
83+
84+
## Links
85+
Project files can be found at:
86+
- [GitHub Repo](https://github.com/DirectiveAthena/AthenaTwitchBot)
87+
- [Pypi link](https://pypi.org/project/AthenaTwitchBot/)
88+
89+
---
90+
91+
## Disclaimer
92+
With *No Dependency*, the standard library is not counted as a dependency
93+
94+
---
95+
Made By Andreas Sas,` 2022`

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@
1212
# ----------------------------------------------------------------------------------------------------------------------
1313
# - Code -
1414
# ----------------------------------------------------------------------------------------------------------------------
15+
def readme_handler() -> str:
16+
with open("README.md", "r") as readme_file:
17+
return readme_file.read()
18+
1519
def version_handler() -> str:
16-
version = 0,4,0
20+
# ------------------------------------------------------------------------------------------------------------------
21+
version = 0,5,0 # <-- DEFINE THE VERSION IN A TUPLE FORMAT HERE
22+
# ------------------------------------------------------------------------------------------------------------------
1723
version_str = ".".join(str(i) for i in version)
1824

1925
with open("src/AthenaTwitchBot/_info/_v.py", "w") as file:
20-
file.write(f"def _version():\n return '{version_str}'")
26+
file.write(f"VERSION='{version_str}'")
2127

2228
return version_str
2329

@@ -26,7 +32,9 @@ def version_handler() -> str:
2632
version=version_handler(),
2733
author="Andreas Sas",
2834
author_email="",
29-
description="A Twitch bot Connector",
35+
description="A zero 3rd party dependency Twitch bot Connector",
36+
long_description=readme_handler(),
37+
long_description_content_type="text/markdown",
3038
url="https://github.com/DirectiveAthena/AthenaTwitchBot",
3139
project_urls={
3240
"Bug Tracker": "https://github.com/DirectiveAthena/AthenaTwitchBot/issues",

src/AthenaTwitchBot/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
from AthenaTwitchBot.models.twitch_bot import TwitchBot
88
from AthenaTwitchBot.models.twitch_bot_protocol import TwitchBotProtocol
9+
from AthenaTwitchBot.models.twitch_message_context import TwitchMessageContext
910

10-
# keep this function to be the last to be imported
1111
from AthenaTwitchBot.functions.launch import launch
12+
13+
# noinspection PyProtectedMember
14+
from AthenaTwitchBot._info.info import info # a general info printer

src/AthenaTwitchBot/_info/_v.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
def _version():
2-
return '0.4.0'
1+
VERSION='0.5.0'

src/AthenaTwitchBot/_info/info.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# ----------------------------------------------------------------------------------------------------------------------
2+
# - Package Imports -
3+
# ----------------------------------------------------------------------------------------------------------------------
4+
# General Packages
5+
from __future__ import annotations
6+
7+
# Custom Library
8+
9+
# Custom Packages
10+
# noinspection PyProtectedMember
11+
import AthenaLib._info.formatting as f
12+
from AthenaTwitchBot._info._v import VERSION
13+
14+
# ----------------------------------------------------------------------------------------------------------------------
15+
# - Code -
16+
# ----------------------------------------------------------------------------------------------------------------------
17+
def info(*, to_str: bool = False) -> None | str:
18+
# todo needs a lot of work
19+
line = "-" * 128
20+
header = f.header(f"""{line}
21+
{f.title("AthenaTwitchBot", to_str)} v{VERSION}
22+
is made by Andreas Sas.
23+
{line}
24+
""", to_str)
25+
26+
body = f"""
27+
Package setup:
28+
{f.sub_modules("data", to_str)} : ...
29+
{f.sub_modules("decorators", to_str)} : ...
30+
{f.sub_modules("functions", to_str)} : ...
31+
{f.sub_modules("models", to_str)} : ...
32+
"""
33+
34+
text = f"{header}{body}{line}"
35+
36+
# export to console or string
37+
if to_str:
38+
return text
39+
else:
40+
print(text)

0 commit comments

Comments
 (0)