mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 14:47:29 +00:00
Merge branch 'dev'
This commit is contained in:
commit
ba1be8a6c5
3 changed files with 10 additions and 7 deletions
|
@ -7,12 +7,10 @@ async def send_error(ctx, error):
|
||||||
await ctx.send('{}\n```\n{}```'.format(base, error))
|
await ctx.send('{}\n```\n{}```'.format(base, error))
|
||||||
|
|
||||||
|
|
||||||
# class NSFW(errext.CheckFailure):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
class Remove(Exception):
|
class Remove(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SizeError(Exception):
|
class SizeError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -46,6 +44,7 @@ class Save(Exception):
|
||||||
self.user = user
|
self.user = user
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
|
|
||||||
class GoTo(Exception):
|
class GoTo(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,10 @@ async def query_kheina(url):
|
||||||
content = re.sub('<a href="/cdn-cgi/l/email-protection".+</a>', '', content)
|
content = re.sub('<a href="/cdn-cgi/l/email-protection".+</a>', '', content)
|
||||||
|
|
||||||
soup = BeautifulSoup(content, 'html5lib')
|
soup = BeautifulSoup(content, 'html5lib')
|
||||||
|
|
||||||
|
if soup.find('data', id='error'):
|
||||||
|
return False
|
||||||
|
|
||||||
results = soup.find('data', id='results').string
|
results = soup.find('data', id='results').string
|
||||||
results = ast.literal_eval(results)
|
results = ast.literal_eval(results)
|
||||||
iqdbdata = soup.find('data', id='iqdbdata').string
|
iqdbdata = soup.find('data', id='iqdbdata').string
|
||||||
|
|
|
@ -24,7 +24,7 @@ except FileNotFoundError:
|
||||||
with open('config.json', 'w') as outfile:
|
with open('config.json', 'w') as outfile:
|
||||||
jsn.dump({'client_id': 0, 'owner_id': 0, 'permissions': 126016,
|
jsn.dump({'client_id': 0, 'owner_id': 0, 'permissions': 126016,
|
||||||
'playing': 'a game', 'prefix': [',', 'm,'], 'selfbot': False, 'token': 'str', 'saucenao_api': 'str'}, outfile, indent=4, sort_keys=True)
|
'playing': 'a game', 'prefix': [',', 'm,'], 'selfbot': False, 'token': 'str', 'saucenao_api': 'str'}, outfile, indent=4, sort_keys=True)
|
||||||
print('FILE NOT FOUND : config.json created with abstract values. Restart run.py with correct values')
|
print('FILE NOT FOUND : config.json created with default values. Restart run.py with correct values')
|
||||||
|
|
||||||
|
|
||||||
def setdefault(filename, default=None, json=False):
|
def setdefault(filename, default=None, json=False):
|
||||||
|
@ -87,10 +87,10 @@ asession = aiohttp.ClientSession()
|
||||||
async def fetch(url, *, params={}, json=False, response=False, text=False):
|
async def fetch(url, *, params={}, json=False, response=False, text=False):
|
||||||
async with asession.get(url, params=params, headers={
|
async with asession.get(url, params=params, headers={
|
||||||
'User-Agent': 'Myned/Modufur (https://github.com/Myned/Modufur)'}, ssl=False) as r:
|
'User-Agent': 'Myned/Modufur (https://github.com/Myned/Modufur)'}, ssl=False) as r:
|
||||||
if json:
|
if response:
|
||||||
return await r.json()
|
|
||||||
elif response:
|
|
||||||
return r
|
return r
|
||||||
|
elif json:
|
||||||
|
return await r.json()
|
||||||
elif text:
|
elif text:
|
||||||
return await r.text()
|
return await r.text()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue