mirror of
https://github.com/polyjitter/searchbot-discord.git
synced 2024-08-14 22:46:55 +00:00
Error Handling, Online Util
This commit is contained in:
parent
8adc005f50
commit
830adece17
4 changed files with 97 additions and 54 deletions
28
extensions/utils/online.py
Normal file
28
extensions/utils/online.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# tacibot online util
|
||||
# Provides utils for various online tools.
|
||||
|
||||
'''Online File'''
|
||||
|
||||
class Online():
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.request = bot.request
|
||||
|
||||
async def hastebin(self, string):
|
||||
"""Posts a string to hastebin."""
|
||||
|
||||
url = "https://hastebin.com/documents"
|
||||
data = string.encode('utf-8')
|
||||
async with self.request.post(url=url, data=data) as haste_response:
|
||||
haste_key = (await haste_response.json())['key']
|
||||
haste_url = f"http://hastebin.com/{haste_key}"
|
||||
# data = {'sprunge': ''}
|
||||
# data['sprunge'] = string
|
||||
# haste_url = await self.aioclient.post(url='http://sprunge.us',
|
||||
# data=data)
|
||||
return haste_url
|
||||
|
||||
def setup(bot):
|
||||
bot.online = Online(bot)
|
Loading…
Add table
Add a link
Reference in a new issue