Update /dalle, /translate; Add /craiyon, /gpt; More restructuring

This commit is contained in:
2024-06-20 01:45:51 +02:00
parent 4c403e516b
commit 7d426e9497
14 changed files with 296 additions and 236 deletions

View File

@ -5,16 +5,16 @@
import hashlib
def cHash(context, data) -> None:
def cHash(context:EventContext, data:InputMessageData) -> None:
algorithm = data.command.arguments["algorithm"]
if data.command.body and algorithm in hashlib.algorithms_available:
hashed = hashlib.new(algorithm, algorithm.join(data.Body.split(algorithm)[1:]).strip().encode()).hexdigest()
SendMsg(context, {
hashed = hashlib.new(algorithm, data.command.body.encode()).hexdigest()
SendMessage(context, {
"TextPlain": hashed,
"TextMarkdown": MarkdownCode(hashed, True),
})
else:
SendMsg(context, {"Text": choice(Locale.__('hash.usage')).format(data.command.tokens[0], hashlib.algorithms_available)})
SendMessage(context, {"Text": choice(Locale.__('hash.usage')).format(data.command.tokens[0], hashlib.algorithms_available)})
RegisterModule(name="Hashing", group="Geek", summary="Functions for hashing of textual content.", endpoints={
"Hash": CreateEndpoint(names=["hash"], summary="Responds with the hash-sum of a message received.", handler=cHash, arguments={