From 4d0b375579ab59d3c534d397b744d40cc6d63df5 Mon Sep 17 00:00:00 2001 From: Nick Lee Date: Sat, 6 Feb 2016 13:17:00 +0800 Subject: [PATCH] Changed glance2() to glance() --- examples/chatbox_nodb.py | 4 ++-- examples/chatboxa_nodb.py | 4 ++-- examples/emodi.py | 2 +- examples/emodia.py | 2 +- examples/guess.py | 2 +- examples/guessa.py | 2 +- examples/inline.py | 4 ++-- examples/inlinea.py | 4 ++-- examples/pairing.py | 6 +++--- examples/pairinga.py | 6 +++--- examples/skeleton.py | 6 +++--- examples/skeleton_extend.py | 6 +++--- examples/skeletona.py | 6 +++--- examples/skeletona_extend.py | 6 +++--- examples/tracker.py | 2 +- examples/trackera.py | 2 +- examples/webhook_aiohttp_skeletona.py | 6 +++--- examples/webhook_flask_deeplinking.py | 2 +- examples/webhook_flask_skeleton.py | 6 +++--- 19 files changed, 39 insertions(+), 39 deletions(-) diff --git a/examples/chatbox_nodb.py b/examples/chatbox_nodb.py index 60ad3b9..4357479 100644 --- a/examples/chatbox_nodb.py +++ b/examples/chatbox_nodb.py @@ -61,7 +61,7 @@ def _read_messages(self, messages): self.sender.sendMessage(msg['text']) def on_message(self, msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) if content_type != 'text': self.sender.sendMessage("I don't understand") @@ -110,7 +110,7 @@ def __init__(self, seed_tuple, store, exclude): # Store every message, except those whose sender is in the exclude list, or non-text messages. def on_message(self, msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) if chat_id in self._exclude: print('Chat id %d is excluded.' % chat_id) diff --git a/examples/chatboxa_nodb.py b/examples/chatboxa_nodb.py index 1aab4aa..7b6fad3 100644 --- a/examples/chatboxa_nodb.py +++ b/examples/chatboxa_nodb.py @@ -66,7 +66,7 @@ def _read_messages(self, messages): @asyncio.coroutine def on_message(self, msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) if content_type != 'text': yield from self.sender.sendMessage("I don't understand") @@ -115,7 +115,7 @@ def __init__(self, seed_tuple, store, exclude): # Store every message, except those whose sender is in the exclude list, or non-text messages. def on_message(self, msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) if chat_id in self._exclude: print('Chat id %d is excluded.' % chat_id) diff --git a/examples/emodi.py b/examples/emodi.py index cad4354..3d048f4 100644 --- a/examples/emodi.py +++ b/examples/emodi.py @@ -15,7 +15,7 @@ """ def handle(msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) m = telepot.namedtuple.namedtuple(msg, 'Message') if chat_id < 0: diff --git a/examples/emodia.py b/examples/emodia.py index af8c27b..4c574e7 100644 --- a/examples/emodia.py +++ b/examples/emodia.py @@ -30,7 +30,7 @@ @asyncio.coroutine def handle(msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) m = telepot.namedtuple.namedtuple(msg, 'Message') if chat_id < 0: diff --git a/examples/guess.py b/examples/guess.py index 2bdae94..d580a30 100644 --- a/examples/guess.py +++ b/examples/guess.py @@ -31,7 +31,7 @@ def open(self, initial_msg, seed): return True # prevent on_message() from being called on the initial message def on_message(self, msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) if content_type != 'text': self.sender.sendMessage('Give me a number, please.') diff --git a/examples/guessa.py b/examples/guessa.py index eed8365..7720493 100644 --- a/examples/guessa.py +++ b/examples/guessa.py @@ -35,7 +35,7 @@ def open(self, initial_msg, seed): @asyncio.coroutine def on_message(self, msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) if content_type != 'text': yield from self.sender.sendMessage('Give me a number, please.') diff --git a/examples/inline.py b/examples/inline.py index d15a5fe..386ae21 100644 --- a/examples/inline.py +++ b/examples/inline.py @@ -16,7 +16,7 @@ def on_message(self, msg): flavor = telepot.flavor(msg) if flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print(self.id, ':', 'Inline Query:', query_id, from_id, query_string) articles = [{'type': 'article', @@ -26,7 +26,7 @@ def on_message(self, msg): print(self.id, ':', 'Answers sent.') elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print(self.id, ':', 'Chosen Inline Result:', result_id, from_id, query_string) diff --git a/examples/inlinea.py b/examples/inlinea.py index 6958787..37a2db7 100644 --- a/examples/inlinea.py +++ b/examples/inlinea.py @@ -19,7 +19,7 @@ def on_message(self, msg): flavor = telepot.flavor(msg) if flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print(self.id, ':', 'Inline Query:', query_id, from_id, query_string) articles = [{'type': 'article', @@ -29,7 +29,7 @@ def on_message(self, msg): print(self.id, ':', 'Answers sent.') elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print(self.id, ':', 'Chosen Inline Result:', result_id, from_id, query_string) diff --git a/examples/pairing.py b/examples/pairing.py index ee28a34..5303db0 100644 --- a/examples/pairing.py +++ b/examples/pairing.py @@ -17,7 +17,7 @@ def __init__(self, seed_tuple, timeout): def on_message(self, msg): self._count += 1 - print '%s %d: %d: %s' % (type(self).__name__, self.id, self._count, telepot.glance2(msg, flavor='normal')) + print '%s %d: %d: %s' % (type(self).__name__, self.id, self._count, telepot.glance(msg, flavor='normal')) def on_close(self, exception): print '%s %d: closed' % (type(self).__name__, self.id) @@ -32,7 +32,7 @@ def on_message(self, msg): self._count += 1 flavor = telepot.flavor(msg) - print '%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance2(msg, flavor=flavor)) + print '%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance(msg, flavor=flavor)) def on_close(self, exception): print '%s %d: closed' % (type(self).__name__, self.id) @@ -47,7 +47,7 @@ def on_message(self, msg): self._count += 1 flavor = telepot.flavor(msg) - print '%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance2(msg, flavor=flavor)) + print '%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance(msg, flavor=flavor)) def on_close(self, exception): print '%s %d: closed' % (type(self).__name__, self.id) diff --git a/examples/pairinga.py b/examples/pairinga.py index cf7f79c..e9986d9 100644 --- a/examples/pairinga.py +++ b/examples/pairinga.py @@ -20,7 +20,7 @@ def __init__(self, seed_tuple, timeout): def on_message(self, msg): self._count += 1 - print('%s %d: %d: %s' % (type(self).__name__, self.id, self._count, telepot.glance2(msg, flavor='normal'))) + print('%s %d: %d: %s' % (type(self).__name__, self.id, self._count, telepot.glance(msg, flavor='normal'))) def on_close(self, exception): print('%s %d: closed' % (type(self).__name__, self.id)) @@ -35,7 +35,7 @@ def on_message(self, msg): self._count += 1 flavor = telepot.flavor(msg) - print('%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance2(msg, flavor=flavor))) + print('%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance(msg, flavor=flavor))) def on_close(self, exception): print('%s %d: closed' % (type(self).__name__, self.id)) @@ -50,7 +50,7 @@ def on_message(self, msg): self._count += 1 flavor = telepot.flavor(msg) - print('%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance2(msg, flavor=flavor))) + print('%s %d: %d: %s: %s' % (type(self).__name__, self.id, self._count, flavor, telepot.glance(msg, flavor=flavor))) def on_close(self, exception): print('%s %d: closed' % (type(self).__name__, self.id)) diff --git a/examples/skeleton.py b/examples/skeleton.py index e0094e4..971d0ab 100644 --- a/examples/skeleton.py +++ b/examples/skeleton.py @@ -13,14 +13,14 @@ def handle(msg): # normal message if flavor == 'normal': - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) print 'Normal Message:', content_type, chat_type, chat_id # Do your stuff according to `content_type` ... # inline query - need `/setinline` elif flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print 'Inline Query:', query_id, from_id, query_string # Compose your own answers @@ -31,7 +31,7 @@ def handle(msg): # chosen inline result - need `/setinlinefeedback` elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print 'Chosen Inline Result:', result_id, from_id, query_string # Remember the chosen answer to do better next time diff --git a/examples/skeleton_extend.py b/examples/skeleton_extend.py index 1572fab..0429e60 100644 --- a/examples/skeleton_extend.py +++ b/examples/skeleton_extend.py @@ -14,14 +14,14 @@ def handle(self, msg): # normal message if flavor == 'normal': - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) print('Normal Message:', content_type, chat_type, chat_id) # Do your stuff according to `content_type` ... # inline query - need `/setinline` elif flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Inline Query:', query_id, from_id, query_string) # Compose your own answers @@ -32,7 +32,7 @@ def handle(self, msg): # chosen inline result - need `/setinlinefeedback` elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Chosen Inline Result:', result_id, from_id, query_string) # Remember the chosen answer to do better next time diff --git a/examples/skeletona.py b/examples/skeletona.py index 1d19d19..acf94c5 100644 --- a/examples/skeletona.py +++ b/examples/skeletona.py @@ -15,14 +15,14 @@ def handle(msg): # normal message if flavor == 'normal': - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) print('Normal Message:', content_type, chat_type, chat_id) # Do your stuff according to `content_type` ... # inline query - need `/setinline` elif flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Inline Query:', query_id, from_id, query_string) # Compose your own answers @@ -33,7 +33,7 @@ def handle(msg): # chosen inline result - need `/setinlinefeedback` elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Chosen Inline Result:', result_id, from_id, query_string) # Remember the chosen answer to do better next time diff --git a/examples/skeletona_extend.py b/examples/skeletona_extend.py index 4e7e12c..8301943 100644 --- a/examples/skeletona_extend.py +++ b/examples/skeletona_extend.py @@ -16,14 +16,14 @@ def handle(self, msg): # normal message if flavor == 'normal': - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) print('Normal Message:', content_type, chat_type, chat_id) # Do your stuff according to `content_type` ... # inline query - need `/setinline` elif flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Inline Query:', query_id, from_id, query_string) # Compose your own answers @@ -34,7 +34,7 @@ def handle(self, msg): # chosen inline result - need `/setinlinefeedback` elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Chosen Inline Result:', result_id, from_id, query_string) # Remember the chosen answer to do better next time diff --git a/examples/tracker.py b/examples/tracker.py index cbdffa1..8f8de00 100644 --- a/examples/tracker.py +++ b/examples/tracker.py @@ -25,7 +25,7 @@ def on_message(self, msg): # Have to answer inline query to receive chosen result if flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) articles = [{'type': 'article', 'id': 'abc', 'title': 'ABC', 'message_text': 'Good morning'}] diff --git a/examples/trackera.py b/examples/trackera.py index 1a687de..71a1726 100644 --- a/examples/trackera.py +++ b/examples/trackera.py @@ -28,7 +28,7 @@ def on_message(self, msg): # Have to answer inline query to receive chosen result if flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) articles = [{'type': 'article', 'id': 'abc', 'title': 'ABC', 'message_text': 'Good morning'}] diff --git a/examples/webhook_aiohttp_skeletona.py b/examples/webhook_aiohttp_skeletona.py index 46dabc2..311c014 100644 --- a/examples/webhook_aiohttp_skeletona.py +++ b/examples/webhook_aiohttp_skeletona.py @@ -14,14 +14,14 @@ def handle(msg): # normal message if flavor == 'normal': - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) print('Normal Message:', content_type, chat_type, chat_id) # Do your stuff according to `content_type` ... # inline query - need `/setinline` elif flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Inline Query:', query_id, from_id, query_string) # Compose your own answers @@ -32,7 +32,7 @@ def handle(msg): # chosen inline result - need `/setinlinefeedback` elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print('Chosen Inline Result:', result_id, from_id, query_string) # Remember the chosen answer to do better next time diff --git a/examples/webhook_flask_deeplinking.py b/examples/webhook_flask_deeplinking.py index 66389aa..4fd975e 100644 --- a/examples/webhook_flask_deeplinking.py +++ b/examples/webhook_flask_deeplinking.py @@ -22,7 +22,7 @@ key_id_map = { 'ghijk' : 123 } def handle(msg): - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) print 'Normal Message:', content_type, chat_type, chat_id if content_type == 'text': diff --git a/examples/webhook_flask_skeleton.py b/examples/webhook_flask_skeleton.py index 416bd2f..0ef001b 100644 --- a/examples/webhook_flask_skeleton.py +++ b/examples/webhook_flask_skeleton.py @@ -16,14 +16,14 @@ def handle(msg): # normal message if flavor == 'normal': - content_type, chat_type, chat_id = telepot.glance2(msg) + content_type, chat_type, chat_id = telepot.glance(msg) print 'Normal Message:', content_type, chat_type, chat_id # Do your stuff according to `content_type` ... # inline query - need `/setinline` elif flavor == 'inline_query': - query_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + query_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print 'Inline Query:', query_id, from_id, query_string # Compose your own answers @@ -34,7 +34,7 @@ def handle(msg): # chosen inline result - need `/setinlinefeedback` elif flavor == 'chosen_inline_result': - result_id, from_id, query_string = telepot.glance2(msg, flavor=flavor) + result_id, from_id, query_string = telepot.glance(msg, flavor=flavor) print 'Chosen Inline Result:', result_id, from_id, query_string # Remember the chosen answer to do better next time