import discord
import game_objects as rpg
import verb_parser as v

client = discord.Client()
client.login("login", "password")


@client.event
def on_message(message):
    command = message.content.split()
    if (len(command) <= 2) & (len(command) > 0):
        verb_word = command[0]
        if verb_word in v.verb_dict:
            verb = v.verb_dict[verb_word]
        else:
            return
                
        if len(command) == 2:
            noun_word = command[1]
            try:
                client.send_message(message.channel, verb(noun_word, message.author.name))
            except:
                pass
        else:
            try:
                client.send_message(message.channel, verb(message.author.name))
            except:
                pass


@client.event
def on_ready():
    print(client.user.name)
    print(client.user.id)
    for i in client.get_all_members():
        v.players[i.name] = rpg.Player(i.name)


client.run()
