closer than ever
This commit is contained in:
parent
ef81693050
commit
81bba03aff
@ -1,7 +1,9 @@
|
|||||||
from .hangman import Hangman
|
from .hangman import Hangman
|
||||||
|
from redbot.core import data_manager
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
n = Hangman(bot)
|
n = Hangman(bot)
|
||||||
|
data_manager.load_bundled_data(n, __file__)
|
||||||
bot.add_cog(n)
|
bot.add_cog(n)
|
||||||
bot.add_listener(n._on_react, "on_reaction_add")
|
bot.add_listener(n._on_react, "on_reaction_add")
|
||||||
|
@ -4,6 +4,7 @@ from random import randint
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from redbot.core import Config, checks
|
from redbot.core import Config, checks
|
||||||
|
from redbot.core.data_manager import cog_data_path, load_basic_configuration
|
||||||
|
|
||||||
|
|
||||||
class Hangman:
|
class Hangman:
|
||||||
@ -13,6 +14,7 @@ class Hangman:
|
|||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
load_basic_configuration("hangman")
|
||||||
self.config = Config.get_conf(self, identifier=1049711010310997110)
|
self.config = Config.get_conf(self, identifier=1049711010310997110)
|
||||||
default_guild = {
|
default_guild = {
|
||||||
"theface": ':thinking:',
|
"theface": ':thinking:',
|
||||||
@ -22,7 +24,7 @@ class Hangman:
|
|||||||
|
|
||||||
self.the_data = defaultdict(
|
self.the_data = defaultdict(
|
||||||
lambda: {"running": False, "hangman": 0, "guesses": [], "trackmessage": False, "answer": ''})
|
lambda: {"running": False, "hangman": 0, "guesses": [], "trackmessage": False, "answer": ''})
|
||||||
self.answer_path = "./data/hanganswers.txt"
|
self.answer_path = "/hanganswers.txt"
|
||||||
self.winbool = defaultdict(lambda: False)
|
self.winbool = defaultdict(lambda: False)
|
||||||
|
|
||||||
self.hanglist = {}
|
self.hanglist = {}
|
||||||
@ -191,8 +193,9 @@ class Hangman:
|
|||||||
|
|
||||||
def _getphrase(self):
|
def _getphrase(self):
|
||||||
"""Get a new phrase for the game and returns it"""
|
"""Get a new phrase for the game and returns it"""
|
||||||
phrasefile = open(self.answer_path, 'r')
|
|
||||||
phrases = phrasefile.readlines()
|
with cog_data_path("hangman").open('r') as phrasefile:
|
||||||
|
phrases = phrasefile.readlines()
|
||||||
|
|
||||||
outphrase = ""
|
outphrase = ""
|
||||||
while outphrase == "":
|
while outphrase == "":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user