convert ircplugin users of privmsg to reply

bss/dr.botzo#21
This commit is contained in:
2017-02-12 11:39:04 -06:00
parent 23bb5cdd78
commit 6cb3757ef9
3 changed files with 34 additions and 24 deletions

View File

@@ -133,8 +133,9 @@ class Storycraft(Plugin):
player = StorycraftPlayer.objects.create(nick=nick, nickmask=event.source, game=game)
# tell the control channel
self.bot.privmsg(master_channel, "{0:s} created a game of storycraft - do '!storycraft game "
"{1:d} join' to take part!".format(nick, game.pk))
self.bot.reply(None, "{0:s} created a game of storycraft - do '!storycraft game "
"{1:d} join' to take part!".format(nick, game.pk),
explicit_target=master_channel)
log.debug("%s added a new game", nick)
return self.bot.reply(event, "Game #{0:d} has been created. When everyone has joined, do "
@@ -163,7 +164,8 @@ class Storycraft(Plugin):
# output results
master_channel = settings.STORYCRAFT_MASTER_CHANNEL
self.bot.privmsg(master_channel, "{0:s} joined storycraft #{1:d}!".format(nick, game_id))
self.bot.reply(None, "{0:s} joined storycraft #{1:d}!".format(nick, game_id),
explicit_target=master_channel)
log.debug("%s joined game #%d", nick, game_id)
return self.bot.reply(event, "{0:s}, welcome to the game.".format(nick))
else:
@@ -235,9 +237,10 @@ class Storycraft(Plugin):
master_channel = settings.STORYCRAFT_MASTER_CHANNEL
# tell the control channel
self.bot.privmsg(master_channel, "{0:s} started storycraft #{1:d}! - first player "
"is {2:s}, do '!storycraft game {1:d} show line' when the game is "
"assigned to you.".format(nick, game_id, player.nick))
self.bot.reply(None, "{0:s} started storycraft #{1:d}! - first player "
"is {2:s}, do '!storycraft game {1:d} show line' when the game is "
"assigned to you.".format(nick, game_id, player.nick),
explicit_target=master_channel)
log.debug("%s started game #%d", nick, game_id)
return self.bot.reply(event, "Game #{0:d} started.".format(game_id))
@@ -343,22 +346,25 @@ class Storycraft(Plugin):
return_msg = 'Line logged. Please add another. ' + progress_str
else:
# notify the new owner, too
self.bot.privmsg(player.nick, "You have a new line in storycraft "
"#{0:d}: '{1:s}' {2:s}"
"".format(game_id, last_line.line, progress_str))
self.bot.reply(None, "You have a new line in storycraft "
"#{0:d}: '{1:s}' {2:s}"
"".format(game_id, last_line.line, progress_str),
explicit_target=player.nick)
master_channel = settings.STORYCRAFT_MASTER_CHANNEL
log.debug("%s added a line to #%d", nick, game_id)
# log output
if game.status == StorycraftGame.STATUS_IN_PROGRESS:
self.bot.privmsg(master_channel, "{0:s} added a line to storycraft "
"#{1:d}! - next player is {2:s}"
"".format(nick, game_id, player.nick))
self.bot.reply(None, "{0:s} added a line to storycraft "
"#{1:d}! - next player is {2:s}"
"".format(nick, game_id, player.nick),
explicit_target=master_channel)
return self.bot.reply(event, return_msg)
else:
self.bot.privmsg(master_channel, "{0:s} finished storycraft #{1:d}!"
"".format(nick, game_id))
self.bot.reply(None, "{0:s} finished storycraft #{1:d}!"
"".format(nick, game_id),
explicit_target=master_channel)
return self.bot.reply(event, "Line logged (and game completed).")
else:
return self.bot.reply(event, "Failed to assign game to next player.")