✨ Made the plex functions use buttons
This commit is contained in:
@ -6,7 +6,6 @@ Contains classes used for utilities.
|
||||
DatabaseFuncs()
|
||||
"""
|
||||
import os # Used to test if files exist
|
||||
import json # Used to read the data about add_movie/add_show
|
||||
import time # Used to test how long it's been since commands were synced
|
||||
|
||||
import re # Used in get_id
|
||||
@ -206,45 +205,6 @@ class DatabaseFuncs():
|
||||
|
||||
return game_message
|
||||
|
||||
def plex_reaction_test(self, message: discord.Message):
|
||||
"""
|
||||
Test if the given message is the response to a plex request.
|
||||
|
||||
*Parameters*
|
||||
------------
|
||||
message: discord.Message
|
||||
The message to test.
|
||||
|
||||
*Returns*
|
||||
---------
|
||||
: bool
|
||||
Whether the message is the response to a plex request.
|
||||
: bool
|
||||
Whether it was a movie request (false for a show
|
||||
request)
|
||||
: list
|
||||
A list of ids or names of the shows or movies that
|
||||
Gwendolyn presented after the request.
|
||||
"""
|
||||
channel = message.channel
|
||||
old_messages_path = "gwendolyn/resources/plex/"
|
||||
file_path = old_messages_path + f"old_message{str(channel.id)}"
|
||||
if os.path.isfile(file_path):
|
||||
with open(file_path, "r") as file_pointer:
|
||||
data = json.load(file_pointer)
|
||||
else:
|
||||
return (False, None, None)
|
||||
|
||||
if data["message_id"] != message.id:
|
||||
return (False, None, None)
|
||||
|
||||
if "imdb_ids" in data:
|
||||
return_data = (True, True, data["imdb_ids"])
|
||||
else:
|
||||
return_data = (True, False, data["imdb_names"])
|
||||
|
||||
return return_data
|
||||
|
||||
async def imdb_commands(self):
|
||||
"""Sync the slash commands with the discord API."""
|
||||
collection = self.bot.database["last synced"]
|
||||
|
Reference in New Issue
Block a user