diff options
-rwxr-xr-x | async_bot.py | 2 | ||||
-rw-r--r-- | async_test.py | 25 | ||||
-rwxr-xr-x | ingrex/praser.py | 2 |
3 files changed, 27 insertions, 2 deletions
diff --git a/async_bot.py b/async_bot.py index 99c4560..5f33f7e 100755 --- a/async_bot.py +++ b/async_bot.py | |||
@@ -135,7 +135,7 @@ def send_message(bot, message, monitor=False): | |||
135 | if monitor is True: | 135 | if monitor is True: |
136 | bot.sendMessage(chat_id="@voamonitor", text=message) | 136 | bot.sendMessage(chat_id="@voamonitor", text=message) |
137 | else: | 137 | else: |
138 | bot.sendMessage(chat_id=CHANNEL_NAME, text=urllib.parse.quote(message)) | 138 | bot.sendMessage(chat_id=CHANNEL_NAME, text=message) |
139 | logger.info(get_time() + ": sendMsg " + message) | 139 | logger.info(get_time() + ": sendMsg " + message) |
140 | break | 140 | break |
141 | except telegram.TelegramError: | 141 | except telegram.TelegramError: |
diff --git a/async_test.py b/async_test.py new file mode 100644 index 0000000..41f5cd7 --- /dev/null +++ b/async_test.py | |||
@@ -0,0 +1,25 @@ | |||
1 | ''' | ||
2 | import aiohttp | ||
3 | import asyncio | ||
4 | import async_timeout | ||
5 | |||
6 | async def fetch(session, url): | ||
7 | with async_timeout.timeout(10): | ||
8 | async with session.get(url) as response: | ||
9 | return await response.text() | ||
10 | |||
11 | async def main(loop): | ||
12 | async with aiohttp.ClientSession(loop=loop) as session: | ||
13 | html = await fetch(session, 'http://python.org') | ||
14 | print(html) | ||
15 | |||
16 | loop = asyncio.get_event_loop() | ||
17 | loop.run_until_complete(main(loop)) | ||
18 | ''' | ||
19 | |||
20 | |||
21 | import telegram | ||
22 | |||
23 | bot = telegram.Bot('243806890:AAEFw0bAA2E5hkxtprb7qGM7mZSlcevQs4Y') | ||
24 | |||
25 | bot.sendMessage(chat_id='-1001052481058', text="Hello") \ No newline at end of file | ||
diff --git a/ingrex/praser.py b/ingrex/praser.py index 1d2c03d..97057dd 100755 --- a/ingrex/praser.py +++ b/ingrex/praser.py | |||
@@ -63,4 +63,4 @@ class Message(object): | |||
63 | else: | 63 | else: |
64 | self.msg = '@' + self.msg | 64 | self.msg = '@' + self.msg |
65 | 65 | ||
66 | self.msg = self.time + self.msg | 66 | self.msg = self.time + ' ' + self.msg |