fix bug allowing users to make the bug mention roles/users

parent 05616be8
......@@ -2,6 +2,7 @@
import requests
from discord import Embed
from discord.ext import commands
import re
class ARKCog:
......@@ -11,6 +12,7 @@ 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
......@@ -25,10 +27,14 @@ class ARKCog:
return None
return response.get('d')[0]
def escape_query(self, query) -> str:
"""Escape mentions from queries"""
return query.replace('<', '\<').replace('>', '\>')
@commands.command()
async def ark(self, query: str, field_to_return: str = None):
"""Search for `query` on Intel's ARK. By default shows the following attributes:
- ProductName
- ClockSpeed
- ClockSpeedMax
......@@ -36,9 +42,10 @@ class ARKCog:
- ThreadCount
- VTD
- AESTech
Reference of fields can be found here: https://odata.intel.com/
"""
escaped_query = self.escape_query(query)
# Check special queries first
if query in self.special_queries:
await self.bot.say(self.special_queries[query])
......
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