Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/extensions/uptime.py → src/misc/uptime.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import arc

from src.models import Blockbot, BlockbotContext, BlockbotPlugin
from src.models import BlockbotContext, BlockbotPlugin, command_loader
from src.utils import utcnow

START_TIME = utcnow()

plugin = BlockbotPlugin("Blockbot Uptime")


@plugin.include
@arc.slash_command("uptime", "Show formatted uptime of Blockbot")
async def uptime(ctx: BlockbotContext) -> None:
up_time = utcnow() - START_TIME
Expand All @@ -25,6 +22,6 @@ def format_time(val: int, s: str) -> str:
await ctx.respond(f"Uptime: **{', '.join(formatted_parts)}**")


@arc.loader
def loader(client: Blockbot) -> None:
client.add_plugin(plugin)
@command_loader
def loader(plugin: BlockbotPlugin) -> None:
plugin.add_command(uptime)
11 changes: 4 additions & 7 deletions src/extensions/xkcd.py → src/misc/xkcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
import arc
import hikari

from src.models import Blockbot, BlockbotContext, BlockbotPlugin
from src.models import BlockbotContext, BlockbotPlugin, command_loader

xkcd = BlockbotPlugin(name="xkcd")


@xkcd.include
@arc.slash_command("xkcd", "Wisdom from xkcd!")
async def xkcd_command(
ctx: BlockbotContext,
Expand Down Expand Up @@ -62,6 +59,6 @@ async def xkcd_command(
await ctx.respond(embed)


@arc.loader
def loader(client: Blockbot) -> None:
client.add_plugin(xkcd)
@command_loader
def loader(plugin: BlockbotPlugin) -> None:
plugin.add_command(xkcd_command)
Loading