Skip to content

Commit

Permalink
Merge pull request #280 from The-4th-Hokage/deepsource-transform-dfbd…
Browse files Browse the repository at this point in the history
…3e2f

Format code with black, yapf, autopep8 and isort
  • Loading branch information
Dhruvacube authored Oct 28, 2021
2 parents aff321f + 8cca2e8 commit 1c26d53
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 67 deletions.
3 changes: 2 additions & 1 deletion minato_namikaze/bot_files/cogs/info/serverinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ async def user(self, ctx, *, user: discord.Member = None):
name="**__Member Info__**",
value=("✏️ Name: {}\n"
"{}: {}\n"
"📅 Created On: {}").format(user.display_name, user.display_name,
"📅 Created On: {}").format(user.display_name,
user.display_name,
prev_names_val, created_on),
)

Expand Down
70 changes: 32 additions & 38 deletions minato_namikaze/bot_files/lib/classes/select_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,18 @@ async def callback(self, interaction: discord.Interaction):
cog = self.bot.get_cog(value)
if cog is None:
await interaction.response.send_message(
"Somehow this category does not exist?", ephemeral=True
)
"Somehow this category does not exist?", ephemeral=True)
return

commands = self.commands[cog]
if not commands:
await interaction.response.send_message(
"This category has no commands for you", ephemeral=True
)
"This category has no commands for you", ephemeral=True)
return

source = GroupHelpPageSource(
cog, commands, prefix=self.view.ctx.clean_prefix
)
source = GroupHelpPageSource(cog,
commands,
prefix=self.view.ctx.clean_prefix)
await self.view.rebind(source, interaction)


Expand All @@ -132,17 +130,15 @@ async def get_page(self, page_number: int) -> Any:
return self

def format_page(self, menu: HelpMenu, page):
embed = discord.Embed(
title="Bot Help", colour=discord.Colour(0xA8B9CD))
embed.description = inspect.cleandoc(
f"""
embed = discord.Embed(title="Bot Help",
colour=discord.Colour(0xA8B9CD))
embed.description = inspect.cleandoc(f"""
Hello! Welcome to the help page.
Use "{menu.ctx.clean_prefix}help command" for more info on a command.
Use "{menu.ctx.clean_prefix}help category" for more info on a category.
Use the dropdown menu below to select a category.
"""
)
""")

embed.add_field(
name="Support Server",
Expand All @@ -154,12 +150,11 @@ def format_page(self, menu: HelpMenu, page):
if self.index == 0:
embed.add_field(
name="Who are you?",
value=(
":pray: Konichiwa :pray:, myself **Minato Namikaze**, **Konohagakure <:uzumaki_naruto:874930645405675521> Yondaime Hokage**"
f"I joined discord on {created_at}. I try my best to do every work of a **hokage**. You can get more "
"information on my commands by using the *dropdown* below.\n\n"
f"I'm also open source. You can see my code on [GitHub]({LinksAndVars.github.value})!"
),
value=(":pray: Konichiwa :pray:, myself **Minato Namikaze**, **Konohagakure <:uzumaki_naruto:874930645405675521> Yondaime Hokage**"
f"I joined discord on {created_at}. I try my best to do every work of a **hokage**. You can get more "
"information on my commands by using the *dropdown* below.\n\n"
f"I'm also open source. You can see my code on [GitHub]({LinksAndVars.github.value})!"
),
inline=False,
)
elif self.index == 1:
Expand Down Expand Up @@ -191,15 +186,14 @@ def __init__(self, source: menus.PageSource, ctx: commands.Context):
super().__init__(source, ctx=ctx, compact=True)

def add_categories(
self, commands: Dict[commands.Cog, List[commands.Command]]
) -> None:
self, commands: Dict[commands.Cog,
List[commands.Command]]) -> None:
self.clear_items()
self.add_item(HelpSelectMenu(commands, self.ctx.bot))
self.fill_items()

async def rebind(
self, source: menus.PageSource, interaction: discord.Interaction
) -> None:
async def rebind(self, source: menus.PageSource,
interaction: discord.Interaction) -> None:
self.source = source
self.current_page = 0

Expand All @@ -214,12 +208,12 @@ class PaginatedHelpCommand(commands.HelpCommand):
def __init__(self):
super().__init__(
command_attrs={
"cooldown": commands.CooldownMapping.from_cooldown(
1, 3.0, commands.BucketType.member
),
"help": "Shows help about the bot, a command, or a category",
}
)
"cooldown":
commands.CooldownMapping.from_cooldown(
1, 3.0, commands.BucketType.member),
"help":
"Shows help about the bot, a command, or a category",
})

def get_command_signature(self, command):
parent = command.full_parent_name
Expand All @@ -241,17 +235,16 @@ def key(command) -> str:
return cog.qualified_name if cog else "\U0010ffff"

entries: List[commands.Command] = await self.filter_commands(
bot.commands, sort=True, key=key
)
bot.commands, sort=True, key=key)

all_commands: Dict[commands.Cog, List[commands.Command]] = {}
for name, children in itertools.groupby(entries, key=key):
if name == "\U0010ffff":
continue

cog = bot.get_cog(name)
all_commands[cog] = sorted(
children, key=lambda c: c.qualified_name)
all_commands[cog] = sorted(children,
key=lambda c: c.qualified_name)

menu = HelpMenu(FrontPageSource(), ctx=self.context)
menu.add_categories(all_commands)
Expand All @@ -260,8 +253,8 @@ def key(command) -> str:
async def send_cog_help(self, cog):
entries = await self.filter_commands(cog.get_commands(), sort=True)
menu = HelpMenu(
GroupHelpPageSource(
cog, entries, prefix=self.context.clean_prefix),
GroupHelpPageSource(cog, entries,
prefix=self.context.clean_prefix),
ctx=self.context,
)
await menu.start()
Expand All @@ -288,8 +281,9 @@ async def send_group_help(self, group):
if len(entries) == 0:
return await self.send_command_help(group)

source = GroupHelpPageSource(
group, entries, prefix=self.context.clean_prefix)
source = GroupHelpPageSource(group,
entries,
prefix=self.context.clean_prefix)
self.common_command_formatting(source, group)
menu = HelpMenu(source, ctx=self.context)
await menu.start()
69 changes: 41 additions & 28 deletions minato_namikaze/bot_files/lib/functions/votes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@


def votedVoidBots(ctx):
if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
if ctx.author.id in (ctx.bot.owner_id,
837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
):
return True
e1 = requests.get(
Expand All @@ -24,9 +25,10 @@ def votedVoidBots(ctx):


def votedTopgg(ctx):
if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
if ctx.author.id in (ctx.bot.owner_id,
837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
):
return True
a = requests.get(
Expand All @@ -44,14 +46,18 @@ def votedTopgg(ctx):


def votedbotsfordiscord(ctx):
if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
if ctx.author.id in (ctx.bot.owner_id,
837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
):
return True
c = requests.get(
f"https://botsfordiscord.com/api/bot/{ctx.bot.user.id}/votes",
headers={"Authorization": bfd, "Content-Type": "application/json"},
headers={
"Authorization": bfd,
"Content-Type": "application/json"
},
)
try:
c_list = str(ctx.message.author.id) in c.json().get("hasVoted24")
Expand All @@ -63,9 +69,10 @@ def votedbotsfordiscord(ctx):


def voteddiscordboats(ctx):
if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
if ctx.author.id in (ctx.bot.owner_id,
837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
):
return True
d = requests.get(
Expand All @@ -82,9 +89,10 @@ def voteddiscordboats(ctx):


def votedfateslist(ctx):
if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
if ctx.author.id in (ctx.bot.owner_id,
837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
):
return True
f = requests.get(
Expand All @@ -102,9 +110,10 @@ def votedfateslist(ctx):


def votedbladebotlist(ctx):
if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
if ctx.author.id in (ctx.bot.owner_id,
837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
):
return True
g = requests.get(
Expand All @@ -120,9 +129,10 @@ def votedbladebotlist(ctx):


def voteddiscordlistspace(ctx):
if ctx.author.id in (ctx.bot.owner_id, 837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
if ctx.author.id in (ctx.bot.owner_id,
837223478934896670) or ctx.guild.id in (
747480356625711204,
853549974212837376,
):
return True
h = requests.get(
Expand All @@ -141,16 +151,19 @@ def voteddiscordlistspace(ctx):
def generatevoteembed(ctx, *argv):
list_dict = {
"top.gg": "https://top.gg/images/dblnew.png",
"discordlist.space": "https://discordlist.space/img/apple-touch-icon.png",
"botsfordiscord": "https://botsfordiscord.com/img/favicons/apple-touch-icon-57x57.png",
"discordlist.space":
"https://discordlist.space/img/apple-touch-icon.png",
"botsfordiscord":
"https://botsfordiscord.com/img/favicons/apple-touch-icon-57x57.png",
"discord.boats": "https://discord.boats/apple-icon-57x57.png",
"fateslist": "https://fateslist.xyz/static/botlisticon.webp",
"bladebotlist": "https://bladebotlist.xyz/img/logo.png",
"voidbots": "https://voidbots.net/assets/img/logo.png",
}
site_dict = {
"top.gg": f"https://top.gg/bot/{ctx.bot.user.id}",
"discordlist.space": f"https://discordlist.space/bot/{ctx.bot.user.id}",
"discordlist.space":
f"https://discordlist.space/bot/{ctx.bot.user.id}",
"botsfordiscord": f"https://botsfordiscord.com/bot/{ctx.bot.user.id}",
"discord.boats": f"https://discord.boats/bot/{ctx.bot.user.id}",
"fateslist": f"https://fateslist.xyz/bot/{ctx.bot.user.id}",
Expand Down Expand Up @@ -181,9 +194,9 @@ def generatevoteembed(ctx, *argv):
description=f'You need to **vote for me** in the **following botlists** :smile: :\n{join_string.join([f"**[{i.capitalize()}]({site_dict[i.lower()]})**" for i in argv[0]])}',
timestamp=ctx.message.created_at,
)
e.set_author(
name=ctx.message.author, url=website, icon_url=ctx.message.author.avatar_url
)
e.set_author(name=ctx.message.author,
url=website,
icon_url=ctx.message.author.avatar_url)
e.set_thumbnail(url=ctx.message.author.avatar_url)
e.set_footer(
text=f"Vote for us in the above mentioned botlists and then enjoy the `{ctx.command.name}` command."
Expand Down

0 comments on commit 1c26d53

Please sign in to comment.