Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
Another patch (#15)
Browse files Browse the repository at this point in the history
* add server rules to server info

thanks to @Cheaterman

* move `on_startup` task to custom client

* some bugfix??

* fix: pre-commit auto fixes

* minor typofix

* fix: pre-commit auto fixes

Co-authored-by: julianne-stingray[bot] <92771582+julianne-stingray[bot]@users.noreply.github.com>
  • Loading branch information
Clemie McCartney and julianne-stingray[bot] authored Oct 1, 2022
1 parent ee157de commit 91f0aa4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 6 additions & 4 deletions extensions/samp.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async def samp(self, ctx, ip=None, port: Optional[int] = 7777):
port = find["port"]
except:
embed = Embed(
description=f"<:cross:839158779815657512> Cannot find server info in database. Please use <:slash:894692029941039194>`samp bookmark add` to add your server info to bookmark.",
description=f"<:cross:839158779815657512> Cannot find server info in database. Please use </samp bookmark add:996967239976747169> to add your server info to bookmark.",
color=0xFF0000,
)
return await ctx.send(embed=embed)
Expand Down Expand Up @@ -194,6 +194,8 @@ async def samp(self, ctx, ip=None, port: Optional[int] = 7777):
srv_info.add_field(name="Language", value=info.language, inline=False)
if info.password is True:
srv_info.add_field(name="Passworded?", value="Yes", inline=False)
for i in rule:
srv_info.add_field(name=i.name, value=i.value, inline=True)
srv_info.set_footer(
text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar.url
)
Expand Down Expand Up @@ -257,7 +259,7 @@ async def samp(self, ctx, ip=None, port: Optional[int] = 7777):
return await paginators.send(ctx)
except:
embed = Embed(
description=f"<:cross:839158779815657512> Couldn't connect to the server",
description=f"<:cross:839158779815657512> Couldn't connect to the server, or there's an error in our end. Please Try again later!",
color=0xFF0000,
)
return await ctx.send(embed=embed)
Expand Down Expand Up @@ -349,7 +351,7 @@ async def edit(self, ctx, ip: str, port: Optional[int] = 7777):
find = server.find_one({"guild_id": ctx.guild_id})
if find is None:
embed = Embed(
description=f"<:cross:839158779815657512> Your server is not in our list, Please register it first!",
description=f"<:cross:839158779815657512> Your server is not in our database yet, Please register it first!",
color=0xFF0000,
)
return await ctx.send(embed=embed)
Expand Down Expand Up @@ -389,7 +391,7 @@ async def remove(self, ctx):
find = server.find_one({"guild_id": ctx.guild_id})
if find is None:
embed = Embed(
description=f"<:cross:839158779815657512> Your server is not in our list, Please register it first!",
description=f"<:cross:839158779815657512> Your server is not in our database yet, Please register it first!",
color=0xFF0000,
)
return await ctx.send(embed=embed)
Expand Down
4 changes: 2 additions & 2 deletions extensions/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def context_userinfo(self, ctx):
value=f"<t:{int(member.joined_at.timestamp())}:F> (<t:{int(member.joined_at.timestamp())}:R>)",
inline=False,
)
members = sorted(ctx.guild.members, key=lambda m: m.joined_at)
members = sorted(member.roles, key=lambda x: -x.position)
embed.add_field(name="User ID:", value=f"{member.id}", inline=False)
if len(member.roles) > 1:
res = member.roles[::-1]
Expand Down Expand Up @@ -184,7 +184,7 @@ async def slash_userinfo(self, ctx, member: naff.Member = None):
value=f"<t:{int(member.joined_at.timestamp())}:F> (<t:{int(member.joined_at.timestamp())}:R>)",
inline=False,
)
members = sorted(ctx.guild.members, key=lambda m: m.joined_at)
members = sorted(member.roles, key=lambda x: -x.position)
embed.add_field(name="User ID:", value=f"{member.id}", inline=False)
if len(member.roles) > 1:
res = member.roles[::-1]
Expand Down
4 changes: 0 additions & 4 deletions utilities/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
TYPE_CHECK_FUNCTION = Callable[[Context], Awaitable[bool]]


class MissingPermissions(CommandException):
"""User is missing permissions"""


def member_permissions(*permissions: Permissions) -> TYPE_CHECK_FUNCTION:
"""
Check if member has any of the given permissions.
Expand Down

0 comments on commit 91f0aa4

Please sign in to comment.