mirror of
https://github.com/RGBCube/minearchy-bot
synced 2025-07-27 17:07:45 +00:00
Reformat
This commit is contained in:
parent
c1eb216eb5
commit
4e5c4507c8
11 changed files with 952 additions and 945 deletions
|
@ -14,16 +14,16 @@ if TYPE_CHECKING:
|
|||
|
||||
class MinecraftServer(
|
||||
Cog,
|
||||
name="Minecraft Server",
|
||||
description="Utilities for the Minecraft server.",
|
||||
name = "Minecraft Server",
|
||||
description = "Utilities for the Minecraft server.",
|
||||
):
|
||||
def __init__(self, bot: MinearchyBot) -> None:
|
||||
self.bot = bot
|
||||
|
||||
@commands.group(
|
||||
invoke_without_command=True,
|
||||
brief="Sends the server IP.",
|
||||
help="Sends the server IP.",
|
||||
invoke_without_command = True,
|
||||
brief = "Sends the server IP.",
|
||||
help = "Sends the server IP.",
|
||||
)
|
||||
async def ip(self, ctx: Context) -> None:
|
||||
await ctx.reply(
|
||||
|
@ -32,8 +32,8 @@ class MinecraftServer(
|
|||
)
|
||||
|
||||
@ip.command(
|
||||
brief="Sends the Java edition IP.",
|
||||
help="Sends the Java edition IP."
|
||||
brief = "Sends the Java edition IP.",
|
||||
help = "Sends the Java edition IP."
|
||||
)
|
||||
async def java(self, ctx: Context) -> None:
|
||||
await ctx.reply(
|
||||
|
@ -42,8 +42,8 @@ class MinecraftServer(
|
|||
)
|
||||
|
||||
@ip.command(
|
||||
brief="Sends the Bedrock edition IP.",
|
||||
help="Sends the Bedrock edition IP.",
|
||||
brief = "Sends the Bedrock edition IP.",
|
||||
help = "Sends the Bedrock edition IP.",
|
||||
)
|
||||
async def bedrock(self, ctx: Context) -> None:
|
||||
await ctx.reply(
|
||||
|
@ -53,8 +53,8 @@ class MinecraftServer(
|
|||
)
|
||||
|
||||
@command(
|
||||
brief="Shows information about the Minecraft server.",
|
||||
help="Shows the total player count, the Minecraft server IP and the server latency.",
|
||||
brief = "Shows information about the Minecraft server.",
|
||||
help = "Shows the total player count, the Minecraft server IP and the server latency.",
|
||||
)
|
||||
async def status(self, ctx: Context) -> None:
|
||||
status = await self.bot.server.status()
|
||||
|
@ -68,97 +68,97 @@ class MinecraftServer(
|
|||
await ctx.reply(message)
|
||||
|
||||
@command(
|
||||
brief="Sends the link to the wiki.",
|
||||
help="Sends the link to the wiki."
|
||||
brief = "Sends the link to the wiki.",
|
||||
help = "Sends the link to the wiki."
|
||||
)
|
||||
async def wiki(self, ctx: Context) -> None:
|
||||
view = View()
|
||||
view.add_item(
|
||||
Button(
|
||||
label="Go to the wiki!",
|
||||
url="https://landsofminearchy.com/wiki",
|
||||
label = "Go to the wiki!",
|
||||
url = "https://landsofminearchy.com/wiki",
|
||||
)
|
||||
)
|
||||
await ctx.reply(view=view)
|
||||
await ctx.reply(view = view)
|
||||
|
||||
@command(
|
||||
brief="Sends the link to the store.",
|
||||
help="Sends the link to the store.",
|
||||
brief = "Sends the link to the store.",
|
||||
help = "Sends the link to the store.",
|
||||
)
|
||||
async def store(self, ctx: Context) -> None:
|
||||
view = View()
|
||||
view.add_item(
|
||||
Button(
|
||||
label="Go to the store!",
|
||||
url="https://landsofminearchy.com/store",
|
||||
label = "Go to the store!",
|
||||
url = "https://landsofminearchy.com/store",
|
||||
)
|
||||
)
|
||||
await ctx.reply(view=view)
|
||||
await ctx.reply(view = view)
|
||||
|
||||
@command(
|
||||
aliases=("forums",),
|
||||
brief="Sends the link to the forum.",
|
||||
help="Sends the link to the forum.",
|
||||
aliases = ("forums",),
|
||||
brief = "Sends the link to the forum.",
|
||||
help = "Sends the link to the forum.",
|
||||
)
|
||||
async def forum(self, ctx: Context) -> None:
|
||||
view = View()
|
||||
view.add_item(
|
||||
Button(
|
||||
label="Go to the forum!",
|
||||
url="https://landsofminearchy.com/forum",
|
||||
label = "Go to the forum!",
|
||||
url = "https://landsofminearchy.com/forum",
|
||||
)
|
||||
)
|
||||
await ctx.reply(view=view)
|
||||
await ctx.reply(view = view)
|
||||
|
||||
@command(
|
||||
aliases=("map",),
|
||||
brief="Sends the link to the dynmap.",
|
||||
help="Sends the link to the dynmap.",
|
||||
aliases = ("map",),
|
||||
brief = "Sends the link to the dynmap.",
|
||||
help = "Sends the link to the dynmap.",
|
||||
)
|
||||
async def dynmap(self, ctx: Context) -> None:
|
||||
view = View()
|
||||
view.add_item(
|
||||
Button(
|
||||
label="Go to the dynmap!",
|
||||
url="https://landsofminearchy.com/dynmap",
|
||||
label = "Go to the dynmap!",
|
||||
url = "https://landsofminearchy.com/dynmap",
|
||||
)
|
||||
)
|
||||
await ctx.reply(
|
||||
content="The dynmap is an interactive, live map of our Minecraft server.", view=view
|
||||
content = "The dynmap is an interactive, live map of our Minecraft server.", view = view
|
||||
)
|
||||
|
||||
@command(
|
||||
brief="Sends the links you can use to vote for the Minecraft server.",
|
||||
help="Sends the links you can use to vote for the Minecraft server.",
|
||||
brief = "Sends the links you can use to vote for the Minecraft server.",
|
||||
help = "Sends the links you can use to vote for the Minecraft server.",
|
||||
)
|
||||
async def vote(self, ctx: Context) -> None:
|
||||
view = View()
|
||||
view.add_item(
|
||||
Button(
|
||||
label="Vote for the Minecraft server!",
|
||||
url="https://landsofminearchy.com/vote",
|
||||
label = "Vote for the Minecraft server!",
|
||||
url = "https://landsofminearchy.com/vote",
|
||||
)
|
||||
)
|
||||
await ctx.reply(view=view)
|
||||
await ctx.reply(view = view)
|
||||
|
||||
@command(
|
||||
name="staff-application",
|
||||
aliases=(
|
||||
name = "staff-application",
|
||||
aliases = (
|
||||
"apply",
|
||||
"staff-applications",
|
||||
),
|
||||
brief="Sends the link to the staff application.",
|
||||
help="Sends the link to the staff application.",
|
||||
brief = "Sends the link to the staff application.",
|
||||
help = "Sends the link to the staff application.",
|
||||
)
|
||||
async def staff_application(self, ctx: Context) -> None:
|
||||
view = View()
|
||||
view.add_item(
|
||||
Button(
|
||||
label="Apply for staff!",
|
||||
url="https://docs.google.com/forms/d/1I7Rh_e-ZTXm5L51XoKZsOAk7NAJcHomUUCuOlQcARvY/viewform",
|
||||
label = "Apply for staff!",
|
||||
url = "https://docs.google.com/forms/d/1I7Rh_e-ZTXm5L51XoKZsOAk7NAJcHomUUCuOlQcARvY/viewform",
|
||||
)
|
||||
)
|
||||
await ctx.reply(view=view)
|
||||
await ctx.reply(view = view)
|
||||
|
||||
|
||||
async def setup(bot: MinearchyBot) -> None:
|
||||
|
|
|
@ -19,8 +19,8 @@ if TYPE_CHECKING:
|
|||
|
||||
class Miscellaneous(
|
||||
Cog,
|
||||
name="Miscellaneous",
|
||||
description="Miscellaneous commands.",
|
||||
name = "Miscellaneous",
|
||||
description = "Miscellaneous commands.",
|
||||
):
|
||||
def __init__(self, bot: MinearchyBot) -> None:
|
||||
self.bot = bot
|
||||
|
@ -32,16 +32,16 @@ class Miscellaneous(
|
|||
self.bot.help_command.hidden = True
|
||||
|
||||
@command(
|
||||
brief="Sends the GitHub repository link for the bot.",
|
||||
help="Sends the GitHub repository link for the bot.",
|
||||
brief = "Sends the GitHub repository link for the bot.",
|
||||
help = "Sends the GitHub repository link for the bot.",
|
||||
)
|
||||
async def github(self, ctx: Context) -> None:
|
||||
# Not a button since I want the embed.
|
||||
await ctx.reply("https://github.com/RGBCube/minearchy-bot")
|
||||
|
||||
@command(
|
||||
brief="Sends info about the bot.",
|
||||
help="Sends info about the bot."
|
||||
brief = "Sends info about the bot.",
|
||||
help = "Sends info about the bot."
|
||||
)
|
||||
async def info(self, ctx: Context) -> None:
|
||||
await ctx.reply(
|
||||
|
@ -49,14 +49,14 @@ class Miscellaneous(
|
|||
f"""
|
||||
__**Bot Info**__
|
||||
**Python Version:** v{python_version()}
|
||||
**Uptime:** `{TimeDelta(seconds=int(get_time() - self.bot.ready_timestamp))}`
|
||||
**Uptime:** `{TimeDelta(seconds = int(get_time() - self.bot.ready_timestamp))}`
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
@command(
|
||||
brief="Sets you as AFK.",
|
||||
help="Sets you as AFK.",
|
||||
brief = "Sets you as AFK.",
|
||||
help = "Sets you as AFK.",
|
||||
)
|
||||
async def afk(self, ctx: Context) -> None:
|
||||
# No error because it will un-afk the caller.
|
||||
|
@ -70,7 +70,7 @@ class Miscellaneous(
|
|||
)
|
||||
return
|
||||
|
||||
await ctx.author.edit(nick=f"[AFK] {ctx.author.display_name}"[:32])
|
||||
await ctx.author.edit(nick = f"[AFK] {ctx.author.display_name}"[:32])
|
||||
await ctx.reply("Set your status to AFK. You can now touch grass freely 🌲.")
|
||||
|
||||
@Cog.listener()
|
||||
|
@ -78,8 +78,10 @@ class Miscellaneous(
|
|||
if not message.author.display_name.upper().startswith("[AFK]"):
|
||||
return
|
||||
|
||||
await message.author.edit(nick=message.author.display_name[5:])
|
||||
await message.channel.send(f"Welcome back {message.author.mention}! I've unset your AFK status.")
|
||||
await message.author.edit(nick = message.author.display_name[5:])
|
||||
await message.channel.send(
|
||||
f"Welcome back {message.author.mention}! I've unset your AFK status."
|
||||
)
|
||||
|
||||
|
||||
async def setup(bot: MinearchyBot) -> None:
|
||||
|
|
|
@ -20,8 +20,8 @@ if TYPE_CHECKING:
|
|||
|
||||
class Moderation(
|
||||
Cog,
|
||||
name="Moderation",
|
||||
description="Moderation commands & utilities.",
|
||||
name = "Moderation",
|
||||
description = "Moderation commands & utilities.",
|
||||
):
|
||||
def __init__(self, bot: MinearchyBot) -> None:
|
||||
self.bot = bot
|
||||
|
@ -34,11 +34,11 @@ class Moderation(
|
|||
self.sniped = DefaultDict(Deque)
|
||||
|
||||
@command(
|
||||
aliases=("mute",),
|
||||
brief="Times out a user.",
|
||||
help="Times out a user."
|
||||
aliases = ("mute",),
|
||||
brief = "Times out a user.",
|
||||
help = "Times out a user."
|
||||
)
|
||||
@commands.has_permissions(manage_messages=True)
|
||||
@commands.has_permissions(manage_messages = True)
|
||||
async def timeout(self, ctx: Context, member: Member, duration: str = "1d") -> None:
|
||||
if duration[-1] not in self.time_values or len(duration) < 2:
|
||||
await ctx.reply("Invalid duration. Valid durations are: d, h, m, s.")
|
||||
|
@ -55,20 +55,21 @@ class Moderation(
|
|||
|
||||
# This is so cursed but works.
|
||||
await member.timeout(
|
||||
TimeDelta(**{clean_time_name: time}), reason=f"Timed out by moderator {ctx.author}"
|
||||
TimeDelta(**{ clean_time_name: time }), reason = f"Timed out by moderator {ctx.author}"
|
||||
)
|
||||
|
||||
await ctx.reply(f"Timed out {member.mention} for {time} {clean_time_name}.")
|
||||
|
||||
# noinspection GrazieInspection
|
||||
@command(
|
||||
brief="Sends the latest deleted messages.",
|
||||
help=(
|
||||
brief = "Sends the latest deleted messages.",
|
||||
help = (
|
||||
"Sends the last 5 deleted messages in a specified channel.\nIf the channel"
|
||||
" isn't specified, it uses the current channel."
|
||||
),
|
||||
)
|
||||
# Needs to be able to delete messages to run the command.
|
||||
@commands.has_permissions(manage_messages=True)
|
||||
@commands.has_permissions(manage_messages = True)
|
||||
async def snipe(self, ctx: Context, channel: TextChannel | None = None) -> None:
|
||||
if channel is None:
|
||||
channel = ctx.channel
|
||||
|
@ -83,12 +84,12 @@ class Moderation(
|
|||
return
|
||||
|
||||
embed = Embed(
|
||||
title=(
|
||||
title = (
|
||||
"Showing last 5 deleted messages for"
|
||||
f" {'the current channel' if ctx.channel.id == channel.id else channel}"
|
||||
),
|
||||
description="The lower the number is, the more recent it got deleted.",
|
||||
color=Color.random(),
|
||||
description = "The lower the number is, the more recent it got deleted.",
|
||||
color = Color.random(),
|
||||
)
|
||||
|
||||
zwsp = "\uFEFF"
|
||||
|
@ -97,8 +98,8 @@ class Moderation(
|
|||
message, ts = log
|
||||
|
||||
embed.add_field(
|
||||
name=str(i) + ("" if i else " (latest)"),
|
||||
value=strip(
|
||||
name = str(i) + ("" if i else " (latest)"),
|
||||
value = strip(
|
||||
f"""
|
||||
Author: {message.author.mention} (ID: {message.author.id}, Plain: {escape_markdown(str(message.author))})
|
||||
Deleted at: <t:{ts}:F> (Relative: <t:{ts}:R>)
|
||||
|
@ -108,10 +109,10 @@ class Moderation(
|
|||
```
|
||||
"""
|
||||
),
|
||||
inline=False,
|
||||
inline = False,
|
||||
)
|
||||
|
||||
await ctx.reply(embed=embed)
|
||||
await ctx.reply(embed = embed)
|
||||
|
||||
@Cog.listener()
|
||||
async def on_message_delete(self, message: Message) -> None:
|
||||
|
|
|
@ -24,33 +24,33 @@ if TYPE_CHECKING:
|
|||
|
||||
class Utils(
|
||||
Cog,
|
||||
name="Utilities",
|
||||
description="Various utilities.",
|
||||
name = "Utilities",
|
||||
description = "Various utilities.",
|
||||
):
|
||||
def __init__(self, bot: MinearchyBot) -> None:
|
||||
self.bot = bot
|
||||
|
||||
@command(
|
||||
brief="Sends the total members in the server.",
|
||||
help="Sends the total members in the server.",
|
||||
brief = "Sends the total members in the server.",
|
||||
help = "Sends the total members in the server.",
|
||||
)
|
||||
async def members(self, ctx: Context) -> None:
|
||||
await ctx.reply(f"There are `{ctx.guild.member_count}` users in this server.")
|
||||
|
||||
@command(
|
||||
brief="Sends the bots ping.",
|
||||
help="Sends the bots ping."
|
||||
brief = "Sends the bots ping.",
|
||||
help = "Sends the bots ping."
|
||||
)
|
||||
async def ping(self, ctx: Context) -> None:
|
||||
ts = get_monotonic()
|
||||
message = await ctx.reply("Pong!")
|
||||
ts = get_monotonic() - ts
|
||||
await message.edit(content=f"Pong! `{int(ts * 1000)}ms`")
|
||||
await message.edit(content = f"Pong! `{int(ts * 1000)}ms`")
|
||||
|
||||
# Fuck this thing I'm never touching it again.
|
||||
@command(
|
||||
name="channel-perm-tree",
|
||||
hidden=True
|
||||
name = "channel-perm-tree",
|
||||
hidden = True
|
||||
)
|
||||
async def channel_perm_tree(self, ctx: Context) -> None:
|
||||
string = []
|
||||
|
@ -88,18 +88,20 @@ class Utils(
|
|||
deny.append(perm)
|
||||
|
||||
if allow or deny:
|
||||
perms.append(f" {typ} `{name}`: {thing.id if name != '@everyone' else ''}")
|
||||
perms.append(
|
||||
f" {typ} `{name}`: {thing.id if name != '@everyone' else ''}"
|
||||
)
|
||||
perms.append(" permissions:")
|
||||
|
||||
for a in allow:
|
||||
perms.append(f" {a}: ✅")
|
||||
for d in deny:
|
||||
perms.append(f" {d}: ❌")
|
||||
|
||||
|
||||
if perms:
|
||||
string.append(" permissions:")
|
||||
string.extend(perms)
|
||||
|
||||
|
||||
# Category perms end.
|
||||
|
||||
# Channel perms start.
|
||||
|
@ -200,7 +202,9 @@ class Utils(
|
|||
deny.append(perm)
|
||||
|
||||
if allow or deny:
|
||||
string.append(f" {typ} `{name}`: {thing.id if name != '@everyone' else ''}")
|
||||
string.append(
|
||||
f" {typ} `{name}`: {thing.id if name != '@everyone' else ''}"
|
||||
)
|
||||
string.append(" permissions:")
|
||||
|
||||
for a in allow:
|
||||
|
@ -215,9 +219,9 @@ class Utils(
|
|||
# Root perms end.
|
||||
|
||||
await ctx.reply(
|
||||
file=File(
|
||||
file = File(
|
||||
BytesIO("\n".join(string).encode()),
|
||||
filename="channel-perm-tree.txt"
|
||||
filename = "channel-perm-tree.txt"
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue