Ejemplo n.º 1
0
async def generalMessage(message):
    p = DictionaryReader()
    try:
        roles = len(message.author.roles)
    except Exception:
        roles = 10
    command = message.content[1::].split(' ')[0].lower()
    msg = p.commandReader(message.content[1::],message.channel.name)
    if msg != None:
        if command in p.whisperCommands():
            if command == 'pub' and roles > 1 and 'help' not in message.content:
                await client.send_message(message.channel, msg)
            else:
                await client.send_message(message.author, msg)
                try:
                    await client.delete_message(message)
                except (HTTPException, Forbidden):
                    print('Error deleting message, probably from whisper')
        else:
            await client.send_message(message.channel, msg)
    else:
        msg = p.commandReader('invalid',message.channel.name)
        await client.send_message(message.author, msg)        
        try:
            await client.delete_message(message)
        except (HTTPException, Forbidden):
            print('Error deleting message, probably from whisper')
Ejemplo n.º 2
0
async def generalMessage(message):
    p = DictionaryReader()
    try:
        roles = len(message.author.roles)
    except Exception:
        roles = 10
    command = message.content[1::].split(' ')[0].lower()
    msg = ''
    if not isinstance(message.channel, DMChannel):
        msg = p.commandReader(message.content[1::],message.channel.name)
    else:
        msg = p.commandReader(message.content[1::],'PM')
        
    if msg != None:
        if command in p.whisperCommands():
            if command == 'pub' and roles > 1 and 'help' not in message.content:
                await message.channel.send(msg)
            else:
                await message.author.send(msg)
                try:
                    await message.delete()
                except (HTTPException, Forbidden):
                    print('Error deleting message, probably from whisper')
        else:
            await message.channel.send(msg)
    else:
        if not isinstance(message.channel, DMChannel):
            msg = p.commandReader(message.content[1::],message.channel.name)
        else:
            msg = p.commandReader(message.content[1::],'PM')
        print(message.content[1::])
        print(msg)
        await message.author.send(msg)        
        try:
            await message.delete()
        except (HTTPException, Forbidden):
            print('Error deleting message, probably from whisper')
Ejemplo n.º 3
0
async def forwardMessage(message):
    p = DictionaryReader()
    roles = message.author.roles
    canSend = False
    for role in roles:
        canSend = canSend or (role.name in p.roles())
    if not canSend:
        print('{0.author.name} can\'t send whispers'.format(message))
        return
    entries = message.content.split(' ')
    target = message.mentions[0]
    if target != None:
        entry = ' '.join(entries[2::])
        msg = p.commandReader(entry)
        if msg != None:
            await target.send(msg)
            await message.delete()
            await message.author.send('Message sent to {0.mention}'.format(target))
        else:
            await message.channel.send('Invalid Message, {0.mention}'.format(message.author))
Ejemplo n.º 4
0
async def sendWelcomeMessage(member):
    p = DictionaryReader()
    msg = p.commandReader('help')
    await member.send(msg)
Ejemplo n.º 5
0
async def sendWelcomeMessage(member):
    p = DictionaryReader()
    msg = p.commandReader('help')
    await client.send_message(member, msg)