View previous topic :: View next topic |
Author |
Message |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 809 Location: Tennessee, USA
|
Posted: Sat Feb 28, 2015 1:54 pm Post subject: Make Eggdrop blind to control codes |
|
|
This post is in response to the following conversation on #egghelp @ freenode.
Quote: | <AlphaTech> In the built-in logs how can I disable color? It making funky logs on my logging webpage
<SpiKe^^> not sure if there's a better way, but you could try a little proc i have used to remove all colorcodes from everything the bot sees
<SpiKe^^> but it will affect everything the bot sees, not just the logging stuff |
I'm thinking this may of use to others also...
Code: |
catch {unbind raw - PRIVMSG *raw:irc:msg}
bind raw - PRIVMSG striprivmsg
proc striprivmsg {f k a} {
set a [string map [list \017 ""] [stripcodes abcgru $a]]
*raw:irc:msg $f $k $a
}
|
This is what BogusTrivia uses to make binds trigger on text that contains control codes.
This code is adapted from an old egghelp.org forum post @ http://forum.egghelp.org/viewtopic.php?t=12944
Please let me know if this helps, AlphaTech. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3743 Location: Mint Factory
|
Posted: Sat Feb 28, 2015 5:30 pm Post subject: |
|
|
This has been discussed before and user offered a solution here.
Code: |
unbind raw - PRIVMSG *raw:irc:msg
unbind raw - PRIVMSG *raw:PRIVMSG
bind raw - PRIVMSG striprivmsg
proc striprivmsg {f k a} {
set a [stripcodes abcgru $a]
*raw:irc:msg $f $k $a
*raw:PRIVMSG $f $k $a
}
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 809 Location: Tennessee, USA
|
Posted: Sat Feb 28, 2015 8:26 pm Post subject: |
|
|
Yup, I mentioned that same prior post too.
This is a revised version of that same proc.
1. As of eggdrop 1.6.21, [stripcodes abcgru $string] does not strip the control code \017, an issue thommey is aware of.
2. For most uses, the "unbind raw - PRIVMSG *raw:PRIVMSG" is not needed.
3. This is a complete example of that proc, with the unbind in a catch, to keep it from killing the bot on rehash.
Thanks for pointing out the prior post I already did though. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3743 Location: Mint Factory
|
Posted: Sun Mar 01, 2015 4:31 am Post subject: |
|
|
Oh snap. To be honest haven't checked the topic you mentioned. /facepalm
Just remembered saw something like this before and wanted to help out and made a fool of myself in the process.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 969
|
Posted: Thu Mar 17, 2022 4:30 am Post subject: |
|
|
anyway to strip incoming messages only and not outgoing ? |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1057 Location: France
|
Posted: Thu Mar 17, 2022 6:19 am Post subject: |
|
|
As said on IRC:
Code: | proc striprivmsg {f k a} {
if {$f ne "${::botnick}![getchanhost $::botnick]"} {
set a [stripcodes abcgru $a]
}
*raw:irc:msg $f $k $a
*raw:PRIVMSG $f $k $a
} |
This will let the message unchanged if emetter is the eggdrop _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 969
|
Posted: Thu Mar 17, 2022 8:33 am Post subject: |
|
|
oh euhm yea thanks CC i posted this before i found out i had controlstrip module loaded on znc thats why i couldnt see any color codes after unloading it all was fine.
thanks again CC much apreciated. |
|
Back to top |
|
 |
user12 Voice
Joined: 19 May 2022 Posts: 3
|
Posted: Thu May 19, 2022 2:37 am Post subject: Re: Make Eggdrop blind to control codes |
|
|
SpiKe^^ wrote: | This post is in response to the following conversation on #egghelp @ freenode.
Quote: | <AlphaTech> In the built-in logs how can I disable color? It making funky logs on my logging webpage
<SpiKe^^> not sure if there's a better way, but you could try a little proc i have used to remove all colorcodes from everything the bot sees
<SpiKe^^> but it will affect everything the bot sees, not just the logging stuff |
I'm thinking this may of use to others also...
Code: |
catch {unbind raw - PRIVMSG *raw:irc:msg}
bind raw - PRIVMSG striprivmsg
proc striprivmsg {f k a} {
set a [string map [list \017 ""] [stripcodes abcgru $a]]
*raw:irc:msg $f $k $a
}
|
This is what BogusTrivia uses to make binds trigger on text that contains control codes.
This code is adapted from an old egghelp.org forum post @ http://forum.egghelp.org/viewtopic.php?t=12944
Please let me know if this helps, AlphaTech. |
that code doesn't work with utf-8 especially emojis  _________________ yes |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 809 Location: Tennessee, USA
|
|
Back to top |
|
 |
user12 Voice
Joined: 19 May 2022 Posts: 3
|
Posted: Fri May 20, 2022 6:17 am Post subject: Ok, |
|
|
Let's see if I explain myself better XD, using eggdrop with utf-8 "emojis" when using !Say 😀 the bot copies the message well using emojis, but by adding this code, it kills the emojis when using !Say 😀 sends signs _________________ yes |
|
Back to top |
|
 |
|