Untitled

By Wet Capybara, 5 Years ago, written in Plain Text, viewed 114 times.
URL http://pb.stoleyour.com/view/b155e388 Embed
Download Paste or View RawExpand paste to full width of browser
  1. import discord
  2. import urllib
  3. from discord.ext import commands
  4.  
  5.  
  6. class Shorten:
  7.  
  8.     def __init__(self, bot):
  9.         self.bot = bot
  10.  
  11.     @commands.command()
  12.     async def shorten(self, url):
  13.    
  14.         url = ("http://ouo.io/api/B3Nm9g8L?s=" + url)
  15.         handle = urllib.request.urlopen(url)
  16.         html = handle.read()
  17.         await self.bot.say("Shortened: " + html)
  18.  
  19.  
  20. def setup(bot):
  21.     bot.add_cog(Shorten(bot))
  22.  

Reply to "Untitled"

Here you can reply to the paste above