Is there a way to purge one chat message through the API, like when MooBot purges a link?
You can use “.timeout 1” which will timeout for one second.
All timeouts send a CLEARCHAT for a username, which replaces their preceding messages with in the chat client.
aaron_clay, do you have an example of using .timeout 1?
I plan on adding purging functionality to my bot but haven’t gotten the time to do so yet.
It would save me some research.
The RAW IRC commands:
PRIVMSG #channel .timeout target_troll 1
What I want to do is purge a single message, not all the messages for a user (which is trivially simple as mentioned).
When for example someone posts a link, it seems MooBot can purge just that message.
I want to know how to purge a single message.
It’s not possible to purge just one message. The user’s entire scrollback will be removed.
Then how do the bot’s do it?
(random caption to make this over 20 characters)
To clarify george’s response, bots typically purge all of a user’s messages using a timeout of 1 second as earlier mentioned. This can sometimes look like they are just deleting a single message if the user only has one message on screen, possibly due to slow mode.
i have the following line:
$server->send_raw(sprintf("PRIVMSG %s .timeout %s 1", $ch->getName(), $n));
Do I need to do something else to make the purging work?
That looks correct although I’m not familiar with the syntax for whatever IRC framework you are using.
I am using the IRC client Irssi on Debian.
My bot is written in PERL and I have it send out the raw command when it parses !timeout or !purge .
No messages get purged and they do not get timed out for x seconds.
So that has to be an issue with Irssi, have to look into that, more debugging yay!
EDIT: fixed by appending ‘:’ before the user’s nick in the send_raw function.
Is there a list somewhere with privmsg commands?