📄 wordoftheday.rb
字号:
# Plugin for the Ruby IRC bot (http://linuxbrit.co.uk/rbot/)# Fetches the "Word of the day" from http://uncyclopedia.org# (c) 2005 Mark Kretschmann <markey@web.de># Licensed under GPL V2.class WordofthedayPlugin < Plugin def help( plugin, topic="" ) "Fetches the 'Word of the day' from uncyclopedia.org. Knowledge is power!" end def privmsg( m ) begin data = bot.httputil.get( URI.parse("http://uncyclopedia.org/wiki/Main_Page") ) index2 = data.index( "</a></span><br /><i>Try to use it in conversation." ) index1 = data.rindex( ">", index2 ) word = data[index1+1..index2-1] @bot.say(m.replyto, "Word of the day: \"#{word}\"\nTry to use it in conversation. Knowledge is power.") rescue m.reply( "Failed to connect to uncyclopedia.org" ) end endendplugin = WordofthedayPlugin.newplugin.register("wordoftheday")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -