working kwaylon

This commit is contained in:
jsl12
2022-01-21 17:19:11 -06:00
parent 2d65987306
commit 3b32e6b396
6 changed files with 37 additions and 36 deletions

View File

@@ -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" ]

View File

@@ -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

View File

@@ -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):

View File

@@ -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:

16
main.py
View File

@@ -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()

View File

@@ -1,8 +1,10 @@
python-dotenv
pandas
discord.py
# nextcord
pandas
nltk
beautifulsoup4
requests
stockquotes
python-dotenv
# stockquotes
# beautifulsoup4
# requests
# lxml