Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: group chat #99

Merged
merged 3 commits into from
Dec 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion BotHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
# User commands
BOT_COMMAND_START = "start"
BOT_COMMAND_HELP = "help"
BOT_COMMAND_CHAT = "chat"
BOT_COMMAND_CHATGPT = "chatgpt"
BOT_COMMAND_EDGEGPT = "bing"
BOT_COMMAND_DALLE = "dalle"
Expand Down Expand Up @@ -611,6 +612,7 @@ def start_bot(self):
# User commands
self._application.add_handler(CaptionCommandHandler(BOT_COMMAND_START, self.bot_command_start))
self._application.add_handler(CaptionCommandHandler(BOT_COMMAND_HELP, self.bot_command_help))
self._application.add_handler(CaptionCommandHandler(BOT_COMMAND_CHAT, self.bot_message))
self._application.add_handler(CaptionCommandHandler(BOT_COMMAND_CHATGPT, self.bot_command_chatgpt))
self._application.add_handler(CaptionCommandHandler(BOT_COMMAND_EDGEGPT, self.bot_command_edgegpt))
self._application.add_handler(CaptionCommandHandler(BOT_COMMAND_DALLE, self.bot_command_dalle))
Expand All @@ -636,7 +638,7 @@ def start_bot(self):
self._application.add_handler(CommandHandler(BOT_COMMAND_ADMIN_BROADCAST, self.bot_command_broadcast))

# Unknown command -> send help
self._application.add_handler(MessageHandler(filters.COMMAND, self.bot_command_help))
self._application.add_handler(MessageHandler(filters.COMMAND, self.bot_command_unknown))

# Add buttons handler
self._application.add_handler(CallbackQueryHandler(self.query_callback))
Expand Down Expand Up @@ -1632,6 +1634,17 @@ async def bot_command_or_message_request_raw(self, request_type: int,
context,
reply_to_message_id=request_response.reply_message_id)

async def bot_command_unknown(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""
unknown command
:param update:
:param context:
:return:
"""
if update.effective_message.chat.type.lower() != "private":
return
await self.bot_command_help(update, context)

async def bot_command_help(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""
/help command
Expand Down
Loading