Use discord.py instead of Hikari so we can use user commands

This commit is contained in:
2024-12-30 01:38:56 +01:00
parent e27d043e2c
commit 0c20e496c1
5 changed files with 160 additions and 137 deletions

13
misc.py
View File

@ -4,7 +4,6 @@ import logging
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import hikari
from openai import OpenAI
from openai.types.chat.chat_completion import ChatCompletion
@ -28,18 +27,6 @@ def get_allowed_users() -> list[str]:
]
def get_trigger_keywords(bot: hikari.GatewayBotAware) -> list[str]:
"""Get the list of trigger keywords to respond to.
Returns:
The list of trigger keywords.
"""
bot_user: hikari.OwnUser | None = bot.get_me()
bot_mention_string: str = f"<@{bot_user.id}>" if bot_user else ""
notification_keywords: list[str] = ["lovibot", bot_mention_string]
return notification_keywords
def chat(user_message: str, openai_client: OpenAI) -> str | None:
"""Chat with the bot using the OpenAI API.