Skip to content

Commit 07d17b4

Browse files
author
LiquidLemon
committed
Display proper prefix in help
1 parent eeb11da commit 07d17b4

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

bot.rb

+15-9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
$stderr.reopen(CONFIG.log_path, 'a')
1818
end
1919

20+
help_message = {
21+
"ctfs" => "display info about all events\n",
22+
"current" => "display info about current events\n",
23+
"upcoming" => "display info about upcoming events\n",
24+
"next" => "display info about the next event\n",
25+
"update" => "update the database (this happens automatically every hour)\n",
26+
"creds" => "modify the credentials database\n",
27+
"load" => "load the credentials database (if modified manually)\n"
28+
}
29+
30+
help_message = help_message.map { |k, v| "#{CONFIG.prefix}#{k} - #{v}" }.join
31+
2032
bot = Cinch::Bot.new do
2133
configure do |c|
2234
c.server = CONFIG.server
@@ -27,20 +39,14 @@
2739
c.plugins.prefix = /^#{CONFIG.prefix || '!'}/
2840
c.plugins.options[CTFPlugin] = {
2941
lookahead: CONFIG.lookahead,
42+
3043
mark_highschool: CONFIG.mark_highschool,
3144
announce_periods: CONFIG.announcement_periods,
32-
help: "!ctfs - display info about all events\n" +
33-
"!current - display info about current events\n" +
34-
"!upcoming - display info about upcoming events\n" +
35-
"!next - display info about the next event\n" +
36-
"!update - update the database (this happens automatically every hour)\n" +
37-
"!creds - modify the credentials database\n" +
38-
"!load - load the credentials database (if modified manually)\n"
45+
help: help_message
3946
}
4047
c.plugins.options[QuitPlugin] = {
4148
authorized: CONFIG.admins,
42-
message: 'Leaving...',
43-
help: '!quit - leave the server (you have to be set as an admin in the config)'
49+
message: 'Leaving...'
4450
}
4551
c.plugins.options[VersionPlugin] = { version: 'CTF-Bot v0.1. Get the source at https://github.com/LiquidLemon/CTF-Bot' }
4652
end

example-config.rb

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
# Defaults to '!'
2222
CONFIG.prefix = '!'
2323

24+
# How many events should be listed in a channel
25+
CONFIG.event_limit = 3
26+
2427
## Used for the `!quit` command
2528
CONFIG.admins = ['LiquidLemon']
2629

plugins/help.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'cinch'
2+
require_relative '../config'
23

34
class HelpPlugin
45
include Cinch::Plugin
@@ -10,6 +11,5 @@ def execute(m)
1011
m.user.notice(plugin[:help])
1112
end
1213
end
13-
m.user.notice('!help - display this message')
1414
end
1515
end

0 commit comments

Comments
 (0)