<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kabaka</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kabaka"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Kabaka"/>
	<updated>2026-05-05T19:42:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Sircbot&amp;diff=9590</id>
		<title>Sircbot</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Sircbot&amp;diff=9590"/>
		<updated>2013-12-02T23:49:43Z</updated>

		<summary type="html">&lt;p&gt;Kabaka: fix spelling error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sircbot is a simple irc bot based in lua script.&lt;br /&gt;
&lt;br /&gt;
== Install sircbot ==&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add sircbot lua-sircbot}}&lt;br /&gt;
&lt;br /&gt;
== Configue sircbot ==&lt;br /&gt;
&lt;br /&gt;
{{Cmd| vi  /etc/conf.d/sircbot}}&lt;br /&gt;
&lt;br /&gt;
Change name, server and channel&lt;br /&gt;
&lt;br /&gt;
 sircbot_opts=&amp;quot;-n name -s server&amp;quot;&lt;br /&gt;
 sircbot_channels=&amp;quot;#channel&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Create sircbot scripts folders and files ==&lt;br /&gt;
&lt;br /&gt;
Sircbot will use an folder for the channel where is logged in. Lets say we will use it at the &amp;quot;test&amp;quot; channel.&lt;br /&gt;
The folder path is: /etc/sircbot.d/#channel&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Lets see an example:&lt;br /&gt;
&lt;br /&gt;
Our bot will be named kumquat and we will join at the #test channel in the irc.ddd.ddd server.&lt;br /&gt;
&lt;br /&gt;
{{Cmd| vi  /etc/conf.d/sircbot}}&lt;br /&gt;
&lt;br /&gt;
Change name, server and channel&lt;br /&gt;
&lt;br /&gt;
 sircbot_opts=&amp;quot;-n kumquat -s irc.ddd.ddd&amp;quot;&lt;br /&gt;
 sircbot_channels=&amp;quot;#test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Create folder bot. &lt;br /&gt;
&lt;br /&gt;
{{Cmd| mkdir /etc/sircbot.d/#test -p}}&lt;br /&gt;
&lt;br /&gt;
Create the lua scrip file for our bot. &lt;br /&gt;
&lt;br /&gt;
{{Cmd| vi /etc/sircbot.d/#test/commands}}&lt;br /&gt;
&lt;br /&gt;
 #!/usr/bin/lua&lt;br /&gt;
 &lt;br /&gt;
 -- Scripts for kumquat in Lua&lt;br /&gt;
 &lt;br /&gt;
 args={...}&lt;br /&gt;
 &lt;br /&gt;
 sender=args[1]   	-- is the nickname of running the command on IRC&lt;br /&gt;
 message=args[2] 	-- is the message or command typed&lt;br /&gt;
 channel=args[3] 	-- is the channel name&lt;br /&gt;
 &lt;br /&gt;
 os.execute(&amp;quot;sleep &amp;quot; .. tonumber(1))&lt;br /&gt;
 &lt;br /&gt;
 -- This command will show: What can i do for you &amp;quot;nickname&amp;quot;?&lt;br /&gt;
 local kumquatresult = string.find(message, &amp;quot;kumquat&amp;quot;) &lt;br /&gt;
   if kumquatresult ~= nil then&lt;br /&gt;
   command=&amp;quot;echo &#039;What can i do for you &#039;&amp;quot;..sender..&amp;quot;&#039;?&#039; | sircbot-send &#039;&amp;quot;..channel..&amp;quot;&#039;&amp;quot;&lt;br /&gt;
   io.popen(command)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 -- This command will show: Hello there, amigo &amp;quot;nickname&amp;quot;&lt;br /&gt;
 local kumquatresult = string.find(message, &amp;quot;hi&amp;quot;)&lt;br /&gt;
   if kumquatresult ~= nil then&lt;br /&gt;
   command=&amp;quot;echo &#039;Hello there, amigo &#039;&amp;quot;..sender..&amp;quot;&#039;&#039; | sircbot-send &#039;&amp;quot;..channel..&amp;quot;&#039;&amp;quot;&lt;br /&gt;
   io.popen(command)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 -- This command will show the current UTC date and time&lt;br /&gt;
 local kumquatresult = string.find(message, &amp;quot;date&amp;quot;)&lt;br /&gt;
   if kumquatresult ~= nil then&lt;br /&gt;
   command=&amp;quot;date -u | sircbot-send &#039;&amp;quot;..channel..&amp;quot;&#039;&amp;quot;&lt;br /&gt;
   io.popen(command)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 -- This command will do a search for a alpine linux package&lt;br /&gt;
 local kumquatresult = string.find(message, &amp;quot;apk search:[^%d]&amp;quot;)&lt;br /&gt;
 if kumquatresult ~= nil then&lt;br /&gt;
   local strng = (string.sub(message, 12))&lt;br /&gt;
   command=&amp;quot;apk search&amp;quot;..strng..&amp;quot; | sircbot-send &#039;&amp;quot;..channel..&amp;quot;&#039;&amp;quot;    &lt;br /&gt;
   io.popen(command)&lt;br /&gt;
 end&lt;br /&gt;
  &lt;br /&gt;
 -- This command will resolve a host name and ip&lt;br /&gt;
 local kumquatresult = string.find(message, &amp;quot;host:[^%d]&amp;quot;)&lt;br /&gt;
 if kumquatresult ~= nil then&lt;br /&gt;
   local strng = (string.sub(message, 6))&lt;br /&gt;
   command=&amp;quot;host &amp;quot;..strng..&amp;quot; | sircbot-send &#039;&amp;quot;..channel..&amp;quot;&#039;&amp;quot;    &lt;br /&gt;
   io.popen(command)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 -- This command will do a 3 times ping to a server or ip address&lt;br /&gt;
 local kumquatresult = string.find(message, &amp;quot;ping:[^%d]&amp;quot;)&lt;br /&gt;
 if kumquatresult ~= nil then&lt;br /&gt;
   local strng = (string.sub(message, 6))&lt;br /&gt;
   command=&amp;quot;ping -c 3 &amp;quot;..strng..&amp;quot; | sircbot-send &#039;&amp;quot;..channel..&amp;quot;&#039;&amp;quot;    &lt;br /&gt;
   io.popen(command)&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
Make the script to be executable&lt;br /&gt;
&lt;br /&gt;
{{Cmd| chmod +x /etc/sircbot.d/#test/commands}}&lt;br /&gt;
&lt;br /&gt;
== Giving life to the bot ==&lt;br /&gt;
&lt;br /&gt;
Starting bot service and adding to boot.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/init.d/sircbot start &amp;amp;&amp;amp; rc-update add sircbot default}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
If your bot is not responding as expected, an easy way to troubleshoot is to manually execute the script in /etc/sircbot.d/&amp;lt;#channelname&amp;gt;/&amp;lt;scriptname&amp;gt; with the three agruments.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|/etc/sircbot.d/&amp;lt;#channelname&amp;gt;/&amp;lt;scriptname&amp;gt; username hi &#039;&amp;lt;#channelname&amp;gt;&#039;}}&lt;br /&gt;
&lt;br /&gt;
If your bot responds as expected, then you know that your script works.  The problem is that sircbot is not executing the script.  Here are two likely causes:&lt;br /&gt;
&lt;br /&gt;
# Sircbot is case-sensitive when looking for the channel directory for a script to execute.  For example, if you have a channel named &amp;quot;#Alpine&amp;quot;, sircbot will look for /etc/sircbot.d/#Alpine/*.  If that pathway isn&#039;t exactly right, then sircbot will skip that folder.  In our example, if you have /etc/sircbot.d/#alpine/script, sircbot will not execute anything in that folder.  To fix, simply rename the folder to /etc/sircbot.d/#Alpine/&lt;br /&gt;
# Sircbot doesn&#039;t execute scripts that have a &#039;.&#039; in the name.  For example a script named &#039;listen.lua&#039; will not be executed.  Simply rename the script to &#039;listen&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>Kabaka</name></author>
	</entry>
</feed>