Gemini: Add 'enabled' config

This commit is contained in:
Gordon Shumway 2024-08-14 13:00:24 -04:00 committed by GitHub
parent a5b09877e0
commit 7a15ad97f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -55,6 +55,15 @@ Gemini = conf.registerPlugin("Gemini")
# conf.registerGlobalValue(Gemini, 'someConfigVariableName',
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
conf.registerChannelValue(
Gemini,
"enabled",
registry.Boolean(
True,
_("""Set False to disable the plugin, True to enable."""),
),
)
conf.registerChannelValue(
Gemini,
"api_key",

View File

@ -53,6 +53,8 @@ class Gemini(callbacks.Plugin):
channel = msg.channel
if not irc.isChannel(channel):
channel = msg.nick
if not self.registryValue("enabled", msg.channel):
return
genai.configure(api_key=self.registryValue("api_key", msg.channel))
prompt = self.registryValue("prompt", msg.channel).replace("$botnick", irc.nick)
max_tokens = self.registryValue("max_tokens", msg.channel)