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

This commit is contained in:
Joakim Hellsén 2024-12-30 01:38:56 +01:00
commit 0c20e496c1
No known key found for this signature in database
GPG key ID: D196AE66FEBE1DC9
5 changed files with 159 additions and 136 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.