async def feedback(self, ctx, *, msg: str = None): """Comando usado pra dar feedback direto pros desenvolvedores Use ash feedback <mensagem desejada>""" if msg is None: return await ctx.send( '<:negate:721581573396496464>│`SEU FEEDBACK NÃO PODE SER VAZIO!`' ) try: member = ctx.author server = ctx.guild channel = self.bot.get_channel(530418605284917252) embed = discord.Embed(title='Feedback', color=random_color()) embed.add_field( name='Info', value= f'● Server: {server.name}\n● ServerID: {server.id}\n● Usuario: {member.name}\n● ' f'UsuarioID: {member.id}') embed.add_field(name='Feedback', value=f'{msg}', inline=False) embed.set_thumbnail(url="{}".format(member.avatar_url)) embed.set_footer(text="Ashley ® Todos os direitos reservados.") await channel.send(embed=embed) await ctx.send( '<:confirmed:721581574461587496>│`Feedback enviado com sucesso!`' ) except discord.errors.HTTPException: await ctx.send( "<:negate:721581573396496464>│`SEU FEEDBACK FOI GRANDE DEMAIS, TENTE MANDAR " "EM PARTES!`")
async def web_hook_rpg(self, ctx, avatar_dir, web_hook_name, msg, quest_name): perms = ctx.channel.permissions_for(ctx.me) if not perms.manage_webhooks: if not perms.send_messages: return return await ctx.send( f'<:negate:721581573396496464>│``Eu não tenho a permissão de:`` ' f'**Gerenciar Webhooks**') avatar = open(avatar_dir, 'rb') _webhook = await ctx.channel.create_webhook(name=web_hook_name, avatar=avatar.read()) emoji = choice(self.config['emojis']['ashley']) guild = self.get_guild(519894833783898112) link = [emo for emo in guild.emojis if str(emo) == emoji][0].url webhook = Webhook(url=_webhook.url) content = f"{quest_name} do {ctx.author.name} disse:\n```{msg}```" webhook.embed = discord.Embed( colour=random_color(), description=f"{content if quest_name != 'Ashley' else msg}", timestamp=dt.utcnow()).set_author( name=ctx.author.name, icon_url=ctx.author.avatar_url).set_thumbnail( url=link).to_dict() await webhook.send() await _webhook.delete()
async def on_shard_ready(self, shard_id): self.webhook.embed = Embed( colour=random_color(), description= f"**O shard `{shard_id}` se encontra pronto para uso**\nAproveite o dia ;)", timestamp=datetime.utcnow()).set_author( name=f"Shard {shard_id}", icon_url=self.bot.user.avatar_url).set_thumbnail( url=self.bot.user.avatar_url).to_dict() await self.webhook.send()
async def send_message(self, message, content=None): msg = await get_response(message) if content is None else content ctx = await self.bot.get_context(message) emoji = choice(self.bot.config['emojis']['ashley']) guild = self.bot.get_guild(519894833783898112) link = [emo for emo in guild.emojis if str(emo) == emoji][0].url embed = discord.Embed(colour=random_color(), description=msg, timestamp=dt.utcnow()) embed.set_thumbnail(url=link) return await ctx.reply(embed=embed)
async def web_hook_rpg(ctx, avatar_dir, web_hook_name, msg, quest_name): avatar = open(avatar_dir, 'rb') web_hook_ = await ctx.channel.create_webhook(name=web_hook_name, avatar=avatar.read()) web_hook = WebHook(url=web_hook_.url) web_hook.embed = discord.Embed( colour=random_color(), description=f"**{msg}**", timestamp=dt.utcnow()).set_author( name=quest_name, icon_url=ctx.guild.icon_url).set_thumbnail( url=ctx.author.avatar_url).to_dict() web_hook.send_() await web_hook_.delete()
async def hook(self, ctx, *, msg=None): avatar = open('images/monsters/dark_magician.jpg', 'rb') web_hook_ = await ctx.channel.create_webhook(name="Dark Magician", avatar=avatar.read()) web_hook = WebHook(url=web_hook_.url) web_hook.embed = Embed( colour=random_color(), description=f"**{msg}**", timestamp=datetime.utcnow()).set_author( name=ctx.author.name, icon_url=ctx.author.avatar_url).set_thumbnail( url=ctx.guild.icon_url).to_dict() web_hook.send_() await web_hook_.delete()
async def on_shard_ready(self, shard_id): commands_log = self.bot.get_channel(575688812068339717) text = f"**O shard** `{shard_id}` **se encontra pronto para uso**" embed = Embed(color=self.color, description=text) await commands_log.send(embed=embed) self.webhook.embed = Embed( colour=random_color(), description= f"**O shard** `{shard_id}` **se encontra pronto para uso**\nAproveite o dia ;)", timestamp=datetime.utcnow()).set_author( name=f"Shard {shard_id}", icon_url=self.bot.user.avatar_url).set_thumbnail( url=self.bot.user.avatar_url).to_dict() await self.webhook.send()
async def pet(self, ctx, *, msg: str = "Oiiiii"): """Comando usado pra se comunicar com pet Use ash pet <pergunta ou qualquer besteira>""" try: pet_n = choice(list(self.bot.pets.keys())) pet = self.bot.pets[pet_n] if pet['colour'][0] is True: pet_c = choice(pet['colour'][2]) indice = pet['colour'][2].index(pet_c) mask = choice(self.letters[:pet['mask'][indice]]) link_ = f'images/pet/{pet_n}/{pet_c}/mask_{mask}.png' else: mask = choice(self.letters[:pet['mask'][0]]) link_ = f'images/pet/{pet_n}/mask_{mask}.png' avatar = open(link_, 'rb') _webhook = await ctx.channel.create_webhook(name=pet_n, avatar=avatar.read()) if 'a_' in _webhook.avatar: format_1 = '.gif' else: format_1 = '.webp' webhook = Webhook(url=_webhook.url) webhook.embed = Embed( colour=random_color(), description=f"```{get_content(msg.lower())}```", timestamp=datetime.utcnow() ).set_author( name=ctx.author.name, icon_url=ctx.author.avatar_url ).set_thumbnail( url= f'https://cdn.discordapp.com/avatars/{_webhook.id}/{_webhook.avatar}{format_1}?size=1024' ).to_dict() await webhook.send() await _webhook.delete() except discord.Forbidden: await ctx.send( "<:alert:739251822920728708>│``Não tenho permissão de gerenciar WEBHOOKS nesse " "servidor.``")