fix catnames with spaces

This commit is contained in:
bakatrouble 2020-02-13 01:18:17 +03:00
parent de70a4cf6a
commit d61f9bb6e4

View File

@ -38,21 +38,21 @@ class PingBotModuleConfig(TelegramBotModuleConfig):
return obj return obj
def i_am_handler(self, update: Update, ctx: CallbackContext): def i_am_handler(self, update: Update, ctx: CallbackContext):
_, category = update.effective_message.text.split() _, category = update.effective_message.text.split(maxsplit=1)
cat = self.get_category(update, category) cat = self.get_category(update, category)
cat.add_user(update.effective_user.id) cat.add_user(update.effective_user.id)
cat.save() cat.save()
update.effective_message.reply_text('Done') update.effective_message.reply_text('Done')
def i_am_not_handler(self, update: Update, ctx: CallbackContext): def i_am_not_handler(self, update: Update, ctx: CallbackContext):
_, category = update.effective_message.text.split() _, category = update.effective_message.text.split(maxsplit=1)
cat = self.get_category(update, category) cat = self.get_category(update, category)
cat.remove_user(update.effective_user.id) cat.remove_user(update.effective_user.id)
cat.save() cat.save()
update.effective_message.reply_text('Done') update.effective_message.reply_text('Done')
def ping_handler(self, update: Update, ctx: CallbackContext): def ping_handler(self, update: Update, ctx: CallbackContext):
_, category = update.effective_message.text.split() _, category = update.effective_message.text.split(maxsplit=1)
cat = self.get_category(update, category) cat = self.get_category(update, category)
if not cat.user_ids: if not cat.user_ids:
return update.effective_message.reply_text(self.no_users_text) return update.effective_message.reply_text(self.no_users_text)