File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 4
4
from asyncio import coroutines
5
5
import concurrent .futures
6
6
from asyncio import futures
7
+ from text_util import toMathSans
7
8
8
9
logging .basicConfig (level = logging .INFO )
9
10
@@ -81,7 +82,10 @@ async def on_message(message):
81
82
if len (message .attachments ) > 0 :
82
83
content += ' ' + message .attachments [0 ].url
83
84
84
- irc .send_my_message ("%s: %s" % (message .author .name , content ))
85
+ # Note(jpc) for nick escaping
86
+ authorName = toMathSans (message .author .name )
87
+ irc .send_my_message ("%s: %s" % (authorName , content ))
88
+
85
89
86
90
@client .event
87
91
async def on_ready ():
Original file line number Diff line number Diff line change
1
+ def toMathSans (text ):
2
+ # convert alphabetic characters to Math Sans, for nick escaping
3
+ result = ''
4
+ for c in text :
5
+ o = ord (c )
6
+ if o >= 0x0061 and o <= 0x007a :
7
+ result += chr (o - 0x0061 + 0x1d5ba )
8
+ elif o >= 0x0041 and o <= 0x005a :
9
+ result += chr (o - 0x0041 + 0x1d5a0 )
10
+ else :
11
+ result += c
12
+ return result
You can’t perform that action at this time.
0 commit comments