public async Task SetTextIntoConfigLol([Remainder] string msg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithDescription( $"Set this guild's leaving message to:\n\n ```{msg}```\n\nSending a test welcome message to <#{config.WelcomeChannel}>"); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); config.LeavingMessage = msg; GuildConfig.SaveGuildConfig(); await SendMessage(embed); if (config.WelcomeChannel != 0) { var a = config.LeavingMessage.Replace("{UserMention}", Context.User.Mention); var b = a.Replace("{ServerName}", Context.Guild.Name); var c = b.Replace("{UserName}", Context.User.Username); var d = c.Replace("{OwnerMention}", Context.Guild.Owner.Mention); var e = d.Replace("{UserTag}", Context.User.DiscriminatorValue.ToString()); var channel = Context.Guild.GetTextChannel(config.WelcomeChannel); var embed2 = new EmbedBuilder(); embed2.WithDescription(e); embed2.WithColor(new Color(config.WelcomeColour1, config.WelcomeColour2, config.WelcomeColour3)); embed2.WithFooter($"Guild Owner: {Context.Guild.Owner.Username}#{Context.Guild.Owner.Discriminator}"); embed2.WithThumbnailUrl(Context.Guild.IconUrl); await channel.SendMessageAsync("", false, embed2); } }
public async Task DeleteMessageOnCommand(bool arg) { GuildConfig.GetOrCreateConfig(Context.Guild.Id).DeleteMessageOnCommand = arg; GuildConfig.SaveGuildConfig(); await Helpers.SendMessage(Context, Helpers.CreateEmbed(Context, $"Set deleting messages on commands to {arg}")); }
public async Task SetRoleInConfig([Remainder] string role) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.SupportRole = role; GuildConfig.SaveGuildConfig(); await ReplyAsync($"`{role}` set as the role to manage tickets."); }
public async Task AddChannelToConfig(string arg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.SupportChannelName = arg; GuildConfig.SaveGuildConfig(); await ReplyAsync($"{arg} set as the Support channel name."); }
public async Task AddBooleanToJson(bool arg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.CanCloseOwnTicket = arg; GuildConfig.SaveGuildConfig(); var embed = Helpers.CreateEmbed(Context, $"{arg} set as the Support Ticket `CanCloseOwnTicket` option."); await Helpers.SendMessage(Context, embed); }
public static async Task GuildUtils(SocketGuild s) { var config = GuildConfig.GetGuildConfig(s.Id) ?? GuildConfig.CreateGuildConfig(s.Id); if (Config.bot.Blacklist.Contains(s.Owner.Id)) { await s.LeaveAsync(); return; } var Bots = 0; var Users = 0; foreach (var user in s.Users) { if (user.IsBot) { Bots += 1; } else { Users += 1; } } if (Bots > Users) { var greemDm = await _client.GetUser(Config.bot.BotOwner).GetOrCreateDMChannelAsync(); await greemDm.SendMessageAsync("", false, new EmbedBuilder() .WithDescription( $"Server {s.Name} is potentially harmful. They have {Bots} bots and {Users} users. Consider making the bot leave.") .WithColor(Config.bot.DefaultEmbedColour)); } var dmChannel = await s.Owner.GetOrCreateDMChannelAsync(); var embed = new EmbedBuilder(); embed.WithTitle($"Thanks for adding me to your server, {s.Owner.Username}!"); embed.WithDescription( "For quick information, visit the wiki: https://github.com/greemdotcs/greemdotcs.github.io/wiki \nNeed quick help? Visit the SIVA-dev server and create a support ticket: https://discord.gg/ubXaT6u \nTo get started, use the command `$h`. Follow that with a module to get a list of commands!"); embed.WithThumbnailUrl(s.IconUrl); embed.WithFooter("Still need help? Visit the SIVA-dev server linked above."); embed.WithColor(Config.bot.DefaultEmbedColour); await dmChannel.SendMessageAsync("", false, embed); config.GuildOwnerId = s.Owner.Id; GuildConfig.SaveGuildConfig(); }
public async Task AddStringToList([Remainder] string role) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithDescription($"Added the {role} to the Config.") .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)) .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); config.SelfRoles.Add(role); GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public async Task SetGuildPrefix([Remainder] string prefix) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithDescription("Done."); embed.WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); config.CommandPrefix = prefix; GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public async Task Leveling(bool arg) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithDescription(arg ? "Enabled leveling for this server." : "Disabled leveling for this server."); config.Leveling = arg; GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public async Task SetIdIntoConfig(SocketGuildChannel chnl) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithDescription($"Set this guild's welcome channel to #{chnl}."); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); config.WelcomeChannel = chnl.Id; GuildConfig.SaveGuildConfig(); await SendMessage(embed); }
public async Task AddCustomCommand(string commandName, [Remainder] string commandValue) { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); config.CustomCommands.Add(commandName, commandValue); GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder() .AddField("Command Name", $"__{commandName}__") .AddField("Bot Response", $"**{commandValue}**") .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); await SendMessage(embed); }
public async Task AddStringToBl([Remainder] string bl) { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); config.Blacklist.Add(bl); GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder(); embed.WithDescription($"Added {bl} to the Blacklist."); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); await SendMessage(embed); }
public async Task ClearBlacklist() { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); config.Blacklist.Clear(); GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder(); embed.WithDescription("Cleared the Blacklist for this server."); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); await SendMessage(embed); }
public async Task AutoRoleRoleAdd([Remainder] string arg = "") { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); config.Autorole = arg; GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder(); embed.WithDescription(Bot.Internal.Utilities.GetFormattedLocaleMsg("AutoroleCommandText", arg)); embed.WithThumbnailUrl(Context.Guild.IconUrl); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); await SendMessage(embed); }
internal static async Task HandleMessages(SocketMessage s) { var msg = s as SocketUserMessage; var context = new SocketCommandContext(_client, msg); if (msg == null) { Console.WriteLine($"{s} not cared for as it's null (for whatever reason)"); return; } //Console.WriteLine($"Var msg: {msg}"); //Console.WriteLine($"Var s: {s}"); //Console.WriteLine($"Var context: {context}"); if (context.Guild == null) { var user = await context.User.GetOrCreateDMChannelAsync(); await user.SendMessageAsync("Commands are not available in DMs."); } var config = GuildConfig.GetGuildConfig(context.Guild.Id) ?? GuildConfig.CreateGuildConfig(context.Guild.Id); config.GuildOwnerId = context.Guild.Owner.Id; GuildConfig.SaveGuildConfig(); if (config.Leveling) { await Leveling.UserSentMessage((SocketGuildUser)context.User, (SocketTextChannel)context.Channel); } if (context.Guild.Id == 385902350432206849) { if (msg.Content.Contains("🎷") || msg.Content.Contains("🎺")) { if (msg.Author.Id == 360493978371751937) { await msg.DeleteAsync(); var msgObj = await context.Channel.SendMessageAsync(context.User.Mention + " no"); Thread.Sleep(5000); await msgObj.DeleteAsync(); } } } }
public async Task SetServerLoggingChannel(bool isEnabled, SocketTextChannel chnl = null) { string lol; var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); lol = isEnabled ? "Enabled server logging" : "Disabled server logging"; if (chnl == null) { chnl = (SocketTextChannel)Context.Channel; } config.IsServerLoggingEnabled = isEnabled; config.ServerLoggingChannel = chnl.Id; GuildConfig.SaveGuildConfig(); var embed = Helpers.CreateEmbed(Context, $"{lol}, and set the channel to <#{chnl.Id}>."); await Helpers.SendMessage(Context, embed); }
public async Task SetIntIntoConfig(int arg1, int arg2, int arg3) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.WelcomeColour1 = arg1; config.WelcomeColour2 = arg2; config.WelcomeColour3 = arg3; GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder(); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithDescription(Bot.Internal.Utilities.GetFormattedLocaleMsg("WelcomeColourText", arg1, arg2, arg3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); await SendMessage(embed); }
public async Task RemoveStringFromBl([Remainder] string bl) { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); var embed = new EmbedBuilder(); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); embed.WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); if (!config.Blacklist.Contains(bl)) { embed.WithDescription($"`{bl}` isn't present in the Blacklist."); } else { embed.WithDescription($"Removed {bl} from the Blacklist."); config.Blacklist.Remove(bl); GuildConfig.SaveGuildConfig(); } await SendMessage(embed); }
public async Task DisableSlashEnableTod(bool setting) { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); config.IsTodEnabled = setting; GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); if (setting) { embed.WithDescription("Enabled Truth or Dare for this server."); } if (setting == false) { embed.WithDescription("Disabled Truth or Dare for this server."); } await ReplyAsync("", false, embed); }
public async Task SetBoolIntoConfig(bool setting) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id) ?? GuildConfig.CreateGuildConfig(Context.Guild.Id); config.Antilink = setting; GuildConfig.SaveGuildConfig(); var embed = new EmbedBuilder(); embed.WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); if (setting) { embed.WithDescription("Enabled Antilink for this server."); } if (setting == false) { embed.WithDescription("Disabled Antilink for this server."); } await ReplyAsync("", false, embed); }
public async Task RemCustomCommand(string commandName) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); if (config.CustomCommands.Keys.Contains(commandName)) { embed.WithDescription($"Removed **{commandName}** as a command!"); config.CustomCommands.Remove(commandName); GuildConfig.SaveGuildConfig(); } else { embed.WithDescription($"**{commandName}** isn't a command on this server."); } await SendMessage(embed); }
public async Task SetServerAdminRole(string roleName) { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); var role = Context.Guild.Roles.FirstOrDefault(x => x.Name == roleName); if (role == null) { embed.WithDescription($"The role `{roleName}` doesn't exist on this server. Remember that this command is cAsE sEnSiTiVe."); } else { embed.WithDescription($"Set the Administrator role to **{roleName}** for this server!"); config.AdminRole = role.Id; GuildConfig.SaveGuildConfig(); } await SendMessage(embed); }
public async Task SetChannelToBeIgnored(string type, SocketGuildChannel chnl = null) { var config = GuildConfig.GetOrCreateConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)) .WithFooter(Bot.Internal.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); switch (type) { case "add": case "Add": config.AntilinkIgnoredChannels.Add(chnl.Id); GuildConfig.SaveGuildConfig(); embed.WithDescription($"Added <#{chnl.Id}> to the list of ignored channels for Antilink."); break; case "rem": case "Rem": config.AntilinkIgnoredChannels.Remove(chnl.Id); GuildConfig.SaveGuildConfig(); embed.WithDescription($"Removed <#{chnl.Id}> from the list of ignored channels for Antilink."); break; case "clear": case "Clear": config.AntilinkIgnoredChannels.Clear(); GuildConfig.SaveGuildConfig(); embed.WithDescription("List of channels to be ignored by Antilink has been cleared."); break; default: embed.WithDescription( $"Valid types are `add`, `rem`, and `clear`. Syntax: `{config.CommandPrefix}ali {{add/rem/clear}} [channelMention]`"); break; } await SendMessage(embed); }
public async Task SetColorForDonatorsIntoJson(int r, int g, int b) { var config = GuildConfig.GetGuildConfig(Context.Guild.Id); var embed = new EmbedBuilder() .WithFooter(Bot.Utilities.GetFormattedLocaleMsg("CommandFooter", Context.User.Username)); if (config.VerifiedGuild) { config.EmbedColour1 = r; config.EmbedColour2 = g; config.EmbedColour3 = b; GuildConfig.SaveGuildConfig(); embed.WithDescription($"Set the embed colour for this guild to `{r} {g} {b}`!"); embed.WithColor(new Color(r, g, b)); } else { embed.WithDescription($"This feature and command is for donators only! Consider donating to unlock: `{config.CommandPrefix}donate`."); embed.WithColor(new Color(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3)); } await ReplyAsync("", false, embed); }
private async Task HandleCommandAsync(SocketMessage s) { var msg = s as SocketUserMessage; var context = new SocketCommandContext(_client, msg); await EventUtils.AssholeChecks(s); await EventUtils.HandleMessages(s); await Blacklist.CheckMessageForBlacklistedTerms(s); await Support.SupportSystem(s); if (msg == null) { Console.WriteLine($"{s} not cared for as it's null (for whatever reason)"); return; } if (context.User.IsBot) { return; } var config = GuildConfig.GetGuildConfig(context.Guild.Id) ?? GuildConfig.CreateGuildConfig(context.Guild.Id); var prefix = config.CommandPrefix ?? Config.bot.Prefix; if (config.EmbedColour1 == 0 && config.EmbedColour2 == 0 && config.EmbedColour3 == 0) { config.EmbedColour1 = 112; config.EmbedColour2 = 0; config.EmbedColour3 = 251; GuildConfig.SaveGuildConfig(); } var argPos = 0; foreach (var command in config.CustomCommands) { if (msg.HasStringPrefix($"{config.CommandPrefix}{command.Key}", ref argPos)) { await context.Channel.SendMessageAsync(command.Value); break; } } if (msg.HasStringPrefix(prefix, ref argPos) || msg.HasMentionPrefix(_client.CurrentUser, ref argPos)) { var result = await _service.ExecuteAsync(context, argPos); //Console.WriteLine($"Command -{msg.Content}- executed"); if (result.IsSuccess == false && result.ErrorReason != "Unknown command.") { string reason; switch (result.ErrorReason) { case "The server responded with error 403: Forbidden": reason = "I'm not allowed to do that. Either I don't have permission or the requested user is higher than me in the role heirarchy."; break; case "Sequence contains no elements": try { reason = $"{msg.MentionedUsers.FirstOrDefault().Mention} doesn't have any."; } catch (NullReferenceException) { reason = "List has no elements."; } break; case "Failed to parse Boolean": reason = "You can only input `true` or `false` for this command."; break; default: reason = result.ErrorReason; break; } var embed = new EmbedBuilder(); if (msg.HasMentionPrefix(_client.CurrentUser, ref argPos)) { var nm = msg.Content.Replace($"<@{_client.CurrentUser.Id}> ", config.CommandPrefix); embed.AddField("Error in command:", nm); embed.AddField("Error reason:", reason); embed.AddField("Weird error?", "[Report it in the SIVA-dev server](https://discord.gg/prR9Yjq)"); embed.WithAuthor(context.User); embed.WithColor(Config.bot.ErrorEmbedColour); await context.Channel.SendMessageAsync("", false, embed); } else { var nm = msg.Content; embed.AddField("Error in command:", nm); embed.AddField("Error reason:", reason); embed.AddField("Weird error?", "[Report it in the SIVA-dev server](https://discord.gg/prR9Yjq)"); embed.WithAuthor(context.User); embed.WithColor(Config.bot.ErrorEmbedColour); await context.Channel.SendMessageAsync("", false, embed); } } if (result.ErrorReason == "Unknown command.") { return; } if (Config.bot.LogAllCommands) { Console.WriteLine($"--| -Command from user: {context.User.Username}#{context.User.Discriminator}"); Console.WriteLine($"--| -Command Issued: {msg.Content}"); Console.WriteLine($"--| -In Guild: {context.Guild.Name}"); Console.WriteLine($"--| -In Channel: #{context.Channel.Name}"); Console.WriteLine($"--| -Time Issued: {DateTime.Now}"); Console.WriteLine(result.IsSuccess ? $"--| -Executed: {result.IsSuccess}" : $"--| -Executed: {result.IsSuccess} | Reason: {result.ErrorReason}"); Console.WriteLine("-------------------------------------------------"); } try { File.AppendAllText("Commands.log", $"--| -Command from user: {context.User.Username}#{context.User.Discriminator} ({context.User.Id})\n"); File.AppendAllText("Commands.log", $"--| -Command Issued: {msg.Content} ({msg.Id})\n"); File.AppendAllText("Commands.log", $"--| -In Guild: {context.Guild.Name} ({context.Guild.Id})\n"); File.AppendAllText("Commands.log", $"--| -In Channel: #{context.Channel.Name} ({context.Channel.Id})\n"); File.AppendAllText("Commands.log", $"--| -Time Issued: {DateTime.Now}\n"); File.AppendAllText("Commands.log", result.IsSuccess ? $"--| -Executed: {result.IsSuccess}\n" : $"--| -Executed: {result.IsSuccess} | Reason: {result.ErrorReason}\n"); File.AppendAllText("Commands.log", "-------------------------------------------------\n"); } catch (FileNotFoundException) { Console.WriteLine("The Commands.log file wasn't found, creating it now."); File.WriteAllText("Commands.log", ""); } if (config.DeleteMessageOnCommand) { await context.Message.DeleteAsync(); } } else { if (msg.Content.Contains($"<@{_client.CurrentUser.Id}>")) { await Helpers.SendMessage(context, null, "<:whO_PENG:437088256291504130>"); } } }
public static async Task SupportSystem(SocketMessage s) { var msg = s as SocketUserMessage; if (msg == null) { return; } var context = new SocketCommandContext(new DiscordSocketClient(), msg); if (context.User.IsBot) { return; } var user = context.User as SocketGuildUser; var config = GuildConfig.GetGuildConfig(context.Guild.Id) ?? GuildConfig.CreateGuildConfig(context.Guild.Id); config.GuildOwnerId = context.Guild.OwnerId; var adminRole = context.Guild.Roles.FirstOrDefault(x => x.Id == config.AdminRole); if (msg.Content == "SetupSupport" && user.Roles.Contains(adminRole)) { var embed = new EmbedBuilder(); embed.WithColor(Config.bot.DefaultEmbedColour); embed.WithDescription(Utilities.GetLocaleMsg("SupportEmbedText")); embed.WithAuthor(context.Guild.Owner); await context.Channel.SendMessageAsync("", false, embed); config.SupportChannelId = context.Channel.Id; config.SupportChannelName = context.Channel.Name; config.CanCloseOwnTicket = true; GuildConfig.SaveGuildConfig(); } if (msg.Content != "SetupSupport") { var supportConfig = GuildConfig.GetGuildConfig(context.Guild.Id); var supportStartChannel = context.Guild.Channels.FirstOrDefault(c => c.Name == supportConfig.SupportChannelName); if (msg.Channel == supportStartChannel) { var supportChannelExists = context.Guild.Channels.FirstOrDefault(c => c.Name == $"{supportConfig.SupportChannelName}-{context.User.Id}"); var role = context.Guild.Roles.FirstOrDefault(r => r.Name == supportConfig.SupportRole); if (supportChannelExists == null) { await msg.DeleteAsync(); var chnl = await context.Guild.CreateTextChannelAsync( $"{supportConfig.SupportChannelName}-{context.User.Id}"); await chnl.AddPermissionOverwriteAsync(context.User, new OverwritePermissions(readMessages : PermValue.Allow, sendMessages : PermValue.Allow, addReactions : PermValue.Allow, sendTTSMessages : PermValue.Deny)); await chnl.AddPermissionOverwriteAsync(context.Guild.EveryoneRole, new OverwritePermissions(readMessages : PermValue.Deny, sendMessages : PermValue.Deny)); if (role != null) { await chnl.AddPermissionOverwriteAsync(role, OverwritePermissions.AllowAll(chnl)); } await chnl.ModifyAsync(x => { x.Position = supportStartChannel.Position - 1; x.Topic = $"Support ticket created by <@{msg.Author.Id}> at {DateTime.UtcNow} (UTC)"; }); var embed = new EmbedBuilder() .WithAuthor(msg.Author) .WithThumbnailUrl(context.User.GetAvatarUrl()) .WithTitle("What do you need help with?") .WithDescription( $"```{msg.Content}```\n\nIf you're done with the ticket, type `{config.CommandPrefix}close`, or react to the message with ☑.") .WithColor(config.EmbedColour1, config.EmbedColour2, config.EmbedColour3) .WithFooter($"Time Created: {DateTime.Now}"); var message = await chnl.SendMessageAsync( $"You can close this ticket if you have the role set for moderating tickets: `{supportConfig.SupportRole}`", false, embed); await message.PinAsync(); await message.AddReactionAsync(new Emoji("☑")); } else { var channel = context.Guild.GetTextChannel(supportChannelExists.Id); await channel.SendMessageAsync( $"{context.User.Mention}, please send your message here rather than the primary support channel. Text: ```{msg.Content}``` If you cannot type in here, please tell an admin."); await msg.DeleteAsync(); } } } }