run start
This commit is contained in:
		| @@ -40,6 +40,7 @@ def setup(update: Update, context: CallbackContext): | |||||||
|   loadConfig() |   loadConfig() | ||||||
|   logging.info("Bot claimed by " + config['name'] + ".") |   logging.info("Bot claimed by " + config['name'] + ".") | ||||||
|   context.bot.sendMessage(chat_id=update.effective_chat.id, text='You just claimed this bot, ' + config['name'] + '.') |   context.bot.sendMessage(chat_id=update.effective_chat.id, text='You just claimed this bot, ' + config['name'] + '.') | ||||||
|  |   start(update, context) | ||||||
|  |  | ||||||
| def setName(update: Update, context: CallbackContext): | def setName(update: Update, context: CallbackContext): | ||||||
|   if(context.args): |   if(context.args): | ||||||
| @@ -104,7 +105,24 @@ def unblock(update: Update, context: CallbackContext): | |||||||
|  |  | ||||||
|  |  | ||||||
| def start(update: Update, context: CallbackContext): | def start(update: Update, context: CallbackContext): | ||||||
|  |   commandsList = [] | ||||||
|  |   commandsList.append(BotCommand(command='start', description='Information about this bot.')) | ||||||
|  |   if('name' in config): | ||||||
|  |     commandsList.append(BotCommand(command='request', description='Send a contact request to ' + config['name'])) | ||||||
|  |     if(isAdmin): | ||||||
|  |       commandsList.append(BotCommand(command='block', description='Admin: Block a user. ID required. /block {ID}')) | ||||||
|  |       commandsList.append(BotCommand(command='unblock', description='Admin: Unblock a user. ID required. /unblock {ID}')) | ||||||
|  |       commandsList.append(BotCommand(command='blocklist', description='Admin: List the blocked IDs.')) | ||||||
|  |       commandsList.append(BotCommand(command='setname', description='Admin: Set your name for information purposes. /setname {name}')) | ||||||
|  |  | ||||||
|  |   if('adminID' not in config): | ||||||
|  |     dispatcher.add_handler(CommandHandler('setup', setup)) | ||||||
|  |     commandsList.append(BotCommand(command='setup', description='Set yourself up as owner.')) | ||||||
|  |  | ||||||
|  |   bot.set_my_commands(commands=commandsList)  | ||||||
|  |  | ||||||
|   reply_markup=telegram.ReplyKeyboardRemove() |   reply_markup=telegram.ReplyKeyboardRemove() | ||||||
|  |  | ||||||
|   if('name' in config): |   if('name' in config): | ||||||
|     context.bot.sendMessage(chat_id=update.effective_chat.id, text="Hello! " + config['name'] + " has set up a contact protection bot. To request contact, type /request.", reply_markup=reply_markup) |     context.bot.sendMessage(chat_id=update.effective_chat.id, text="Hello! " + config['name'] + " has set up a contact protection bot. To request contact, type /request.", reply_markup=reply_markup) | ||||||
|   else: |   else: | ||||||
| @@ -153,24 +171,6 @@ def request(update: Update, context: CallbackContext): | |||||||
|  |  | ||||||
| loadConfig() | loadConfig() | ||||||
|  |  | ||||||
| commandsList = [] |  | ||||||
| commandsList.append(BotCommand(command='start', description='Information about this bot.')) |  | ||||||
| if('name' in config): |  | ||||||
|   commandsList.append(BotCommand(command='request', description='Send a contact request to ' + config['name'])) |  | ||||||
|   commandsList.append(BotCommand(command='block', description='Admin: Block a user. ID required. /block {ID}')) |  | ||||||
|   commandsList.append(BotCommand(command='unblock', description='Admin: Unblock a user. ID required. /unblock {ID}')) |  | ||||||
|   commandsList.append(BotCommand(command='blocklist', description='Admin: List the blocked IDs.')) |  | ||||||
|   commandsList.append(BotCommand(command='setname', description='Admin: Set your name for information purposes. /setname {name}')) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| if('adminID' not in config): |  | ||||||
|   dispatcher.add_handler(CommandHandler('setup', setup)) |  | ||||||
|   commandsList.append(BotCommand(command='setup', description='Set yourself up as owner.')) |  | ||||||
|  |  | ||||||
| bot.set_my_commands(commands=commandsList)  |  | ||||||
|  |  | ||||||
| dispatcher.add_handler(CommandHandler('start', start)) | dispatcher.add_handler(CommandHandler('start', start)) | ||||||
| dispatcher.add_handler(CommandHandler('block', block)) | dispatcher.add_handler(CommandHandler('block', block)) | ||||||
| dispatcher.add_handler(CommandHandler('blocklist', listBlacklist)) | dispatcher.add_handler(CommandHandler('blocklist', listBlacklist)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user