# Path: dozer/utils.py
# def oauth_url(client_id, permissions=None, guild=None, redirect_uri=None):
#     """A helper function that returns the OAuth2 URL for inviting the bot
#     into guilds.
# 
#     Parameters
#     -----------
#     client_id: :class:`str`
#         The client ID for your bot.
#     permissions: :class:`~discord.Permissions`
#         The permissions you're requesting. If not given then you won't be requesting any
#         permissions.
#     guild: :class:`~discord.Guild`
#         The guild to pre-select in the authorization screen, if available.
#     redirect_uri: :class:`str`
#         An optional valid redirect URI.
# 
#     Returns
#     --------
#     :class:`str`
#         The OAuth2 URL for inviting the bot into guilds.
#     """
#     url = 'https://discord.com/oauth2/authorize?client_id={}&scope=bot%20applications.commands'.format(client_id)
#     if permissions is not None:
#         url = url + '&permissions=' + str(permissions.value)
#     if guild is not None:
#         url = url + "&guild_id=" + str(guild.id)
#     if redirect_uri is not None:
#         url = url + "&response_type=code&" + urlencode({'redirect_uri': redirect_uri})
#     return url


import inspect
import discord
from discord.ext.commands import BadArgument, cooldown, BucketType, Group, has_permissions, NotOwner, guild_only
from ._utils import *
from ..utils import oauth_url
            format_args['len_pages'] = 1
            format_args['page_num'] = 1
            embed = discord.Embed(title=title.format(**format_args), description=description.format(**format_args), color=discord.Color.blue())
            embed.set_footer(text=footer.format(**format_args))
            await ctx.send(embed=embed)

    @has_permissions(change_nickname=True)
    @command()
    async def nick(self, ctx, *, nicktochangeto):
        """Allows a member to change their nickname."""
        await discord.Member.edit(ctx.author, nick=nicktochangeto[:32])
        await ctx.send("Nick successfully changed to " + nicktochangeto[:32])
        if len(nicktochangeto) > 32:
            await ctx.send("Warning: truncated nickname to 32 characters")

    @command()
    async def invite(self, ctx):
        """
        Display the bot's invite link.
        The generated link gives all permissions the bot requires. If permissions are removed, some commands will be unusable.
        """
        bot_info = await self.bot.application_info()
        if not bot_info.bot_public or self.bot.config['invite_override'] != "":
            await ctx.send(self.bot.config['invite_override'] or "The bot is not able to be publicly invited. Please "
                                                                 "contact the bot developer. If you are the bot "
                                                                 "developer, please check the bot console. ")
            return
        perms = 0
        for cmd in ctx.bot.walk_commands():
            perms |= cmd.required_permissions.value

# Path: dozer/utils.py
# def oauth_url(client_id, permissions=None, guild=None, redirect_uri=None):
#     """A helper function that returns the OAuth2 URL for inviting the bot
#     into guilds.
# 
#     Parameters
#     -----------
#     client_id: :class:`str`
#         The client ID for your bot.
#     permissions: :class:`~discord.Permissions`
#         The permissions you're requesting. If not given then you won't be requesting any
#         permissions.
#     guild: :class:`~discord.Guild`
#         The guild to pre-select in the authorization screen, if available.
#     redirect_uri: :class:`str`
#         An optional valid redirect URI.
# 
#     Returns
#     --------
#     :class:`str`
#         The OAuth2 URL for inviting the bot into guilds.
#     """
#     url = 'https://discord.com/oauth2/authorize?client_id={}&scope=bot%20applications.commands'.format(client_id)
#     if permissions is not None:
#         url = url + '&permissions=' + str(permissions.value)
#     if guild is not None:
#         url = url + "&guild_id=" + str(guild.id)
#     if redirect_uri is not None:
#         url = url + "&response_type=code&" + urlencode({'redirect_uri': redirect_uri})
#     return url


# Path: dozer/cogs/general.py
import inspect
import discord
from discord.ext.commands import BadArgument, cooldown, BucketType, Group, has_permissions, NotOwner, guild_only
from ._utils import *
from ..utils import oauth_url

            format_args['len_pages'] = 1
            format_args['page_num'] = 1
            embed = discord.Embed(title=title.format(**format_args), description=description.format(**format_args), color=discord.Color.blue())
            embed.set_footer(text=footer.format(**format_args))
            await ctx.send(embed=embed)

    @has_permissions(change_nickname=True)
    @command()
    async def nick(self, ctx, *, nicktochangeto):
        """Allows a member to change their nickname."""
        await discord.Member.edit(ctx.author, nick=nicktochangeto[:32])
        await ctx.send("Nick successfully changed to " + nicktochangeto[:32])
        if len(nicktochangeto) > 32:
            await ctx.send("Warning: truncated nickname to 32 characters")

    @command()
    async def invite(self, ctx):
        """
        Display the bot's invite link.
        The generated link gives all permissions the bot requires. If permissions are removed, some commands will be unusable.
        """
        bot_info = await self.bot.application_info()
        if not bot_info.bot_public or self.bot.config['invite_override'] != "":
            await ctx.send(self.bot.config['invite_override'] or "The bot is not able to be publicly invited. Please "
                                                                 "contact the bot developer. If you are the bot "
                                                                 "developer, please check the bot console. ")
            return
        perms = 0
        for cmd in ctx.bot.walk_commands():
            perms |= cmd.required_permissions.value

        await ctx.send('<{}>'.format(oauth_url(ctx.me.id, discord.Permissions(perms))))