diff --git a/am_bot/cogs/command_responses.json b/am_bot/cogs/command_responses.json index f90ba0e..7a7fbc9 100644 --- a/am_bot/cogs/command_responses.json +++ b/am_bot/cogs/command_responses.json @@ -49,6 +49,29 @@ "amcvids": { "duplicate": "amcv" }, + "docs": { + "embed": { + "author": { + "name": "Documentation Websites", + "icon_url": "https://i.imgur.com/Rt7vu2j.png", + "proxy_icon_url": "https://media.discordapp.net/attachments/1194039176920834120/1461728918531870893/ADKLogo_128.png?ex=696b9ca3&is=696a4b23&hm=a6a7547b5f7b2d1aff9f24f07fe1fd5299cd8f81c4deea5d88b411e075513728&=&format=webp&quality=lossless" + }, + "fields": [ + { + "name": "===========================", + "value": "[Official modding documentation](https://devkit.studiowildcard.com/)\n[Blog, snippets & tutorials](https://arkmodding.net/)\n[Wiki, general FAQ & tutorials](https://wiki.arkmodding.net/)\n[CurseForge - Ark knowledge base](https://support.curseforge.com/en/support/solutions/folders/9000199294/)\n[CurseForge - Premium mods documentation](https://support.curseforge.com/en/support/solutions/articles/9000235469-ark-premium-mods/)\n[CurseForge - Suggest your premium mod](https://arksa.curseforge.com/#premium)\n[CurseForge - Moderation policies & guidelines](https://support.curseforge.com/en/support/solutions/articles/9000197279-project-and-modpack-moderation-policies)", + "inline": true + } + ], + "color": 2921542, + "type": "rich", + "description": "Links to documentation websites, where you can find various info and guides.", + "title": "" + } + }, + "links": { + "duplicate": "docs" + }, "gso": { "content": "__**SAH Discord**__: https://discord.gg/h2k7agJJGS" }, @@ -60,6 +83,9 @@ }, "cf": { "content": "https://discord.gg/Q4bB5zE75f" + }, + "tutorials": { + "commands": "docs, wcws, amcv" } } } diff --git a/am_bot/cogs/responses.py b/am_bot/cogs/responses.py index d16b793..c01faab 100644 --- a/am_bot/cogs/responses.py +++ b/am_bot/cogs/responses.py @@ -30,17 +30,36 @@ async def on_message(self, message: discord.Message): message.content[0] in COMMANDS and message.content[1:] in COMMANDS[message.content[0]] ): + # Grab command info from JSON. command = COMMANDS[message.content[0]][message.content[1:]] - if "duplicate" in command: - # Handle duplicate commands, - # grab original defined by `duplicate` - command = COMMANDS[message.content[0]][command["duplicate"]] + # Prepare the list of commands to send. + to_send = [] + if "commands" in command: + # Handle multiple commands, + # grab the list of commands defined by `commands`. + commands_list = command["commands"].split(", ") + for current_command in commands_list: + if current_command in COMMANDS[message.content[0]]: + to_send.append( + COMMANDS[message.content[0]][current_command] + ) + else: + to_send.append(command) + logger.info(f"Executing response command: {message.content}") - if "embed" in command: - await message.channel.send( - embed=discord.Embed.from_dict(command["embed"]) - ) - elif "content" in command: - await message.channel.send(content=command["content"]) + # Send messages. + for command_to_send in to_send: + final_cmd = command_to_send + if "duplicate" in final_cmd: + # Handle duplicate commands, + # grab original defined by `duplicate`. + final_cmd = COMMANDS[message.content[0]][ + final_cmd["duplicate"]] + if "embed" in final_cmd: + await message.channel.send( + embed=discord.Embed.from_dict(final_cmd["embed"]) + ) + elif "content" in final_cmd: + await message.channel.send(content=final_cmd["content"])