MrThoe

Simple Discord Bot

Mar 4th, 2021 (edited)
917
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×