Updated plugin auth db name.
This commit is contained in:
parent
5c60824ff6
commit
91d9b29d29
3 changed files with 39 additions and 3 deletions
|
@ -44,7 +44,10 @@ function bot:OnChannelMessage(Username, Channel, Message)
|
|||
end
|
||||
|
||||
if not self._commands[Command] then
|
||||
Channel:Say("Unknown command '" .. Command .. "'.")
|
||||
local FellBack = hook.Call("bot.UnknownCommand", Username, Channel, Command, Arguments)
|
||||
if not FellBack then
|
||||
Channel:Say("Unknown command '" .. Command .. "'.")
|
||||
end
|
||||
else
|
||||
local CommandData = self._commands[Command]
|
||||
if #Arguments ~= CommandData.Arguments and CommandData.Arguments ~= -1 then
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
postgres = {}
|
||||
|
||||
plugin.AddHook('auth.GetLevel', 'GetLevel', function(Channel, Account)
|
||||
local DB = plugin.DBOpen('auth')
|
||||
local DB = plugin.DBOpen('main')
|
||||
local Query = DB:Query("select _level from _level where _account = ? and _channel = ?",
|
||||
Account, Channel.Name)
|
||||
for Row in Query do
|
||||
|
|
|
@ -12,6 +12,39 @@ plugin.AddCommand('at', 0, function(Username, Channel)
|
|||
if #Users == 0 then
|
||||
Channel:Say("Trochę Łotwa. Nawet zimnioka nie ma.")
|
||||
else
|
||||
Channel:Say(table.concat(Users, ','))
|
||||
Channel:Say(table.concat(Users, ', '))
|
||||
end
|
||||
end, "Show who's at the Warsaw Hackerspace.")
|
||||
|
||||
plugin.AddCommand('describe', 1, function(Username, Channel, Term)
|
||||
local db = plugin.DBOpen('main')
|
||||
local Header = false
|
||||
local Counter = 0
|
||||
for Row in db:Query('select _oid::text from _term where lower(_name) = lower(?);', Term) do
|
||||
local Oid = Row._oid
|
||||
for Row2 in db:Query('select _text from _entry where _term_oid = ?', Oid) do
|
||||
if not Header then
|
||||
Channel:Say(string.format('I heard "%s" is:', Term))
|
||||
Header = true
|
||||
end
|
||||
local Text = Row2._text
|
||||
Channel:Say(string.format('[%i] ', Counter) .. Text)
|
||||
Counter = Counter + 1
|
||||
end
|
||||
end
|
||||
if not Header then
|
||||
Channel:Say("No such term!")
|
||||
end
|
||||
|
||||
end, "Describe a saved term.")
|
||||
|
||||
plugin.AddHook('bot.UnknownCommand', 'DescribeTerm', function(Username, Channel, Command, Arguments)
|
||||
local db = plugin.DBOpen('main')
|
||||
for Row in db:Query('select _oid::text from _term where lower(_name) = lower(?);', Command) do
|
||||
local Oid = Row._oid
|
||||
for Row2 in db:Query('select _text from _entry where _term_oid = ? order by random() limit 1;', Oid) do
|
||||
Channel:Say(Row2._text)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue