]> jfr.im git - irc/quakenet/newserv.git/commitdiff
LUALIB: allow achievement send to take longs.
authorChris Porter <redacted>
Sun, 28 Mar 2010 00:57:51 +0000 (00:57 +0000)
committerChris Porter <redacted>
Sun, 28 Mar 2010 00:57:51 +0000 (00:57 +0000)
lua/lib/quakenet/achievements.lua

index 04f7babee37dc0946a5568624db3ac4365713ab7..e3c59e11db1d2724a426be1363a2ef6f418d349f 100644 (file)
@@ -5,17 +5,27 @@ Achievements = class(function(obj, bot_id, types)
   obj.types = types
 end)
 
-function Achievements:send(nick, type, ...)
+function Achievements:send(nick, achievement, ...)
   local extra = ...
   if not extra then
     extra = 0
   end
 
-  local ntype = self.types[type]
+  local ntype = self.types[achievement]
   if ntype then
-    type = ntype
+    achievement = ntype
   end
 
-  local user_numeric = irc_numerictobase64(nick.numeric)
-  irc_privmsg("C", "EXTACH " .. user_numeric .. " " .. self.bot_id .. " " .. type .. " " .. extra)
+  local user_numeric
+  if type(nick) == "table" then
+    user_numeric = irc_numerictobase64(nick.numeric)
+  else -- assume it's a numeric
+    user_numeric = irc_numerictobase64(nick)
+  end
+  
+  if not user_numeric then
+    return
+  end
+
+  irc_privmsg("C", "EXTACH " .. user_numeric .. " " .. self.bot_id .. " " .. achievement .. " " .. extra)
 end