diff options
Diffstat (limited to 'bigresult.py')
| -rw-r--r-- | bigresult.py | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/bigresult.py b/bigresult.py index 8016d76..adab920 100644 --- a/bigresult.py +++ b/bigresult.py @@ -1,10 +1,17 @@ +from time import sleep import discord import dotenv from discord.ext import commands import random import threading -import time +import datetime from functools import partial, wraps +import json +import urllib.request +from RobloxAPI.main import RobloxMarketPlaceAPI +import math + + # from commands.funny import BigCommands class BigResultPlus(commands.Bot): @@ -20,6 +27,10 @@ class BigResultPlus(commands.Bot): "teachmethebigresult": BigResultPlus.teachbigresult, "ivotedfor": BigResultPlus.voot, } + self.daily_pi_update_msg = "rise and shine bastards, server time is ;;date;; and the Pumpkin Pi is ;;robux;; and Avi has ;;profit?;; ;;amount;; robux" + self.roblox_api_url = "https://catalog.roblox.com/v1/search/items/details?" + self.pumpkin_pi_buy = 800 + self.robloxAPI = RobloxMarketPlaceAPI() # intents = discord.Intents.all() # self.client = commands.Bot(intents=intents, command_prefix="!") # This represents our connection with Discord @@ -27,6 +38,32 @@ class BigResultPlus(commands.Bot): for key in self.COMMANDS: super().command(name=key)(wraps(self.COMMANDS[key])(partial(self.COMMANDS[key], self))) + def riseandshine(self): + next_day = datetime.datetime.now() + next_day = next_day.replace(day=next_day.day + 1) + self.robloxAPI.configure_request("CreatorName", "Roblox") + self.robloxAPI.configure_request("Keyword", "Pumpkin Pi") + self.robloxAPI.configure_request("Limit", "10") + self.robloxAPI.configure_request("TARGET", 16986805) + + while True: + today = datetime.datetime.now() + if (today < next_day): + sleep(60*60) + next_day = today.replace(day=today.day + 1) + + if not self.robloxAPI.send_request(): + return + + pumpkinpi = self.robloxAPI.read_response() + update_msg = self.daily_pi_update_msg.replace(";;date;;", today.isoformat()) + update_msg = update_msg.replace(";;robux;;", f"{pumpkinpi["lowestPrice"]}") + if self.pumpkin_pi_buy - pumpkinpi["lowestPrice"] < 0: + update_msg = update_msg.replace(";;profit?;;", "gained") + else: + update_msg = update_msg.replace(";;profit?;;", "lost (LOL)") + update_msg = update_msg.replace(";;amount;;", f"{abs(self.pumpkin_pi_buy - pumpkinpi["lowestPrice"])}") + self.send_msg(update_msg, 0) # @client.command(name="snipe") @@ -78,7 +115,7 @@ class BigResultPlus(commands.Bot): saved = message.content await channel_sent.send("BOOM :sunglasses: :fire:") await message.delete() - time.sleep(2) + sleep(2) await channel_sent.send(saved) self.snipe_active = False @@ -140,14 +177,17 @@ class BigResultPlus(commands.Bot): elif ("?" in fuckyou and random.randint(1, 2000) == 1984): await message.reply("did you attend?") + sleep(1) await message.reply("were you there?") + sleep(1) await message.reply("were you listening?") + sleep(1) await message.reply("why do you ask?") return await super().process_commands(message) return - async def send_msg(self, msg): - channel = super().get_channel(427176475406630914) + async def send_msg(self, msg, channel): + channel = super().get_channel(channel) await channel.send(msg) |
