From e3970972cf5a203be0b66981e79d7b739fb3128c Mon Sep 17 00:00:00 2001 From: Tor Henning Ueland Date: Fri, 18 Jan 2013 21:55:03 +0100 Subject: [PATCH 01/14] added a links file contaning links to other third party plugins --- thirdparty-plugins/links.php | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 thirdparty-plugins/links.php diff --git a/thirdparty-plugins/links.php b/thirdparty-plugins/links.php new file mode 100644 index 0000000..762c8b3 --- /dev/null +++ b/thirdparty-plugins/links.php @@ -0,0 +1,3 @@ +Links to other plugins for VikingBot: + +Doorway/plugin for Roundup Issue Tracker https://gist.github.com/3295338 From 5566ff55f4f930ff53cfa438f1d37f43bce6c3b5 Mon Sep 17 00:00:00 2001 From: Tor Henning Ueland Date: Wed, 9 Oct 2013 20:51:34 +0200 Subject: [PATCH 02/14] Added support for text formatting --- README | 17 +++++++++++++++++ lib/functions.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/README b/README index f9ce6c6..0ea99ea 100644 --- a/README +++ b/README @@ -53,6 +53,23 @@ upgradePlugin: +========== TEXT FORMATTING ========== +If you wish, you can format text the bot sends to a channel/user, via your plugins. +Use any of the following codes to apply the relevant text color or format. The text will +keep the given format until either end of string, or the {reset} tag. + +Available colors: +{white}, {black}, {blue}, {green}, {red}, {darkRed}, {purple}, +{orange}, {yellow}, {lime}, {teal}, {cyan}, {lightBlue}, {pink}, {grey} & {lightGrey} + +Other tags: +{reset}, {bold} & {underline} + +Example: +"{bold}i am bold and {red}red{reset}, but now i am normal" + +PS: Different IRC-clients may display colors differently, some servers even deny color use! + ========== BUGS/PROBLEMS? ========== Feel free to contact me via IRC on EfNet/Freenode/Undernet (Ueland) or via e-mail: tor.henning AT gmail.com. diff --git a/lib/functions.php b/lib/functions.php index 6e9796f..fbbcbf5 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -32,10 +32,40 @@ function getNick($in) { */ function sendMessage($socket, $channel, $msg) { if(strlen($msg) > 2) { //Avoid sending empty lines to server, since all data should contain a line break, 2 chars is minimum + $msg = prettify($msg); sendData($socket, "PRIVMSG {$channel} :{$msg}"); } } +/** + * Converts color / formatting codes to IRC-syntax + * + */ +function prettify($msg) { + $msg = str_replace("{reset}", "\017", $msg); + $msg = str_replace("{white}", "\0030", $msg); + $msg = str_replace("{black}", "\0031", $msg); + $msg = str_replace("{blue}", "\0032", $msg); + $msg = str_replace("{green}", "\0033", $msg); + $msg = str_replace("{red}", "\0034", $msg); + $msg = str_replace("{darkRed}", "\0035", $msg); + $msg = str_replace("{purple}", "\0036", $msg); + $msg = str_replace("{orange}", "\0037", $msg); + $msg = str_replace("{yellow}", "\0038", $msg); + $msg = str_replace("{lime}", "\0039", $msg); + $msg = str_replace("{teal}", "\00310", $msg); + $msg = str_replace("{cyan}", "\00311", $msg); + $msg = str_replace("{lightBlue}", "\00312", $msg); + $msg = str_replace("{pink}", "\00313", $msg); + $msg = str_replace("{grey}", "\00314", $msg); + $msg = str_replace("{lightGrey}", "\00315", $msg); + + $msg = str_replace("{bold}", "\002", $msg); + $msg = str_replace("{underline}", "\017", $msg); + $msg = str_replace("{bold}", "\002", $msg); + return $msg; +} + /** * Sends data to server */ From 91ab9526342171fdd796c7035fe59f52ee3be4cd Mon Sep 17 00:00:00 2001 From: renini Date: Tue, 22 Oct 2013 10:54:58 +0200 Subject: [PATCH 03/14] Create current config and plugins dir --- .gitattributes | 22 +++++ .gitignore | 215 ++++++++++++++++++++++++++++++++++++++++++++++++ config.dist.php | 32 +++++++ 3 files changed, 269 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 config.dist.php diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d6bd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,215 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg diff --git a/config.dist.php b/config.dist.php new file mode 100644 index 0000000..b2e2ba2 --- /dev/null +++ b/config.dist.php @@ -0,0 +1,32 @@ + 'servername', //Server name, prefix it with "ssl://" in order to use SSL server + 'port' => 6666, //Server port + 'channel' => '#vikingbot', //Channel to join, use array('channel1', 'channel2') for multiple channels + 'name' => 'vikingbot', //Name of the bot + 'nick' => 'vikingbot', //Nick of the bot + 'pass' => '', //Server password + 'waitTime' => 10, //How many seconds to wait before joining channel after connecting to server + 'adminPass' => 'vikingbot', //Bot admin password, used for commands like !exit (!exit vikingbot) + 'memoryLimit' => '128', //Max memory the bot can use, in MB + 'memoryRestart' => '10', //Min memory usage, in MB. (The bot will try to clear RAM or restart if reached) + 'trigger' => '!', //What character should be used as bot command prefixes + 'maxPerTenMin' => 50 //Max messgages a user can send per 10 minutes before beeing ignored for that time +); + +//===================================== +//Plugin specific configuration +//===================================== + +//RSS Reader +$config['plugins']['rssReader'] = array( + array('title'=> 'VG', 'url'=>'http://www.vg.no/rss/nyfront.php?frontId=1', 'pollInterval'=>15, 'channel'=>'#vikingbot'), + array('title'=> 'BBC News', 'url'=>'http://feeds.bbci.co.uk/news/rss.xml', 'pollInterval'=>15, 'channel'=>'#vikingbot'), + array('title'=> 'CNN', 'url'=>'http://rss.cnn.com/rss/edition.rss', 'pollInterval'=>15, 'channel'=>'#vikingbot'), +); + +//File reader +$config['plugins']['fileReader'] = array( + 'channel' => '#vikingbot', +); From 551590c3d94153571c613f3d7b322b7ed520aa0c Mon Sep 17 00:00:00 2001 From: renini Date: Tue, 22 Oct 2013 10:58:26 +0200 Subject: [PATCH 04/14] Added autoOpPlugin.php --- plugins/autoOpPlugin.php | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 plugins/autoOpPlugin.php diff --git a/plugins/autoOpPlugin.php b/plugins/autoOpPlugin.php new file mode 100644 index 0000000..be20d1f --- /dev/null +++ b/plugins/autoOpPlugin.php @@ -0,0 +1,47 @@ +config = $config; + $this->socket = $socket; + $this->autoOpConfig = $config['plugins']['autoOp']; + } + + function tick() { + + } + + function onMessage($from, $channel, $msg) { + + } + + function onData($data) { + + if ($this->autoOpConfig['mode']) { + + if (strpos($data,'JOIN :') !== false) { + $bits = explode(" ", $data); + $nick = getNick(@$bits[0]); + $channel = trim(str_replace(":", '', @$bits[2])); + + if ($this->autoOpConfig['mode'] == 1) { + if (in_array($nick, $this->autoOpConfig['channel'][$channel])) { + sendData($this->socket, "MODE {$channel} +o {$nick}"); + } + } elseif ($this->autoOpConfig['mode'] == 2) { + sendData($this->socket, "MODE {$channel} +o {$nick}"); + } + + } + } + } + + function destroy() { + $this->socket = null; + } + +} From 30c61f9f1e7f94bd9e554fbc5c17f206536f974f Mon Sep 17 00:00:00 2001 From: renini Date: Tue, 22 Oct 2013 11:01:37 +0200 Subject: [PATCH 05/14] Added AutoOp config examples --- config.dist.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config.dist.php b/config.dist.php index b2e2ba2..e937189 100644 --- a/config.dist.php +++ b/config.dist.php @@ -30,3 +30,12 @@ $config['plugins']['fileReader'] = array( 'channel' => '#vikingbot', ); + +//Auto Op +$config['plugins']['autoOp'] = array( + 'mode' => '1', // autop mode, 0 = disabled, 1 = only configured users, 2 = autoop everyone + 'channel' => array( + '#channel1' => array('nick1','nick2','nick3','nick4','nick5','nick6','nick7','nick8'), + '#channel2' => array('ueland','ernini') + ), +); From 92121aa0ff23ada5cda2edd22f07b191df64e577 Mon Sep 17 00:00:00 2001 From: renini Date: Tue, 22 Oct 2013 11:08:00 +0200 Subject: [PATCH 06/14] Added README --- README | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..0ea99ea --- /dev/null +++ b/README @@ -0,0 +1,75 @@ +========== INSTALLING ========== +1) copy config.dist.php to config.php +2) update config.php with correct settings +3) run it, sh start.sh +4) check log outout in logs/vikingbot.log + +========== SUPPORTED COMMANDS ========== +The following commands are supported out of the box +(aka they are not controlled via plugins): + +!quit [password] - Shuts down the bot +!restart [password] - Restarts the bot + +The following commands are supported via the plugins that +is installed per default: + +!botlog [password] [rows] - The bot responds with the [rows] last rows of the bot log file (default: 10 rows) +!memory - The bot responds with memory usage statistics +!ping - The bot responds with a pong to say that it is still alive +!uptime - The bot responds with the bots uptime +!upgrade [password] - The bot will attempt to upgrade itself to the latest version via GIT pull +!op nick channel [password] - The bot attempts to give *user* on *channel OP status + +========== INSTALLED PLUGINS ========== +The following plugins are installed per default: + +fileReaderPlugin: + - Outputs data from db/fileReaderOutput.db to channel specified in the plugin, + useful for GIT/SVN commit hooks or anything other that should push data to a + channel + +botLogPlugin: + - Plugin that responds to a "!log" with the last N rows of the bot`s log file + +memoryPlugin: + - Plugin that responds to a "!memory" with information about memory usage + +opPlugin: + - Plugin that respons to a "!op ..." by oping a user if the bot has op itsefl + +pingPlugin: + - Plugin that responds to a "!ping" with a "pong". + +uptimePlugin: + - Plugin that responds to a "!uptime" with the bots uptime + +rssPlugin: + - Plugin that pulls RSS feeds at specified intervals and outputs new + RSS elements to a specified channel. + +upgradePlugin: + - Plugin that upgrades the bot via git pull. + + + +========== TEXT FORMATTING ========== +If you wish, you can format text the bot sends to a channel/user, via your plugins. +Use any of the following codes to apply the relevant text color or format. The text will +keep the given format until either end of string, or the {reset} tag. + +Available colors: +{white}, {black}, {blue}, {green}, {red}, {darkRed}, {purple}, +{orange}, {yellow}, {lime}, {teal}, {cyan}, {lightBlue}, {pink}, {grey} & {lightGrey} + +Other tags: +{reset}, {bold} & {underline} + +Example: +"{bold}i am bold and {red}red{reset}, but now i am normal" + +PS: Different IRC-clients may display colors differently, some servers even deny color use! + +========== BUGS/PROBLEMS? ========== +Feel free to contact me via IRC on EfNet/Freenode/Undernet (Ueland) +or via e-mail: tor.henning AT gmail.com. From 63797dae9b26c314706da77bf1d6c2d5dfe6c194 Mon Sep 17 00:00:00 2001 From: renini Date: Tue, 22 Oct 2013 11:08:40 +0200 Subject: [PATCH 07/14] Updated README with new plugin information --- README | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README b/README index 0ea99ea..54ea540 100644 --- a/README +++ b/README @@ -50,7 +50,9 @@ rssPlugin: upgradePlugin: - Plugin that upgrades the bot via git pull. - + +autoOpPlugin: + - Plugin that gives +o to everyone or to certain nicks on channel join. ========== TEXT FORMATTING ========== From 9d244a83b89c10715ae12ef690ac715f2114cd81 Mon Sep 17 00:00:00 2001 From: Tor Henning Ueland Date: Thu, 19 Dec 2013 16:44:03 +0100 Subject: [PATCH 08/14] Adjustments after merge --- .gitignore | 218 ------------------------------------------------ README | 5 -- config.dist.php | 5 +- 3 files changed, 1 insertion(+), 227 deletions(-) diff --git a/.gitignore b/.gitignore index 9bb2a0b..d684e76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,220 +1,2 @@ -<<<<<<< HEAD config.php logs/vikingbot.log -======= -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results - -[Dd]ebug/ -[Rr]elease/ -x64/ -build/ -[Bb]in/ -[Oo]bj/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.log -*.scc - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf -*.cachefile - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.Publish.xml -*.pubxml - -# NuGet Packages Directory -## TODO: If you have NuGet Package Restore enabled, uncomment the next line -#packages/ - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -sql/ -*.Cache -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.[Pp]ublish.xml -*.pfx -*.publishsettings - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -App_Data/*.mdf -App_Data/*.ldf - -############# -## Windows detritus -############# - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac crap -.DS_Store - - -############# -## Python -############# - -*.py[co] - -# Packages -*.egg -*.egg-info -dist/ -build/ -eggs/ -parts/ -var/ -sdist/ -develop-eggs/ -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg ->>>>>>> proj1/master diff --git a/README b/README index 0cf9542..f322782 100644 --- a/README +++ b/README @@ -50,14 +50,9 @@ rssPlugin: upgradePlugin: - Plugin that upgrades the bot via git pull. -<<<<<<< HEAD - -======= autoOpPlugin: - Plugin that gives +o to everyone or to certain nicks on channel join. ->>>>>>> proj1/master - ========== TEXT FORMATTING ========== If you wish, you can format text the bot sends to a channel/user, via your plugins. diff --git a/config.dist.php b/config.dist.php index b74f9b9..c2709c8 100644 --- a/config.dist.php +++ b/config.dist.php @@ -30,15 +30,12 @@ $config['plugins']['fileReader'] = array( 'channel' => '#vikingbot', ); -<<<<<<< HEAD -======= //Auto Op $config['plugins']['autoOp'] = array( - 'mode' => '1', // autop mode, 0 = disabled, 1 = only configured users, 2 = autoop everyone + 'mode' => '0', // autop mode, 0 = disabled, 1 = only configured users, 2 = autoop everyone 'channel' => array( '#channel1' => array('nick1','nick2','nick3','nick4','nick5','nick6','nick7','nick8'), '#channel2' => array('ueland','ernini') ), ); ->>>>>>> proj1/master From 9f8649db9a0e9bdde441413116d255f85ec49f0d Mon Sep 17 00:00:00 2001 From: renini Date: Fri, 10 Jan 2014 13:14:22 +0100 Subject: [PATCH 09/14] Correcting logformat The log format is outputted with the number of days in the month, instead of the actually day. So for example the log for today has the following entries: [31.Jan.14 12:10:50] PRIVMSG t Number of days in the given month d Day of the month, 2 digits with leading zeros --- lib/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.php b/lib/functions.php index fbbcbf5..d03cacf 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -118,7 +118,7 @@ function logMsg($msg) { if(!stringEndsWith($msg, "\n")) { $msg .= "\n"; } - echo "[".date("t.M.y H:i:s")."] {$msg}"; + echo "[".date("d.M.y H:i:s")."] {$msg}"; } /** From b05f6ec59867bdc2002ca93028d5a5415a8b1af4 Mon Sep 17 00:00:00 2001 From: Stoyvo Date: Sat, 24 May 2014 12:30:17 -0400 Subject: [PATCH 10/14] First Commit --- README | 78 +++++++----------------------------------------- README-VikingBot | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 68 deletions(-) create mode 100644 README-VikingBot diff --git a/README b/README index f322782..8599b7f 100644 --- a/README +++ b/README @@ -1,76 +1,18 @@ -========== INSTALLING ========== -1) copy config.dist.php to config.php -2) update config.php with correct settings -3) run it, sh start.sh -4) check log outout in logs/vikingbot.log +http://cryptoglance.info -========== SUPPORTED COMMANDS ========== -The following commands are supported out of the box -(aka they are not controlled via plugins): +---- -!quit [password] - Shuts down the bot -!restart [password] - Restarts the bot +cryptoGlance -The following commands are supported via the plugins that -is installed per default: +### What is this? -!botlog [password] [rows] - The bot responds with the [rows] last rows of the bot log file (default: 10 rows) -!memory - The bot responds with memory usage statistics -!ping - The bot responds with a pong to say that it is still alive -!uptime - The bot responds with the bots uptime -!upgrade [password] - The bot will attempt to upgrade itself to the latest version via GIT pull -!op nick channel [password] - The bot attempts to give *user* on *channel OP status +We have forked Ueland/VikingBot for our own personal use on our IRC Channel #cryptoGlance on freenode.net. -========== INSTALLED PLUGINS ========== -The following plugins are installed per default: +### What does it do? -fileReaderPlugin: - - Outputs data from db/fileReaderOutput.db to channel specified in the plugin, - useful for GIT/SVN commit hooks or anything other that should push data to a - channel +As this is a freshly forked repo, this is 100% identical to Ueland/VikingBot. Features can be found here. -botLogPlugin: - - Plugin that responds to a "!log" with the last N rows of the bot`s log file +### We owe thanks to the following: -memoryPlugin: - - Plugin that responds to a "!memory" with information about memory usage - -opPlugin: - - Plugin that respons to a "!op ..." by oping a user if the bot has op itsefl - -pingPlugin: - - Plugin that responds to a "!ping" with a "pong". - -uptimePlugin: - - Plugin that responds to a "!uptime" with the bots uptime - -rssPlugin: - - Plugin that pulls RSS feeds at specified intervals and outputs new - RSS elements to a specified channel. - -upgradePlugin: - - Plugin that upgrades the bot via git pull. - -autoOpPlugin: - - Plugin that gives +o to everyone or to certain nicks on channel join. - -========== TEXT FORMATTING ========== -If you wish, you can format text the bot sends to a channel/user, via your plugins. -Use any of the following codes to apply the relevant text color or format. The text will -keep the given format until either end of string, or the {reset} tag. - -Available colors: -{white}, {black}, {blue}, {green}, {red}, {darkRed}, {purple}, -{orange}, {yellow}, {lime}, {teal}, {cyan}, {lightBlue}, {pink}, {grey} & {lightGrey} - -Other tags: -{reset}, {bold} & {underline} - -Example: -"{bold}i am bold and {red}red{reset}, but now i am normal" - -PS: Different IRC-clients may display colors differently, some servers even deny color use! - -========== BUGS/PROBLEMS? ========== -Feel free to contact me via IRC on EfNet/Freenode/Undernet (Ueland) -or via e-mail: tor.henning AT gmail.com. +- [Ueland/VikingBot](https://github.com/Ueland/VikingBot) +- [LiteSaber](https://coinhuntr.com/) (For referring us to VikingBot) \ No newline at end of file diff --git a/README-VikingBot b/README-VikingBot new file mode 100644 index 0000000..f322782 --- /dev/null +++ b/README-VikingBot @@ -0,0 +1,76 @@ +========== INSTALLING ========== +1) copy config.dist.php to config.php +2) update config.php with correct settings +3) run it, sh start.sh +4) check log outout in logs/vikingbot.log + +========== SUPPORTED COMMANDS ========== +The following commands are supported out of the box +(aka they are not controlled via plugins): + +!quit [password] - Shuts down the bot +!restart [password] - Restarts the bot + +The following commands are supported via the plugins that +is installed per default: + +!botlog [password] [rows] - The bot responds with the [rows] last rows of the bot log file (default: 10 rows) +!memory - The bot responds with memory usage statistics +!ping - The bot responds with a pong to say that it is still alive +!uptime - The bot responds with the bots uptime +!upgrade [password] - The bot will attempt to upgrade itself to the latest version via GIT pull +!op nick channel [password] - The bot attempts to give *user* on *channel OP status + +========== INSTALLED PLUGINS ========== +The following plugins are installed per default: + +fileReaderPlugin: + - Outputs data from db/fileReaderOutput.db to channel specified in the plugin, + useful for GIT/SVN commit hooks or anything other that should push data to a + channel + +botLogPlugin: + - Plugin that responds to a "!log" with the last N rows of the bot`s log file + +memoryPlugin: + - Plugin that responds to a "!memory" with information about memory usage + +opPlugin: + - Plugin that respons to a "!op ..." by oping a user if the bot has op itsefl + +pingPlugin: + - Plugin that responds to a "!ping" with a "pong". + +uptimePlugin: + - Plugin that responds to a "!uptime" with the bots uptime + +rssPlugin: + - Plugin that pulls RSS feeds at specified intervals and outputs new + RSS elements to a specified channel. + +upgradePlugin: + - Plugin that upgrades the bot via git pull. + +autoOpPlugin: + - Plugin that gives +o to everyone or to certain nicks on channel join. + +========== TEXT FORMATTING ========== +If you wish, you can format text the bot sends to a channel/user, via your plugins. +Use any of the following codes to apply the relevant text color or format. The text will +keep the given format until either end of string, or the {reset} tag. + +Available colors: +{white}, {black}, {blue}, {green}, {red}, {darkRed}, {purple}, +{orange}, {yellow}, {lime}, {teal}, {cyan}, {lightBlue}, {pink}, {grey} & {lightGrey} + +Other tags: +{reset}, {bold} & {underline} + +Example: +"{bold}i am bold and {red}red{reset}, but now i am normal" + +PS: Different IRC-clients may display colors differently, some servers even deny color use! + +========== BUGS/PROBLEMS? ========== +Feel free to contact me via IRC on EfNet/Freenode/Undernet (Ueland) +or via e-mail: tor.henning AT gmail.com. From 06a8822da6d471cc77e473086c9b507286a9aae4 Mon Sep 17 00:00:00 2001 From: Stoyvo Date: Sat, 24 May 2014 12:30:59 -0400 Subject: [PATCH 11/14] Readme fix --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From ade1a00fc7a0a2997bf0e308449001f2b8d16930 Mon Sep 17 00:00:00 2001 From: Stoyvo Date: Sat, 24 May 2014 12:31:32 -0400 Subject: [PATCH 12/14] Readme fix --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 8599b7f..361b6aa 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ ---- -cryptoGlance - ### What is this? We have forked Ueland/VikingBot for our own personal use on our IRC Channel #cryptoGlance on freenode.net. From 7c915f560e2a09c3ee5ffaea31fa5a8336bccfd3 Mon Sep 17 00:00:00 2001 From: Stoyvo Date: Sat, 24 May 2014 17:32:49 -0400 Subject: [PATCH 13/14] Misc Changes - Moved plugins to a different config - Rename some stuff to be more generic --- .gitignore | 4 ++-- VikingBot.php => bot.php | 7 ++++--- config.dist.php | 41 -------------------------------------- config.php | 17 ++++++++++++++++ lib/functions.php | 43 ++++++++++++++++++++++------------------ plugins.php | 20 +++++++++++++++++++ plugins/botLogPlugin.php | 2 +- plugins/skeleton.txt | 2 +- start.sh | 2 +- 9 files changed, 70 insertions(+), 68 deletions(-) rename VikingBot.php => bot.php (98%) delete mode 100644 config.dist.php create mode 100644 config.php create mode 100644 plugins.php diff --git a/.gitignore b/.gitignore index d684e76..86446fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -config.php -logs/vikingbot.log +logs/* +db/* \ No newline at end of file diff --git a/VikingBot.php b/bot.php similarity index 98% rename from VikingBot.php rename to bot.php index 18d6d39..12eb4bb 100644 --- a/VikingBot.php +++ b/bot.php @@ -1,6 +1,7 @@ socket, "QUIT :{$msg}"); foreach($this->plugins as $plugin) { @@ -253,4 +254,4 @@ function antiFlood($user) { } //Start the bot -$bot = new VikingBot($config); +$bot = new Bot($config); diff --git a/config.dist.php b/config.dist.php deleted file mode 100644 index c2709c8..0000000 --- a/config.dist.php +++ /dev/null @@ -1,41 +0,0 @@ - 'servername', //Server name, prefix it with "ssl://" in order to use SSL server - 'port' => 6666, //Server port - 'channel' => '#vikingbot', //Channel to join, use array('channel1', 'channel2') for multiple channels - 'name' => 'vikingbot', //Name of the bot - 'nick' => 'vikingbot', //Nick of the bot - 'pass' => '', //Server password - 'waitTime' => 10, //How many seconds to wait before joining channel after connecting to server - 'adminPass' => 'vikingbot', //Bot admin password, used for commands like !exit (!exit vikingbot) - 'memoryLimit' => '128', //Max memory the bot can use, in MB - 'memoryRestart' => '10', //Min memory usage, in MB. (The bot will try to clear RAM or restart if reached) - 'trigger' => '!', //What character should be used as bot command prefixes - 'maxPerTenMin' => 50 //Max messgages a user can send per 10 minutes before beeing ignored for that time -); - -//===================================== -//Plugin specific configuration -//===================================== - -//RSS Reader -$config['plugins']['rssReader'] = array( - array('title'=> 'VG', 'url'=>'http://www.vg.no/rss/nyfront.php?frontId=1', 'pollInterval'=>15, 'channel'=>'#vikingbot'), - array('title'=> 'BBC News', 'url'=>'http://feeds.bbci.co.uk/news/rss.xml', 'pollInterval'=>15, 'channel'=>'#vikingbot'), - array('title'=> 'CNN', 'url'=>'http://rss.cnn.com/rss/edition.rss', 'pollInterval'=>15, 'channel'=>'#vikingbot'), -); - -//File reader -$config['plugins']['fileReader'] = array( - 'channel' => '#vikingbot', -); - -//Auto Op -$config['plugins']['autoOp'] = array( - 'mode' => '0', // autop mode, 0 = disabled, 1 = only configured users, 2 = autoop everyone - 'channel' => array( - '#channel1' => array('nick1','nick2','nick3','nick4','nick5','nick6','nick7','nick8'), - '#channel2' => array('ueland','ernini') - ), -); diff --git a/config.php b/config.php new file mode 100644 index 0000000..871a564 --- /dev/null +++ b/config.php @@ -0,0 +1,17 @@ + 'chat.freenode.net', //Server name, prefix it with "ssl://" in order to use SSL server + 'port' => 6667, //Server port + 'channel' => array('#cryptoGlance'), //Channel to join, use array('channel1', 'channel2') for multiple channels + 'name' => 'cryptoGlance', //Name of the bot + 'nick' => 'cryptoGlance', //Nick of the bot + 'pass' => '', //Server password + 'waitTime' => 10, //How many seconds to wait before joining channel after connecting to server + 'adminPass' => '', //Bot admin password, used for commands like !exit (!exit vikingbot) + 'memoryLimit' => '128', //Max memory the bot can use, in MB + 'memoryRestart' => '10', //Min memory usage, in MB. (The bot will try to clear RAM or restart if reached) + 'trigger' => '!', //What character should be used as bot command prefixes + 'maxPerTenMin' => 50 //Max messgages a user can send per 10 minutes before beeing ignored for that time +); \ No newline at end of file diff --git a/lib/functions.php b/lib/functions.php index d03cacf..c276717 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -42,27 +42,32 @@ function sendMessage($socket, $channel, $msg) { * */ function prettify($msg) { + // Reset Colours/Styling $msg = str_replace("{reset}", "\017", $msg); - $msg = str_replace("{white}", "\0030", $msg); - $msg = str_replace("{black}", "\0031", $msg); - $msg = str_replace("{blue}", "\0032", $msg); - $msg = str_replace("{green}", "\0033", $msg); - $msg = str_replace("{red}", "\0034", $msg); - $msg = str_replace("{darkRed}", "\0035", $msg); - $msg = str_replace("{purple}", "\0036", $msg); - $msg = str_replace("{orange}", "\0037", $msg); - $msg = str_replace("{yellow}", "\0038", $msg); - $msg = str_replace("{lime}", "\0039", $msg); - $msg = str_replace("{teal}", "\00310", $msg); - $msg = str_replace("{cyan}", "\00311", $msg); - $msg = str_replace("{lightBlue}", "\00312", $msg); - $msg = str_replace("{pink}", "\00313", $msg); - $msg = str_replace("{grey}", "\00314", $msg); - $msg = str_replace("{lightGrey}", "\00315", $msg); - + + // Colours + $msg = str_replace("{white}", "\0030", $msg); + $msg = str_replace("{black}", "\0031", $msg); + $msg = str_replace("{blue}", "\0032", $msg); + $msg = str_replace("{green}", "\0033", $msg); + $msg = str_replace("{red}", "\0034", $msg); + $msg = str_replace("{darkRed}", "\0035", $msg); + $msg = str_replace("{purple}", "\0036", $msg); + $msg = str_replace("{orange}", "\0037", $msg); + $msg = str_replace("{yellow}", "\0038", $msg); + $msg = str_replace("{lime}", "\0039", $msg); + $msg = str_replace("{teal}", "\00310", $msg); + $msg = str_replace("{cyan}", "\00311", $msg); + $msg = str_replace("{lightBlue}", "\00312", $msg); + $msg = str_replace("{pink}", "\00313", $msg); + $msg = str_replace("{grey}", "\00314", $msg); + $msg = str_replace("{lightGrey}", "\00315", $msg); + + // Styling $msg = str_replace("{bold}", "\002", $msg); - $msg = str_replace("{underline}", "\017", $msg); - $msg = str_replace("{bold}", "\002", $msg); + $msg = str_replace("{underline}", "\017", $msg); + $msg = str_replace("{bold}", "\002", $msg); + return $msg; } diff --git a/plugins.php b/plugins.php new file mode 100644 index 0000000..7a332cd --- /dev/null +++ b/plugins.php @@ -0,0 +1,20 @@ + 'cryptoGlance', 'url'=>'http://www.reddit.com/r/cryptoglance/.rss', 'pollInterval' => 15, 'channel'=> $config['channel'][0]), +); + +//File reader -- not used +//$plugins['fileReader'] = array( +// 'channel' => '#cryptoglance', +//); + +//Auto Op -- not used +//$plugins['autoOp'] = array( +// 'mode' => '0', // autop mode, 0 = disabled, 1 = only configured users, 2 = autoop everyone +// 'channel' => array( +// '#channel1' => array('nick1','nick2','nick3','nick4','nick5','nick6','nick7','nick8'), +// '#channel2' => array('ueland','ernini') +// ), +//); diff --git a/plugins/botLogPlugin.php b/plugins/botLogPlugin.php index f1bbc17..e7fc69b 100644 --- a/plugins/botLogPlugin.php +++ b/plugins/botLogPlugin.php @@ -45,7 +45,7 @@ function onMessage($from, $channel, $msg) { //Password auth ok, display log data sendMessage($this->socket, $channel, "{$from}: Last {$limit} entries from bot log:"); - $logdata = file('logs/vikingbot.log'); + $logdata = file('logs/bot.log'); $rows = count($logdata); for($i=$rows - $limit; $i<$rows; $i++){ sendMessage($this->socket, $channel, "{$logdata[$i]}"); diff --git a/plugins/skeleton.txt b/plugins/skeleton.txt index 059884a..b71edae 100644 --- a/plugins/skeleton.txt +++ b/plugins/skeleton.txt @@ -1,7 +1,7 @@ logs/vikingbot.log 2>&1 & +php bot.php > logs/bot.log 2>&1 & From 1817b23cc35629024b2951c2d4a33174a52b57e2 Mon Sep 17 00:00:00 2001 From: Stoyvo Date: Sat, 24 May 2014 17:33:34 -0400 Subject: [PATCH 14/14] Added config.php to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 86446fd..cca6049 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +config.php logs/* db/* \ No newline at end of file