From d06defd8d7561d90ecbf7cfb4d5e4778a348e98e Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 26 Dec 2022 03:23:14 -0500 Subject: chore: replace flake8 with pylint, refactor, add pre-commit --- src/moyaiBot/__init__.py | 8 -------- src/moyaiBot/lib.py | 20 -------------------- src/moyaiBot/moyaiBot.py | 42 ------------------------------------------ src/moyai_bot/__init__.py | 9 +++++++++ src/moyai_bot/bot.py | 43 +++++++++++++++++++++++++++++++++++++++++++ src/moyai_bot/lib.py | 21 +++++++++++++++++++++ 6 files changed, 73 insertions(+), 70 deletions(-) delete mode 100644 src/moyaiBot/__init__.py delete mode 100644 src/moyaiBot/lib.py delete mode 100644 src/moyaiBot/moyaiBot.py create mode 100644 src/moyai_bot/__init__.py create mode 100644 src/moyai_bot/bot.py create mode 100644 src/moyai_bot/lib.py (limited to 'src') diff --git a/src/moyaiBot/__init__.py b/src/moyaiBot/__init__.py deleted file mode 100644 index dad1ed9..0000000 --- a/src/moyaiBot/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -import os -from .moyaiBot import moyai - -TOKEN = os.getenv("TOKEN") - - -def main(): - moyai.run(TOKEN) diff --git a/src/moyaiBot/lib.py b/src/moyaiBot/lib.py deleted file mode 100644 index 899a906..0000000 --- a/src/moyaiBot/lib.py +++ /dev/null @@ -1,20 +0,0 @@ -import discord -import random - - -def get_random_response(moyai): - 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) diff --git a/src/moyaiBot/moyaiBot.py b/src/moyaiBot/moyaiBot.py deleted file mode 100644 index f09700a..0000000 --- a/src/moyaiBot/moyaiBot.py +++ /dev/null @@ -1,42 +0,0 @@ -import discord -from discord.ext import commands -from moyaiBot.lib import get_random_response - -intents = discord.Intents.default() -intents.message_content = True -moyai = commands.Bot(command_prefix="m!", description="moyai", intents=intents) - - -@moyai.event -async def on_ready(): - print(f"logged in as {moyai.user}") - - -@moyai.event -async def on_message(message): - if message.author == moyai.user: - return - - echo_messages = [ - "moyai", str(discord.utils.get(moyai.emojis, name="moyai")) - ] - try: - index = echo_messages.index(message.content.lower()) - await message.channel.send(echo_messages[index]) - except ValueError: - pass - - await moyai.process_commands(message) - - -@moyai.command() -async def ask(ctx): - await ctx.send(get_random_response(moyai)) - - -@moyai.command() -async def moyaispam(ctx): - msg = str() - for i in range(30): - msg += str(discord.utils.get(moyai.emojis, name="moyai")) - await ctx.send(msg) diff --git a/src/moyai_bot/__init__.py b/src/moyai_bot/__init__.py new file mode 100644 index 0000000..0820f2a --- /dev/null +++ b/src/moyai_bot/__init__.py @@ -0,0 +1,9 @@ +import os + +from .bot import moyai + +TOKEN = os.getenv("TOKEN") + + +def main(): + moyai.run(TOKEN) diff --git a/src/moyai_bot/bot.py b/src/moyai_bot/bot.py new file mode 100644 index 0000000..8a152a8 --- /dev/null +++ b/src/moyai_bot/bot.py @@ -0,0 +1,43 @@ +import discord +from discord.ext import commands + +from moyai_bot.lib import get_random_response + +intents = discord.Intents.default() +intents.message_content = True # pylint: disable=assigning-non-slot +moyai = commands.Bot(command_prefix="m!", description="moyai", intents=intents) + + +@moyai.event +async def on_ready(): + print(f"logged in as {moyai.user}") + + +@moyai.event +async def on_message(message): + if message.author == moyai.user: + return + + echo_messages = [ + "moyai", str(discord.utils.get(moyai.emojis, name="moyai")) + ] + try: + index = echo_messages.index(message.content.lower()) + await message.channel.send(echo_messages[index]) + except ValueError: + pass + + await moyai.process_commands(message) + + +@moyai.command() +async def ask(ctx): + await ctx.send(get_random_response(moyai)) + + +@moyai.command() +async def moyaispam(ctx): + msg = str() + for _ in range(30): + msg += str(discord.utils.get(moyai.emojis, name="moyai")) + await ctx.send(msg) diff --git a/src/moyai_bot/lib.py b/src/moyai_bot/lib.py new file mode 100644 index 0000000..c7ec164 --- /dev/null +++ b/src/moyai_bot/lib.py @@ -0,0 +1,21 @@ +import random + +import discord + + +def get_random_response(moyai): + 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) -- cgit v1.2.3