public static async Task MessageReceived(SocketMessage arg) { try { if (!arg.Author.IsBot && arg.Channel.GetType() == typeof(SocketTextChannel)) { var ThisGuild = ((SocketTextChannel)arg.Channel).Guild; bool ThisGlobalChatEnabled = GuildStuff.ReadSetting(GuildStuff.GuildSettings.GlobalChannelForOthers, ThisGuild.Id); if (ThisGlobalChatEnabled) { string Id = GuildStuff.ReturnExtraSaved(GuildStuff.GuildSettings.GlobalChannelForOthers, ThisGuild.Id); SocketTextChannel ThisGlobalChatChannel = ThisGuild.GetTextChannel(ulong.Parse(Id)); if (ThisGlobalChatChannel.Id == arg.Channel.Id) { bool MsgUsed = false; EmbedBuilder Embed; var UserDataForEmb = StoreHandler.LoadData(arg.Author.Id, "GBCHATEMBED"); if (UserDataForEmb != null) { string AuthorForEmb = UserDataForEmb.Split(new[] { "author.name=" }, StringSplitOptions.None)[1].Split('=')[0]; System.Drawing.Color HexColor = ColorTranslator.FromHtml($"#{UserDataForEmb.Split(new[] { "embcolor=" }, StringSplitOptions.None)[1].Split('=')[0]}"); string FooterMsg = UserDataForEmb.Split(new[] { "footer.text=" }, StringSplitOptions.None)[1].Split('=')[0]; Embed = new EmbedBuilder() { Author = new EmbedAuthorBuilder() { IconUrl = arg.Author.GetAvatarUrl() ?? Program.Client.CurrentUser.GetAvatarUrl(), Name = $"{arg.Author.Username} • [{AuthorForEmb}]" }, Color = new Discord.Color(HexColor.R, HexColor.G, HexColor.B), Description = arg.Content, Footer = new EmbedFooterBuilder() { Text = FooterMsg.Length > 0 ? $"{arg.Author.Id} • [{FooterMsg}]" : arg.Author.Id.ToString() }, }; } else { Embed = new EmbedBuilder() { Author = new EmbedAuthorBuilder() { IconUrl = arg.Author.GetAvatarUrl() ?? Program.Client.CurrentUser.GetAvatarUrl(), Name = arg.Author.Username }, Color = Discord.Color.Teal, Description = arg.Content, Footer = new EmbedFooterBuilder() { Text = arg.Author.Id.ToString(), }, }; } bool Passed = false; foreach (var Guild in Program.GetAllShardGuilds()) { try { bool GlobalChatEnabled = GuildStuff.ReadSetting(GuildStuff.GuildSettings.GlobalChannelForOthers, Guild.Id); if (GlobalChatEnabled) { SocketTextChannel GlobalChatChannel = Guild.GetTextChannel(ulong.Parse(GuildStuff.ReturnExtraSaved(GuildStuff.GuildSettings.GlobalChannelForOthers, Guild.Id))); if (Guild != ThisGuild) { var MsgF = MessageFilter(arg); if (MsgF.MsgPassed) { Passed = MsgF.MsgPassed; await GlobalChatChannel.SendMessageAsync("", false, Embed.Build()); } else if (!MsgUsed) { MsgUsed = true; await arg.Channel.SendMessageAsync($"Sorry! Your message contained content that was deemed inappropriate - {MsgF.Reason}"); } } } } catch { } } if (new Random().Next(0, 100) > 98) { await arg.Channel.SendMessageAsync("`pls tell people about me if you like me` :pleading_face: "); } if (Passed) { await((SocketUserMessage)arg).AddReactionAsync(new Emoji("\u2705")); } } } } } catch { } }