Commit 5431b4b8 authored by Jens Langhammer's avatar Jens Langhammer

Update ark.py

parent 517ff790
......@@ -2,7 +2,6 @@
import requests
from discord import Embed
from discord.ext import commands
import re
class ARKCog:
......@@ -12,7 +11,6 @@ class ARKCog:
'@everyone': "Hah. Nice try. Being very funny. Cheeky cunt.",
':(){ :|: & };: -': "This is a python bot, not a bash bot you nimwit."
}
mention_re = r'<(\?|@|!).*>'
def __init__(self, bot):
self.bot = bot
......@@ -29,13 +27,10 @@ class ARKCog:
def escape_query(self, query) -> str:
"""Escape mentions from queries"""
print(query)
if '@' in query:
return ''
return query
return query.replace('`', "'")
@commands.command()
async def ark(self, query: str, field_to_return: str = None):
async def ark(self, *query):
"""Search for `query` on Intel's ARK. By default shows the following attributes:
- ProductName
......@@ -48,7 +43,7 @@ class ARKCog:
Reference of fields can be found here: https://odata.intel.com/
"""
query = self.escape_query(query)
query = self.escape_query(' '.join(query))
# Check special queries first
if query in self.special_queries:
await self.bot.say(self.special_queries[query])
......@@ -59,8 +54,6 @@ class ARKCog:
return
fields = ['ProductName', 'ClockSpeed', 'ClockSpeedMax',
'CoreCount', 'ThreadCount', 'VTD', 'AESTech']
if field_to_return and field_to_return in cpu_data:
fields = [field_to_return]
# Create embedded message
embed = Embed(title="ARK Search Result",
......@@ -72,4 +65,4 @@ class ARKCog:
def setup(bot):
"""setup"""
bot.add_cog(ARKCog(bot))
\ No newline at end of file
bot.add_cog(ARKCog(bot))
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