mirror of
https://github.com/polyjitter/searchbot-discord.git
synced 2024-08-14 22:46:55 +00:00
New get_webhook and logging features
This commit is contained in:
parent
7ae19ef8a6
commit
a824c068e7
4 changed files with 254 additions and 100 deletions
|
@ -5,7 +5,12 @@
|
|||
|
||||
'''Online File'''
|
||||
|
||||
import discord
|
||||
|
||||
|
||||
class Online():
|
||||
"""Provides various online utilities for your bot."""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.request = bot.request
|
||||
|
@ -18,11 +23,16 @@ class Online():
|
|||
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 get_webhook(self, url: str):
|
||||
"""Easily gets a webhook from a url."""
|
||||
|
||||
return discord.Webhook.from_url(
|
||||
url,
|
||||
adapter=discord.AsyncWebhookAdapter(self.request)
|
||||
)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.online = Online(bot)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue