import discord import urllib from discord.ext import commands class Shorten: def __init__(self, bot): self.bot = bot @commands.command() async def shorten(self, url): url = ("http://ouo.io/api/B3Nm9g8L?s=" + url) handle = urllib.request.urlopen(url) html = handle.read() await self.bot.say("Shortened: " + html) def setup(bot): bot.add_cog(Shorten(bot))