summaryrefslogtreecommitdiff
path: root/src/teawie_bot/utils.py
diff options
context:
space:
mode:
authorseth <[email protected]>2023-01-24 22:02:03 -0500
committerseth <[email protected]>2023-01-24 22:03:37 -0500
commit540bec224ded2d44279d37a1c71a99ca8a4b5fa0 (patch)
treee546f092480dd358c1f1f9e944fbb70687e2557e /src/teawie_bot/utils.py
parent5deaf0cc1580e13c48f3dbc7ff4c76d35640fcfc (diff)
feat: polish up teawie changes
Diffstat (limited to 'src/teawie_bot/utils.py')
-rw-r--r--src/teawie_bot/utils.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/teawie_bot/utils.py b/src/teawie_bot/utils.py
index 99f2a13..c75135b 100644
--- a/src/teawie_bot/utils.py
+++ b/src/teawie_bot/utils.py
@@ -2,52 +2,53 @@ import importlib.resources
import random
from math import ceil
-from discord.ext import commands
import discord
+from discord.ext import commands
from teawie_bot import copypastas
CHAR_LIMIT: int = 2000
+# pylint: disable-next=too-few-public-methods
class Teawies:
"""
- wrapper class around list[discord.Emoji]
- """
+ wrapper class around list[discord.Emoji]
+ """
def __init__(self, bot: commands.Bot):
names = [
"teawiecry", "teawiederp", "teawiedizzy",
"teawienerdcroppedanddownsized", "teawieneutral", "teawiepet",
"teawiepetfast", "teawiepop", "teawiesmile", "teawiesmug",
- "teawiestarstruck", "tei", "wavy", "wie", "wie~1",
- "manythoughtsheadfull"
+ "teawiestarstruck", "tei", "wavy", "wie", "manythoughtsheadfull"
]
- self.emojis: list[str] = []
- for name in names:
- emoji = discord.utils.get(bot.emojis, name=name)
- if emoji:
- self.emojis.append(str(emoji))
+ self.emojis: list[str] = [
+ str(discord.utils.get(bot.emojis, name=name)) for name in names
+ ]
def random(self) -> str:
return random.choice(self.emojis)
-def get_random_response(bot: commands.Bot, teawies: Teawies) -> str:
+def get_random_response(bot: commands.Bot) -> str:
responses = [
- "soon", "maybe", "perhaps", "elaborate",
+ "soon",
+ "maybe",
+ "perhaps",
+ "elaborate",
str(discord.utils.get(bot.emojis, name="moyai")),
]
- responses = responses + teawies.emojis
+ responses = responses + bot.teawies.emojis
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
- """
+ 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)]