Integriere Botan.io, der Key von Botan muss in die config.lua eingetragen werden.
Es wird nur der Name des Plugin geloggt, keine Befehle und auch keine Userdaten!
This commit is contained in:
34
otouto/plugins/botan.lua
Normal file
34
otouto/plugins/botan.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
local botan = {}
|
||||
|
||||
local https = require('ssl.https')
|
||||
local URL = require('socket.url')
|
||||
local redis = (loadfile "./otouto/redis.lua")()
|
||||
local utilities = require('otouto.utilities')
|
||||
local bindings = require('otouto.bindings')
|
||||
|
||||
function botan:init(config)
|
||||
if not config.botan_token then
|
||||
print('Missing config value: botan_token.')
|
||||
print('botan.lua will not be enabled.')
|
||||
return
|
||||
end
|
||||
botan.triggers = {
|
||||
"^/nil$"
|
||||
}
|
||||
end
|
||||
|
||||
local BASE_URL = 'https://api.botan.io/track'
|
||||
|
||||
function botan:appmetrica(text, token, plugin_name)
|
||||
https.request(BASE_URL..'/?token='..token..'&uid=1&name='..plugin_name)
|
||||
end
|
||||
|
||||
function botan:action(msg, config, matches, plugin_name)
|
||||
if not plugin_name then
|
||||
return
|
||||
end
|
||||
|
||||
botan:appmetrica(msg.text, config.botan_token, plugin_name)
|
||||
end
|
||||
|
||||
return botan
|
Reference in New Issue
Block a user