Skip to content

Commit 7dd830b

Browse files
authored
Merge pull request CloudBotIRC#160 from linuxdaemon/gonzobot+foods-cleanup
Fix formatting of invalid user message in foods.py
2 parents 72ae4a6 + c4e51ac commit 7dd830b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

plugins/foods.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,10 @@ def load_foods(bot):
7777
load_template_data(bot, food.datafile, basic_food_data[food.name])
7878

7979

80-
def basic_format(text, data, food_type, **kwargs):
80+
def basic_format(text, data, **kwargs):
8181
user = text
8282
kwargs['user'] = user
8383

84-
if not is_valid(user):
85-
return "I can't give {} to that user.".format(food_type)
86-
8784
generator = textgen.TextGenerator(
8885
data["templates"], data["parts"], variables=kwargs
8986
)
@@ -99,7 +96,10 @@ def make_cmd_list(value):
9996

10097
def basic_food(food):
10198
def func(text, action):
102-
action(basic_format(text, basic_food_data[food.name], food.unitname))
99+
if not is_valid(text):
100+
return "I can't give {} to that user.".format(food.unitname)
101+
102+
action(basic_format(text, basic_food_data[food.name]))
103103

104104
func.__name__ = food.name
105105
func.__doc__ = "<user> - gives {} to [user]".format(food.unitname)

0 commit comments

Comments
 (0)