Many have already noticed that I spent my last days (aside from the ladder development) with a lobby bot entirely written in Lua.. It's logged-in as MelBot.
I started the project because I wanted some basic ladder commands in the #league and #tourney channels but I told myself: If I'm writing a bot, why not just make it right..
I tried to resemble the Lua stuff in Spring itself as much as possible so that people who write Lua stuff for Spring can easily write Lua stuff for the lobby..
Since widget and gadget were already taken, I decided to call my widgets "melons" as it sounds cool and contains "mel"

Here is an example of the melon that provides the !rank and !ladderlist commands:
Code: Select all
function melon:GetInfo()
return {
name = "Ladder",
desc = "Provides several commands to interface with the ladder API.",
author = "MelTraX"
}
end
function melon:Initialize()
bot:AddCommand("ladderlist", List, "displays a list of all ladders")
bot:AddCommand("rank", Rank, "displays the rank of a player - params: ladderID playername")
end
function List(from, params)
local content = http.request("http://www.spring-league.com/ladder/lobby/ladderlist.php")
if content ~= nil then
for word in string.gmatch(content, "([^\n]*)\n") do
bot:Reply(word)
end
end
end
function Rank(from, params)
if params == nil then
bot:Reply("Usage: !rank <ladderID> <playerName>")
else
local ladder, player = SplitParameters(params)
if ladder == nil or player == nil then
bot:Reply("Usage: !rank <ladderID> <playerName>")
return
end
local gets = "ladder=" .. ladder .. "&players[]=" .. player
local content = http.request("http://www.spring-league.com/ladder/lobby/ranking.php?" .. gets)
local name, rating, rank = SplitParameters(content)
bot:Reply(name .. " is on rank " .. rank .. " with a rating of " .. rating)
end
end
Code: Select all
Initialize()
Update(updates)
Said(channel, from, message)
GotPM(from, message)
Shutdown()
Code: Select all
Say(conn, channel, message)
PM(to, message)
AddCommand(cmd, func, desc)
AddHelpTopic(cmd, func, desc)
RemoveCommand(cmd)
Reply(message) - only available in Command functions
Stuff that's still missing are user, channel and battle callins and callouts..
If anyone is interested to write stuff for it or has suggestions what others should write for it, feel free to post here (or PM me in the lobby)..