public async Task Execute(object arguments, Message m) { var force = (int)arguments; var tweets = await GetVosTweets(force == 1); var districts = new [] { "Amlodd", "Cadarn", "Crwys", "Hefin", "Iorwerth", "Ithell", "Meilyr", "Trahaearn" }; // Getting districts var activeMatch = Regex.Match(tweets.ElementAt(0).Text, VosRegex).Groups; var previous = Regex.Match(tweets.ElementAt(1).Text, VosRegex).Groups; var next = districts.Except(new[] { activeMatch[1].Value, activeMatch[2].Value, previous[1].Value, previous[2].Value }) .Select(s => $"{s}"); await m.Channel.SendMessage( $"**Active districts**: {activeMatch[1]} and {activeMatch[2]}.\n" + $"**Previous districts**: {previous[1]} and {previous[2]}.\n" + $"**Potential upcoming districts**: {string.Join(", ", next).ReplaceLast(",", " and")}."); }
private String getMessageDelta(Discord.Message bfr, Discord.Message aft) { if (bfr.Text == aft.Text) { return(String.Empty); } return($"`Time Sent :` {getTime(aft.Timestamp)}\n" + $"`Channel :` {discordEscape(aft.Channel.Name)}\n" + $"`Id :` `{aft.Id}`\n" + $"`Old Content :` {bfr.Text}\n" + $"`New Content :` {aft.Text}\n" + $"\nUser info:\n{getUser(aft.User)}"); }
public async Task <object> ParseArguments(string[] args, Message message) { var force = 0; var parser = new FluentCommandLineParser(); parser.Setup <bool>('f', "force") .SetDefault(false) .Callback(f => force = f ? 1 : 0); parser.Parse(args); return(force); }
private String getMessage(Discord.Message msg) => $"`Time Sent :` {getTime(msg.Timestamp)}\n" + $"`Channel :` {discordEscape(msg.Channel.Name)}\n" + $"`Id :` `{msg.Id}`\n" + $"`Content :` {msg.Text}\n" + $"\nUser info:\n{getUser(msg.User)}";
public DiscordMessage(Discord.Message message) { messageInterface = message; }