fixed chat chooser

This commit is contained in:
Kylmakalle 2017-09-09 22:12:38 +03:00
parent f1659018df
commit 8afba01113

12
bot.py
View File

@ -1,25 +1,20 @@
import cherrypy
import logging import logging
import os import os
import re import re
import redis
import requests import requests
import telebot import telebot
import threading import threading
import time import time
import traceback import traceback
import ujson import ujson
from telebot import types
import redis
import vk import vk
import wget import wget
from PIL import Image from PIL import Image
from telebot import types from telebot import types
import cherrypy
from credentials import token, vk_app_id, bot_url, local_port from credentials import token, vk_app_id, bot_url, local_port
from vk_messages import VkMessage, VkPolling from vk_messages import VkMessage, VkPolling
vk_threads = {} vk_threads = {}
@ -183,7 +178,7 @@ def callback_buttons(call):
bot.send_message(call.from_user.id, bot.send_message(call.from_user.id,
'<i>Вы в беседе {}</i>'.format(chat['title']), '<i>Вы в беседе {}</i>'.format(chat['title']),
parse_mode='HTML').wait() parse_mode='HTML').wait()
currentchat[str(call.from_user.id)] = call.data currentchat[str(call.from_user.id)] = {'title': chat['title'], 'id': 'group' + str(chat['chat_id'])}
elif call.data.lstrip('-').isdigit(): elif call.data.lstrip('-').isdigit():
session = VkMessage(vk_tokens.get(str(call.from_user.id))).session session = VkMessage(vk_tokens.get(str(call.from_user.id))).session
if '-' in call.data: if '-' in call.data:
@ -696,7 +691,6 @@ def reply_text(message):
# bot.polling(none_stop=True) # bot.polling(none_stop=True)
class WebhookServer(object): class WebhookServer(object):
# index равнозначно /, т.к. отсутствию части после ip-адреса (грубо говоря) # index равнозначно /, т.к. отсутствию части после ip-адреса (грубо говоря)
@cherrypy.expose @cherrypy.expose
def index(self): def index(self):