-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.conf
572 lines (510 loc) · 18.6 KB
/
bot.conf
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
{
"timezone": "Europe/Stockholm",
"db": {
// The database engine to use, valid values are postgres and
// sqlite. If empty, we'll default to sqlite.
"engine": "sqlite",
// Path to the SQLite3 database file or a postgres connection
// string.
// "path": "postgres://user:pass@localhost:5432/bot?sslmode=disable",
"path": "./bot.db",
// A generic error message that will be written to the IRC
// channel if there's a problem with the database.
"err": "database error"
},
"http": {
// Set to true to enable the HTTP server.
"enableHTTP": true,
// Which address and port to listen on.
"address": "",
"port": "8080",
// Toggle the echo route, if set a HTTP endpoint will be
// activated that will pass the POST data back to the IRC
// channel.
"enableEcho": true,
"echoRoute": "/echo",
"echoMethod": "POST"
},
"irc": {
// Basic IRC settings.
"address": "localhost:6667",
"channel": "#bot",
"nick": "bot",
"realName": "bot",
"user": "bot",
"version": "bot",
// Post connect messages is useful to handle for example nick
// identifications, the messages will be sent once a connection
// has been successfully established to the server.
"postConnectMessages": [
{ "target": "osm", "message": "this message is sent when the bot has connected" }
],
// Post connect modes, same as postConnectMessages but for MODE.
"postConnectModes": [
"+x"
],
// The grace period defines how many milliseconds to wait
// until a message is sent, think of this as a flood
// protection thingy, it will default to 750 if set to 0 or if
// it's empty.
"gracePeriod": 750,
// If set to true the bot will rejoin the channel if it's
// kicked.
"rejoinOnKick": true,
// An array of user hosts that should be given op as soon as
// they join the channel. Each entry is compiled into a
// regexp.
"operators": [
"~osm@127.0.0.1"
],
// An array of user hosts to ignore messages from. Each entry
// is compiled into a regexp.
"ignore": [
],
// Flood protection.
// If set to true, the flood protection code will be enabled.
"enableFloodProt": true,
// The cmd and time threshold values determines how many
// commands that can be issued before the flood protection is
// triggered for the user.
// The following values dictates that a user can write 3
// commands within a 5 second time frame.
// The user will be ignored for the number of seconds that are
// defined in the ignore time property.
"floodProtCmdThreshold": 3,
"floodProtTimeThreshold": 5,
"floodProtIgnoreTime": 60,
// These messages will be sent once a user is ignored and
// unignored.
"floodProtMsgIgnore": "<nick> is ignored",
"floodProtMsgUnignore": "<nick> is unignored",
// Update notifier sends a message to the specified users when
// a new version of the bot has been released.
"enableUpdateNotifier": true,
"updateNotifierMsg": "new version of the bot is available (<version>)",
"updateNotifierNames": [
"osm"
],
// Enable supernytt news fetching.
"enableSupernytt": false,
"supernyttGrammarMessage": "<title> - <content>",
// Quiz
"enableQuiz": true,
// A quiz source can either be a json file on the local file
// system, a http/https url or a SQL query that fetches data
// from the bots database.
"quizSources": {
"test": "./quiz.json",
"chat": "SELECT 'chat' AS category, message AS question, nick AS answer FROM log"
},
"quizCmd": "!quiz",
"quizSubCmdStart": "start",
"quizSubCmdStop": "stop",
"quizSubCmdStats": "stats",
"quizHintInterval": 15,
"quizMsgNameDoesNotExist": "<name> does not exist",
"quizMsgLoadError": "unable to load <name>",
"quizMsgAlreadyStarted": "a quiz is already started",
"quizMsgQuestion": "<category>: <question>",
"quizMsgHint": "hint: <text>",
"quizMsgAnswer": "answer: <text>",
"quizMsgCorrect": "correct! one point to <nick>",
"quizMsgQuizEnd": "the quiz is over",
// Lyssnar - A lyssnar.com integration.
// Checkout lyssnar.com and github.com/osm/lyssnar
//
// Commands:
// !lyssnar <nick>
// Returns what <nick> is currently listening to on Spotify.
//
// Placeholders for lyssnarMsg:
// <nick> - Nick of the user that is listening to something.
// <song> - Current song that <nick> is listening to.
"enableLyssnar": true,
"lyssnarCmd": "!lyssnar",
"lyssnarErr": "there's something wrong with the lyssnar.com integration",
"lyssnarErrUserNotConfigured": "the user is not configured",
"lyssnarMsg": "<nick> listening to <song>",
"lyssnarMsgUserIsNotListening": "the user is not listening to anything right now",
"lyssnare": {
"osm": "osclin"
},
// Toggle the giphy.com integration.
// You will need to acquire your own API to use this feature.
"enableGiphy": true,
"giphyCmd": "!giphy",
"giphyLang": "en",
"giphyAPIKey": "",
"giphyMsgNothingFound": "nothing found",
// Toggle the tenor.com integration.
// You will need to acquire your own API to use this feature.
"enableTenor": true,
"tenorCmd": "!tenor",
"tenorLang": "en_US",
"tenorAPIKey": "",
"tenorMsgNothingFound": "nothing found",
// Enable cron jobs.
"enableCron": true,
// Command and sub commands for the cron integration.
// To interact with the cron engine you would first need to
// send the cmd defined in cronCmd, followed by a sub command
// and possibly more parameters, if needed.
//
// Examples
//
// Add:
// Say hello, world at minute 0 every hour.
// !cron add 0 * * * * hello, world
//
// Say "hello, world" every minute but with the limit set to
// 5, which means that the job only will be repeated 5 times.
// !cron add * * * * * limit:5 hello, world <exec_count>/<exec_limit>
//
// List:
// !cron list
//
// Delete:
// !cron delete 5efeeae8-1fb3-48b1-9dd9-a7e83a8d6c2e
//
// Update:
// !cron update 5efeeae8-1fb3-48b1-9dd9-a7e83a8d6c2e 15 * * * * world, hello
"cronCmd": "!cron",
"cronSubCmdAdd": "add",
// A special word that will be used to define how many times
// the cron job should be repeated.
// Example: !cron add * * * * * limit:5 hello, world
"cronSubCmdAddLimit": "limit",
"cronSubCmdDelete": "delete",
"cronSubCmdList": "list",
"cronSubCmdUpdate": "update",
// Messages send when one of the cron sub commands has
// completed.
"cronErr": "check your syntax",
"cronMsgAdd": "cron job added, next execution is <next_execution>",
"cronMsgDelete": "cron job deleted",
"cronMsgList": "id: <id> expression: <expression> message: <message> limited: <is_limited> count: <exec_count>/<exec_limit>, next: <next_execution>",
"cronMsgUpdate": "cron job updated",
// Grammar
// The grammar is used to construct the message that is
// trigged by the crob job.
"cronGrammarMsgIsLimited": "<is_limited>",
"cronGrammarMsgExecCount": "<exec_count>",
"cronGrammarMsgExecLimit": "<exec_limit>",
// <random_who> will be replaced with a random name from the
// channel.
"cronGrammarMsgRandomWho": "<random_who>",
// The <giphy> tag will be replaced with a random giphy on
// execution.
"cronGrammarGiphy": "<giphy>",
// Prints the current week number.
"cronGrammarWeek": "<week>",
// The <giphy search="foo"> will search for the query given in
// search and replaced with the returned url.
"cronGrammarGiphySearch": "<giphy search=\"([a-zåäöA-ZÅÄÖ0-9 ]+)\"[^>]*>",
"cronGrammarTenorSearch": "<tenor search=\"([a-zåäöüA-ZÅÄÖÜ0-9 ]+)\"[^>]*>",
// Enable logging of all received IRC messages.
"enableLogging": true,
// The seen command requires logging to be enabled, if it is
// you can see whenever a nick was last seen in the channel.
"seenCmd": "!seen",
"seenMsgFound": "<nick> <date> <time>, saying <message>",
"seenMsgNotFound": "<nick> has never been here",
// Chattistik - Chat statistics.
//
// Commands:
// !chattistik today
// Display chat statistics for the current day.
//
// !chattistik yesterday
// Display chat statistics for the previous day.
//
// !chattistik 2019-07-07
// Display chat statistics for the given date.
"enableChattistik": true,
"chattistikCmd": "!chattistik",
"chattistikCmdToday": "today",
"chattistikCmdYesterday": "yesterday",
"chattistikMsgNoStats": "There are no stats for the date",
// URL check.
// if an URL has been written to the channel before it will
// respond with a message saying who and when the URL was
// first seen.
//
// Placeholders for urlCheckMsg:
// <nick> - The nick that paste the URL for the first time.
// <url> - The URL.
// <timestamp> - Timestamp for when the URL was first seen.
"enableURLCheck": true,
"urlCheckMsg": "LOL, <nick> posted <url> on <timestamp>",
// URL meta data extractor.
// When a URL is seen in the channel that matches any of the
// URLs defined we'll try to fetch the meta data for the given
// URL and send it to the channel.
//
// Placeholders for urlMetaMsg:
// <title> - og:title
// <description> - og:description
// <description||title> - og:description || og:title
"enableURLMeta": true,
"urlMetaMsg": "<description||title>",
"urlMetaURLs": [
"https://github.com"
],
"urlMetaIgnoreURLs": [
"youtube.com"
],
// March - https://github.com/osm/march
// If an URL that is seen in the channel matches any of the
// regexps in the we'll archive it using the march URL defined
// here.
"enableMarch": false,
"marchURL": "http://127.0.0.1:8080/foo",
"marchCredentials": "foo:foo",
"marchURLRegexps": [
"(jpg|jpeg|gif|png|webm)$"
],
// Command.
// Execute commands on the host system.
// The commands that are defined inside commands will accept
// input from the IRC channel.
// The commands in commandsStatic will ignore all input from
// the IRC channel and just execute the command as it is
// defined in the configuration file.
"enableCommands": true,
"commands": {
"!echo": "echo"
},
"commandsStatic": {
"!echo-static": "echo static"
},
"commandErrExec": "command execution error",
// Weather - Display weather from openweathermap.org
// You need to obtain an API key to use this feature, that can
// be done by visiting https://openweathermap.org
//
// Commands:
// !w <city>
// Displays weather for the given city.
//
// Placeholders for weatherMsg:
// <city> - The city that weather was requested for.
// <main> - The main weather description for the city.
// <description> - Extended weather description.
// <temp> - Temperature for the given city.
"enableWeather": true,
"weatherCmd": "!w",
"weatherErr": "unknown city",
"weatherAPIKey": "",
"weatherMsg": "<city>, <main>, <description>: <temp>",
// Factoid.
// Listens to all messages that the channel receives, if
// there's a message that matches the <trigger> a <reply> is
// written to the channel.
//
// Commands:
// !factoid add <trigger sentence> <factoidCmdAddDelimiter> <reply>
// Add a new factoid.
//
// !factoid forget <uuid>
// Forget a factoid with the given uuid.
//
// !factoid snoop <trigger sentence>
// Fetch information about the given factoid.
//
// !factoid snoop-reply <reply sentence>
// Fetch information about the given factoid.
//
// !factoid snoop-author <author>
// Fetch information about the given factoid.
//
// !factoid count <trigger sentence>
// Return number of factoids for the given trigger sentence.
//
// Placeholders for factoids:
// <reply> writes the reply as <bot> foo
// <action> writes the reply as /me foo
// <who> is replaced by the nick that triggered the factoid
// <randomwho> is replaced by a random nick from the channel
"enableFactoid": true,
// A random number between 1 and 100 will be generated each
// time a factoid is triggered, if this value is set it will
// also make sure that the random number is greater than the
// generated number before it is sent to the channel.
"factoidRate": 50,
// To add a factoid you need to write a message looking
// somewhat like this:
// !factoid add your trigger word _is_ what the bot should
// reply All words up until the text specified in the delimiter
// is considered to be the trigger word and all text after the
// delimiter is the reply.
"factoidCmd": "!factoid",
"factoidSubCmdAdd": "add",
"factoidSubCmdAddDelimiter": " _is_ ",
// To delete a factoid you will invoke the command that is
// define here followed by the UUID of the factoid.
"factoidSubCmdDelete": "forget",
// To snoop, you invoke the command defined below followed by
// the trigger word or sentence.
"factoidSubCmdSnoop": "snoop",
// To snoop, you invoke the command defined below followed by
// the trigger word or sentence.
"factoidSubCmdSnoopReply": "snoop-reply",
// To snoop, you invoke the command defined below followed by
// the trigger word or sentence.
"factoidSubCmdSnoopAuthor": "snoop-author",
// Count how many facts there are for a given trigger
// sentence.
"factoidSubCmdCount": "count",
// Defines the grammar for the placeholders that the factoids
// are allowed to use.
"factoidGrammarAction": "<action>",
"factoidGrammarRandomWho": "<randomwho>",
"factoidGrammarReply": "<reply>",
"factoidGrammarWho": "<who>",
// Can be used in a factoid to inject a random word.
// Example: !factoid add foo _is_ <reply> <randomword words="a b c">
// Generates a reply with either that says either a, b or c.
"factoidGrammarRandomWord": "<randomword words=\"([a-zåäöüA-ZÅÄÖÜ0-9 ]+)\"[^>]*>",
// The <giphy> tag will be replaced with a random giphy on
// execution.
"factoidGrammarGiphy": "<giphy>",
// The <giphy search="foo"> will search for the query given in
// search and replaced with the returned url.
"factoidGrammarGiphySearch": "<giphy search=\"([a-zåäöA-ZÅÄÖ0-9 ]+)\"[^>]*>",
// The <tenor search="foo"> will search for the query given in
// search and replaced with the returned url.
"factoidGrammarTenorSearch": "<tenor search=\"([a-zåäöüA-ZÅÄÖÜ0-9 ]+)\"[^>]*>",
// Static factoid messages.
"factoidMsgAdd": "noted",
"factoidMsgDelete": "*removed*",
"factoidMsgIs": "is",
// This message has it own set of placeholders and they are
// not configurable, since they don't need to be.
"factoidMsgSnoop": "<id>: <author> taught me that <trigger> is <reply> <timestamp>",
// This message does also have two specific placeholders, one
// for the trigger sentence the is checked and one for the
// numer of occurrences it has.
"factoidMsgCount": "<trigger> has <count> occurrences",
// The pastebin API key is needed when snooping factoids or
// listing cron entries that has 5 or more entries, if so, the
// results are created on pastebin and the URL for the results
// is written to the channel. You can signup for a free account
// at pastebin.com to use this feature.
"pastebinApiKey": "",
// Dumpinen is a service similair to pastebin, but it doesn't
// rate limit and it doesn't require an API key.
"enableDumpinen": true,
// Dictionary.
// This is the dictionary service, the bot can have one or
// more dictionaries. The dictionary is triggerd by the
// trigger word, which needs to be unique to not trigger other
// things.
//
// Example:
// !namesday 1201
"dictionaries": [
{
"trigger": "!namesday",
"dictionary": "./namesday.se.json",
"foundMsg": "<key> == <value>",
"notFoundMsg": "<key> was not found in the dictionary"
}
],
// SMHI Weather.
// The SMHI integration downloads forecasts from the SMHI API
// once every hour. You can than query the locally stored
// database about the weather for a given location.
//
// Example: !smhi osm
// The command above will fetch the forecast for the osm
// location that is closest in time.
//
// Example: !smhi osm 12:00
// Fetches the forecast for the current day at 12:00 for osm.
//
// Example: !smhi osm 2020-12-01 12:00
// Fetches the forecast for the the given date at the given
// time for osm.
//
// The following properties are available in the output
// message.
// <id>
// <timestamp>
// <time>
// <date>
// <inserted_at>
// <updated_at>
// <nick>
// <name>
// <air_pressure>
// <air_temperature>
// <horizontal_visibility>
// <maximum_precipitation_intensity>
// <mean_precipitation_intensity>
// <mean_value_of_high_level_cloud_cover>
// <mean_value_of_low_level_cloud_cover>
// <mean_value_of_medium_level_cloud_cover>
// <mean_value_of_total_cloud_cover>
// <median_precipitation_intensity>
// <minimum_precipitation_intensity>
// <percent_of_precipitation_in_frozen_form>
// <precipitation_category>
// <precipitation_category_description>
// <relative_humidity>
// <thunder_probability>
// <weather_symbol>
// <weather_symbol_description>
// <wind_direction>
// <wind_gust_speed>
// <wind_speed>
// <wind_speed_description>
"enableSMHI": true,
"smhiLanguage": "sv-SE",
"smhiCmdWeather": "!smhi",
"smhiMsgWeatherError": "unable to find forecast",
"smhiMsgWeather": "<weather_symbol_description>, <air_temperature> C",
"smhiMsgWeatherFull": "<date> <time>, <weather_symbol_description>, <air_temperature> C",
"smhiMsgSun": "sunrise: <sunrise>, sunset: <sunset>, total sun time: <sun_hours>h <sun_minutes>m",
"smhiForecastLocations": {
"osm": {
"latitude": 57.72219,
"longitude": 11.94755
},
"foo": {
"alias": "osm"
}
},
// Parcel tracking.
// With this feature enabled you can query their track and
// trace API. You will need to get your own API key from their
// site. See https://developer.postnord.com for more info.
//
// Examples:
// Add a tracking number with a supplied alias
// !pt add <id> <alias>
// Remove a tracking number
// !pt remove <id>
// Get the latest status update for the given tracking number.
// !pt info <id|alias> [<alias>]
// Get full status update for the given trackning number.
// !ptfull <id|alias> [<alias>]
"enableParcelTracking": true,
"parcelTrackingPostNordAPIKey": "",
"parcelTrackingLocale": "sv",
"parcelTrackingMsgInfo": "<consignor_name>, <event_date> <event_time>, <location_display_name>, <event_description> ankomst: <estimation_or_drop_off_date> <estimation_or_drop_off_time>",
"parcelTrackingMsgAliasRemoved": "<alias> removed",
"parcelTrackingMsgAliasDoesNotExist": "<alias> does not exist",
"parcelTrackingErrNoData": "no tracking data found",
"parcelTrackingErrDuplicateAlias": "<alias> is already in use for parcel <existing_id>",
"parcelTrackingCmd": "!pt",
"parcelTrackingCmdAdd": "add",
"parcelTrackingCmdRemove": "remove",
"parcelTrackingCmdInfo": "info",
"parcelTrackingCmdFull": "full",
"parcelTrackingCmdList": "list",
"enableWeek": true,
"weekCmd": "!week",
"enableGoogleSearch": true,
"googleSearchCmd": "!g"
}
}