Advertisement
3nd0fw0r1d

bot

Mar 14th, 2020
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.69 KB | None | 0 0
  1. # bot.py
  2. from PIL import Image, ImageFilter
  3. import os, glob
  4. import math, random
  5. import time
  6.  
  7. import discord
  8. import requests
  9. import io
  10. from discord.ext import commands
  11. from discord.ext.commands import Bot
  12. from discord import Emoji
  13. from discord import File
  14. from dotenv import load_dotenv
  15.  
  16. X = [226,160,280,198,255,280,160]
  17. Y = [515,530,540,550,550,585,645]
  18. X2 = [310,220]
  19. Y2 = [595,790]
  20. leng = len(X)
  21. leng2 = len(X2)
  22. one = Image.open("Base.png")
  23. two = Image.open("Arm.png")
  24.  
  25. load_dotenv()
  26. TOKEN = os.getenv('DISCORD_TOKEN')
  27.  
  28.  
  29.  
  30. bot = commands.Bot(command_prefix='!')
  31.  
  32. @bot.command(name='emoji')
  33. async def nine_nine(ctx, test):
  34.     one1 = one.copy()
  35.     two2 = two.copy()
  36.     start = test.find(":",3)+1
  37.     stri2 = test[start:]
  38.     stri3 = stri2[:-1]
  39.     ##await ctx.send("https://cdn.discordapp.com/emojis/"+stri3+".png")
  40.     url = "https://cdn.discordapp.com/emojis/"+stri3+".png"
  41.     r = requests.get(url, stream=True)
  42.     r.raise_for_status()
  43.     r.raw.decode_content = True  # Required to decompress gzip/deflate compressed responses.
  44.     with Image.open(r.raw) as img:
  45.         ##img.show()
  46.         ##img.save('emoji.png')
  47.         pog = img.copy()
  48.     r.close()
  49.     for i in range(leng):
  50.         ##print(i)
  51.         one1.alpha_composite(pog.resize((70,70), Image.LANCZOS).rotate(random.randint(0,360), Image.BICUBIC, expand=1),(X[i],Y[i]))
  52.     comp2 = Image.alpha_composite(one1,two2)
  53.     for i in range(leng2):
  54.         comp2.alpha_composite(pog.resize((70,70), Image.LANCZOS).rotate(random.randint(0,360), Image.BICUBIC, expand=1),(X2[i],Y2[i]))
  55.     ##comp2.show()
  56.     comp2.save('memes6.png')
  57.     await ctx.channel.send(file=discord.File('memes6.png'))
  58.  
  59.  
  60. bot.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement