Added main bot

master
pocketjawa 2017-04-15 23:50:57 -04:00
parent 2875bad36d
commit 2588d04162
1 changed files with 52 additions and 0 deletions

52
buttsbot.py Normal file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env python3.4
import discord
import asyncio
import configparser
import datetime
import random
import os
#Get script location
cwd = os.path.dirname(os.path.realpath(__file__))
#Import config file
config = configparser.ConfigParser()
config.read(cwd + "/config.cfg")
token = config.get("configuration", "token")
bot_channel_id = discord.Object(id=config.get("configuration", "bot_channel_id"))
owner_id = discord.User(id=config.get("configuration", "owner_id"))
admin_id = discord.User(id=config.get("configuration", "admin_id"))
client = discord.Client()
@client.event
@asyncio.coroutine
def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
yield from client.send_message(bot_channel_id, "This isn't a butt...")
#yield from client.send_message(bot_channel_id, '!test')
@client.event
@asyncio.coroutine
def on_message(message):
if message.author == client.user:
return
if random.randint(0,50) >= 40:
words = message.content.split()
relpacenum = random.randint(1,5)
replacedwords = 0
while relpacenum > replacedwords:
wordnum = random.randint(1,len(words))
words[(wordnum-1)] = "butt"
replacedwords = replacedwords+1
yield from client.send_message(message.channel, " ".join(words))
client.run(token)