Discord bookmark bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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