diff --git a/bot.py b/bot.py index af18451..fe6f03f 100644 --- a/bot.py +++ b/bot.py @@ -163,7 +163,8 @@ def craft_list(bot: Bot, update: Update, groups: tuple) -> None: if item_filter == 'all': items = dbItem.select(lambda i: i).order_by(lambda i: i.id) elif item_filter == 'basic': - items = dbItem.select(lambda i: not i.complex).order_by(lambda i: i.id) + #items = dbItem.select(lambda i: not i.complex).order_by(lambda i: i.id) + items = dbItem.select(lambda i: orm.raw_sql(r"i.id ~ E'^\\d+$$'") and orm.between(orm.raw_sql("i.id::integer"), 1, 69) and not i.complex).order_by(lambda i: i.id) elif item_filter == 'complex': items = dbItem.select(lambda i: i.complex).order_by(lambda i: i.id) elif item_filter == 'armour': @@ -228,7 +229,7 @@ def craft_cb(bot: Bot, update: Update, groups: tuple) -> None: kb_markup = None if item.complex: - recipe_text = '{name}\n\n'.format(name=item.name) + recipe_text = '{id} - {name}\n\n'.format(id=item.id, name=item.name) recipe_text += gen_craft_tree(item) else: recipe_text = "{} cannot be crafted.".format(item.name) @@ -382,7 +383,12 @@ def item_search(bot: Bot, update: Update, args: list=None) -> None: for item in items: result_text += '{:>3} - {}'.format(item.id, item.name) - result_text += ' (/craft_{})\n'.format(item.id) if item.complex else ' (/i_{})\n'.format(item.id) + command = 'craft' + if item.id.isdigit() and 39 <= int(item.id) <= 69: + command = 'brew' + elif item.id.startswith('p'): + command = 'brew' + result_text += ' (/{}_{})\n'.format(command, item.id) if item.complex else ' (/i_{})\n'.format(item.id) elif len(items) == 1: for item in items: return craft_cb(bot, update, (item.id, )) diff --git a/config.py b/config.py index bb30e4c..1d24aa2 100644 --- a/config.py +++ b/config.py @@ -33,7 +33,7 @@ 'dsn': os.getenv('DATABASE_URL')} WEBHOOK_PORT = int(os.getenv('PORT')) - WEBHOOK_URL = 'cw-crafts-bot.herokuapp.com' + WEBHOOK_URL = '{}.herokuapp.com'.format(os.getenv('HEROKU_APP_NAME')) else: LOGLEVEL = 'DEBUG' DB_PARAMS = {'provider': 'postgres',