From 59bef3241fde018fb76eacae7b62bffda12e3115 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Thu, 2 Feb 2023 16:44:38 -0800 Subject: [PATCH] add after hours pricing --- app/cogs/actual_utils.py | 5 ----- app/cogs/animal_functions.py | 11 ----------- app/cogs/anime_girls.py | 25 ------------------------- app/cogs/cheeky_functions.py | 8 -------- app/cogs/server_utils.py | 2 -- app/cogs/stable_diffusion.py | 1 - app/core_utils.py | 1 - app/nft.py | 1 - app/stock.py | 16 +++++++++++++--- app/trackdays.py | 1 + 10 files changed, 14 insertions(+), 57 deletions(-) diff --git a/app/cogs/actual_utils.py b/app/cogs/actual_utils.py index edaf90da..051ad2fe 100755 --- a/app/cogs/actual_utils.py +++ b/app/cogs/actual_utils.py @@ -43,7 +43,6 @@ class ActualUtils(commands.Cog): @option(name="title", requried=True, description="The title of the issue") @option(name="description", require=True, description="The body of the issue") async def issue(self, ctx: commands.Context): - post_args = {"title": title, "description": description} headers = {"PRIVATE-TOKEN": os.getenv("gitlab_token")} @@ -67,7 +66,6 @@ class ActualUtils(commands.Cog): required=True, ) async def define(self, ctx, word): - import define_word embed = define_word.get_definition(word) @@ -75,7 +73,6 @@ class ActualUtils(commands.Cog): @commands.command(name="tts") async def tts(self, ctx: commands.Context): - import tts if ctx.message.content.split()[1] == "langs": @@ -159,7 +156,6 @@ class ActualUtils(commands.Cog): default="California", ) async def corona(self, ctx: commands.Context, location): - import corona await ctx.defer() @@ -182,7 +178,6 @@ class ActualUtils(commands.Cog): default=False, ) async def stock(self, ctx, symbols, verbose): - import stock results = stock.parse_message(symbols, verbose) diff --git a/app/cogs/animal_functions.py b/app/cogs/animal_functions.py index fe7dd85f..9f1ad2cb 100755 --- a/app/cogs/animal_functions.py +++ b/app/cogs/animal_functions.py @@ -11,56 +11,48 @@ class AnimalFunctions(commands.Cog): guild_ids=None, name="redpanda", description="Posts a photo of a redpanda" ) async def redpanda(self, ctx: commands.Context): - await ctx.respond(animals.get_red_panda()) @commands.slash_command( guild_ids=None, name="panda", description="Posts a photo of a panda" ) async def panda(self, ctx: commands.Context): - await ctx.respond(animals.get_panda()) @commands.slash_command( guild_ids=None, name="koala", description="Posts a photo of a koala" ) async def koala(self, ctx: commands.Context): - await ctx.respond(animals.get_koala()) @commands.slash_command( guild_ids=None, name="racoon", description="Posts a photo of a racoon" ) async def racoon(self, ctx: commands.Context): - await ctx.respond(animals.get_racoon()) @commands.slash_command( guild_ids=None, name="fox", description="Posts a photo of a fox" ) async def fox(self, ctx: commands.Context): - await ctx.respond(animals.get_fox()) @commands.slash_command( guild_ids=None, name="cat", description="Posts a photo of a cat" ) async def cat(self, ctx: commands.Context): - await ctx.respond(animals.get_cat()) @commands.slash_command( guild_ids=None, name="kangaroo", description="Posts a photo of a kangaroo" ) async def kangaroo(self, ctx: commands.Context): - await ctx.respond(animals.get_kangaroo()) @commands.slash_command( guild_ids=None, name="dog", description="Posts a photo of a dog" ) async def dog(self, ctx: commands.Context): - await ctx.respond(animals.get_dog()) @commands.slash_command( @@ -73,21 +65,18 @@ class AnimalFunctions(commands.Cog): guild_ids=None, name="birb", description="Posts a photo of a birb" ) async def birb(self, ctx: commands.Context): - await ctx.respond(animals.get_birb()) @commands.slash_command( guild_ids=None, name="cowboy", description="Posts a photo of a bad dog" ) async def cowboy(self, ctx: commands.Context): - await ctx.respond(animals.cowboy()) @commands.slash_command( guild_ids=None, name="dale", description="Posts a photo of the goodest boy" ) async def dale(self, ctx: commands.Context): - await ctx.respond(file=discord.File(animals.dale())) @commands.slash_command( diff --git a/app/cogs/anime_girls.py b/app/cogs/anime_girls.py index 5c8809e2..e7aaef3a 100755 --- a/app/cogs/anime_girls.py +++ b/app/cogs/anime_girls.py @@ -23,7 +23,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="pout", description="Posts a gif of an anime girl pouting" ) async def pout(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="blush") @@ -34,7 +33,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="yeet", description="Posts a gif of an anime girl yeeting" ) async def yeet(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="yeet") @@ -47,7 +45,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl cuddleing", ) async def cuddle(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="cuddle") @@ -58,7 +55,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="awoo", description="Posts a gif of a dog/anime girl" ) async def awoo(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="awoo") @@ -71,7 +67,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime bonking someone on the head", ) async def bonk(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="bonk") @@ -82,7 +77,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="glomp", description="Posts a gif of an aggressive hug" ) async def glomp(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="glomp") @@ -93,7 +87,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="pout", description="Posts a gif of an anime girl pouting" ) async def pout(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="blush") @@ -104,7 +97,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="waifu", description="Posts a gif of an anime girl" ) async def waifu(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="waifu") @@ -115,7 +107,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="neko", description="Posts a gif of a cat/anime girl" ) async def neko(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="neko") @@ -128,7 +119,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl bullying someone", ) async def bully(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="bully") @@ -139,7 +129,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="cry", description="Posts a gif of an anime girl crying" ) async def cry(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="cry") @@ -150,7 +139,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="hug", description="Posts a gif of an anime girl huging" ) async def hug(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="hug") @@ -161,7 +149,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="kiss", description="Posts a gif of an anime girl kissing" ) async def kiss(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="kiss") @@ -172,7 +159,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="lick", description="Posts a gif of an anime girl licking" ) async def lick(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="lick") @@ -185,7 +171,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl pating someone on the head", ) async def pat(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="pat") @@ -198,7 +183,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl being smug", ) async def smug(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="smug") @@ -211,7 +195,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl highfiveing", ) async def highfive(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="highfive") @@ -222,7 +205,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="nom", description="Posts a gif of an anime girl eating" ) async def nom(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="nom") @@ -235,7 +217,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl biting someone", ) async def bite(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="bite") @@ -246,7 +227,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="slap", description="Posts a gif of an anime girl slapping" ) async def slap(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="slap") @@ -257,7 +237,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="wink", description="Posts a gif of an anime girl winking" ) async def wink(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="wink") @@ -268,7 +247,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="poke", description="Posts a gif of an anime girl pokeing" ) async def poke(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="poke") @@ -279,7 +257,6 @@ class AnimeGirls(commands.Cog): guild_ids=None, name="dance", description="Posts a gif of an anime girl dancing" ) async def dance(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="dance") @@ -292,7 +269,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl cringeing", ) async def cringe(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="cringe") @@ -305,7 +281,6 @@ class AnimeGirls(commands.Cog): description="Posts a gif of an anime girl blushing", ) async def blush(self, ctx: commands.Context): - await ctx.respond( embed=core_utils.generate_embed( embed_url=core_utils.waifu_pics(endpoint="blush") diff --git a/app/cogs/cheeky_functions.py b/app/cogs/cheeky_functions.py index 602684ed..8ec5abc5 100755 --- a/app/cogs/cheeky_functions.py +++ b/app/cogs/cheeky_functions.py @@ -22,7 +22,6 @@ class Cheeky(commands.Cog): description="Separate your choices with 'or', or enter a singular choice to get a yes/no answer.", ) async def decide(self, ctx, input_string): - import random choices = input_string.split(" or ") @@ -68,7 +67,6 @@ class Cheeky(commands.Cog): description="Posts a greentext image", ) async def greentext(self, ctx: commands.Context): - import get_from_reddit embed = discord.Embed( @@ -124,7 +122,6 @@ class Cheeky(commands.Cog): name="bottom", description="The bottom text to put on the meme", required=True ) async def meme(self, ctx: commands.Context, template, top, bottom): - import meme_gen await ctx.defer() @@ -147,7 +144,6 @@ class Cheeky(commands.Cog): @commands.slash_command(name="donate") async def donate(self, ctx: commands.Context): - await ctx.respond( "https://paypal.me/ldooks\nhttps://venmo.com/ldooks\nhttps://cash.me/$ldooks" ) @@ -164,7 +160,6 @@ class Cheeky(commands.Cog): max_length=300, ) async def tiktok(self, ctx: commands.Context, input: str): - import tempfile import base64 @@ -196,7 +191,6 @@ class Cheeky(commands.Cog): @commands.slash_command(guild_ids=None, name="nft", description="Returns an nft") async def nft(self, ctx: commands.Context): - import nft result = nft.get_nft() @@ -208,7 +202,6 @@ class Cheeky(commands.Cog): ) @option(name="question", description="Your question", required=True) async def eight_ball(self, ctx: commands.Context, question: str): - import eight_ball result = eight_ball.check_8ball(question) @@ -233,7 +226,6 @@ class Cheeky(commands.Cog): required=True, ) async def twitter(self, ctx: commands.Context, message_id: str): - message = await ctx.channel.fetch_message(message_id) author_avatar = message.author.avatar response = requests.get( diff --git a/app/cogs/server_utils.py b/app/cogs/server_utils.py index 1b9deb61..9462874a 100644 --- a/app/cogs/server_utils.py +++ b/app/cogs/server_utils.py @@ -86,7 +86,6 @@ class ServerUtils(commands.Cog): description="Returns a link to the worlde luke is hosting", ) async def wordle(self, ctx: commands.Context): - await ctx.respond("https://wordle.luker.gq") @commands.slash_command(guild_ids=None, name="dot", description="dot") @@ -243,7 +242,6 @@ class ServerUtils(commands.Cog): @commands.command(name="help") async def help(self, ctx: commands.Context, method=None): - import help_methods if method: diff --git a/app/cogs/stable_diffusion.py b/app/cogs/stable_diffusion.py index 4209ae1e..cfac9e78 100755 --- a/app/cogs/stable_diffusion.py +++ b/app/cogs/stable_diffusion.py @@ -29,7 +29,6 @@ class StableDiffusion(commands.Cog): async def sd( self, ctx: commands.Context, positive_prompt: str, negative_prompt: str ): - if ctx.channel.name == "stable-diffusion" or ctx.channel.name == "bot-testing": import socket import stable_diffusion diff --git a/app/core_utils.py b/app/core_utils.py index b4082611..60cf5d83 100755 --- a/app/core_utils.py +++ b/app/core_utils.py @@ -6,7 +6,6 @@ my_id = 144986109804412928 def download_image(url, path=None): - request = requests.get(url) suffix_list = [ "jpeg", diff --git a/app/nft.py b/app/nft.py index e8e794ea..40664920 100755 --- a/app/nft.py +++ b/app/nft.py @@ -3,7 +3,6 @@ import random def get_nft(): - # To find the collection's address, you have to do a curl against the API # curl -s --request GET --url https://api.opensea.io/api/v1/collection/ | | jq -r .[].primary_asset_contracts[].address # Alternatively, go to some asset on Opensea and take the chunk of the URL after "assets": diff --git a/app/stock.py b/app/stock.py index e39e1425..d751381f 100755 --- a/app/stock.py +++ b/app/stock.py @@ -111,9 +111,19 @@ def get_stock(share_name, verbose=False): embed.set_thumbnail(url=meme_url) embed.set_author(name=request["shortName"]) - embed.add_field( - name="Current price", value="$%s" % request["regularMarketPrice"], inline=False - ) + if request["marketState"] == "POST": + embed.add_field( + name="After Hours price", + value="$%s" % request["postMarketPrice"], + inline=False, + ) + else: + embed.add_field( + name="Current price", + value="$%s" % request["regularMarketPrice"], + inline=False, + ) + embed.add_field( name="Opening price", value="$%s" % request["regularMarketOpen"], inline=False ) diff --git a/app/trackdays.py b/app/trackdays.py index fe42ca24..5bf716c1 100755 --- a/app/trackdays.py +++ b/app/trackdays.py @@ -49,6 +49,7 @@ async def get_msreg(track): events[track].append(event_object) except TypeError: pass + # sort track events by date def date_to_datetime(input): return datetime.strptime(input["event_date"], "%Y-%m-%d")