🧹 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

@ -7,7 +7,7 @@ import lxml # Used in imageFunc
import fandom # Used in findWikiPage
import d20 # Used in rollDice
import ast
from .bedre_netflix import BedreNetflix
from .plex import Plex
from .nerd_shit import NerdShit
from .generators import Generators
@ -19,16 +19,16 @@ fandom.set_wiki("senkulpa")
class MyStringifier(d20.MarkdownStringifier):
def _str_expression(self, node):
if node.comment == None:
resultText = "Result"
result_text = "Result"
else:
resultText = node.comment.capitalize()
result_text = node.comment.capitalize()
return f"**{resultText}**: {self._stringify(node.roll)}\n**Total**: {int(node.total)}"
return f"**{result_text}**: {self._stringify(node.roll)}\n**Total**: {int(node.total)}"
class Other():
def __init__(self, bot):
self.bot = bot
self.bedre_netflix = BedreNetflix(self.bot)
self.plex = Plex(self.bot)
self.nerd_shit = NerdShit(self.bot)
self.generators = Generators(self.bot)
@ -41,11 +41,11 @@ class Other():
self.bot.log("Picking a movie")
with open("gwendolyn/resources/movies.txt", "r") as f:
movieList = f.read().split("\n")
movieName = random.choice(movieList)
movie_list = f.read().split("\n")
movie_name = random.choice(movie_list)
self.bot.log(f"Searching for {movieName}")
searchResult = imdbClient.search_movie(movieName)
self.bot.log(f"Searching for {movie_name}")
searchResult = imdbClient.search_movie(movie_name)
self.bot.log("Getting the data")
movie = searchResult[0]
@ -74,17 +74,17 @@ class Other():
author = ctx.author.display_name
now = datetime.datetime.now()
if time_in_range(now.replace(hour=5, minute=0, second=0, microsecond=0),now.replace(hour=10, minute=0, second=0, microsecond=0), now):
sendMessage = "Good morning, "+str(author)
send_message = "Good morning, "+str(author)
elif time_in_range(now.replace(hour=13, minute=0, second=0, microsecond=0),now.replace(hour=18, minute=0, second=0, microsecond=0), now):
sendMessage = "Good afternoon, "+str(author)
send_message = "Good afternoon, "+str(author)
elif time_in_range(now.replace(hour=18, minute=0, second=0, microsecond=0),now.replace(hour=22, minute=0, second=0, microsecond=0), now):
sendMessage = "Good evening, "+str(author)
send_message = "Good evening, "+str(author)
elif time_in_range(now.replace(hour=22, minute=0, second=0, microsecond=0),now.replace(hour=23, minute=59, second=59, microsecond=0), now):
sendMessage = "Good night, "+str(author)
send_message = "Good night, "+str(author)
else:
sendMessage = "Hello, "+str(author)
send_message = "Hello, "+str(author)
await ctx.send(sendMessage)
await ctx.send(send_message)
# Finds a random picture online
async def imageFunc(self, ctx):