Guest User

Untitled

a guest
Aug 27th, 2020
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3.  
  4. #creating instance of a bot and setting it to a 'client' variable. And set prefix to call the bot
  5. client = commands.Bot(command_prefix = '.')
  6.  
  7. #created first event
  8. @client.event
  9. async def on_ready():
  10. print('I am ready')
  11.  
  12.  
  13. @client.event
  14. async def on_member_join(member):
  15. message = f'Welcome to the server, {member}'
  16. print(message)
  17.  
  18. @client.event
  19. async def on_member_remove(member):
  20. message = f'Farewell, {member}.'
  21. #print('Type is', type(member))
  22. print(message)
  23.  
  24. @client.command()
  25. async def greet(ctx):
  26. await ctx.send("Hello")
  27.  
Advertisement
Add Comment
Please, Sign In to add comment