mirror of https://github.com/zulip/zulip.git
inject-messages: occationally show how many messages have been sent
(imported from commit 98f59c252cf8a47ffa8320dd18a74fd46e90054f)
This commit is contained in:
parent
4cad5f6e96
commit
c7f2a29db4
|
@ -48,9 +48,11 @@ def truncate(string, length):
|
|||
return string[:length - 3] + "..."
|
||||
|
||||
last_character = None
|
||||
num_messages_sent = 0
|
||||
def send_message(character, text, subject):
|
||||
global characters
|
||||
global last_character
|
||||
global num_messages_sent
|
||||
message = text
|
||||
if character != last_character:
|
||||
message = characters[character]['intro'] + message
|
||||
|
@ -67,6 +69,10 @@ def send_message(character, text, subject):
|
|||
exit(1)
|
||||
last_character = character
|
||||
|
||||
num_messages_sent += 1
|
||||
if num_messages_sent % 100 == 0:
|
||||
print "Sent %s messages" % (num_messages_sent,)
|
||||
|
||||
def maybe_assign_character(character):
|
||||
global characters
|
||||
global users
|
||||
|
@ -103,3 +109,5 @@ for line in play:
|
|||
if re.search('[\.|\?|!]$', next_message):
|
||||
send_message(next_character, next_message, subject)
|
||||
next_message = ''
|
||||
|
||||
print "Sent %s messages" % (num_messages_sent,)
|
||||
|
|
Loading…
Reference in New Issue