/** * Author: dkanus * Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore * License: GPL * Copyright 2023 Anton Tarasenko *------------------------------------------------------------------------------ * This file is part of Acedia. * * Acedia is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License, or * (at your option) any later version. * * Acedia is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Acedia. If not, see . */ class ACommandNotify extends Command dependsOn(ChatApi); protected function BuildData(CommandDataBuilder builder) { builder.Group(P("core")); builder.Summary(P("Notifies players with provided message.")); builder.ParamText(P("message")); builder.OptionalParams(); builder.ParamNumber(P("duration")); builder.Describe(P("Notify to players message with distinct header and body.")); builder.RequireTarget(); builder.Option(P("title")); builder.Describe(P("Specify the optional title of the notification.")); builder.ParamText(P("title")); builder.Option(P("channel")); builder.Describe(P("Specify the optional channel. A channel is a grouping mechanism used to" @ "control the display of related notifications. Only last message from the same channel is" @ "stored in queue.")); builder.ParamText(P("channel_name")); } protected function ExecutedFor( EPlayer target, CallData arguments, EPlayer instigator, CommandPermissions permissions ) { local Text title, message, plainTitle, plainMessage; plainMessage = arguments.parameters.GetText(P("message")); if (arguments.options.HasKey(P("title"))) { plainTitle = arguments.options.GetTextBy(P("/title/title")); } title = _.text.FromFormatted(plainTitle); message = _.text.FromFormatted(plainMessage); target.Notify( title, message, arguments.parameters.GetFloat(P("duration")), arguments.options.GetTextBy(P("/channel/channel_name"))); _.memory.Free4(title, message, plainTitle, plainMessage); } defaultproperties { preferredName = "notify" }