public async Task statusAsync() { ISelfUser SelfUser = Context.Client.CurrentUser; EmbedAuthorBuilder eab = new EmbedAuthorBuilder { IconUrl = SelfUser.GetAvatarUrl(), Name = SelfUser.Username }; EmbedBuilder builder = new EmbedBuilder(); builder.WithAuthor(eab); builder.WithDescription(SelfUser.Username + " Statistics"); TimeSpan startTime = (DateTime.Now - Process.GetCurrentProcess().StartTime); DiscordShardedClient client = Context.Client as DiscordShardedClient; SocketSelfUser SocketSelf = Context.Client.CurrentUser as SocketSelfUser; string status = "Online"; switch (SocketSelf.Status) { case UserStatus.Offline: status = "Offline"; break; case UserStatus.Online: status = "Online"; break; case UserStatus.Idle: status = "Idle"; break; case UserStatus.AFK: status = "AFK"; break; case UserStatus.DoNotDisturb: status = "Do Not Disturb"; break; case UserStatus.Invisible: status = "Invisible/Offline"; break; } string assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); int fixedCmdGlobalCount = GlobalVars.CommandExecutions + 1; int fixedCmdGlobalCount_Servers = GlobalVars.CommandExecutions_Servers + 1; int fixedCmdGlobalCount_DMs = GlobalVars.CommandExecutions_DMs + 1; builder.AddField("Bot Uptime: ", startTime.ToReadableString(), true); builder.AddField("Server Uptime: ", GlobalVars.SystemUpTime().ToReadableString(), true); builder.AddField("Usercount: ", (await userService.GetUserCountAsync()).ToString(), true); builder.AddField("Servercount: ", client.Guilds.Count, true); builder.AddField("Commands used since bot start: ", fixedCmdGlobalCount); builder.AddField("Commands in servers: ", fixedCmdGlobalCount_Servers); builder.AddField("Commands in DMs ", fixedCmdGlobalCount_DMs); builder.AddField("Bot status: ", status, true); builder.AddField("Latency: ", client.Latency + "ms", true); builder.AddField("Shards: ", client.Shards.Count, true); builder.AddField("Bot version: ", assemblyVersion, true); await Context.Channel.SendMessageAsync("", false, builder.Build()).ConfigureAwait(false); }
public async Task DmAsync(string user, [Remainder] string dm = "") { IUser User = await Context.Client.GetUserAsync(ulong.Parse(user)); IDMChannel Dm = await User.GetOrCreateDMChannelAsync(); ISelfUser client = Context.Client.CurrentUser; var embed = new EmbedBuilder(); embed.WithAuthor($"Owner of {client}"); embed.WithThumbnailUrl(client.GetAvatarUrl()); embed.WithColor(Color.DarkTeal); embed.WithDescription(dm); embed.WithFooter("You can reply to this message with =>contact"); await Dm.SendMessageAsync(embed : embed.Build()); }
public async Task fmfeaturedAsync() { try { EmbedBuilder builder = new EmbedBuilder { Color = new Discord.Color(186, 0, 0) }; ISelfUser SelfUser = Context.Client.CurrentUser; builder.WithThumbnailUrl(SelfUser.GetAvatarUrl()); builder.AddField("Featured:", _timer.GetTrackString()); await Context.Channel.SendMessageAsync("", false, builder.Build()); this._logger.LogCommandUsed(Context.Guild?.Id, Context.Channel.Id, Context.User.Id, Context.Message.Content); } catch (Exception e) { _logger.LogError(e.Message, Context.Message.Content, Context.User.Username, Context.Guild?.Name, Context.Guild?.Id); await ReplyAsync("Unable to show the featured avatar on FMBot due to an internal error. The timer service cannot be loaded. Please wait for the bot to fully load."); } }