44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
# [ IMPORTS ] #
|
|
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
|
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes, CallbackQueryHandler, Application
|
|
import configparser
|
|
import json
|
|
import os
|
|
|
|
# other files in here
|
|
from errors import *
|
|
from commands_admin import *
|
|
from commands_user import *
|
|
from handler_participant_lists import *
|
|
from log import *
|
|
|
|
#############################################
|
|
# [ CONFIG FILES ] #
|
|
|
|
# Konfiguration
|
|
config = configparser.ConfigParser()
|
|
config.read('telegram_bot_token.cfg')
|
|
config.read('telegram_bot_config.cfg')
|
|
print("Configs loaded.")
|
|
|
|
#############################################
|
|
# [ MAIN LOOP ] #
|
|
|
|
def main():
|
|
app = ApplicationBuilder().token(config['telegram']['bot_token']).build()
|
|
|
|
# Admin commands
|
|
app.add_handler(CommandHandler("newEvent", newEvent))
|
|
|
|
# User commands
|
|
# app.add_handler(CommandHandler("start", start))
|
|
|
|
# buttons
|
|
app.add_handler(CallbackQueryHandler(button))
|
|
|
|
print("Bot läuft...")
|
|
app.run_polling()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|