DDG style Bangs now support Bangs at the End (Implements #404)

This commit is contained in:
Vansh Comar 2021-10-28 12:50:45 +05:30
parent 190b684469
commit 1de7846aed

View File

@ -55,9 +55,10 @@ def resolve_bang(query: str, bangs_dict: dict) -> str:
query = query.lower()
split_query = query.split(' ')
for operator in bangs_dict.keys():
if operator not in split_query:
if operator not in split_query \
and operator[1:] + operator[0] not in split_query:
continue
return bangs_dict[operator]['url'].format(
query.replace(operator, '').strip())
query.replace(operator if operator in split_query
else operator[1:] + operator[0], '').strip())
return ''