File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5151basic_food_data = defaultdict (dict )
5252
5353
54- def is_valid (target ):
55- """ Checks if a string is a valid IRC nick. """
56- if nick_re .match (target ):
57- return True
58- else :
59- return False
60-
61-
6254def load_template_data (bot , filename , data_dict ):
6355 data_dict .clear ()
6456 food_dir = os .path .join (bot .data_dir , "food" )
@@ -95,8 +87,8 @@ def make_cmd_list(value):
9587
9688
9789def basic_food (food ):
98- def func (text , action ):
99- if not is_valid (text ):
90+ def func (text , action , is_nick_valid ):
91+ if not is_nick_valid (text ):
10092 return "I can't give {} to that user." .format (food .unitname )
10193
10294 action (basic_format (text , basic_food_data [food .name ]))
Original file line number Diff line number Diff line change @@ -100,12 +100,11 @@ def boobies(text):
100100
101101
102102@hook .command ("awesome" , "iscool" , "cool" )
103- def awesome (text ):
103+ def awesome (text , is_nick_valid ):
104104 """- Prints a webpage to show <nick> how awesome they are."""
105- nick_re = re .compile ("^[A-Za-z0-9_|.\-\]\[]*$" , re .I )
106105 link = 'http://is-awesome.cool/{}'
107106 nick = text .split (' ' )[0 ]
108- if nick_re . match (nick ):
107+ if is_nick_valid (nick ):
109108 return "{}: I am blown away by your recent awesome action(s). Please read \x02 {}\x02 " .format (
110109 nick , link .format (nick )
111110 )
You can’t perform that action at this time.
0 commit comments