Exemplo n.º 1
0
    async def invite(self, ctx: Context) -> None:
        """Gives the invite link of this bot."""
        url = oauth_url(self.bot.user.id, Permissions(3525696))
        embed = DefaultEmbed(ctx,
                             description=markdown_link("invite_link", url))

        await ctx.send(embed=embed)
Exemplo n.º 2
0
async def invite_link(ctx: CommandContext):
    client_id = (await ctx.client.application_info()).id

    permissions = discord.Permissions()

    # So the bot can actually add the webhooks it needs to do the proxy functionality
    permissions.manage_webhooks = True

    # So the bot can respond with status, error, and success messages
    permissions.send_messages = True

    # So the bot can delete channels
    permissions.manage_messages = True

    # So the bot can respond with extended embeds, ex. member cards
    permissions.embed_links = True

    # So the bot can send images too
    permissions.attach_files = True

    # (unsure if it needs this, actually, might be necessary for message lookup)
    permissions.read_message_history = True

    # So the bot can add reactions for confirm/deny prompts
    permissions.add_reactions = True

    url = oauth_url(client_id, permissions)
    await ctx.reply_ok(
        "Use this link to add PluralKit to your server: {}".format(url))
Exemplo n.º 3
0
    async def invite(self, ctx):
        # This tells the user that the command they are trying to use isn't translated yet.
        user_language = {
            "lang":
            self.bot.user_data["UserData"][str(
                ctx.author.id)]["Settings"]["Language"]
        }
        if ctx.command.qualified_name not in localization[
                user_language["lang"]]:

            class Continue(ui.View):
                def __init__(self):
                    super().__init__(timeout=15)
                    self.value = None

                @ui.button(label=localization[user_language["lang"]]
                           ["language_not_available"]["button"],
                           style=ButtonStyle.primary,
                           emoji="▶️",
                           custom_id="continue")
                async def continue_button(self, button, interaction):
                    if interaction.user.id == ctx.author.id:
                        user_language["lang"] = "eng"
                        await self.message.delete()
                        self.value = True
                        self.stop()

                async def on_timeout():
                    await self.message.delete()
                    self.stop()

            emb = Embed(description=localization[user_language["lang"]]
                        ["language_not_available"]["description"]).set_footer(
                            text=localization[user_language["lang"]]
                            ["language_not_available"]["footer"])
            view = Continue()
            view.message = await ctx.send(embed=emb, view=view)
            await view.wait()
            if not view.value:
                return
        user_language = user_language["lang"]

        app_info: AppInfo = await self.bot.application_info()
        permissions = Permissions()
        permissions.update(send_messages=True,
                           embed_links=True,
                           add_reactions=True,
                           manage_messages=True,
                           manage_roles=True,
                           manage_channels=True,
                           use_application_commands=True)

        emb = Embed(
            title=localization[user_language]["invite"]["title"],
            description=localization[user_language]["invite"]["description"].
            format(url=oauth_url(app_info.id, permissions=permissions)),
        ).set_author(name=self.bot.user.name,
                     icon_url=self.bot.user.avatar.url).set_footer(
                         text=localization[user_language]["invite"]["footer"])
        await ctx.send(embed=emb)
Exemplo n.º 4
0
Arquivo: tau.py Projeto: osamagmt/tau
async def on_ready():
    app_info = await bot.application_info()
    bot.owner_id = app_info.owner.id

    prefix = bot.guilds_.default['prefix']
    await bot.change_presence(activity=Game(name=f'{prefix}help'))

    ccp.ready(f'Logged in as {bot.user.name}')
    ccp.ready(f'ID: {bot.user.id}')
    bot.url = oauth_url(client_id=bot.user.id,
                        permissions=Permissions(permissions=8))
    ccp.ready(f'URL: \u001b[1m\u001b[34m{bot.url}\u001b[0m')

    for guild in bot.guilds:
        if guild.id not in bot.guilds_.keys():
            await bot.guilds_.insert(guild.id)
            if guild.system_channel:
                await bot.guilds_.update(guild.id, 'system_channel',
                                         guild.system_channel.id)

        if guild.me.guild_permissions.manage_guild:
            bot.invites_[guild.id] = await guild.invites()
            if 'VANITY_URL' in guild.features:
                vanity = await guild.vanity_invite()
                bot.invites_[guild.id].append(vanity)
Exemplo n.º 5
0
 async def on_ready(self):
     app_info = await self.application_info()
     self.invite_url = dutils.oauth_url(app_info.id)
     print(
         f'Logged in as {self.user.name}\nBot invite link: {self.invite_url}'
     )
     self.load_extension('extensions.core')
Exemplo n.º 6
0
    async def botinvite(self, ctx):
        """Sends the invite link of the bot"""

        await ctx.send(
            oauth_url(self.bot.user.id,
                      permissions=discord.Permissions(permissions=8),
                      guild=None,
                      redirect_uri=None))
Exemplo n.º 7
0
def generate_oauth():
    client_id = os.getenv("CLIENT_ID", "")
    guild_id = os.getenv("GUILD_ID", "")
    # Has send messages permisison
    permissions = Permissions(permissions=2048)
    Client().get_guild(guild_id)
    generated_url = oauth_url(client_id, permissions)
    print(f"Generated oauth for given client id: {generated_url}")
Exemplo n.º 8
0
 async def invite(ctx: Interaction):
     """Give an invite link for this bot"""
     await ctx.response.send_message(
         oauth_url(
             app.id,
             permissions=Permissions(manage_roles=True),
             scopes=["bot", "applications.commands"]),
         ephemeral=True)
Exemplo n.º 9
0
 def invite_url(self, p: int = 335932480, guildid: int = None) -> str:
     """Generate an invite URL for the bot
     using the permsisions provided"""
     url = utils.oauth_url(
         self.user.id,
         permissions=Permissions(p),
         redirect_uri=self.guild_invite_url,
     )
     return f"{url}&guild_id={guildid}" if guildid else url
Exemplo n.º 10
0
 async def invite(self, ctx, *args):
     """
     Return an OAuth link to add this bot to a server
     `-invite`
     """
     await ctx.channel.send(
         embed=await Macro.send("Add me to your server [here]({})".format(
             oauth_url(self.bot.user.id,
                       permissions=Permissions(permissions=268443702)))))
Exemplo n.º 11
0
 async def on_ready(self):
     app_info = await self.application_info()
     self.invite_url = dutils.oauth_url(app_info.id)
     print(
         f'Logged in as {self.user.name}\nBot invite link: {self.invite_url}'
     )
     await self.change_presence(game=discord.Game(
         name=f'{self.prefix[0]}help | Version {self.version}', type=0))
     self.load_extension('extensions.core')
Exemplo n.º 12
0
 async def invite(self, ctx):
     """Gives you the bot's Invite Link. If you don't want the bot to create its own role or you want to set the
     permissions yourself, use the Invite without permissions. But don't forget that it won't work without these
     permissions.
     """
     no_perms = oauth_url(ctx.bot.client_id, Permissions.none())
     best_perms = oauth_url(
         ctx.bot.client_id,
         Permissions(send_messages=True,
                     read_messages=True,
                     embed_links=True,
                     add_reactions=True,
                     move_members=True,
                     manage_channels=True))
     await ctx.send(embed=Embed(
         title=':envelope: Invite links',
         description=
         f'[Invite (recommended)]({best_perms})\n[Invite (no permissions)]({no_perms})',
         color=0x000000))
Exemplo n.º 13
0
 def get_opening_note(self):
     return (
         "**Welcome to ShrimpMaster!**\n"
         "[**Support Server**]({1}) • [**Bot Invite**]({2})\n"
         "Get help on a command category by running `{0}{3} <category>`.\n"
         "Get help on a specific command by running `{0}{3} <command>`."
     ).format(
         self.clean_prefix, core.SUPPORT_SERVER,
         utils.oauth_url(self.context.bot.user.id,
                         discord.Permissions(core.RECOMMENDED_PERMISSIONS),
                         self.context.guild), self.invoked_with)
Exemplo n.º 14
0
 async def invite(self, ctx):
     """Admin tool for the bot owner"""
     if str(ctx.author.id) not in self.bot.administrators:
         await ctx.send(":x: This command is not for you")
         return
     if ctx.channel.name != "yata-admin":
         await ctx.send(":x: Use this command in `#yata-admin`")
         return
     # await ctx.send(oauth_url(self.bot.user.id, discord.Permissions(permissions=469837840)))
     await ctx.send(
         oauth_url(self.bot.user.id, discord.Permissions(permissions=8)))
Exemplo n.º 15
0
    async def on_connect(self):
        permissions = Permissions(
            add_reactions=True,
            manage_messages=True,
            read_message_history=True,
            read_messages=True,
            send_messages=True,
        )

        url = oauth_url(self.bot.user.id, permissions)

        logger.info('Invite URL: %s', url)
Exemplo n.º 16
0
async def invite(message, client, color):
    """Return the bot's invite url."""
    async with message.channel.typing():
        await sleep(1)
        await message.channel.send(
            embed=Embed(title="**C O N V I T E**!",
                        url=oauth_url(client.user.id, Permissions(10860)),
                        color=color).set_thumbnail(url=client.user.avatar_url).
            add_field(name=f"👤 **DE**: *{client.user.name}*",
                      value="🗓️ **Dia**: *HOJE*\n"
                      "🕛 **Horário**: *Ja ja*\n"
                      f"🏠 **Local**: *No seu servidor*").set_footer(
                          text="Conto com você!"))
Exemplo n.º 17
0
    async def invite(self, ctx: commands.Context):
        url = oauth_url(CLIENT_ID, permissions=PERMISSIONS)
        embed = discord.Embed(
            color=discord.Color.dark_magenta(),
            url=url,
            timestamp=ctx.message.created_at,
            title="Invite Me!",
            description="Invite Me! to your guild by clicking on the title.",
        )
        embed.set_footer(text=f"Requested by {ctx.author}",
                         icon_url=ctx.author.avatar_url)
        embed.set_thumbnail(url=self.client.user.avatar_url)

        await ctx.send(embed=embed)
Exemplo n.º 18
0
 async def invite(self, ctx):
     """Get invite links for the bot."""
     rec_p = discord.Permissions(268791015)
     min_p = discord.Permissions(355425)
     r = 'https://dragdev.xyz/thank_you.htmk'
     rec = utils.oauth_url(ctx.bot.user.id,
                           permissions=rec_p,
                           redirect_uri=r)
     min = utils.oauth_url(ctx.bot.user.id,
                           permissions=min_p,
                           redirect_uri=r)
     e = discord.Embed(
         title="Invite me!",
         description=
         f"To invite the bot we recommend using the [website's dropdown menu]"
         f"(https://dragdev.xyz/supertool), but you can choose from [recommended perms]({rec}), or [Minimum "
         f"Permissions]({min}).\n\nBotLists:\n[discord.bots.gg](https://discord.bots.gg/bots/614260030015012875)\n"
         f"[pending]\n[pending]\n\nSupport server: https://discord.gg/ekcWBMT",
         color=0xbc1b16)
     owner = self.bot.get_user(self.bot.owner_ids[0])
     e.set_footer(text=f"My owner is {str(owner)}.",
                  icon_url=str(owner.avatar_url_as(format='png')))
     return await ctx.send(embed=e)
Exemplo n.º 19
0
    async def generate_invite(self, ctx, client_id: str, *permissions: str):
        perm_bits = 0

        for permission in permissions:
            if permission.upper() not in perms.Permissions.__members__.keys():
                return await ctx.send(f"{permission} is not recognised.")
            else:
                perm_bits |= perms.Permissions[permission.upper()]

        await ctx.send(
            utils.oauth_url(
                client_id,
                permissions=perm_bits if hasattr(perm_bits, "value") else None,
                guild=ctx.guild,
            ))
Exemplo n.º 20
0
async def invite_link(ctx: CommandContext, args: List[str]):
    client_id = os.environ["CLIENT_ID"]

    permissions = discord.Permissions()
    permissions.manage_webhooks = True
    permissions.send_messages = True
    permissions.manage_messages = True
    permissions.embed_links = True
    permissions.attach_files = True
    permissions.read_message_history = True
    permissions.add_reactions = True

    url = oauth_url(client_id, permissions)
    logger.debug("Sending invite URL: {}".format(url))
    return url
Exemplo n.º 21
0
async def invite_link(ctx: CommandContext):
    client_id = os.environ["CLIENT_ID"]

    permissions = discord.Permissions()
    permissions.manage_webhooks = True
    permissions.send_messages = True
    permissions.manage_messages = True
    permissions.embed_links = True
    permissions.attach_files = True
    permissions.read_message_history = True
    permissions.add_reactions = True

    url = oauth_url(client_id, permissions)
    logger.debug("Sending invite URL: {}".format(url))
    return CommandSuccess("Use this link to add PluralKit to your server: {}".format(url))
Exemplo n.º 22
0
 async def on_ready(self):
     self.lockdown = False
     self.redis.set('__info__', 'This database is used by the Liara discord bot, logged in as user {0}.'
                    .format(self.user))
     self.logger.info('Liara is connected!')
     self.logger.info('Logged in as {0}.'.format(self.user))
     if self.shard_id is not None:
         self.logger.info('Shard {0} of {1}.'.format(self.shard_id + 1, self.shard_count))
     if self.user.bot:
         app_info = await self.application_info()
         self.invite_url = dutils.oauth_url(app_info.id)
         self.logger.info('Invite URL: {0}'.format(self.invite_url))
         self.owner = app_info.owner
     else:
         self.owner = self.user
Exemplo n.º 23
0
async def on_ready():
    """
    Changes presence and says name

    :return:
    """
    async with aiohttp.ClientSession() as session:
        raw_response = await session.post('https://cleverbot.io/1.0/create',
                                          json={'user': config.clever_api_user, 'key': config.clever_api_key,
                                                'nick': 'Fiona'})
        await raw_response.text()
        await session.close()
    link = utils.oauth_url('464543446187769867', permissions=Permissions.all())
    await client.change_presence(activity=Game(name='f?help for help'))
    sys.stdout.write('Logged in as ' + client.user.display_name + '\n')
    sys.stdout.write(('Invite URL:\n%s' % link) + '\n')
Exemplo n.º 24
0
    async def get_link(self, ctx):
        """Get the invite link to add this bot to your server!"""
        url = oauth_url(os.getenv("CLIENT_ID"))

        embed = discord.Embed(colour=0xFB98FB)
        embed.set_author(
            name=f'Catgirl Bot',
            url='https://github.com/Burrit0z/catgirl-bot',
            icon_url='https://avatars0.githubusercontent.com/u/57574731?s=500')
        embed.set_image(
            url=
            'https://raw.githubusercontent.com/Burrit0z/catgirl-bot/master/catgirl.png'
        )
        await ctx.send(
            content=f'**Here is the invite link {owouwu.gen()}\n{url}**',
            embed=embed)
Exemplo n.º 25
0
    async def on_ready(self):
        if self.started:
            return
        else:
            self.started = True

        self.logger.info('Logged in as {0}.'.format(self.user))
        if self.user.bot:
            app_info = await self.application_info()
            self.invite_url = dutils.oauth_url(app_info.id)
            self.logger.info('Invite URL: {0}'.format(self.invite_url))
            self.owner = app_info.owner
        elif self.self_bot:
            self.owner = self.user
        else:
            self.owner = self.get_user(self.args.userbot)
        self.logger.info("Potato's prefixes are: " + ", ".join(self.settings["command_prefix"]))
        self.loop.create_task(self.startup())
    async def generate_invite_command(self, ctx, client_id: str, *permissions: str):
        perm_bits = 0

        for permission in permissions:
            if permission.upper() not in permission_bits.Permissions.__members__.keys():
                return await ctx.send(f"{permission} is not recognised.")
            else:
                perm_bits |= permission_bits.Permissions[permission.upper()]

        try:
            int(client_id)

            await ctx.send(
                utils.oauth_url(
                    client_id, permissions=perm_bits if hasattr(perm_bits, "value") else None, guild=ctx.guild
                )
            )
        except Exception:
            await ctx.send("Please provide a valid client ID")
Exemplo n.º 27
0
    async def info_group(self, ctx):
        """Shows information about the bot."""
        members_count = sum(len(server.members) for server in self.bot.servers)
        unique_members_count = len(set(self.bot.get_all_members()))
        members_str = '{} ({} unique)'.format(members_count, unique_members_count)
        owner = ctx.message.server.get_member(self.bot.owner.id)
        owner = owner or self.bot.owner

        embed = discord.Embed(title='Bot support server invite', url='https://discord.gg/ZWnENfx', colour=0x738bd7)
        embed.set_author(name='{0.display_name} ({0})'.format(owner), icon_url=owner.avatar_url)
        embed.add_field(name='Command prefixes', value=str(self.bot.command_prefix(self.bot, ctx.message))[1:-1])
        embed.add_field(name='Servers', value=str(len(self.bot.servers)))
        embed.add_field(name='Members', value=members_str)
        embed.add_field(name='Memory', value=self._get_memory_str())
        embed.add_field(name='Uptime', value=self._get_uptime_str())
        embed.add_field(name='Click this to invite me to your server :', value=dutils.oauth_url(self.bot.app_info.id), inline=False)
        embed.set_footer(text='Powered by discord.py', icon_url='http://i.imgur.com/5BFecvA.png')

        await self.bot.say(embed=embed)
Exemplo n.º 28
0
 async def on_message(self, message):
     ctx: Context = await self.bot.get_context(message)
     # Adding some statistics
     self.bot.counter["messages"] += 1
     # Checking if the author of the message is a bot
     if message.author.bot:
         return
     if isinstance(message.channel, DMChannel):
         invite_ids: list = list(
             dict.fromkeys(re.findall(regex.invite_url,
                                      message.content)))[:10]
         invites: list = []
         for invite_id in invite_ids:
             try:
                 invite: Invite = await self.bot.fetch_invite(invite_id)
             except NotFound:
                 invites.append(
                     f"Could not find a server for the `{invite_id}` invite!"
                 )
             else:
                 guild: Guild = invite.guild
                 if not guild:
                     invites.append(
                         f"Could not find a server for the `{invite_id}` invite!"
                     )
                 else:
                     url = oauth_url(
                         self.bot.user.id,
                         permissions=config.permissions,
                         guild=guild,
                         scopes=["bot", "applications.commands"])
                     invites.append(f"[{guild.name}]({url})")
         em = Embed(color=self.bot.color,
                    description="\n".join(invites),
                    title=f"Invite {self.bot.user.name} to:")
         if invites:
             await ctx.reply(embed=em)
     else:
         await check_data(ctx)
     # Mention the bot to list prefixes
     if re.fullmatch(f"<@!?{self.bot.user.id}>", message.content):
         await ctx.reply(
             f"My prefixes here are:\n{await Prefixes.list(ctx)}")
Exemplo n.º 29
0
 async def on_ready(self):
     await self.redis.set('__info__', 'This database is used by the Liara discord bot, logged in as user {0}.'
                          .format(self.user))
     self.logger.info('Liara is connected!')
     self.logger.info('Logged in as {0}.'.format(self.user))
     if self.shard_id is not None:
         self.logger.info('Shard {0} of {1}.'.format(self.shard_id + 1, self.shard_count))
     if self.user.bot:
         app_info = await self.application_info()
         self.invite_url = dutils.oauth_url(app_info.id)
         self.logger.info('Invite URL: {0}'.format(self.invite_url))
         self.owner = app_info.owner
     elif self.self_bot:
         self.owner = self.user
     else:
         self.owner = self.get_user(self.args.userbot)
     if self.test:
         self.logger.info('Test complete, logging out...')
         await self.logout()
         exit(0)  # jenkins' little helper
Exemplo n.º 30
0
    async def invite(self, ctx):
        """
        Sends an invite link
        """

        bot_invite = oauth_url(
            "717062311755513976",
            discord.Permissions(read_messages=True,
                                send_messages=True,
                                send_tts_messages=True,
                                embed_links=True,
                                read_message_history=True,
                                mention_everyone=True,
                                external_emojis=True,
                                attach_files=True,
                                add_reactions=True,
                                manage_messages=True))
        embed = discord.Embed(title=f"Click here to invite me to your server",
                              url=bot_invite,
                              color=discord.Color.dark_blue())

        embed.set_thumbnail(url=self.bot.user.avatar_url)

        await ctx.send(embed=embed)