示例#1
0
        embed = discord.Embed(title=f"{member.name}'s roles", color=0x2f3136)
        embed.set_thumbnail(url=member.avatar_url)
        embed.add_field(name=f"Roles ({len(roles)})",
                        value=" ".join([role.mention for role in roles]))
        await ctx.send(embed=embed)


@bot.command(pass_context=True)
async def roleinfo(ctx, *, role: discord.Role = None):
    """➜  Info about a role"""
    if role == None:
        await ctx.send(":x: | Role not found")
    else:
        colour = ''.join([random.choice('0123456789ABCDEF') for x in range(6)])
        colour = int(colour, 16)
        embed = discord.Embed(colour=discord.Colour(value=colour),
                              timestamp=datetime.datetime.utcnow())
        embed.add_field(name="Role Name", value=format(role.name))
        embed.add_field(name="Role ID", value=format(role.id))
        embed.add_field(name="For Guild", value=format(role.guild))
        embed.add_field(name="Hoist", value=format(role.hoist))
        embed.add_field(name="Role Position", value=format(role.position))
        embed.add_field(name="Mentionable Role",
                        value=format(role.mentionable))
        embed.add_field(name="Role Created At", value=format(role.created_at))
        await ctx.send(embed=embed)


keep_alive()
client.loop.create_task(statuschange())
client.run(os.environ.get("BABI"))
示例#2
0
            if random.random() <= CHANCE:
                try:
                    for i in range(len(arr)):
                        if arr[i].translate(
                                str.maketrans(
                                    "", "",
                                    "#!$%&:\"\'()*+,-./;<=>?@[\\]^_`{|}~")
                        ).lower() == "im":
                            # detect if "I'm is in the string"

                            await message.channel.send(
                                "Hi {}, I'm Dad!".format(" ".join(arr[i + 1:]))
                            )
                            # sends the dreaded message
                        return
                        # terminates the function
                except:
                    pass
    finally:
        await client.process_commands(message)


@client.event
async def on_ready():
    await client.change_presence(status=discord.Status.online,
                                 activity=discord.Game("[d!] Hi, I'm Dad!"))
    # change status when bot is loaded


keep_alive()  # start internal server to keep bot loaded
client.run(TOKEN)  # log into Discord