mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 20:41:21 -05:00
Gemini: Add 'enabled' config
This commit is contained in:
parent
a5b09877e0
commit
7a15ad97f6
@ -55,6 +55,15 @@ Gemini = conf.registerPlugin("Gemini")
|
|||||||
# conf.registerGlobalValue(Gemini, 'someConfigVariableName',
|
# conf.registerGlobalValue(Gemini, 'someConfigVariableName',
|
||||||
# registry.Boolean(False, _("""Help for 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(
|
conf.registerChannelValue(
|
||||||
Gemini,
|
Gemini,
|
||||||
"api_key",
|
"api_key",
|
||||||
|
@ -53,6 +53,8 @@ class Gemini(callbacks.Plugin):
|
|||||||
channel = msg.channel
|
channel = msg.channel
|
||||||
if not irc.isChannel(channel):
|
if not irc.isChannel(channel):
|
||||||
channel = msg.nick
|
channel = msg.nick
|
||||||
|
if not self.registryValue("enabled", msg.channel):
|
||||||
|
return
|
||||||
genai.configure(api_key=self.registryValue("api_key", msg.channel))
|
genai.configure(api_key=self.registryValue("api_key", msg.channel))
|
||||||
prompt = self.registryValue("prompt", msg.channel).replace("$botnick", irc.nick)
|
prompt = self.registryValue("prompt", msg.channel).replace("$botnick", irc.nick)
|
||||||
max_tokens = self.registryValue("max_tokens", msg.channel)
|
max_tokens = self.registryValue("max_tokens", msg.channel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user