diff --git a/config.py b/config.py index f9ac699..a66a62f 100644 --- a/config.py +++ b/config.py @@ -1 +1 @@ -TOKEN = "1749418611:AAGOV2XB5mkMXqX-J_wtNu7KkrkhO_Xylmg" +TOKEN = "1749418611:AAGOV2XB5mkMXqX-J_wtNu7KkrkhO_Xylmg" \ No newline at end of file diff --git a/func.py b/func.py new file mode 100644 index 0000000..8281c0f --- /dev/null +++ b/func.py @@ -0,0 +1,30 @@ +import datetime +import threading + +import telegram +from telegram import InlineKeyboardMarkup, InlineKeyboardButton, ForceReply +from telegram.ext import CommandHandler, MessageHandler, Filters, ConversationHandler, CallbackQueryHandler +from config import TOKEN +import sqlite3 +import time +import os +import importlib +import requests + +bot = telegram.Bot(token=TOKEN) + + +def start(update, context): + print('进入start函数') + update.message.reply_text( + '您好!', + ) + + +def chat_content_exec(update, context): + chat_id = update.effective_message.chat_id + print(chat_id) + + +start_handler = CommandHandler('start', start) +chat_content_handler = MessageHandler(Filters.text, chat_content_exec), diff --git a/main.py b/main.py index 0a228e0..b1087ee 100644 --- a/main.py +++ b/main.py @@ -2,30 +2,13 @@ from telegram.ext import Updater from config import TOKEN from telegram import InlineKeyboardMarkup, InlineKeyboardButton, ForceReply from telegram.ext import CommandHandler, MessageHandler, Filters, ConversationHandler, CallbackQueryHandler -import sqlite3 -from func import start, reserve, run, kill, status, update, get - +from func import start_handler, chat_content_handler updater = Updater(token=TOKEN, use_context=True) dispatcher = updater.dispatcher - -start_handler = CommandHandler('start', start) -reserve_handler = CommandHandler('reserve', reserve) -run_handler = CommandHandler('run', run) -kill_handler = CommandHandler('kill', kill) -update_handler = CommandHandler('update', update) -status_handler = CommandHandler('status', status) -get_handler = CommandHandler('get', get) - - dispatcher.add_handler(start_handler) -dispatcher.add_handler(reserve_handler) -dispatcher.add_handler(run_handler) -dispatcher.add_handler(kill_handler) -dispatcher.add_handler(update_handler) -dispatcher.add_handler(status_handler) -dispatcher.add_handler(get_handler) +dispatcher.add_handler(chat_content_handler) updater.start_polling() updater.idle()