This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on :message, /https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)/i do |m, message| | |
| url = message.to_s | |
| doc = Nokogiri::HTML(open(url)) | |
| user = doc.at_css("span.username.js-action-profile-name b").text | |
| status = doc.xpath("//div[3]/div/div/div/div/p").text[/\S(.+)/] | |
| message = "Twitter | @#{user}: #{status}" | |
| m.reply message | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.9.3-p327 :028 > m = messages.including("logs") | |
| => #<TamTam::MessageSet:0x3ffe16067918 size=2> | |
| 1.9.3-p327 :029 > m.by_count | |
| => {"logs, man"=>1, "all the logs"=>1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on :message, do |message| | |
| messagevar = message.to_s | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'cinch' | |
| require 'cinch/plugins/AccidentalHaiku' | |
| require 'cinch/plugins/CleverBot' | |
| require 'Nokogiri' | |
| require 'open-uri' | |
| bot = Cinch::Bot.new do | |
| configure do |c| | |
| c.server = "irc.freenode.org" | |
| #c.port = "7667" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #requires -version 2.0 | |
| # handy global variables | |
| $GLOBAL:SMADLL = ([appdomain]::CurrentDomain.getassemblies()|?{$_.location -match "System.Management.Automation.dll"}).location | |
| # $GLOBAL:SMDIR = (Get-ItemProperty 'hklm:/software/microsoft/System Center/2010/Service Manager/Setup').InstallDirectory | |
| # $GLOBAL:SMSDKDIR = "${SMDIR}\SDK Binaries" | |
| # $GLOBAL:SMDLL = "${SMSDKDIR}/Microsoft.EnterpriseManagement.Core.dll" | |
| $GLOBAL:EMGTYPE = "Microsoft.EnterpriseManagement.EnterpriseManagementGroup" | |
| $GLOBAL:DATAGENDIR = "$psScriptRoot\DataGen" | |
| $GLOBAL:SMDEFAULTCOMPUTER = "US-DC-SCSM-01" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'Nokogiri' | |
| require 'open-uri | |
| # current regex string matches too much stuff. Trying https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)$ instead | |
| on :message, /(\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i do |m, message| | |
| # on :message, /https?:\/\/(www.)?twitter.com(.+)\W/i do |m, message| | |
| url = message.to_s | |
| doc = Nokogiri::HTML(open(url)) | |
| user = doc.at_css("span.username.js-action-profile-name b").text | |
| status = doc.xpath("//div[3]/div/div/div/div/p").text[/\S(.+)/] |
NewerOlder