-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: created help command * fix: changed name of command * feat: add function to get puzzles by uni * fix: order query results by ascending order * feat: remove puzzle_id parameter. manually create puzzle_id * fix: check for metameta in uni argument * feat: add admin command that lists all puzzles * fix: attempting to fix formatter issue * fix: further fix attempt * fix: another formatter fix attempt * chore: replacing comments * feat: added to help command * fix: add descriptions to commands * fix: ORDER BY used incorrectly * fix: did not return True upon success * fix: interaction response was not sent * feat: add function to get all puzzles in db * fix: automatically turn puzzle_id uppercase in delete_puzzle * fix: variable error. uni_puzzles was not iterable * feat: edited config to take in victory role and channel * feat: check if team has completed hunt after each submission * fix: old code gave error (not enough values to unpack) * feat: add check mark to solved puzzles * fix: forgot return statements * feat: ensured teams cannot have the same name as the exec role
- Loading branch information
Showing
6 changed files
with
270 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import discord | ||
from discord import app_commands | ||
from discord.ext import commands | ||
|
||
EXEC_ID = "Executives" | ||
|
||
|
||
class Help(commands.GroupCog): | ||
def __init__(self, bot: commands.Bot): | ||
self.bot = bot | ||
|
||
@app_commands.command(name="commands", description="Get a list of bot commands") | ||
async def help_command(self, interaction: discord.Interaction): | ||
await interaction.response.defer(ephemeral=True) | ||
|
||
user = interaction.user | ||
user_roles = [role.name for role in user.roles] | ||
|
||
admin_commands = [ | ||
"`/admin create_puzzle [PUZZLE_NAME] [PUZZLE_ANSWER] [PUZZLE_LINK] [UNI] [META] [PUZZLE_AUTHOR]` - Creates a new puzzle with given arguments.", | ||
"`/admin delete_puzzle [PUZZLE_ID]` - Deletes the puzzle with the given ID.", | ||
"`/admin list_puzzles` - Lists all created puzzles along with their answers" | ||
"`/admin set_hint_channel` - Sets the current channel to be the new channel for receiving hint requests.", | ||
] | ||
|
||
team_commands = [ | ||
"`/team create [TEAM_NAME]` - Create a new team with the given name.", | ||
"`/team leave` - Leave your current team. Deletes the team if no more members.", | ||
"`/team invite [INVITED_USER]` - Invites the given user into your team. They can accept or reject.", | ||
] | ||
|
||
puzzle_commands = [ | ||
"`/puzzle submit [PUZZLE_ID] [ANSWER]` - Submits and checks your answer for the specified puzzle.", | ||
"`/puzzle list` - Lists all the puzzles available.", | ||
"`/puzzle hint` - Sends a hint request to the execs.", | ||
] | ||
|
||
help_embed = discord.Embed(description="List of Commands") | ||
|
||
if EXEC_ID in user_roles: | ||
help_embed.colour = discord.Color.green() | ||
help_embed.add_field(name="Admin", value="\n".join(admin_commands)) | ||
|
||
help_embed.add_field(name="Team", value="\n".join(team_commands)) | ||
help_embed.add_field(name="Puzzle", value="\n".join(puzzle_commands)) | ||
|
||
await interaction.followup.send(embed=help_embed, ephemeral=True) | ||
|
||
|
||
async def setup(bot: commands.Bot): | ||
await bot.add_cog(Help(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.