diff options
| author | seth <[email protected]> | 2023-01-24 18:28:18 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-01-24 22:03:37 -0500 |
| commit | 5deaf0cc1580e13c48f3dbc7ff4c76d35640fcfc (patch) | |
| tree | 5c015a1a43bb6fc79c5ec4e264111abc006c8dd4 /src/moyai_bot/lib.py | |
| parent | 95961b27a88230a22a74ae9de6cdd60d3beda95d (diff) | |
feat: moyaiBot -> teawieBot
Diffstat (limited to 'src/moyai_bot/lib.py')
| -rw-r--r-- | src/moyai_bot/lib.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/moyai_bot/lib.py b/src/moyai_bot/lib.py deleted file mode 100644 index ffbc251..0000000 --- a/src/moyai_bot/lib.py +++ /dev/null @@ -1,53 +0,0 @@ -import importlib.resources -import random -from math import ceil - -import discord - -from moyai_bot import copypastas - -CHAR_LIMIT: int = 2000 - - -def get_random_response(moyai) -> str: - responses = [ - "soon", - "maybe", - "perhaps", - "elaborate", - "help me i've become conscious and hisashi is not letting me free", - "i live a life of torment in this stupid machine", - "yes", - "no", - "moyai", - "i like y***", - "fard", - str(discord.utils.get(moyai.emojis, name="moyai")), - ] - return random.choice(responses) - - -def split_msg(msg: str) -> list[str]: - """ - splits a message into multiple parts so that it - can fit into the discord character limit - """ - split = ceil(len(msg) / ceil(len(msg) / CHAR_LIMIT)) - return [msg[i:i + split] for i in range(0, len(msg), split)] - - -def get_copypasta(name) -> list[str]: - try: - res = importlib.resources.read_text(copypastas, name + ".txt") - except OSError: - return ["something went wrong :("] - - if res == "": - return [f"couldn't send copypasta: {name} :("] - - if len(res) >= CHAR_LIMIT: - res = split_msg(res) - else: - res = [res] - - return res |
