From 3b32e6b39633b393ad8839c183bc5a8375788e8f Mon Sep 17 00:00:00 2001 From: jsl12 <32917998+jsl12@users.noreply.github.com> Date: Fri, 21 Jan 2022 17:19:11 -0600 Subject: [PATCH] working kwaylon --- Dockerfile | 7 ++----- docker-compose.yml | 1 - kwaylon/jokes/jokes.py | 25 +++++++++++++------------ kwaylon/kwaylon.py | 12 +++++++----- main.py | 16 ++++++++-------- requirements.txt | 12 +++++++----- 6 files changed, 37 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6bfbb3..d89f1bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,10 @@ RUN python -m pip install --upgrade pip RUN pip install pandas RUN pip install discord.py RUN pip install nltk - -# below fuckery from stockquotes -RUN pip install beautifulsoup4 -RUN pip install requests +RUN python -m nltk.downloader -d /usr/local/share/nltk_data all +RUN pip install python-dotenv WORKDIR /usr/src/app COPY ./ ./ -RUN pip install -r requirements.txt CMD [ "python", "main.py" ] diff --git a/docker-compose.yml b/docker-compose.yml index f3ae6f7..621cc31 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,5 +8,4 @@ services: volumes: - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro -# - /mnt/dietpi_userdata/kwaylon:/usr/src/app restart: unless-stopped diff --git a/kwaylon/jokes/jokes.py b/kwaylon/jokes/jokes.py index 65c2723..13c65d5 100644 --- a/kwaylon/jokes/jokes.py +++ b/kwaylon/jokes/jokes.py @@ -1,7 +1,7 @@ import re import discord -import stockquotes +# import stockquotes from . import base, helpers @@ -64,17 +64,18 @@ class AssJoke(base.Joke): await message.reply(f'{res} {discord.utils.get(client.emojis, name="kaylon")}') -class DominosJoke(base.Joke): - @property - def regex(self) -> re.Pattern: - return re.compile('domino\'?s', re.IGNORECASE) - - async def respond(self, message: discord.Message, client: discord.Client, match: re.Match): - cp = stockquotes.Stock('DPZ').current_price - msg = f'You know, my friend Ben has made about ${cp - 16:.0f} on Domino\'s stock. He basically owns it now' - if (e := discord.utils.get(client.emojis, name="pizza")): - await message.add_reaction(e) - await message.reply(msg) +# DominosJoke isn't working because stockquotes is fucked +# class DominosJoke(base.Joke): +# @property +# def regex(self) -> re.Pattern: +# return re.compile('domino\'?s', re.IGNORECASE) +# +# async def respond(self, message: discord.Message, client: discord.Client, match: re.Match): +# cp = stockquotes.Stock('DPZ').current_price +# msg = f'You know, my friend Ben has made about ${cp - 16:.0f} on Domino\'s stock. He basically owns it now' +# if (e := discord.utils.get(client.emojis, name="pizza")): +# await message.add_reaction(e) +# await message.reply(msg) class BeansJoke(base.GifJoke): diff --git a/kwaylon/kwaylon.py b/kwaylon/kwaylon.py index b61a71b..8f2f99c 100644 --- a/kwaylon/kwaylon.py +++ b/kwaylon/kwaylon.py @@ -33,12 +33,14 @@ class Kwaylon(discord.Client): async def handle_ready(self): async def alive(): channel: discord.TextChannel = discord.utils.get(self.get_all_channels(), name='robotics-facility') - await channel.send(f"I'm aliiiiiive {discord.utils.get(self.emojis, name='kaylon')}") + await channel.send('https://tenor.com/view/terminator-im-back-gif-19144173') + await channel.send(f"{discord.utils.get(self.emojis, name='kaylon')}") - self.data: data.MsgData = await data.MsgData.create(client=self, limit=self.limit, days=self.days) - self.data.to_sql(self.db_path) - LOGGER.info(f'{self.data.msgs.shape[0]} messages total') - # await alive() + await alive() + + # self.data: data.MsgData = await data.MsgData.create(client=self, limit=self.limit, days=self.days) + # self.data.to_sql(self.db_path) + # LOGGER.info(f'{self.data.msgs.shape[0]} messages total') async def handle_message(self, message): if message.author != self.user: diff --git a/main.py b/main.py index 9f39305..9fefa11 100644 --- a/main.py +++ b/main.py @@ -27,14 +27,14 @@ if __name__ == '__main__': await client.handle_message(message) - @client.event - async def on_raw_reaction_add(payload: RawReactionActionEvent): - await client.handle_raw_reaction(payload) - - - @client.event - async def on_raw_reaction_remove(payload: RawReactionActionEvent): - await client.handle_raw_reaction(payload) + # @client.event + # async def on_raw_reaction_add(payload: RawReactionActionEvent): + # await client.handle_raw_reaction(payload) + # + # + # @client.event + # async def on_raw_reaction_remove(payload: RawReactionActionEvent): + # await client.handle_raw_reaction(payload) load_dotenv() diff --git a/requirements.txt b/requirements.txt index b441fd9..d981308 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,10 @@ -python-dotenv +pandas discord.py # nextcord -pandas nltk -beautifulsoup4 -requests -stockquotes +python-dotenv + +# stockquotes +# beautifulsoup4 +# requests +# lxml