make sure game is run in channel not pm

This commit is contained in:
Gordon Shumway 2019-02-24 21:55:16 -05:00 committed by GitHub
parent 4cfaf2f06a
commit 2128f837cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -53,6 +53,9 @@ class HuntNFish(callbacks.Plugin):
performs a random hunt
"""
channel = msg.args[0]
if not irc.isChannel(channel):
irc.reply("This command must be run in a channel")
return
hunttrophy = conf.supybot.directories.data.dirize("hunttrophy_{0}.db".format(channel))
if not os.path.isfile(hunttrophy):
with open(hunttrophy, 'w') as f:
@ -104,6 +107,9 @@ class HuntNFish(callbacks.Plugin):
performs a random fishing trip
"""
channel = msg.args[0]
if not irc.isChannel(channel):
irc.reply("This command must be run in a channel")
return
fishtrophy = conf.supybot.directories.data.dirize("fishtrophy_{0}.db".format(channel))
if not os.path.isfile(fishtrophy):
with open(fishtrophy, 'w') as f:
@ -155,6 +161,9 @@ class HuntNFish(callbacks.Plugin):
checks the current highscores for hunting and fishing
"""
channel = msg.args[0]
if not irc.isChannel(channel):
irc.reply("This command must be run in a channel")
return
hunttrophy = conf.supybot.directories.data.dirize("hunttrophy_{0}.db".format(channel))
fishtrophy = conf.supybot.directories.data.dirize("fishtrophy_{0}.db".format(channel))
if not os.path.isfile(fishtrophy):
@ -184,6 +193,10 @@ class HuntNFish(callbacks.Plugin):
"""takes no arguments
resets the highscores for both hunting and fishing. this command is limited to the owner, to prevent just anyone from clearing the scores
"""
channel = msg.args[0]
if not irc.isChannel(channel):
irc.reply("This command must be run in a channel")
return
hunttrophy = conf.supybot.directories.data.dirize("hunttrophy_{0}.db".format(channel))
fishtrophy = conf.supybot.directories.data.dirize("fishtrophy_{0}.db".format(channel))
if not os.path.isfile(fishtrophy):