Skip to content

Commit 4de4492

Browse files
committed
feat: Version command
1 parent 10c0ecf commit 4de4492

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The initial idea is to have all the logging of the `IRC` channel dumped into a `
2626

2727
Not sure if it's worth having the bot itself serve the website, but due to the fact that `SQLite` will be locked during the bot's operation, then this will have to be the path, for the time being.
2828

29-
# Usage
29+
## Usage
3030

3131
```console
3232
$ paslogbot -h
@@ -37,4 +37,8 @@ PARAMS:
3737
-h/--help This help message.
3838
-c/--config=FILE Use provided FILE as config. ( default: ~/.pasirclogbot )
3939
-d/--debug Turn debug On. (default: Off)
40-
```
40+
```
41+
42+
## About the author
43+
44+
I'm usually on `irc.libera.chat` on the `#objectpascal`, `#lazarus` and `#pascal` channels. On `IRC` I use the nick name `[Batch]`.

src/bot/irclogbot.bot.pas

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ TIRCLogBot = class(TObject)
3939
ATarget, AMessage: String);
4040

4141
procedure Help(const ATarget: String);
42+
procedure Version(const ATarget: String);
4243
procedure Replay(const ATarget: String; ACount: Integer);
4344
protected
4445
public
@@ -140,6 +141,11 @@ procedure TIRCLogBot.OnPrivateMessage(ASender: TIdContext; const ANickname,
140141
Help(ANickname);
141142
exit;
142143
end;
144+
if Pos('.version', Trim(AMessage)) = 1 then
145+
begin
146+
Version(ANickname);
147+
exit;
148+
end;
143149
if Pos('.replay', Trim(AMessage)) = 1 then
144150
begin
145151
strings:= AMessage.Split([' ']);
@@ -178,9 +184,19 @@ procedure TIRCLogBot.Help(const ATarget: String);
178184
debug('Help command.');
179185
FIRC.Say(ATarget, 'Commands:');
180186
FIRC.Say(ATarget, '.help - This help information.');
187+
FIRC.Say(ATarget, '.version - Version and info about the bot.');
181188
FIRC.Say(ATarget, '.replay [count] - Raplays last <count> lines. Default is last 10 lines.');
182189
end;
183190

191+
procedure TIRCLogBot.Version(const ATarget: String);
192+
begin
193+
debug('Version command.');
194+
FIRC.Say(ATarget, Format('Version: %s, %s',[
195+
cVersion,
196+
cRepoURL
197+
]));
198+
end;
199+
184200
procedure TIRCLogBot.Replay(const ATarget: String; ACount: Integer);
185201
var
186202
lines: TStringList;

src/common/irclogbot.common.pas

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ interface
88
SysUtils
99
;
1010

11+
const
12+
cVersion = 'v0.0.3';
13+
cRepoURL = 'https://github.com/ObjectPascal-Community/pasirclogbot';
14+
1115
var
1216
DebugOn: Boolean;
1317

0 commit comments

Comments
 (0)