示例#1
0
        protected async Task <RestUserMessage> ReplyAsync(
            LocalisationStringKey stringKey,
            LocalMentions mentions = null,
            params object[] args)
        {
            var localisedString = await LocalisationService.GetResponseAsync(Context.Member.Id, Context.Guild.Id, stringKey, args);

            return(await Context.Channel.SendMessageAsync(localisedString, mentions : mentions ?? LocalMentions.None));
        }
示例#2
0
        private string[] ParseLine(string line, out LocalisationStringKey key)
        {
            this._logger.LogDebug("Parsing line {line}", line);

            var split = line.Split('=', StringSplitOptions.RemoveEmptyEntries);

            if (split.Length != 2)
            {
                throw new InvalidOperationException("Language string must have format \"key=value\"");
            }

            if (!Enum.TryParse(split[0], out key))
            {
                throw new InvalidOperationException($"{split[0]} was not recognised as a valid localisation key");
            }

            return(split);
        }
示例#3
0
 public EspeonTypeParserFailedResult(LocalisationStringKey key) : base(key.ToString())
 {
 }
示例#4
0
 protected async Task <RestUserMessage> ReplyAsync(LocalisationStringKey stringKey, params object[] args)
 {
     return(await ReplyAsync(stringKey, LocalMentions.None, args));
 }