Skip to content

Instantly share code, notes, and snippets.

@omiq
Created June 14, 2018 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omiq/3aab26dd3d3ce0f71c8e1c97139fbd90 to your computer and use it in GitHub Desktop.
Save omiq/3aab26dd3d3ce0f71c8e1c97139fbd90 to your computer and use it in GitHub Desktop.
Discord "Welcome Bot"
import os
import discord
# discord client
client = discord.Client()
def process_message(message):
args = message.content.split(" ")
return args
# create a new event
@client.event
async def on_ready():
print()
print("STEEMMAKERS ARE GO!")
print("(Bot Ready)")
servers = "\n - ".join([s.name + " (" + s.id + ")" for s in client.servers])
print(servers)
channel = client.get_channel("383256479056134146")
await client.send_message(channel, "Beep Boop Blurp! [Bot Ready]")
# listen for specific messages
@client.event
async def on_message(message):
if message.content.startswith("/hello"):
await client.send_message(message.channel, "BY YOUR COMMAND!")
if message.content.startswith("/check-check"):
await client.send_message(message.channel, ":+1: Channel = {}".format(message.channel))
print(message.channel.id)
# welcome message
@client.event
async def on_member_join(member):
print("** " + member.name + " joined")
welcome_message = member.name + """ - Welcome! :)
Read this helpful introduction to get acquainted with the group:
https://hackmd.io/s/Bk5sNz_xm
"""
channel = client.get_channel("383256479056134146")
await client.send_message(channel, welcome_message)
# run the bot
bot = os.environ['SMBOT']
client.run(bot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment