diff --git a/README.md b/README.md index 2a4960a..2125a11 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The initial idea is to have all the logging of the `IRC` channel dumped into a ` 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. -# Usage +## Usage ```console $ paslogbot -h @@ -37,4 +37,8 @@ PARAMS: -h/--help This help message. -c/--config=FILE Use provided FILE as config. ( default: ~/.pasirclogbot ) -d/--debug Turn debug On. (default: Off) -``` \ No newline at end of file +``` + +## About the author + +I'm usually on `irc.libera.chat` on the `#objectpascal`, `#lazarus` and `#pascal` channels. On `IRC` I use the nick name `[Batch]`. \ No newline at end of file diff --git a/src/bot/irclogbot.bot.pas b/src/bot/irclogbot.bot.pas index 99fb9e0..2705445 100644 --- a/src/bot/irclogbot.bot.pas +++ b/src/bot/irclogbot.bot.pas @@ -39,6 +39,7 @@ TIRCLogBot = class(TObject) ATarget, AMessage: String); procedure Help(const ATarget: String); + procedure Version(const ATarget: String); procedure Replay(const ATarget: String; ACount: Integer); protected public @@ -140,6 +141,11 @@ procedure TIRCLogBot.OnPrivateMessage(ASender: TIdContext; const ANickname, Help(ANickname); exit; end; + if Pos('.version', Trim(AMessage)) = 1 then + begin + Version(ANickname); + exit; + end; if Pos('.replay', Trim(AMessage)) = 1 then begin strings:= AMessage.Split([' ']); @@ -178,9 +184,19 @@ procedure TIRCLogBot.Help(const ATarget: String); debug('Help command.'); FIRC.Say(ATarget, 'Commands:'); FIRC.Say(ATarget, '.help - This help information.'); + FIRC.Say(ATarget, '.version - Version and info about the bot.'); FIRC.Say(ATarget, '.replay [count] - Raplays last lines. Default is last 10 lines.'); end; +procedure TIRCLogBot.Version(const ATarget: String); +begin + debug('Version command.'); + FIRC.Say(ATarget, Format('Version: %s, %s',[ + cVersion, + cRepoURL + ])); +end; + procedure TIRCLogBot.Replay(const ATarget: String; ACount: Integer); var lines: TStringList; diff --git a/src/common/irclogbot.common.pas b/src/common/irclogbot.common.pas index b9558b6..9726279 100644 --- a/src/common/irclogbot.common.pas +++ b/src/common/irclogbot.common.pas @@ -8,6 +8,10 @@ interface SysUtils ; +const + cVersion = 'v0.0.3'; + cRepoURL = 'https://github.com/ObjectPascal-Community/pasirclogbot'; + var DebugOn: Boolean;