Ejemplo n.º 1
0
 async def send_reply(self, reply, message: discord.Message, where) -> discord.Message:
     if reply:
         for r in reply:
             r = random_choose(r) if isinstance(r, list) else r
             r = Variable(message).apply_variable(r)
             if where == 'group':
                 self.Botreply = await message.channel.send(r)
             elif where == 'private':
                 self.Botreply = DMchannel = await message.author.create_dm()
                 await DMchannel.send(r)
             write_log(hora_atual()+f' Enviando a resposta "{r}" há mensagem "{emoji.demojize(message.content)}" do author {message.author}.', path.log)
Ejemplo n.º 2
0
 async def send_reaction(self, reaction, message:discord.Message, where):
     if reaction:
         for r in reaction:
             code_reaction = r
             r = random_choose(r) if isinstance(r, list) else r
             r = emoji.emojize(r, use_aliases = True)
             try:
                 if where == 'author':
                     await message.add_reaction(r)
                 elif where == 'bot' and self.Botreply:
                     await self.Botreply.add_reaction(r)
                 write_log(hora_atual()+f' Adicionando a reação "{code_reaction}" a mensagem "{emoji.demojize(message.content)}" do autor {message.author}.', path.log)
             except discord.HTTPException:
                 print(r)
Ejemplo n.º 3
0
 async def on_ready():
     write_log(hora_atual() + ' Bot inicializado.', paths.log)
Ejemplo n.º 4
0
                ]
                to_insert = dict()

                for each in to_read:
                    to_insert[each] = None
                    if each in actual:
                        to_insert[each] = actual[each]

                await Interpreter.message_and_reply(
                    self,
                    message=message,
                    conditions=to_insert['conditions'],
                    expected_message=to_insert['expected message'],
                    reply=to_insert['reply'],
                    reaction=to_insert['reaction'],
                    delete=to_insert['delete'],
                    pin=to_insert['pin'],
                    delay=to_insert['delay'],
                    kick=to_insert['kick'],
                    ban=to_insert['ban'],
                    where_reply=to_insert['where reply'],
                    where_reaction=to_insert['where reaction'])

        client.run(token)


try:
    Bot()
except discord.errors.LoginFailure:
    write_log(hora_atual() + ' Falha no login.', paths.log)
Ejemplo n.º 5
0
 async def ban_member(self, ban, message: discord.Message):
     if ban and isinstance(message.channel, discord.GroupChannel):
         await message.author.ban()
         write_log(hora_atual()+f' Banindo jogador "{message.author.name}"."')
Ejemplo n.º 6
0
 async def kick_member(self, kick, message: discord.Message):
     if kick and isinstance(message.channel, discord.GroupChannel):
         await message.author.kick()
         write_log(hora_atual()+f' Expulsando jogador "{message.author.name}".')
Ejemplo n.º 7
0
 async def pin_message(self, pin, message: discord.Message):
     if pin:
         await message.pin()
         write_log(hora_atual()+f' Fixando mensagem "{emoji.demojize(message.content)}" do autor {message.author}.',path.log)
Ejemplo n.º 8
0
 async def remove_message(self, delete, message: discord.Message):
     if delete and isinstance(message.channel, discord.GroupChannel):
         await message.delete()
         write_log(hora_atual()+f' Removendo mensagem "{emoji.demojize(message.content)}" do autor {message.author}.',path.log)