Created new debugging bot and fixed code in bot.py to be working again. Also inserted new functions
This commit is contained in:
@@ -22,20 +22,30 @@ bot = telebot.TeleBot(os.getenv('BOT_API_KEY'))
|
||||
|
||||
@bot.message_handler(commands=['start']) # /start -> saving as new user and sending welcome
|
||||
def send_start(message):
|
||||
new_user = User(int(message.from_user.id), int(message.chat.id))
|
||||
new_user = User(int(message.from_user.id), message.from_user.first_name, int(message.chat.id))
|
||||
existing_already = False
|
||||
for known_user in user_list:
|
||||
if known_user.user_id == new_user.user_id:
|
||||
existing_already = True
|
||||
if existing_already == False:
|
||||
user_list.add(new_user)
|
||||
user_list.append(new_user)
|
||||
|
||||
bot.reply_to(message, "Welcome to this share bot project. Type /help to get information on what this bot can do")
|
||||
|
||||
|
||||
@bot.message_handler(commands=['help']) # /help -> sending all functions
|
||||
def send_welcome(message):
|
||||
bot.reply_to(message, "/id or /auth for authentication. /update to get updates on your shares. For further details see aktienbot.flokaiser.com")
|
||||
bot.reply_to(message, "/id or /auth for authentication. /update to get updates on your shares. /users to see all users. For further details see aktienbot.flokaiser.com")
|
||||
|
||||
@bot.message_handler(commands=['users'])
|
||||
def send_all_users(message):
|
||||
print('Debug: users command')
|
||||
user_id = int(message.from_user.id)
|
||||
answer = 'Current number of users: ' + str(len(user_list))
|
||||
bot.send_message(chat_id = user_id, text=answer)
|
||||
for known_user in user_list:
|
||||
answer = str(known_user.user_id) + ' : ' + known_user.user_name
|
||||
bot.send_message(chat_id=user_id, text=answer)
|
||||
|
||||
|
||||
@bot.message_handler(commands=['id', 'auth']) # /auth or /id -> Authentication with user_id over web tool
|
||||
@@ -56,6 +66,7 @@ def echo_all(message):
|
||||
answer = 'Do not know this command or text: ' + message.text
|
||||
bot.reply_to(message, answer)
|
||||
|
||||
|
||||
telebot.logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user