Advertisement
MrThoe

Simple Discord Bot

Mar 4th, 2021 (edited)
1,629
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. """
  2. This is an example of using python to add
  3. a robot into a discord server.  To be used
  4. with my turtorial that I gave to my students.
  5. """
  6.  
  7. #Install these packages with pip or git if not using repl.it
  8. import discord
  9. import os
  10.  
  11. client = discord.Client()
  12.  
  13. @client.event
  14. async def on_ready():
  15.   print('We have logged in as {0.user}'.format(client))
  16.  
  17. @client.event
  18. async def on_message(msg):
  19.   #Check to make sure it's not the Robot sending the message
  20.   if msg.author == client.user:
  21.     return
  22.  
  23.   if msg.content.startswith('CVHS'):
  24.     await msg.channel.send("CVHS ROCKS!!!!")
  25.  
  26. client.run(os.getenv('token'))
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement