None
This commit is contained in:
parent
14e8e7f627
commit
3a3e2bb35c
30
func.py
Normal file
30
func.py
Normal file
@ -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),
|
21
main.py
21
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()
|
||||
|
Loading…
Reference in New Issue
Block a user