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')
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')