/// <summary> /// Sends a message into the Debug Message Channel if it is defined and Debug is true /// </summary> /// <param name="message">Message to send</param> public static async Task SendDebugMessage(DebugCategories category, string message, string description = null) { if (DebugMessage != null) { await DebugMessage(new LogMessage(LogSeverity.Debug, category.ToString(), message)); } if (debugLogging[(int)category] && GuildChannelHelper.TryGetChannel(GuildChannelHelper.DebugChannelId, out SocketTextChannel channel)) { EmbedBuilder debugembed; if (string.IsNullOrEmpty(description)) { debugembed = new EmbedBuilder { Color = BotCore.EmbedColor, Title = $"**[{category.ToString().ToUpper()}]**", Description = message }; } else { debugembed = new EmbedBuilder { Color = BotCore.EmbedColor, Title = $"**[{category.ToString().ToUpper()}]** {message}", Description = description }; } await channel.SendEmbedAsync(debugembed); } }
internal static async Task WelcomeNewUser(SocketGuildUser user) { if (GuildChannelHelper.TryGetChannel(GuildChannelHelper.WelcomingChannelId, out SocketTextChannel channel)) { if (user.Guild.Id == channel.Guild.Id) { if (welcomingMessage.Contains("{0}")) { await channel.SendEmbedAsync($"Welcome {user.Mention}!", string.Format(welcomingMessage, user.Mention)); } else { await channel.SendEmbedAsync($"Welcome {user.Mention}!", welcomingMessage); } } } }
public static async Task SendAdminCommandUsedMessage(IDMCommandContext context, Command command) { if (GuildChannelHelper.TryGetChannel(GuildChannelHelper.AdminCommandUsageLogChannelId, out SocketTextChannel channel)) { EmbedBuilder debugembed = new EmbedBuilder { Color = BotCore.EmbedColor, Title = $"Admin-Only command used by {context.User.Username}#{context.User.Discriminator}", }; debugembed.AddField("Command and Arguments", $"Matched Command```{command.Syntax}```Arguments```{context.Message.Content}".MaxLength(1021) + "```"); string location; if (GuildCommandContext.TryConvert(context, out IGuildCommandContext guildContext)) { SocketTextChannel locationChannel = channel.Guild.GetTextChannel(guildContext.Channel.Id); location = $"Guild `{guildContext.Guild.Name}` Channel {(locationChannel == null ? Markdown.InlineCodeBlock(guildContext.Channel.Name) : locationChannel.Mention)}"; } else { location = "Private Message to Bot"; } debugembed.AddField("Location", location); await channel.SendEmbedAsync(debugembed); } }