Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Baxter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ def issue(section, issue)
end
return url
end
def commit(sections, hash)
actualresults = []
sections.each do |section|
actualsection = $urlhelpers[section]
url = "https://github.com/Multiverse/Multiverse-#{actualsection}/commit/#{hash}"
begin
doc = Nokogiri::HTML(open(url))
actualresults<<url
rescue OpenURI::HTTPError
end
end
return actualresults
end
def wiki(sections, search)
actualresults = []
sections.each do |section|
Expand Down Expand Up @@ -142,6 +155,24 @@ def latest(plugins)
end
end
end

on :message, /!commit-?([cpnsa])\s?:(.+)/i do |m, type, hash|
if m.channel.opped?(m.user) || m.channel.voiced?(m.user)
commitresults = commit([type], hash)
commitresults.each do |result|
m.reply(result)
end
end
end

on :message, /!commit\s?:(.+)/i do |m, hash|
if m.channel.opped?(m.user) || m.channel.voiced?(m.user)
commitresults = commit(["c", "p", "n", "s"], hash)
commitresults.each do |result|
m.reply(result)
end
end
end
end

bot.start
Expand Down