diff --git a/.env b/.env index 20e8a7e..6a0be34 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ DISCORD_TOKEN=NzcxNzQ2NDg5MjE5MTUzOTMw.X5wm7Q.siDgoUQOu5YtSJ8zcSpbtmxr3IM DISCORD_GUILD=Team (O3) -STEAM_API_KEY=84D642824B05D1EF8CD1B186B728BB46 \ No newline at end of file +STEAM_API_KEY=84D642824B05D1EF8CD1B186B728BB46 +CAT_API_KEY=afab5571-5377-4214-a573-0e24034e9bad \ No newline at end of file diff --git a/.vs/Chatbot/v16/.suo b/.vs/Chatbot/v16/.suo index 430187f..37d5d38 100644 Binary files a/.vs/Chatbot/v16/.suo and b/.vs/Chatbot/v16/.suo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index 2893cde..bba312a 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/Chatbot.py b/Chatbot.py index 5fecf2b..45a68e4 100644 --- a/Chatbot.py +++ b/Chatbot.py @@ -18,6 +18,7 @@ load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') GUILD = os.getenv('DISCORD_GUILD') steamApiKey = os.getenv('STEAM_API_KEY') +catApiKey = os.getenv('CAT_API_KEY') client = discord.Client() api = WebAPI(key=steamApiKey) @@ -104,6 +105,20 @@ def isUserBanned(steamID):#Emily "Getting quite the ban collection here because you're: \n" + ", ".join(banList)] return random.choice(reply) + +def iNeedACat(): # Emily + api = requests.get("https://api.thecatapi.com/v1/images/search", params = {'q': 'requests+language:python'}, headers = {"authorisation":catApiKey}) + api = api.text + api = list(api.split(",")) + api = api[-3] + api = api[7:-1] + return api + +def catMessage(): + reply = ["Here's a cat for you in these trying times", + "Emergency cat pics incoming!", + "*QUICK GET THE CATS*"] + return random.choice(reply) #================Emily=Function=End============================================ #================BenHB=Function=Start========================================== @@ -186,6 +201,11 @@ async def on_message(message): #checks for a message "Something went wrong *looks pointedly at Ben*", "Why it looks like the SteamID function broke down, I wonder why, *Ben*"] await message.channel.send(random.choice(randomSteamIDErrorReplies)) + + if "cat" in message.content.lower(): + await message.channel.send(catMessage()) + await message.channel.send(iNeedACat()) + # ================================================