diff --git a/FormulaForge/Extensions/latex.py b/FormulaForge/Extensions/latex.py index 401c97a..6389837 100644 --- a/FormulaForge/Extensions/latex.py +++ b/FormulaForge/Extensions/latex.py @@ -8,7 +8,7 @@ from FormulaForge.Models.url import URLBuilder, convert_new_line_to_url_encoding -latex_images = arc.RESTPlugin("latex_images") +latex_images = arc.GatewayPlugin("latex_images") @latex_images.include @@ -16,7 +16,7 @@ name="latex_to_image", description="Convert LaTeX (Math Mode) to an image." ) async def latex_to_image( - ctx: arc.RESTContext, + ctx: arc.GatewayContext, is_transparent: arc.Option[ bool, arc.BoolParams( @@ -105,10 +105,10 @@ async def latex_to_image( @arc.loader -def load(client: arc.RESTClient) -> None: +def load(client: arc.GatewayClient) -> None: client.add_plugin(latex_images) @arc.unloader -def unload(client: arc.RESTClient) -> None: +def unload(client: arc.GatewayClient) -> None: client.remove_plugin(latex_images) diff --git a/FormulaForge/Extensions/unit_convert.py b/FormulaForge/Extensions/unit_convert.py index 2ab63fe..0791754 100644 --- a/FormulaForge/Extensions/unit_convert.py +++ b/FormulaForge/Extensions/unit_convert.py @@ -8,7 +8,7 @@ from FormulaForge.utils.convert_temp import convert_temperature -unit_converter = arc.RESTPlugin("unit_converter") +unit_converter = arc.GatewayPlugin("unit_converter") unit_convert_group = unit_converter.include_slash_group( "unit_convert", @@ -56,7 +56,7 @@ def embed_builder(value, from_unit, to_unit, converted_value): @unit_convert_group.include @arc.slash_subcommand(name="temperature", description="Convert temperature.") async def temperature( - ctx: arc.RESTContext, + ctx: arc.GatewayContext, temperature: arc.Option[ float, arc.FloatParams( @@ -94,7 +94,7 @@ async def temperature( @unit_convert_group.include @arc.slash_subcommand(name="speed", description="Convert speed.") async def speed( - ctx: arc.RESTContext, + ctx: arc.GatewayContext, speed: arc.Option[ float, arc.FloatParams( @@ -139,7 +139,7 @@ async def speed( @unit_convert_group.include @arc.slash_subcommand(name="mass", description="Convert mass.") async def mass( - ctx: arc.RESTContext, + ctx: arc.GatewayContext, mass: arc.Option[ float, arc.FloatParams( @@ -174,7 +174,7 @@ async def mass( @unit_convert_group.include @arc.slash_subcommand(name="energy", description="Convert energy.") async def energy( - ctx: arc.RESTContext, + ctx: arc.GatewayContext, energy: arc.Option[ float, arc.FloatParams( @@ -209,7 +209,7 @@ async def energy( @unit_convert_group.include @arc.slash_subcommand(name="length", description="Convert length.") async def length( - ctx: arc.RESTContext, + ctx: arc.GatewayContext, length: arc.Option[ float, arc.FloatParams( @@ -242,10 +242,10 @@ async def length( @arc.loader -def load(client: arc.RESTClient) -> None: +def load(client: arc.GatewayClient) -> None: client.add_plugin(unit_converter) @arc.unloader -def unload(client: arc.RESTClient) -> None: +def unload(client: arc.GatewayClient) -> None: client.remove_plugin(unit_converter) diff --git a/FormulaForge/Models/url.py b/FormulaForge/Models/url.py index 6a92603..07f570b 100644 --- a/FormulaForge/Models/url.py +++ b/FormulaForge/Models/url.py @@ -19,5 +19,5 @@ def __call__(self, *args, **kwargs) -> str: def convert_new_line_to_url_encoding(formula_without_newline_encoding: str) -> str: - """Converts \n to %0A""" + """Converts newline to %0A which is the URL encoding for newline.""" return formula_without_newline_encoding.replace("\n", "%0A") diff --git a/FormulaForge/bot.py b/FormulaForge/bot.py index ea0629f..e46d77c 100644 --- a/FormulaForge/bot.py +++ b/FormulaForge/bot.py @@ -5,28 +5,28 @@ import miru -class MyModal(miru.Modal[miru.REST]): - formula = miru.TextInput[miru.REST]( +class MyModal(miru.Modal[miru.GW]): + formula = miru.TextInput[miru.GW]( label="Formula", placeholder="Remember to add $ in Math Mode https://www1.cmc.edu/pages/faculty/aaksoy/latex/latexthree.html", required=True, style=hikari.TextInputStyle.PARAGRAPH, ) - async def callback(self, context: miru.ModalContext[miru.REST]) -> None: + async def callback(self, context: miru.ModalContext[miru.GW]) -> None: await context.respond("Processing...") TOKEN = os.environ["TOKEN"] -bot = hikari.RESTBot(token=TOKEN, logs="DEBUG") -modal_client = miru.RESTClient(bot) -client = arc.RESTClient(bot) +bot = hikari.GatewayBot(token=TOKEN, logs="DEBUG") +modal_client = miru.GatewayClient(bot) +client = arc.GatewayClient(bot) @client.include @arc.slash_command(name="ping", description="Ping the bot.") -async def ping_slash(ctx: arc.RESTContext) -> None: +async def ping_slash(ctx: arc.GatewayContext) -> None: await ctx.respond("Pong!")