add setting for list role

This commit is contained in:
2024-06-23 17:41:43 -05:00
parent 398163df18
commit 3a4d5f8fae
2 changed files with 20 additions and 11 deletions

View File

@@ -1,4 +1,6 @@
{ {
"SESSION_TITLE_SUGGESTIONS.SETTING_ROLE_HINT": "Select the minimum role required to use the /titles command.",
"SESSION_TITLE_SUGGESTIONS.SETTING_ROLE_NAME": "List Titles Command Required Role",
"SESSION_TITLE_SUGGESTIONS.INVALID_DATE": "Invalid date provided.", "SESSION_TITLE_SUGGESTIONS.INVALID_DATE": "Invalid date provided.",
"SESSION_TITLE_SUGGESTIONS.SUGGESTION_AUTOCOMPLETE_MESSAGE": "Enter your session title suggestion.", "SESSION_TITLE_SUGGESTIONS.SUGGESTION_AUTOCOMPLETE_MESSAGE": "Enter your session title suggestion.",
"SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_COMMAND_DESCRIPTION": "List all title suggestions for the provided date", "SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_COMMAND_DESCRIPTION": "List all title suggestions for the provided date",

View File

@@ -51,7 +51,7 @@ function registerCustomChatCommands() {
aliases: ["/ts"], aliases: ["/ts"],
description: game.i18n.localize("SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_COMMAND_DESCRIPTION"), description: game.i18n.localize("SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_COMMAND_DESCRIPTION"),
icon: '<i class="fa-solid fa-podcast"></i>', icon: '<i class="fa-solid fa-podcast"></i>',
requiredRole: "TRUSTED", requiredRole: game.settings.get("asc-session-title-suggestions", "titleListCommandRole"),
callback: async (chat, parameters, messageData) => { callback: async (chat, parameters, messageData) => {
const newMessageData = {} const newMessageData = {}
const suggestions = game.messages.filter(m => { const suggestions = game.messages.filter(m => {
@@ -98,16 +98,23 @@ function registerCustomChatCommands() {
Hooks.on("init", function() { Hooks.on("init", function() {
//This code runs once the Foundry VTT software begins its initialization workflow //This code runs once the Foundry VTT software begins its initialization workflow
registerClipboardCopyButton(); registerClipboardCopyButton();
loadTemplates(flavor_template_path) Object.values(TEMPLATES.suggestion).forEach((template_path)=>loadTemplates(template_path))
Object.values(TEMPLATES.suggestion).forEach((template_path)=>{ Object.values(TEMPLATES.suggestionList).forEach((template_path)=>loadTemplates(template_path))
loadTemplates(template_path) game.settings.register("asc-session-title-suggestions", "titleListCommandRole", {
} name: game.i18n.localize("SESSION_TITLE_SUGGESTIONS.SETTING_ROLE_NAME"),
) scope: "world",
Object.values(TEMPLATES.suggestionList).forEach((template_path)=>{ config: true,
loadTemplates(template_path) type: String,
} default: "TRUSTED",
) requiresReload: true,
choices: {
"PLAYER": game.i18n.localize("USER.RolePlayer"),
"TRUSTED": game.i18n.localize("USER.RoleTrusted"),
"ASSISTANT": game.i18n.localize("USER.RoleAssistant"),
"GAMEMASTER": game.i18n.localize("USER.RoleGamemaster")
},
hint: game.i18n.localize("SESSION_TITLE_SUGGESTIONS.SETTING_ROLE_HINT")
});
}); });
Hooks.on("ready", function() { Hooks.on("ready", function() {