Skip to content

Instantly share code, notes, and snippets.

@omiq
Created February 21, 2018 21:03
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/e3782e8763408da43b3cde1ad048ef17 to your computer and use it in GitHub Desktop.
Save omiq/e3782e8763408da43b3cde1ad048ef17 to your computer and use it in GitHub Desktop.
Discord bookmark bot
import os
import sys
import discord
import subprocess
# 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("BOOP BEEP BOOP SQUEEE!")
print("(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("/add-link"):
args = process_message(message)
blog = args[1]
link = args[2]
result = subprocess.check_output(['/home/chrisg/steemit/add-link.sh', blog, link])
await client.send_message(message.channel, "@{} Link added: {}".format(message.author,link))
# run the bot
bot = "xxxxxxxxYOUR KEY HERExxxxxxx"
client.run(bot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment