public async Task servermessages() { //List<IMessage> m = await MessageCollector.collectMessages(Context.Guild); var m = await MessageCollector.collectMessages(Context.Guild); int mC = m.Count(); await Context.Channel.SendMessageAsync(mC + " messages have been sent in this server"); }
public async Task serveractivity([Summary("Interval to group messages by, in days.\nSyntax: [days of interval]d")] TimeSpan interval) { string name = generateOrderID(Context.Message); List <DateTimeOffset> l = await MessageCollector.collectMessages(Context.Guild); ActivityGraph(l, interval, name); await Context.Channel.SendFileAsync(name + ".png"); }
public async Task serveractivehours(int timezone = 0) { List <DateTimeOffset> l = await MessageCollector.collectMessages(Context.Guild); string name = generateOrderID(Context.Message); HourGraph(l, timezone, name); await Context.Channel.SendFileAsync(name + ".png"); }
public async Task activitygraph([Summary("Interval to group messages by, in days.\nSyntax: [days of interval]d")] TimeSpan interval, [Summary("User to get activity of, defaults to current user")] SocketUser user = null) { SocketUser User = user; if (User == null) { User = Context.User; } string name = generateOrderID(Context.Message); List <DateTimeOffset> l = await MessageCollector.collectMessages(user, Context.Guild); ActivityGraph(l, interval, name); await Context.Channel.SendFileAsync(name + ".png"); }
public async Task activehours([Summary("Timezone to adjust to relative to UTC. For example UTC-5 (EST) would be -5")] int timezone = 0, [Summary("User to get activity of, defaults to current user")] SocketUser user = null) { SocketUser User = user; if (User == null) { User = Context.User; } List <DateTimeOffset> l = await MessageCollector.collectMessages(User, Context.Guild); string name = generateOrderID(Context.Message); HourGraph(l, timezone, name); await Context.Channel.SendFileAsync(name + ".png"); }
public async Task channelmessages([Summary("The channel to get messages from, defaults to current channel")] ISocketMessageChannel channel = null) { ISocketMessageChannel Channel = channel; if (Channel == null) { Channel = Context.Channel; } //List<IMessage> m = await MessageCollector.collectMessages(Channel); var m = await MessageCollector.collectMessages(Channel); int mC = m.Count(); await Context.Channel.SendMessageAsync(mC + " messages have been sent in <#" + Channel.Id + ">"); }
public async Task comparegraph([Summary("Interval to group messages by, in days.\nSyntax: [days of interval]d")] TimeSpan interval, params string[] userList) { if (Context.Message.MentionedUsers.Count < 2) { await Context.Channel.SendMessageAsync("Please specify at least 2 users"); return; } List <SocketUser> users = Context.Message.MentionedUsers.ToList(); List <DateTimeOffset>[] msgss = await MessageCollector.collectMessages(users.ToArray(), Context.Guild); string n = generateOrderID(Context.Message); CompareGraph(msgss, users, interval, n); await Context.Channel.SendFileAsync(n + ".png"); }
public async Task score([Summary("The user to get the score of, defaults to current user")] SocketUser user = null) { SocketUser User = user; if (User == null) { User = Context.User; } List <DateTimeOffset> m = await MessageCollector.collectMessages(User, Context.Guild); int mC = m.Count; m.Sort(); double d = Math.Abs(m.Last().Subtract(m.First()).TotalDays); int score = (int)((double)mC / d); await Context.Channel.SendMessageAsync("Your score is currently " + score); }
public async Task messages([Summary("The user to get messages from, defaults to current user")] SocketUser user = null) { SocketUser User = user; if (User == null) { User = Context.User; if (User == null) { return; } } List <DateTimeOffset> m = await MessageCollector.collectMessages(User, Context.Guild); int mC = m.Count; await Context.Channel.SendMessageAsync(User.Username + " has sent " + mC + " messages in this server."); }
public async Task messages([Summary("The user to get messages from, defaults to current user")] SocketUser user = null, [Summary("The channel to get messages from, defaults to current channel")] ISocketMessageChannel channel = null) { SocketUser User = user; ISocketMessageChannel Channel = channel; if (User == null) { User = Context.User as SocketGuildUser; } if (Channel == null) { Channel = Context.Channel; } List <DateTimeOffset> m = await MessageCollector.collectMessages(User, Channel); int mC = m.Count; await Context.Channel.SendMessageAsync(user.Username + " has sent " + mC + " messages in <#" + Channel.Id + ">"); }
private void ChannelGraph(SocketGuild guild, string filename, SocketUser user = null) { PlotModel plot = new PlotModel(); //List<DateTimeOffset> messages = new List<DateTimeOffset>();//MessageCollector.collectMessages(guild); int total = 0; if (user == null) { Task <List <DateTimeOffset> > t = MessageCollector.collectMessages(guild); t.Wait(); total = t.Result.Count; } else { Task <List <DateTimeOffset> > t = MessageCollector.collectMessages(user, guild); t.Wait(); total = t.Result.Count; } //int total = messages.Count; Dictionary <IMessageChannel, int> organized = new Dictionary <IMessageChannel, int>(); foreach (SocketTextChannel channel in guild.TextChannels) { Task <List <DateTimeOffset> > t = MessageCollector.collectMessages(channel); t.Wait(); organized.Add(channel, t.Result.Count); } var pieSeries = new OxyPlot.Series.PieSeries { Title = "ChannelGraph: " + filename + "\n Messages referenced: " + total }; pieSeries.AreInsideLabelsAngled = true; for (int i = 0; i < organized.Count; i++) { var l = organized.ToList(); decimal percent = decimal.Divide(l[i].Value, total) * 100; if (l[i].Value == 0 || percent < 1) { continue; } if (percent < 2) { pieSeries.Slices.Add(new PieSlice(null, l[i].Value)); } else { pieSeries.Slices.Add(new PieSlice(l[i].Key.Name, l[i].Value)); } } plot.Series.Add(pieSeries); plot.TitleFontSize = 40; var pngExporter = new PngExporter { Width = 1200, Height = 1000 }; pngExporter.ExportToFile(plot, filename + ".png"); }