diff --git a/app/cogs/actual_utils.py b/app/cogs/actual_utils.py index db792d8a..e8effd64 100644 --- a/app/cogs/actual_utils.py +++ b/app/cogs/actual_utils.py @@ -35,11 +35,26 @@ class ActualUtils(commands.Cog): await ctx.defer() await ctx.followup.send(result) - @commands.command(name="issue") + @commands.slash_command( + guild_ids=core_utils.my_guilds, + name="issue", + description="Files an issue on gitlab", + ) + @option(name="title", requried=True, description="The title of the issue") + @option(name="description", require=True, description="The body of the issue") async def issue(self, ctx: commands.Context): - import gitlab - await ctx.send(gitlab.parse_message(ctx.message)) + post_args = {"title": title, "description": description} + + headers = {"PRIVATE-TOKEN": os.getenv("gitlab_token")} + + r = requests.post( + "https://git.luker.gq/api/v4/projects/3/issues", + data=post_args, + headers=headers, + ) + + await ctx.respond(r.json()["web_url"]) @commands.command(name="tts") async def tts(self, ctx: commands.Context): @@ -67,7 +82,7 @@ class ActualUtils(commands.Cog): required=True, description="The query you want to pass to wolfram alpha", ) - async def ask(self, ctx, query): + async def wolfram(self, ctx, query): import questions await ctx.defer() @@ -75,17 +90,6 @@ class ActualUtils(commands.Cog): questions.answer_question(query), ) - @commands.command(name="openai") - async def openai(self, ctx: commands.Context, *, query): - if ctx.message.author.id != core_utils.my_id: - await ctx.send("Sorry, this is a paid dale-bot feature") - return - import questions - - await ctx.reply( - questions.open_ai(query), - ) - @commands.has_role("Track day gamers") @commands.slash_command( guild_ids=core_utils.my_guilds, diff --git a/app/cogs/cheeky_functions.py b/app/cogs/cheeky_functions.py index 52df1bae..99489092 100644 --- a/app/cogs/cheeky_functions.py +++ b/app/cogs/cheeky_functions.py @@ -71,17 +71,23 @@ class Cheeky(commands.Cog): await ctx.respond(embed=embed) - @commands.command(name="roll") + @commands.slash_command( + guild_ids=None, name="roll", decide="Roll X number of N sided die", type=int + ) + @option(name="num_of_dies", required=True, type=int) + @option(name="sides", required=True, description="Number of sides on your die") + @option( + name="number_to_add", + description="An optional number to add to your roll", + required=False, + default=None, + ) async def roll( self, ctx: commands.Context, number_of_die, sides, number_to_add=None ): import dice - sides = sides.split("d")[1] - if "+" in ctx.message.content: - number_to_add = int(ctx.message.content.split("+")[-1]) - - await ctx.reply(embed=dice.roll(number_of_die, sides, number_to_add)) + await ctx.respond(embed=dice.roll(number_of_die, sides, number_to_add)) @commands.command(name="excuse") async def excuse(self, ctx: commands.Context): diff --git a/app/dice.py b/app/dice.py index f8a166da..13771141 100755 --- a/app/dice.py +++ b/app/dice.py @@ -22,12 +22,17 @@ def roll(number_of_die, sides, number_to_add=None): embed_color = 15844367 embed = discord.Embed(description=None, color=embed_color, type="rich") - embed.set_author(name="Rolling %s %s sided die" % (number_of_die, sides)) + embed.set_author(name="Rolling %s, %s sided die" % (number_of_die, sides)) embed.add_field(name="Rolls", value=results, inline=False) if number_to_add: + number_to_add = int(number_to_add) + embed.set_author( + name="Rolling %s, %s sided die, and adding %s" + % (number_of_die, sides, number_to_add) + ) embed.add_field( name="**Total**", - value=":game_die: %s+%s = %s" + value=":game_die: %d+%d = %d" % (sum(results), number_to_add, (sum(results) + number_to_add)), inline=False, ) diff --git a/app/gitlab.py b/app/gitlab.py deleted file mode 100755 index 501f6342..00000000 --- a/app/gitlab.py +++ /dev/null @@ -1,34 +0,0 @@ -import requests -import os - -import help_methods -import role_check - - -def create_issue(title, description): - - post_args = {"title": title, "description": description} - - headers = {"PRIVATE-TOKEN": os.getenv("gitlab_token")} - - r = requests.post( - "https://git.luker.gq/api/v4/projects/3/issues", data=post_args, headers=headers - ) - - return r.json()["web_url"] - - -def parse_message(message): - if len(message.content.split()) == 1: - return help_methods.get_help_message(method="issue") - - try: - message = " ".join(message.content.split()[1:]) - title, description = message.split(";") - except Exception: - return help_methods.get_help_message(method="issue") - - try: - return create_issue(title=title, description=description) - except Exception: - return help_methods.get_help_message(method="issue")