Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3. from time import sleep
  4.  
  5.  
  6. me = commands.Bot(command_prefix='.', self_bot=True)
  7.  
  8.  
  9. @me.event
  10. async def on_ready():
  11. print("----------")
  12. print("Logged in as:")
  13. print(" "+str(me.user.name))
  14. print(" "+str(me.user.id))
  15. print("----------")
  16.  
  17.  
  18. def makeEmbed(*, name=None, icon=None, colour=0xDEADBF, values={}):
  19. '''Creates an embed messasge with specified inputs'''
  20.  
  21. # Create an embed object with the specified colour
  22. embedObj = discord.Embed(colour=colour)
  23.  
  24. # Set the author and URL
  25. embedObj.set_author(name=name, icon_url=icon)
  26.  
  27. # Create all of the fields
  28. for i in values:
  29. if values[i] == '':
  30. values[i] = 'None'
  31. embedObj.add_field(name=i, value='{}'.format(values[i]))
  32.  
  33. # Return to user
  34. return embedObj
  35.  
  36.  
  37. @me.event
  38. async def on_message(message):
  39. if message.author.id == me.user.id and message.server.id == '140847179043569664':
  40. if len(message.embeds) > 0:
  41. return
  42. pass
  43. else:
  44. return
  45.  
  46. actualDict = {}
  47. name = message.clean_content
  48.  
  49. actualObj = makeEmbed(name=name, icon=me.user.avatar_url, values=actualDict)
  50. sleep(0.4)
  51. await me.edit_message(message, ' ', embed=actualObj)
  52.  
  53.  
  54.  
  55. token = "UserToken"
  56. me.run(token, bot=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement