String formatting exists and it is a wonderful thing.
This commit is contained in:
parent
11f7ebaa86
commit
fb3fa55477
1 changed files with 27 additions and 20 deletions
|
@ -212,11 +212,11 @@ class Module(object):
|
|||
|
||||
channel.set_user_setting(uid, "ducks-befriended", total_befriended)
|
||||
|
||||
event["stdout"].write(
|
||||
"Aww! " + nick + " befriended a duck! You've befriended " +
|
||||
Utils.bold(
|
||||
str(total_befriended)) + " ducks in " + Utils.bold(
|
||||
channel.name) + "!")
|
||||
msg = "Aww! %s befriended a duck! You've befriended %s ducks in %s!" \
|
||||
% ( Utils.bold(nick), Utils.bold(total_befriended),
|
||||
Utils.bold(channel.name) )
|
||||
|
||||
event["stdout"].write(msg)
|
||||
|
||||
self.clear_ducks(channel)
|
||||
|
||||
|
@ -243,10 +243,11 @@ class Module(object):
|
|||
|
||||
channel.set_user_setting(uid, "ducks-shot", total_shot)
|
||||
|
||||
event["stdout"].write(
|
||||
"Pow! " + nick + " shot a duck! You've shot " + Utils.bold(
|
||||
str(total_shot)) + " ducks in " + Utils.bold(
|
||||
channel.name) + "!")
|
||||
msg = "Pow! %s shot a duck! You've shot %s ducks in %s!" \
|
||||
% ( Utils.bold(nick), Utils.bold(total_shot),
|
||||
Utils.bold(channel.name) )
|
||||
|
||||
event["stdout"].write(msg)
|
||||
|
||||
self.clear_ducks(channel)
|
||||
|
||||
|
@ -279,11 +280,16 @@ class Module(object):
|
|||
else:
|
||||
total_poached += number
|
||||
|
||||
event["stdout"].write(
|
||||
nick + ": " + str(total_poached) + " ducks killed (" + str(
|
||||
channel_poached) + " in " + channel + "), and " + str(
|
||||
total_friends) + " ducks befriended (" + str(
|
||||
channel_friends) + " in " + channel + ")")
|
||||
tf = total_friends
|
||||
tp = total_poached
|
||||
cp = channel_poached
|
||||
cf = channel_friends
|
||||
|
||||
msg = "%s ducks killed (%s in %s), and %s ducks befriended (%s in %s)" \
|
||||
% ( Utils.bold(tp), Utils.bold(cp), Utils.bold(channel),
|
||||
Utils.bold(tf), Utils.bold(cf), Utils.bold(channel) )
|
||||
|
||||
event["stdout"].write(Utils.bold(nick) + ": " + msg)
|
||||
|
||||
def duck_enemies(self, event):
|
||||
the_enemy = event["server"].find_all_user_channel_settings("ducks-shot")
|
||||
|
@ -303,14 +309,14 @@ class Module(object):
|
|||
enemy_nicks.append(user)
|
||||
enemy_ducks.append(enemies)
|
||||
|
||||
sentence = "Duck Wranglers -- "
|
||||
sentence = Utils.bold("Duck Wranglers: ")
|
||||
build = []
|
||||
|
||||
length = len(enemy_nicks) if len(enemy_nicks) < 8 else 8
|
||||
|
||||
for i in range(0, length):
|
||||
build.append(Utils.bold(enemy_nicks[i]) + " ("
|
||||
+ str(enemy_ducks[i]) + ")")
|
||||
build.append("%s (%s)" % (Utils.bold(enemy_nicks[i]),
|
||||
enemy_ducks[i]))
|
||||
|
||||
sentence += ", ".join(build)
|
||||
|
||||
|
@ -335,14 +341,15 @@ class Module(object):
|
|||
friend_nicks.append(user)
|
||||
friend_ducks.append(friends)
|
||||
|
||||
sentence = "Duck Befrienders -- "
|
||||
sentence = Utils.bold("Duck Friends: ")
|
||||
|
||||
length = len(friend_nicks) if len(friend_nicks) < 8 else 8
|
||||
build = []
|
||||
|
||||
for i in range(0, length):
|
||||
build.append(Utils.bold(friend_nicks[i]) + " ("
|
||||
+ str(friend_ducks[i]) + ")")
|
||||
build.append("%s (%s)" % ( Utils.bold(friend_nicks[i]),
|
||||
friend_ducks[i])
|
||||
)
|
||||
|
||||
sentence += ", ".join(build)
|
||||
|
||||
|
|
Loading…
Reference in a new issue