🧹 More refactoring

This commit is contained in:
Nikolaj
2021-08-17 18:05:41 +02:00
parent 074a06e863
commit 573d081734
31 changed files with 1971 additions and 1787 deletions

View File

@ -72,7 +72,7 @@ class EventHandler():
channel = message.channel
reacted_message = f"{user.display_name} reacted to a message"
self.bot.log(reacted_message, str(channel.id))
plex_data = tests.bedre_netflix_reaction_test(message)
plex_data = tests.plex_reaction_test(message)
# plex_data is a list containing 3 elements: whether it was
# the add_show/add_movie command message the reaction was to
# (bool), whether it's a movie (bool) (if false, it's a
@ -84,10 +84,10 @@ class EventHandler():
if tests.connect_four_reaction_test(*reaction_test_parameters):
column = emoji_to_command(reaction.emoji)
params = [message, f"#{user.id}", column-1]
await self.bot.games.connect_four.placePiece(*params)
await self.bot.games.connect_four.place_piece(*params)
if plex_data[0]:
plex_functions = self.bot.other.bedre_netflix
plex_functions = self.bot.other.plex
if plex_data[1]:
movie_pick = emoji_to_command(reaction.emoji)
if movie_pick == "none":

View File

@ -27,7 +27,7 @@ class DatabaseFuncs():
user: discord.User) -> bool
hangman_reaction_test(message: discord.Message,
user: discord.User) -> bool
bedre_netflix_reaction_test(message: discord.Message,
plex_reaction_test(message: discord.Message,
user: discord.User) -> bool, bool,
list
imdb_commands()
@ -206,7 +206,7 @@ class DatabaseFuncs():
return game_message
def bedre_netflix_reaction_test(self, message: discord.Message):
def plex_reaction_test(self, message: discord.Message):
"""
Test if the given message is the response to a plex request.
@ -227,7 +227,7 @@ class DatabaseFuncs():
Gwendolyn presented after the request.
"""
channel = message.channel
old_messages_path = "gwendolyn/resources/bedre_netflix/"
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:

View File

@ -16,7 +16,7 @@ Contains utility functions used by parts of the bot.
new_string: str) -> str
emoji_to_command(emoji: str) -> str
"""
import json # Used by longString(), get_params() and make_files()
import json # Used by long_strings(), get_params() and make_files()
import logging # Used for logging
import os # Used by make_files() to check if files exist
import sys # Used to specify printing for logging