diff --git a/src/utils/utils.py b/src/utils/utils.py index e907744..b86541e 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -85,14 +85,17 @@ color = d.Color(0x1A1A1A) last_commands = {} -async def fetch(url, *, params={}, json=False, response=False): +async def fetch(url, *, params={}, json=False, response=False, text=False): async with aiohttp.ClientSession() as session: async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modufur'}, ssl=False) as r: - if response: - return r - elif json: + if json: return await r.json() - return await r.read() + elif response: + return r + elif text: + return await r.text() + else: + return await r.read() def generate_embed(ctx, *, title=d.Embed.Empty, kind='rich', description=d.Embed.Empty, url=d.Embed.Empty, timestamp=d.Embed.Empty, colour=color, footer={}, image=d.Embed.Empty, thumbnail=d.Embed.Empty, author={}, fields=[]):