egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Make Eggdrop blind to control codes

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 785
Location: Tennessee, USA

PostPosted: Sat Feb 28, 2015 1:54 pm    Post subject: Make Eggdrop blind to control codes Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Sat Feb 28, 2015 5:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 785
Location: Tennessee, USA

PostPosted: Sat Feb 28, 2015 8:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Sun Mar 01, 2015 4:31 am    Post subject: Reply with quote

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. Rolling Eyes
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 894

PostPosted: Thu Mar 17, 2022 4:30 am    Post subject: Reply with quote

anyway to strip incoming messages only and not outgoing ?
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 987
Location: France

PostPosted: Thu Mar 17, 2022 6:19 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 894

PostPosted: Thu Mar 17, 2022 8:33 am    Post subject: Reply with quote

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
View user's profile Send private message
user12
Voice


Joined: 19 May 2022
Posts: 3

PostPosted: Thu May 19, 2022 2:37 am    Post subject: Re: Make Eggdrop blind to control codes Reply with quote

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 Very Happy Very Happy Very Happy
_________________
yes
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 785
Location: Tennessee, USA

PostPosted: Thu May 19, 2022 9:01 am    Post subject: Reply with quote

That code has little to do with how your bot does utf-8

See these links for help with utf-8 issues with tcl/eggdrop

https://github.com/eggheads/eggdrop/issues/4

[07:42] <SergioR> it's Tcl issue, not eggdrop
[07:43] <SergioR> utf-8 extended = generic/tcl.h - #define TCL_UTF_MAX 6
[07:45] <SergioR> https://snap.servx.org/-UykzuNVHJQ

https://wiki.eggheads.org/index.php/UTF-8
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
user12
Voice


Joined: 19 May 2022
Posts: 3

PostPosted: Fri May 20, 2022 6:17 am    Post subject: Ok, Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber