wordoftheday.rb
来自「Amarok是一款在LINUX或其他类UNIX操作系统中运行的音频播放器软件。 」· RB 代码 · 共 31 行
RB
31 行
# 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 + =
减小字号Ctrl + -
显示快捷键?