Removed module
This commit is contained in:
@@ -3,29 +3,31 @@ script for telegram bot and its functions
|
||||
"""
|
||||
__author__ = "Florian Kellermann, Linus Eickhoff, Florian Kaiser"
|
||||
__date__ = "02.05.2022"
|
||||
__version__ = "0.0.1"
|
||||
__version__ = "0.0.1"
|
||||
__license__ = "None"
|
||||
|
||||
# main bot at http://t.me/guess_the_price_bot
|
||||
# debug bot at http://t.me/amazondebug_bot
|
||||
|
||||
from dotenv import load_dotenv
|
||||
import telebot
|
||||
from telebot import types
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
load_dotenv(dotenv_path='.env') # load environment variables
|
||||
import telebot
|
||||
from dotenv import load_dotenv
|
||||
from telebot import types
|
||||
|
||||
bot_version = "0.0.1" # version of bot
|
||||
from source.db import User, session
|
||||
|
||||
load_dotenv(dotenv_path='.env') # load environment variables
|
||||
|
||||
bot_version = "0.0.1" # version of bot
|
||||
|
||||
bot = telebot.TeleBot(os.getenv('BOT_API_KEY'))
|
||||
|
||||
@bot.message_handler(commands=['start', 'Start'])
|
||||
|
||||
@bot.message_handler(commands=['start', 'Start'])
|
||||
def send_start(message):
|
||||
|
||||
""" Sending welcome message to new user
|
||||
:type message: message object bot
|
||||
:param message: message that was reacted to, in this case always containing '/start'
|
||||
@@ -35,12 +37,13 @@ def send_start(message):
|
||||
:rtype: none
|
||||
"""
|
||||
bot.reply_to(message, "Welcome to this amazon prices guesser bot")
|
||||
|
||||
|
||||
|
||||
telebot.logger.setLevel(logging.DEBUG)
|
||||
|
||||
@bot.inline_handler(lambda query: query.query == 'text') # inline prints for debugging
|
||||
|
||||
|
||||
@bot.inline_handler(lambda query: query.query == 'text') # inline prints for debugging
|
||||
def query_text(inline_query):
|
||||
|
||||
""" Output in the console about current user actions and status of bot
|
||||
:type inline_query:
|
||||
:param inline_query:
|
||||
@@ -56,8 +59,8 @@ def query_text(inline_query):
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
def main_loop():
|
||||
|
||||
""" Start bot
|
||||
:raises: none
|
||||
|
||||
@@ -65,9 +68,10 @@ def main_loop():
|
||||
"""
|
||||
bot.infinity_polling()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main_loop()
|
||||
except KeyboardInterrupt:
|
||||
print('\nExiting by user request.\n')
|
||||
sys.exit(0)
|
||||
sys.exit(0)
|
||||
|
Reference in New Issue
Block a user