-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbot-api.r3
154 lines (122 loc) · 3.75 KB
/
bot-api.r3
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
REBOL [
Title: "API"
Name: bot-api
Type: module
Version: 1.0.0
Options: []
Exports: [
about-users
botname
bot-expressions
chat-length-limit
commands
done
delete-message
from-now
get-userid
greet-message
header
html-url
id-rule
log
login2so
low-rep-message
max-scan-messages
message-id
no-of-messages
parent-id
person-id
pause-period
percent-encode
privileged-users
profile-url
read-messages
read-message
referrer-url
reply
speak
speak-private
storage
timestamp
to-dash
to-idate
to-itime
to-markdown-code
two-minutes-ago
unix-to-date
unix-now
url-encode
user-name
ideone-user
ideone-pass
ideone-url
]
]
; The name of the bot
; Configured in bot-config.r
botname: _
; The command modules loaded by the bot
commands: []
; The message new users will be greeted with
; Configured in bot-config.r
greet-message: ""
; The message new users with a reputation lower than 20
; will be greeted with.
; Configured in bot-config.r
low-rep-message: ""
; The number of messages to fetch at a time
no-of-messages: _
; The maximum number of characters allowed by the chat system
chat-length-limit: _
; Users who have special privileges with the bot (e.g. remove keys)
; privileged-users: ["HostileFork" 211160 "Graham Chiu" 76852 "johnk" 1864998]
privileged-users: []
; Mapping of username to info-link + timezone
; about-users: [
; earl [https://github.com/earl 1:00]
; graham [https://github.com/gchiu/ 13:00]
; ]
about-users: []
; Mapping of keyword to description + URL
; bot-expressions: [
; "help" ["FAQ" http://rebolsource.net/go/chat-faq]
; "tutorial" ["Introduction to Rebol" http://www.rebol.com/rebolsteps.html]
; "Devcon" ["Red Video from Devcon 2013" https://www.youtube.com/watch?v=JjPKj0_HBTY]
; ]
bot-expressions: []
; Signifies that a command's dialect rule is done
done: false
; The parse rule for user IDs
id-rule: _
; The main chat URL with highlight turned off
html-url: _
; The main chat URL
referrer-url: _
ideone-url: ideone-pass: ideone-user: profile-url: person-id: user-name: message-id: parent-id: timestamp: storage: _
get-userid: func [txt][]
read-messages: func [cnt] []
read-message: func [message-id] []
delete-message: func [parent-id message-id /silent] []
speak-private: func [message room-id] []
log: func [text] []
speak: func [message] []
reply: func [message-id text [string! block!]] []
percent-encode: func [char [char!]] []
url-encode: func [text] []
to-markdown-code: func [txt] []
unix-to-date: func [ unix [string! integer!]] []
from-now: func [d [date!]][]
unix-now: does []
two-minutes-ago: does []
to-itime: func [
{Returns a standard internet time string (two digits for each segment)}
time [time! number! block!]
] []
to-idate: func [
{Returns a standard Internet date string.}
date [date!]
] []
to-dash: func [
{Returns name replacing space and . with -}
username [string!]
][]