Commit 517ff790 authored by Jens Langhammer's avatar Jens Langhammer

Finally fix bug and actually test it

parent 7aef8ce8
......@@ -29,7 +29,10 @@ class ARKCog:
def escape_query(self, query) -> str:
"""Escape mentions from queries"""
return query.replace('<', '\<').replace('>', '\>')
print(query)
if '@' in query:
return ''
return query
@commands.command()
async def ark(self, query: str, field_to_return: str = None):
......@@ -45,14 +48,14 @@ class ARKCog:
Reference of fields can be found here: https://odata.intel.com/
"""
escaped_query = self.escape_query(query)
query = self.escape_query(query)
# Check special queries first
if escaped_query in self.special_queries:
await self.bot.say(self.special_queries[escaped_query])
if query in self.special_queries:
await self.bot.say(self.special_queries[query])
return
cpu_data = ARKCog.do_lookup(escaped_query)
cpu_data = ARKCog.do_lookup(query)
if not cpu_data:
await self.bot.say("I couldn't find anything matching `%s`" % escaped_query)
await self.bot.say("I couldn't find anything matching `%s`" % query)
return
fields = ['ProductName', 'ClockSpeed', 'ClockSpeedMax',
'CoreCount', 'ThreadCount', 'VTD', 'AESTech']
......@@ -61,7 +64,7 @@ class ARKCog:
# Create embedded message
embed = Embed(title="ARK Search Result",
description="Query was `%s`" % escaped_query,
description="Query was `%s`" % query,
color=0x0071c5)
for field in fields:
embed.add_field(name=field, value=cpu_data[field])
......@@ -69,4 +72,4 @@ class ARKCog:
def setup(bot):
"""setup"""
bot.add_cog(ARKCog(bot))
bot.add_cog(ARKCog(bot))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment