1- # Written by Scaevolus 2010
21import string
32import asyncio
43import re
5- from sqlalchemy import Table , Column , String
64
5+ from sqlalchemy import Table , Column , String
76import requests
87
98from cloudbot import hook
10- from cloudbot .util import botvars , formatting , web
9+ from cloudbot .util import botvars , colors , web
10+
1111
1212re_lineends = re .compile (r'[\r\n]*' )
1313
1414FACTOID_CHAR = "?" # TODO: config
1515
16- # some simple "shortcodes" for formatting purposes
17- shortcodes = {
18- '[b]' : '\x02 ' ,
19- '[/b]' : '\x02 ' ,
20- '[u]' : '\x1F ' ,
21- '[/u]' : '\x1F ' ,
22- '[i]' : '\x16 ' ,
23- '[/i]' : '\x16 '
24- }
25-
2616table = Table (
2717 "mem" ,
2818 botvars .metadata ,
@@ -153,7 +143,7 @@ def factoid(match, async, event, message, action):
153143
154144 if factoid_id in factoid_cache :
155145 data = factoid_cache [factoid_id ]
156- # factoid preprocessors
146+ # factoid pre-processors
157147 if data .startswith ("<py>" ):
158148 code = data [4 :].strip ()
159149 variables = 'input="""{}"""; nick="{}"; chan="{}"; bot_nick="{}";' .format (arguments .replace ('"' , '\\ "' ),
@@ -163,8 +153,8 @@ def factoid(match, async, event, message, action):
163153 else :
164154 result = data
165155
166- # factoid postprocessors
167- result = formatting . multi_replace (result , shortcodes )
156+ # factoid post-processors
157+ result = colors . parse (result )
168158
169159 if result .startswith ("<act>" ):
170160 result = result [5 :].strip ()
0 commit comments