Created
November 6, 2011 01:25
-
-
Save tyama/1342324 to your computer and use it in GitHub Desktop.
IRCボットテンプレ。(半手動IRCボット: 別チャンネルにて、say:hello。で、発言投げ。)
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
@Grab(group='org.pircbotx', module='pircbotx', version='1.5') | |
import org.pircbotx.PircBotX | |
import org.pircbotx.hooks.ListenerAdapter | |
def botName = "oreore" | |
def serverName = "192.168.100.100" | |
def channel = "#channel" | |
def channel2 = "#channel2" | |
def bot = new PircBotX() | |
bot.name = bot.nick = bot.login = botName | |
bot.verbose=false | |
bot.getListenerManager().addListener( | |
[onMessage:{e -> | |
println "(${e.user.nick}) ${e.message} [${new Date().format('yyyy/MM/dd HH:mm:ss')}]" | |
//"say -v Kyoko -r 300 \"${e.message}、と、${e.user.nick}が、言っとる\"".execute() | |
if(e.message.startsWith('say:')){ | |
def comment = e.message.replace('say:','') | |
bot.sendMessage(channel, comment) | |
println "(${botName}) $comment" | |
} | |
}] as ListenerAdapter | |
) | |
bot.connect serverName | |
bot.joinChannel channel | |
bot.joinChannel channel2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment