Date: 2015/07/19 07:08:28 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
######################################################################################################
######################################################################################################
## _ _____ __ ___ _____ ___ ##
## __| | \_ \ /__\ / __\ /__ \ __ _ __ _ / _ \ __ _ _ __ ___ ___ _ __ ##
## / _` | / /\/ / \// / / / /\/ / _` | / _` | / /_)/ / _` || '__|/ __| / _ \| '__| ##
## | (_| |/\/ /_ / _ \ / /___ / / | (_| || (_| | / ___/ | (_| || | \__ \| __/| | ##
## \__,_|\____/ \/ \_/ \____/ \/ \__,_| \__, | \/ \__,_||_| |___/ \___||_| ##
## |___/ ##
## Made by Fortifier42 ##
######################################################################################################
######################################################################################################
IRC_Chat:
debug: false
type: format
format: "<&sp><&7>[<&a>IRC<&7>] <&3><text>"
IRC_Config:
type: yaml data
# Change this to change the name your bot will display with in the IRC Channel!
#Probably a good idea to change this so you don't get conflicts between other bots/users.
botname: "Tag-Parser"
# Change the following line to change the join command argument(s)!
# At this stage, it does not change the /help irc output. :(
joincmds: join|connect|start
# Change the following line to change the quit command argument(s)!
# At this stage, it does not change the /help irc output. :(
quitcmds: quit|leave|exit|disconnect|stop
# Change the following line to change the msg command argument(s)!
# At this stage, it does not change the /help irc output. :(
msgcmds: send|say|tell|msg|message
# Change the following line to change the irc server to join!
server: "irc.esper.net"
# Change the following line to change the channel the bot will join!
channel: "#Denizen-Dev"
# Change the following line to determine what the prefix should be.
# It is good to have a space after the trigger to ensure readability and compatability!
trigger: ">tag "
# Set this to "" to stop logging all together, or change the file which IRC actions will be logged to.
# Currently only /irc send <message> and tag parsing are logged.
logfile: plugins/Denizen/logs/ircbot.log
IRC_Command:
debug: false
type: command
name: irc
usage: /irc <<>(join/quit/msg <<>message<>>)<>>
permission: irc.admin
description: Used to connect, leave and send messages to IRC.
script:
- if <context.args.size> == 0 {
- narrate format:IRC_Chat "<&c><script.yaml_key[usage]>"
- queue clear
}
- define cmd <context.args.get[1]>
- if <context.args.size> == 1 {
- if <s@IRC_Config.yaml_key[joincmds].as_list.contains_any[%cmd%]> {
- ~irc connect ircserver@<s@IRC_Config.yaml_key[server]>
- irc raw ircserver@<s@IRC_Config.yaml_key[server]> "USER <s@IRC_Config.yaml_key[botname]> <s@IRC_Config.yaml_key[botname]>_ <s@IRC_Config.yaml_key[botname]>__ <s@IRC_Config.yaml_key[botname]>"
- irc raw ircserver@<s@IRC_Config.yaml_key[server]> "NICK <s@IRC_Config.yaml_key[botname]>"
- irc join ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]>
- narrate format:IRC_Chat "Joined the IRC."
- queue clear
}
else if <s@IRC_Config.yaml_key[quitcmds].as_list.contains_any[%cmd%]> {
- ~irc leave ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]>
- ~irc quit ircserver@<s@IRC_Config.yaml_key[server]>
- narrate format:IRC_Chat "Left the IRC."
- queue clear
}
else {
else {
- narrate format:IRC_Chat "<&c>Invalid command!"
- queue clear
}
}
else {
- if <s@IRC_Config.yaml_key[msgcmds].contains_any[%cmd%]> {
- define msg "<context.args.get[2].to[<context.args.size>].space_separated||null>"
- if %msg% == null {
- narrate format:IRC_Chat "<&c>No message has been specified."
- queue clear
}
- irc message ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]> <def[msg]>
- narrate format:IRC_Chat "Sent message: <&f><&sq>%msg%<&sq>"
- if <s@IRC_Config.yaml_key[logfile]> == "" queue clear
- log "<player.name||Console> sent <&sq>%msg%<&sq>"" file:<s@IRC_Config.yaml_key[logfile]>
}
}
IRC_Parsing:
debug: false
type: world
events:
on irc message:
- if <context.channel> != "ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]>" || <context.message.substring[1,<s@IRC_Config.yaml_key[trigger].length>]> != <s@IRC_Config.yaml_key[trigger]> {
- queue clear
}
- define tags "<context.message.after[<s@IRC_Config.yaml_key[trigger]>]>"
- define parsed <parse.substring[1,300]:<def[tags]>>
- irc message ircchannel@<s@IRC_Config.yaml_key[server]><s@IRC_Config.yaml_key[channel]> "<context.speaker><&r><&co> the tag <&sq><&b><def[tags]><&r><&sq> fills with <&sq><&b><def[parsed]><&r><&sq>"
- if <s@IRC_Config.yaml_key[logfile]> == "" queue clear
- log "<context.speaker> parsed <def[tags]>" file:<s@IRC_Config.yaml_key[logfile]>