Sponsored Content
Top Forums Shell Programming and Scripting Using ii for irc chat - scripting assistance? Post 302591221 by spartan2006 on Thursday 19th of January 2012 01:46:02 PM
Old 01-19-2012
Using ii for irc chat - scripting assistance?

I am using ii for irc on my pogoplug...

hxxp://hg.suckless.org/ii/file/d163c8917af7/FAQ

If you look at the bottom of there, it states

Code:
    31 What other fancy stuff can I do with ii?
    32 ----------------------------------------
    33 It is very easy to write irc bots in ii:
    34 tail -f \#/out | while read foo; do name=echo $foo | awk '{print $2}' | sed 's,<\\(.*\\)>,\\1,'; if 0 -eq expr $RANDOM % 10 then echo "$name: WHAT??" ; fi; done
    35 This will just spam a channel but think about using nagios2irc or you can
    36 use ii to generate channel stats. Your imagination should be boundless.

Now, forgive me, but I more or less have no idea what that is doing.


My goal is to do something similiar to what this normal irc remote script will do, but with ii

Code:
on 1:TEXT:*:#channel_name:if (your_text_trigger isin $1-) { msg your_nickname_to_message from $nick ( $chan ) said $1- }

Basically, whenever someone says a trigger in a particular channel, it will message a nickname with that entire line.

The channel output is stored in a file named "out". When the trigger is stated, I'd need the name of the person who said it along with the entire line of what they said (containing the trigger as well) sent to "in" along with the command to private message it.

Is that possible with ii, from what you can see?

---------- Post updated 01-19-12 at 01:45 PM ---------- Previous update was 01-18-12 at 09:57 PM ----------

To add some clarification .....

I need to tail a particular file which is essentially a log file. Whenever I see my name, I want it to copy that entire line to a different file.

I figure I will have to use awk to do this, but beyond that I am completely lost.

Code:
tail -f outputfile | grep -w 'trigger1|trigger2|trigger3'

That should only display things that have the trigger word in them (entire line, right?).

How can I then take that line, store it to a variable, then send some text, then the variable, to another file?

Last edited by spartan2006; 01-19-2012 at 03:28 PM..
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scripting neophyte needs file manipulation assistance

I need to write two shell scripts for an rsync backup solution. The first script will copy all backed up files into a folder named after the original folder, plus a date stamp (so e.g. if the original folder name is 'foo' and is backed up on the 10th of September, then the backup folder will be... (0 Replies)
Discussion started by: LambdaCalculus
0 Replies

2. Shell Programming and Scripting

Assistance in Perl scripting

PFA file "color.txt". Note : There is no newline character in the file. I have manually inserted the newline char to make it easy to understand. I am expecting out in the form as specified in second file "out.txt" I need a perl script to perform the task. Thanks in advance. (2 Replies)
Discussion started by: deo_kaustubh
2 Replies

3. Shell Programming and Scripting

sed newbie scripting assistance

Howdy folks, I'm trying to craft a log file summarisation tool for an application that creates a lot of duplicate entries with only a different suffix to indicate point of execution. I thought I'd gotten close but I'm clearly missing something. Here's a genericized version: A text_file... (3 Replies)
Discussion started by: mthespian
3 Replies

4. Shell Programming and Scripting

Dhcp.config file scripting assistance

Hello everyone! I am brand new at this forum thing and wanted to thank all of you for your time and help in advance for helping me troubleshoot my issue. I am fairly new to shell scripting and scoured the entire internet to find a solution for my issue to no avail and hope you're able to help. ... (2 Replies)
Discussion started by: sedrocks
2 Replies

5. Shell Programming and Scripting

Noob to scripting needs some assistance

Hello, I am in a Unix class and have been out of town. I have been tasked to generate a couple of scripts and ahve never done it before. I have a virtual machine running Ubuntu. The task is below Prompt the system administrator for all valid input parameters Generate a menu to ask which... (1 Reply)
Discussion started by: jkeeton81
1 Replies
picoirc(n)						  Simple embeddable IRC interface						picoirc(n)

__________________________________________________________________________________________________________________________________________________

NAME
picoirc - Small and simple embeddable IRC client. SYNOPSIS
package require Tcl package require picoirc ?0.5? ::picoirc::connect callback nick url ::picoirc::post context channel message ::picoirc::splituri uri ::picoirc::send context line _________________________________________________________________ DESCRIPTION
This package provides a general purpose minimal IRC client suitable for embedding in other applications. All communication with the parent application is done via an application provided callback procedure. Each connection has its own state so you can hook up multiple servers in a single application instance. To initiate an IRC connection you must call picoirc::connect with a callback procedure, a nick-name to use on IRC and the IRC URL that describes the connection. This will return a variable name that is the irc connection context. See CALLBACK for details. This package is a fairly simple IRC client. If you need something with more capability investigate the irc package. COMMANDS
::picoirc::connect callback nick url Create a new irc connection to the server specified by url and login using the nick as the username. The callback must be as speci- fied in CALLBACK. Returns a package-specific variable that is used when calling other commands in this package. ::picoirc::post context channel message This should be called to process user input and send it to the server. A number of commands are recognised when prefixed with a for- ward-slash (/). Such commands are converted to IRC command sequences and then sent. ::picoirc::splituri uri Splits an IRC scheme uniform resource indicator into its component parts. Returns a list of server, port and channel. The default port is 6667 and there is no default channel. ::picoirc::send context line This command is where all raw output to the server is handled. The default action is to write the line to the irc socket. However, before this happens the callback is called with "debug write". This permits the application author to inspect the raw IRC data and if desired to return a break error code to halt further processing. In this way the application can override the default send via the callback procedure. CALLBACK
The callback must look like: proc Callback {context state args} { } where context is the irc context variable name (in case you need to pass it back to a picoirc procedure). state is one of a number of states as described below. init called just before the socket is created connect called once we have connected, before we join any channels close called when the socket gets closed, before the context is deleted. If an error occurs before we get connected the only argument will be the socket error message. userlist channel nicklist called to notify the application of an updated userlist. This is generated when the output of the NAMES irc command is seen. The package collects the entire output which can span a number of output lines from the server and calls this callback when they have all been received. chat target nick message type called when a message arrives. target is the identity that the message was targetted for. This can be the logged in nick or a chan- nel name. nick is the name of the sender of the message. message is the message text. type is set to "ACTION" if the message was sent as a CTCP ACTION system channel message called when a system message is received topic channel topic called when the channel topic string is seen. topic is the text of the channel topic. traffic action channel nick ?newnick? called when users join, leave or change names. action is either entered, left or nickchange and nick is the user doing the action. newnick is the new name if action is nickchange. NOTE: channel is often empty for these messages as nick activities are global for the irc server. You will have to manage the nick for all connected channels yourself. version This is called to request a version string to use to override the internal version. If implemented, you should return as colon delimited string as Appname:Appversion:LibraryVersion For example, the default is PicoIRC:[package provide picoirc]:Tcl [info patchlevel] debug type raw called when data is either being read or written to the network socket. type is set to read when reading data and write if the data is to be written. raw is the unprocessed IRC protocol data. In both cases the application can return a break error code to interrupt further processing of the raw data. If this is a read oper- ation then the package will not handle this line. If the operation is write then the package will not send the data. This callback is intended for debugging protocol issues but could be used to redirect all input and output if desired. SEE ALSO
rfc 1459 KEYWORDS
chat, irc irc 0.5 picoirc(n)
All times are GMT -4. The time now is 10:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy