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)); }
public static AllowedMentionsJsonModel ToModel(this LocalMentions mentions) { if (mentions == null) { return(null); } var model = new AllowedMentionsJsonModel { Users = mentions.UserIds.ToArray(), Roles = mentions.RoleIds.ToArray() }; if (mentions.ParsedMentions == ParsedMention.None) { model.Parse = Array.Empty <string>(); } else { var parse = new List <string>(3); if (mentions.ParsedMentions.HasFlag(ParsedMention.Everyone)) { parse.Add("everyone"); } if (mentions.ParsedMentions.HasFlag(ParsedMention.Users)) { parse.Add("users"); } if (mentions.ParsedMentions.HasFlag(ParsedMention.Roles)) { parse.Add("roles"); } model.Parse = parse; } model.RepliedUser = Optional.FromNullable(mentions.MentionRepliedUser); return(model); }
public static AllowedMentionsModel ToModel(this LocalMentions mentions) { if (mentions == null) { return(null); } var model = new AllowedMentionsModel { Users = mentions.UserIds.Select(x => x.RawValue).ToArray(), Roles = mentions.RoleIds.Select(x => x.RawValue).ToArray() }; if (mentions.ParsedMentions == ParsedMention.None) { model.Parse = Array.Empty <string>(); } else { var parse = new List <string>(3); if (mentions.ParsedMentions.HasFlag(ParsedMention.Everyone)) { parse.Add("everyone"); } if (mentions.ParsedMentions.HasFlag(ParsedMention.Users)) { parse.Add("users"); } if (mentions.ParsedMentions.HasFlag(ParsedMention.Roles)) { parse.Add("roles"); } model.Parse = parse; } return(model); }
public Task <RestUserMessage> SendMessageAsync(IEnumerable <LocalAttachment> attachments, string content = null, bool isTTS = false, LocalEmbed embed = null, LocalMentions mentions = null, RestRequestOptions options = null) => Client.SendMessageAsync(Id, attachments, content, isTTS, embed, mentions, options);
public async Task <RestUserMessage> SendMessageAsync(IEnumerable <LocalAttachment> attachments, string content = null, bool textToSpeech = false, LocalEmbed embed = null, LocalMentions mentions = null, RestRequestOptions options = null) { var channel = await CreateDmChannelAsync(options).ConfigureAwait(false); return(await channel.SendMessageAsync(attachments, content, textToSpeech, embed, mentions, options).ConfigureAwait(false)); }
public async Task <RestUserMessage> SendMessageAsync(Snowflake channelId, IEnumerable <LocalAttachment> attachments, string content = null, bool textToSpeech = false, LocalEmbed embed = null, LocalMentions mentions = null, RestRequestOptions options = null) { if (attachments == null) { throw new ArgumentNullException(nameof(attachments)); } var model = await ApiClient.CreateMessageAsync(channelId, attachments, content, textToSpeech, embed, mentions, options).ConfigureAwait(false); return(new RestUserMessage(this, model)); }
public async Task <RestUserMessage> SendMessageAsync(Snowflake channelId, string content = null, bool textToSpeech = false, LocalEmbed embed = null, LocalMentions mentions = null, RestRequestOptions options = null) { var model = await ApiClient.CreateMessageAsync(channelId, content, textToSpeech, embed, mentions, options).ConfigureAwait(false); return(new RestUserMessage(this, model)); }
protected Task <RestUserMessage> ReplyAsync(string content = "", LocalEmbedBuilder embed = null, LocalMentions allowedMentions = null) => Context.Channel.SendMessageAsync(content, false, embed?.Build(), mentions: allowedMentions);