python类gg()的实例源码

Announcer.py 文件源码 项目:youtube 作者: FishyFing 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _list_channels(self, ctx):
        """Lists YouTube channels with announcements enabled"""
        guild = ctx.message.guild
        if guild.id in self.ids:
            try:
                data = discord.Embed(
                    title="**__Announcement Channels__**\n", colour=discord.Colour(value=11735575))
                k = self.ids[guild.id]['yt_channel']
                data.add_field(
                    name="YouTube Channel", value=k)
                data.add_field(
                    name="Discord Channel", value=self.ids[guild.id]['channel'])
                data.set_footer(
                    text="Made with \U00002665 by Francis#6565. Support server: https://discord.gg/yp8WpMh")
                await ctx.send(embed=data)
            except IndexError as e:
                logger.exception(
                    "An error occured while pulling data from list... {}".format(e))
general.py 文件源码 项目:spirit 作者: jgayfer 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def on_guild_join(self, guild):
        """Send welcome message to the server owner"""
        message = ("Greetings! My name is **{}**, and my sole responsibility is to help you and "
                   "your group kick ass in Destiny 2! You're receiving this message because you "
                   "or one of your trusted associates has added me to **{}**.\n\n"
                   "**Command Prefix**\n\n"
                   "My default prefix is **!**, but you can also just mention me with **@{}**. "
                   "If another bot is already using the **!** prefix, you can choose a different prefix "
                   "for your server with **!settings setprefix <new_prefix>** (don't include the brackets).\n\n"
                   "For a list of all available commands, use the **!help** command. If you want more "
                   "information on a command, use **!help <command_name>**.\n\n"
                   "If you have any feedback, you can use my **!feedback** command to send "
                   "a message to my developer! If you want to request a feature, report a bug, "
                   "stay up to date with new features, or just want some extra help, check out the official "
                   "{} Support server! (https://discord.gg/GXCFpkr)"
                   ).format(self.bot.user.name, guild.name, self.bot.user.name,
                            self.bot.user.name, self.bot.user.name)
        await guild.owner.send(message)
irc_socket.py 文件源码 项目:Uso-Bot 作者: Renondedju 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def check_for_stats(osu_name):
    cursor.execute("SELECT osuId FROM users WHERE osuName = ?", (osu_name,))
    osu_id = cursor.fetchall()
    if not osu_id:

        sender.send_message(osu_name, "Hey ! Nice to meet you, it seems to be your first time here ! Remember that this bot is also available on discord [https://discord.gg/Qsw3yD5 server] [https://discordapp.com/oauth2/authorize?client_id=318357311951208448&scope=bot&permissions=8 add the bot to your server] ! Oh and also, if you need a list of the commands avaiable, type : o!help. GL & HF")

        response = requests.get("https://osu.ppy.sh/api/get_user?k=" + constants.Api.osuApiKey + "&u=" + osu_name, verify=True)
        data = response.json()
        osu_id = data[0]["user_id"]

        cursor.execute("INSERT INTO users (osuId, osuName) VALUES (?, ?)", (osu_id, osu_name,))
        conn.commit()
        api = OsuApi(constants.Api.osuApiKey, connector=ReqConnector())
        update_stats.update_stats(0, conn, api, username = osu_name)
        return osu_id
    else:
        return osu_id[0][0]
UsoDiscord.py 文件源码 项目:Uso-Bot 作者: Renondedju 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def on_command_error(exception, context):

    #Colors
    Color_Off='\x1b[0m'
    Red='\x1b[1;31;40m'
    Yellow='\x1b[1;33;40m'

    message = context.message
    channel = message.channel
    if not message.channel.is_private and not message.content.startswith(commandPrefix + 'mute'):
        cursor.execute("SELECT state FROM server WHERE serverID = ?", (str(message.server.id),))
        if cursor.fetchall()[0][0] == 'on':
            channel = message.author
        else:
            channel = message.channel

    errors = traceback.format_exception(type(exception), exception, exception.__traceback__)
    output = ''
    for line in errors:
        output += line

    await Log(message, content = "Message:\n" + message.content + "\n\n```" + output + "```", logLevel=2)
    await client.send_message(channel, "Oops ! Unexpected error :/\nGo to my personal server to ask for some help if needed !\n<https://discord.gg/Qsw3yD5>")
core.py 文件源码 项目:Bonfire 作者: Phxntxm 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def addbot(self):
        """Provides a link that you can use to add me to a server

        EXAMPLE: !addbot
        RESULT: http://discord.gg/yo_mama"""
        perms = discord.Permissions.none()
        perms.read_messages = True
        perms.send_messages = True
        perms.manage_roles = True
        perms.ban_members = True
        perms.kick_members = True
        perms.manage_messages = True
        perms.embed_links = True
        perms.read_message_history = True
        perms.attach_files = True
        app_info = await self.bot.application_info()
        await self.bot.say("Use this URL to add me to a server that you'd like!\n{}"
                           .format(discord.utils.oauth_url(app_info.id, perms)))
meta.py 文件源码 项目:LunaBot 作者: miraai 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def about(self):
        """Tells you information about the bot itself."""
        revision = os.popen(r'git show -s HEAD --format="%s (%cr)"').read().strip()
        result = ['**About Me:**']
        result.append('- Author: Mirai [ID: 173502573205127170]')
        result.append('- Library: discord.py (Python)')
        result.append('- Latest Change: {}'.format(revision))
        result.append('- Uptime: {}'.format(self.get_bot_uptime()))
        result.append('- Servers: {}'.format(len(self.bot.servers)))
        result.append('- Commands Run: {}'.format(sum(self.bot.commands_used.values())))

        # statistics
        total_members = sum(len(s.members) for s in self.bot.servers)
        total_online  = sum(1 for m in self.bot.get_all_members() if m.status != discord.Status.offline)
        unique_members = set(self.bot.get_all_members())
        unique_online = sum(1 for m in unique_members if m.status != discord.Status.offline)
        channel_types = Counter(c.type for c in self.bot.get_all_channels())
        voice = channel_types[discord.ChannelType.voice]
        text = channel_types[discord.ChannelType.text]
        result.append('- Total Members: {} ({} online)'.format(total_members, total_online))
        result.append('- Unique Members: {} ({} online)'.format(len(unique_members), unique_online))
        result.append('- {} text channels, {} voice channels'.format(text, voice))
        result.append('')
        result.append('Luna server: https://discord.gg/PDmtxWq')
        await self.bot.say('\n'.join(result))
events.py 文件源码 项目:BlitzcrankBotV2 作者: SuperFrosty 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def on_command_error(self, ctx, error):
        """Error handling"""
        error_msg = None
        if isinstance(error, commands.MissingRequiredArgument):
            await ctx.send(error)
        elif isinstance(error, commands.CommandNotFound):
            pass
        elif isinstance(error, commands.CommandInvokeError):
            original = error.original
            if isinstance(original, discord.Forbidden):
                await ctx.send("I need to have the 'embed links' permission to send messages!")
                return
            elif isinstance(original, exceptions.Halt):
                return

            print('{0.created_at}: {0.author}: {0.content}'.format(ctx.message))
            print(error)
            embed = discord.Embed(title="An unexpected error occured :I", colour=0xCA0147,
                                  description="If you feel like this shouldn't be happening [click here to join my support server](https://discord.gg/UP4TwFX).")
            await ctx.send("", embed=embed)
        else:
            print('{0.created_at}: {0.author}: {0.content}'.format(ctx.message))
            print(str(error))
tome.py 文件源码 项目:TomeBot 作者: Carbsta 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def info(self, message):
        inguilds = 0
        for sever in self.servers:
            inguilds = inguilds + 1
        response = """
**NOW ON VERSION 2!!! 100% MORE STABLE**
(Finally)
Type ?commands to see the commands.
Add the suffix -p to disable embeds.
e.g: ?commands -p

Find the owner of the Bot here:
<https://discord.gg/25bf5NT>

also on github:
<https://github.com/Carbsta/TomeBot>

Hosted by @Crablabuk.

To add to your server use this link:
<https://discordapp.com/oauth2/authorize?client_id=247413966094073856&scope=bot&permissions=0>
"""
        response = response +"\n\nCurrently in "+str(inguilds)+" discord server(s)."
        return(response)
info.py 文件源码 项目:Discord-SelfBot 作者: IgneelDxD 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def about(self, ctx):
        """Infos about the SelfBot."""
        embed = discord.Embed()
        embed.set_author(name="Igneel's SelfBot", url="https://igneeldxd.github.io/Discord-SelfBot/")
        embed.description = "https://igneeldxd.github.io/Discord-SelfBot/\nThis is a Selfbot written by IgneelDxD#6666\nFor support or feedback you can join my [Server](https://discord.gg/DJK8h3n)"
        embed.colour = discord.Color.purple()

        async with aiohttp.ClientSession() as cs:
            async with cs.get("https://api.github.com/repos/IgneelDxD/Discord-SelfBot/commits") as resp:
                result = json.loads(await resp.text())
                form = '[``{0}``](https://github.com/IgneelDxD/Discord-SelfBot/commit/{0}) {1} ({2})'
                com0 = form.format(result[0]['sha'][:7], result[0]['commit']['message'], getAgo(parser.parse(result[0]['commit']['author']['date'], ignoretz=True)))
                com1 = form.format(result[1]['sha'][:7], result[1]['commit']['message'], getAgo(parser.parse(result[1]['commit']['author']['date'], ignoretz=True)))
                embed.add_field(name='Latest Changes', value=f'{com0}\n{com1}')
        embed.set_thumbnail(url="https://i.imgur.com/cD51k3R.png")
        embed.set_footer(text='Made with discord.py | rewrite is the future!', icon_url='https://i.imgur.com/MyEXmz8.png')
        await edit(ctx, embed=embed)

    # User info on Server
mod.py 文件源码 项目:.bot 作者: GriffinG1 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def kick(self, ctx, member, *, reason="No reason was given."):
        """Kick a member."""
        found_member = self.find_user(member, ctx)
        if found_member == ctx.message.author:
            return await ctx.send("You can't kick yourself, you absolute fucking dumbass.")
        elif not found_member:
            await ctx.send("That user could not be found.")
        else:
            reason_msg = "The given reason was: `{}`".format(reason)
            try:
                await found_member.send("You have been kicked by user {0.name}#{0.discriminator}.\n{2}\nYou can rejoin the server with this link: https://discord.gg/hHHKPFz".format(ctx.message.author, self.bot.rules_channel.mention, reason_msg))
            except discord.errors.Forbidden:
                pass
            audit_reason = reason + " This action was done by: " + ctx.message.author.name
            await found_member.kick(reason=audit_reason)
            await ctx.send("Successfully kicked user {0.name}#{0.discriminator}!".format(found_member))
            embed = discord.Embed(description="<@{0.id}> | {0.name}#{0.discriminator} kicked user <@{1.id}> | {1.name}#{1.discriminator}".format(ctx.message.author, found_member))
            embed.add_field(name="Reason given", value="• " + reason)
            await self.bot.cmd_logs_channel.send(embed=embed)
misc.py 文件源码 项目:Discord-Selfbot 作者: appu1232 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def about(self, ctx, txt: str = None):
        """Links to the bot's github page."""
        if embed_perms(ctx.message) and txt != 'short':
            em = discord.Embed(color=0xad2929, title='\ud83e\udd16 Appu\'s Discord Selfbot',
                               description='**Features:**\n- Custom commands/reactions\n- Save last x images in a channel to your computer\n- Keyword notifier\n'
                                           '- Set/cycle your game status and your avatar\n- Google web and image search\n- MyAnimeList search\n- Spoiler tagging\n'
                                           '- Server info commands\n- Quoting, calculator, creating polls, and much more')
            em.add_field(name='\ud83d\udd17 Link to download',
                         value='[Github link](https://github.com/appu1232/Discord-Selfbot/tree/master)')
            em.add_field(name='\ud83c\udfa5Quick examples:', value='[Simple commands](http://i.imgur.com/3H9zpop.gif)')
            if txt == 'link': em.add_field(name='?? Discord Server', value='Join the official Discord server [here](https://discord.gg/FGnM5DM)!')
            em.set_footer(text='Made by appu1232#2569', icon_url='https://i.imgur.com/RHagTDg.png')
            await ctx.send(content=None, embed=em)
        else:
            await ctx.send('https://github.com/appu1232/Selfbot-for-Discord')
        await ctx.message.delete()
help.py 文件源码 项目:spirit 作者: jgayfer 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def help_embed_all(self, prefix, commands):
        """Create an embed message that displays command help"""
        help = discord.Embed(title="Available Commands", color=constants.BLUE)
        help.description = ("**Note:** don't include the angled brackets\n"
                          + "For additional help, join the support server: https://discord.gg/ZqkjJEa")
        help.set_footer(text="Use {}help [command] for more info on a command".format(prefix))

        for command in commands:
            if command.hidden:
                continue
            signature = self.get_command_signature(prefix, command)
            help.add_field(name="{}".format(signature), value="{}".format(command.help.split('\n')[0]), inline=False)
        return help
cog_info.py 文件源码 项目:Godavaru 作者: Godavaru 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def about(self, ctx):
        """Show the stuff about me! I promise I'm interesting uwu

        **Usage:** `g_about [credits]`

        **Permission:** User"""
        args = ctx.message.content
        args = args.split(' ')
        member_count = 0
        server_count = len(self.bot.guilds)
        for server in self.bot.guilds:
            for member in server.members:
                member_count += 1
        abtEm = discord.Embed(title='About Godavaru!', description=abtDesc, color=0x9B59B6)
        abtEm.add_field(name='Version Number', value='{}'.format(self.bot.version), inline=False)
        abtEm.add_field(name='Servers', value=str(server_count))
        abtEm.add_field(name='Users',value=str(member_count) + '\n\n[Invite me](https://goo.gl/chLxM9)\n[Support guild](https://discord.gg/ewvvKHM)\n[Patreon page](https://www.patreon.com/godavaru)', inline=False).set_footer(text="Made with love <3 | Check out g_about credits for special credits.").set_thumbnail(url="https://cdn.discordapp.com/avatars/311810096336470017/fa4daf0662e13f25bdbd09fd18bdc36d.png")
        try:
            if args[1] == "credits":
                embed = discord.Embed(title="Special Recognition",description=""
                                      +"**Primary Developer:** Desiree#3658\n"
                                      +"**Developers:** Yuvira#7655, AttributeError#2513, and Jonas B.#9089\n"
                                      +"**Sensei:** Yuvira#7655\n"
                                      +"**Emotional Support & Boyfriend:** MrLar#8117\n"
                                      +"**Inspiration:** Kodehawa#3457 (`and MantaroBot, if it wasn't for that project I probably would never have tried to make a bot`)\n\n"
                                      +"And thanks to everyone who has used the bot. Much love <3",
                                      color=0x1abc9c)
            else:
                embed = abtEm
        except IndexError:
            embed = abtEm
        await ctx.send(content=None, embed=embed)
cog_info.py 文件源码 项目:Godavaru 作者: Godavaru 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def invite(self, ctx):
        """Get some important links about me.

        **Usage:** `g_invite`

        **Permission:** User"""
        embed = discord.Embed(description='Here are some useful links for the Godavaru bot. If you have any questions at all, feel free to join the support guild and tag Desiree#3658 with your questions!\nBelow you can also find the links to the support guild itself and the Patreon URL. Thanks for using the bot!', color=0x9B59B6).set_author(name='Useful Links for Godavaru!', icon_url='https://cdn.discordapp.com/avatars/311810096336470017/fa4daf0662e13f25bdbd09fd18bdc36d.png').add_field(name='Invite URL', value='http://polr.me/godavaru').add_field(name='Support Guild', value='https://discord.gg/ewvvKHM').add_field(name="Patreon URL", value='https://patreon.com/godavaru').add_field(name="Github", value="https://github.com/Desiiii/Godavaru")
        await ctx.send(content=None, embed=embed)
UsoDiscord.py 文件源码 项目:Uso-Bot 作者: Renondedju 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def link_user(ctx):
    rank, channel, message = await init_command(ctx.message)
    if rank in ['USER', 'ADMIN', 'MASTER']:
        parameters = message.content.replace(commandPrefix + 'link_user ', '')
        results = get_user(user = parameters, me = False)

        stats = []
        if not (results == []):
            for item in results[0]:
                stats.append(item)
            osuId = stats[16][1]
            osuUsername = stats[17][1]

            cursor.execute("SELECT * FROM users WHERE discordId = ?", (str(message.author.id),))
            if not cursor.fetchall():
                key = userlink.generate_new_key(osuId, message.author.id)

                if message.channel.is_private == False:
                    embed = discord.Embed(title = "Link account", description = "Please check your private messages to get your key and the instructions to link your account to uso !", colour = 0x3498db)
                    await client.send_message(channel, embed = embed)

                embed = discord.Embed(title = "Link account", colour = 0x3498db, description="Please open <:osu:310362018773204992> and send me __**``pass {}``**__\nMy ingame name is __UsoBot__ -> [profile](https://osu.ppy.sh/u/10406668)\nBe careful, this key will __expire in 10 min__".format(key)) 
                await client.send_message(message.author, embed = embed)

            else:
                await client.send_message(channel, "Sorry, you already linked your account ! If you have a problem, please contact Renondedju\n? <https://discord.gg/Qsw3yD5>")

        else:
            await client.send_message(channel, "Oups sorry, didn't find this user\n*Try with your osu id instead or the link to your profile*")

    else:
        missing_permissions_message(channel)
UsoDiscord.py 文件源码 项目:Uso-Bot 作者: Renondedju 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def on_server_join(server):
    try:
        cursor.execute("INSERT INTO server (serverID, state) VALUES (?, ?)", (server.id, 'off'))
        conn.commit()
    except sqlite3.IntegrityError:
        print ("Already in database")
    embed = discord.Embed(title = "Hi there !", description="**Nice to meet you, I'm Uso!**\nMy command prefix is ``" + commandPrefix + "``\nIf you want to know what am i capable of, try ``" + commandPrefix + "help``\nAdmins : you can mute me if needed by doing ``" + commandPrefix + "mute on``\n\nAdd the bot to your server [Here](https://discordapp.com/oauth2/authorize?client_id=318357311951208448&scope=bot&permissions=8)\nI'm also avaiable ingame ! Look for UsoBot\nYou can come to my own server to have some help if nedded or even support the devs :D\n?https://discord.gg/Qsw3yD5\n\n:heart::heart::heart:Have fun evryone !:heart::heart::heart:") 
    embed.set_thumbnail(url = "https://cdn.discordapp.com/avatars/"+str(client.user.id)+"/"+str(client.user.avatar)+".png")
    message = await client.send_message(client.get_server(server.id), embed = embed)
    await Log(message, logLevel = 1, thumbnailUrl = server.icon_url, content = "**I've been added to a new server !**\n__Server name :__ **" + str(server.name) + "**\n__Server Id :__ **" + str(server.id) + "**\n__Users :__ **" + str(server.member_count) + "**\n__Owner name :__ **" + str(server.owner.name) + "**")
utility.py 文件源码 项目:rerobot 作者: voqz 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def help_message():
    """

    :return:
    """
    help_text = """
    **RERO**
    *The multipurpose utility bot for Discord.*

    Commands
    ```ruby
    .             ?names : List of detected name changes
     ?pm [on, off, 24/7] : Sends you PM if you get mentioned
         ?8ball question : Answers a question 8 ball style
           ?sr subreddit : Grab random image from the subreddit
             ?anime name : Grab a anime from MAL
             ?manga name : Grab a manga from MAL
               ?ud query : Urban Dictionary definition
             ?wiki query : Wikipedia summary of querry
            ?giphy query : Gif matching querry
          ?xkcd [number] : Random xkcd or specify a number
           ?weather city : Get weather information
For a complete list of functions (*too many to send by PM*),

Want Rero in your server too?
<https://discordapp.com/oauth2/authorize?client_id=314796406948757504&scope=bot&permissions=8>

Visit RERO's Server:
https://discord.gg/nSHt53W
"""
return help_text

```

main.py 文件源码 项目:Laima-Discord-Bot 作者: glouis 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')
    invite = discord.Game(name="https://discord.gg/VsrbrYC", url=None, type=0)
    await bot.change_presence(game=invite)
paginator.py 文件源码 项目:tuxbot-bot 作者: outout14 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def show_page(self, page, *, first=False):
        self.current_page = page
        entries = self.get_page(page)

        self.embed.clear_fields()
        self.embed.description = self.description
        self.embed.title = self.title

        if hasattr(self, '_is_bot'):
            value ='For more help, join the official bot support server: https://discord.gg/pYuKF2Z'
            self.embed.add_field(name='Support', value=value, inline=False)

        self.embed.set_footer(text=f'Use "{self.prefix}help command" for more info on a command.')

        signature = _command_signature

        for entry in entries:
            self.embed.add_field(name=signature(entry), value=entry.short_doc or "No help given", inline=False)

        if self.maximum_pages:
            self.embed.set_author(name=f'Page {page}/{self.maximum_pages} ({self.total} commands)')

        if not self.paginating:
            return await self.channel.send(embed=self.embed)

        if not first:
            await self.message.edit(embed=self.embed)
            return

        self.message = await self.channel.send(embed=self.embed)
        for (reaction, _) in self.reaction_emojis:
            if self.maximum_pages == 2 and reaction in ('\u23ed', '\u23ee'):
                # no |<< or >>| buttons if we only have two pages
                # we can't forbid it if someone ends up using it but remove
                # it from the default set
                continue

            await self.message.add_reaction(reaction)
service.py 文件源码 项目:StreamNotificationBot 作者: ivandardi 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _make_list_embed(self, streamers, subscriber):
        streams = '\n'.join(f'[{username}]({self.stream_url(username)})' for (username,) in streamers)
        if len(streams) > 1024:
            log.warning('Embed value length is over 1024!')
            return discord.Embed(
                description='Please complain about embed pagination in https://discord.gg/xrzJhqq',
                color=discord.Color.red()
            )

        embed = discord.Embed(description=streams, color=discord.Color.blue())
        embed.set_author(name=f"{self.service_name.capitalize()} subscriptions for {subscriber}")
        return embed
bot.py 文件源码 项目:Chiaki-Nanami 作者: Ikusaba-san 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def support_invite(self):
        # The following is the link to the bot's support server.
        # You are allowed to change this to be another server of your choice.
        # However, doing so will instantly void your warranty.
        # Change this at your own peril.
        return 'https://discord.gg/WtkPTmE'
commands.py 文件源码 项目:petal 作者: hdmifish 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def anonCheck(self, msg):
        if msg.author == self.client.user:
            return False
        elif msg.channel.id == self.hc.id or msg.channel.id == self.sc.id:
            return True
        else:
            return False
    # AskPatch is designed for discord.gg/patchgaming but you may edit it
    # for your own personal uses if you like
    # the database fields are:
    # Single table:
    # varchar(20) author, vc(20) id, TIMESTAMP time, TEXT content, BOOL used,
    # INT(11)PK entryid, BOOL approved
asmbotcmd.py 文件源码 项目:Discord-ASM-Bot 作者: Emzi0767 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def help(self, ctx, *, architecture: str = None):
        """
        Prints help
        """
        me = ctx.guild.me

        if architecture is None:
            embed = self._embed(ctx, "Assembler help", "To invoke Assembler, call {} assemble `<architecture>` `<assembly code block>`. For help, call {} help or {} help `[architecture]` to show how"
                                                       " to assemble for given architecture. Source code of the bot is available [on Emzi's GitHub](https://github.com/Emzi0767/Discord-ASM-Bot). To"
                                                       " invite the bot to your server, Follow [this invite link]"
                                                       "(https://discordapp.com/oauth2/authorize?client_id=283200903937261569&scope=bot&permissions=0). For more help or support, join [Emzi's server]"
                                                       "(https://discord.gg/rGKrJDR).".format(me.mention, me.mention, me.mention), "info")
            embed.add_field(name="Example", value=me.mention + " assemble x86 ```x86asm\nmov eax, sp\n```", inline=False)

            archstr = "• " + "\n• ".join(x.display_name for x in self._archmap)
            embed.add_field(name="Available architectures", value=archstr, inline=False)

        else:
            arch = None
            for xarch in self._archmap:
                if xarch.display_name == architecture:
                    arch = xarch

            if arch is None:
                raise Exception("Unknown architecture specified")

            embed = self._embed(ctx, "Architecture help", "Architecture name: {}\nArchitecture full name: `{}`".format(arch.display_name, arch.clang_name))

            archstr = ", ".join("`{}`".format(x) for x in arch.names)
            embed.add_field(name="Architecture aliases", value=archstr, inline=False)

        await ctx.channel.send(embed=embed)
cmd_help.py 文件源码 项目:tobypythonbot 作者: TobyyTheCoder 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def ex(args, message, client, invoke):
    args_out = ""
    if len(args) > 0:
        args_out = "\n\n*Attached arguments: %s*" % args.__str__()[1:-1].replace("'", "")
    yield from client.send_message(message.channel, "Check your direct messages! I slid in!")
    yield from client.send_message(message.author, "Hey! Thanks for typing ?help, here's a list of commands which should hopefully be of some use to you - here they are:\n\n**?ping** - Returns a message saying 'PONG!'\n**?help** - Sends you this message.\n\nMore to come in the future!\n\nBot coded by: Tobyy\nOfficial Support Server: https://discord.gg/VurEzsA\n\nEnjoy!")
snake.py 文件源码 项目:snake 作者: AnonymousDapper 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, bot_class, *args, **kwargs):
        self.bot_class = bot_class
        self.chat_ids = {}
        self.shards = {}
        self.extensions = {}
        self.shard_tasks = {}
        self.shard_connect_failures = {}

        self.shard_count = 0
        self.loop = asyncio.get_event_loop()
        self.config = self._read_config("config.json")
        self.credentials = self._read_config("credentials.json")

        self.description = kwargs.pop("description", "\nHsss! Checkout the support command the join the official server!\n")
        self.pm_help = kwargs.pop("pm_help", False)
        self.help_attrs = kwargs.pop("help_attrs", dict(hidden=True))
        self.command_not_found = kwargs.pop("command_not_found", "\N{WARNING SIGN} Whoops, '{}' doesn't exist!")
        self.command_has_no_subcommands = kwargs.pop("command_has_no_subcommands", "\N{WARNING SIGN} Sorry, '{0.name}' doesn't have '{1}'")

        self.invite_url = "https://discord.gg/qC4ancm"
        self.kwargs = kwargs
        self.args = args

        self.kwargs.update({
            "description": self.description,
            "pm_help": self.pm_help,
            "help_attrs": self.help_attrs,
            "command_not_found": self.command_not_found,
            "command_has_no_subcommands": self.command_has_no_subcommands,
            "shard_count": self.shard_count
        })

        self.log = logging.getLogger()
        self.log.setLevel(logging.DEBUG)
        self.log.addHandler(
            logging.FileHandler(filename="snake.log", encoding="utf-8", mode='w')
        )
bot.py 文件源码 项目:LunaBot 作者: miraai 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def changelog():
    """Gives a URL to the current bot changelog."""
    await bot.say('https://discord.gg/y2PcWMM')

#loads bot credentials.json as file. Takes client_id, carbon_key and bots_key=client_id now (i will fix it)
#if id is missing, it wont load the file
core.py 文件源码 项目:GAFBot 作者: DiNitride 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def server(self, ctx):
        """
        Invite like to the bot's support server
        """
        await ctx.send("<http://discord.bot.neverendinggaf.com> - https://discord.gg/ddbFt7S")
general.py 文件源码 项目:MangoByte 作者: mdiller 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def info(self, ctx):
        """Prints info about mangobyte"""
        github = "https://github.com/mdiller/MangoByte"
        python_version = "[Python {}.{}.{}]({})".format(*os.sys.version_info[:3], "https://www.python.org/")
        discordpy = "https://github.com/Rapptz/discord.py"

        embed = discord.Embed(description="The juiciest unsigned 8 bit integer you eva gonna see", color=discord.Color.green())

        embed.set_author(name=self.bot.user.name, icon_url=self.bot.user.avatar_url, url=github)

        embed.add_field(name="Development Info", value=(
            "Developed as an open source project, hosted on [GitHub]({}). "
            "Implemented using {} and a python discord api wrapper [discord.py]({})".format(github, python_version, discordpy)))

        embed.add_field(name="Features", value=(
            "• Answers questions (`?ask`)\n"
            "• Plays audio clips (`?play`, `?dota`)\n"
            "• Greets users joining a voice channel\n"
            "• For a list of command categories, try `?help`"))

        help_guild_link = "https://discord.gg/d6WWHxx"

        embed.add_field(name="Help", value=(
            f"If you want to invite mangobyte to your server/guild, click this [invite link]({invite_link}). "
            f"If you have a question, suggestion, or just want to try out mah features, check out the [Help Server/Guild]({help_guild_link})."))

        owner = (await self.bot.application_info()).owner

        embed.set_footer(text="MangoByte developed by {}".format(owner.name), icon_url=owner.avatar_url)

        await ctx.send(embed=embed)
Info.py 文件源码 项目:TwentyTwo 作者: EPITECH-2022 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def invite(self):
        await self.bot.reply('https://discord.gg/TVA9Z38')
        await self.bot.replied(context)
paginator.py 文件源码 项目:PyMiki 作者: TheGrammarJew 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def show_page(self, page, *, first=False):
        self.current_page = page
        entries = self.get_page(page)

        self.embed.clear_fields()
        self.embed.description = self.description
        self.embed.title = self.title

        if hasattr(self, '_is_bot'):
            value ='For more help, join the official bot support server: https://discord.gg/pYuKF2Z'
            self.embed.add_field(name='Support', value=value, inline=False)

        self.embed.set_footer(text=f'Use "{self.prefix}help command" for more info on a command.')

        signature = _command_signature

        for entry in entries:
            self.embed.add_field(name=signature(entry), value=entry.short_doc or "No help given", inline=False)

        if self.maximum_pages:
            self.embed.set_author(name=f'Page {page}/{self.maximum_pages} ({self.total} commands)')

        if not self.paginating:
            return await self.channel.send(embed=self.embed)

        if not first:
            await self.message.edit(embed=self.embed)
            return

        self.message = await self.channel.send(embed=self.embed)
        for (reaction, _) in self.reaction_emojis:
            if self.maximum_pages == 2 and reaction in ('\u23ed', '\u23ee'):
                # no |<< or >>| buttons if we only have two pages
                # we can't forbid it if someone ends up using it but remove
                # it from the default set
                continue

            await self.message.add_reaction(reaction)


问题


面经


文章

微信
公众号

扫码关注公众号