public static async Task MainAsync(Server server, Channel channel, User user, IEnumerable<string> args) { bool isError = false; string errorMessage = ""; try { Color c = null; Role r = null; string colorName = null; if (args.FirstOrDefault() != null) colorName = args.FirstOrDefault().ToLower(); c = GetRoleColor(colorName); if (colorName != null && c != null) { if ((r = GetRole(Capitalize(args.First().ToLower()), server.Roles)) != null) { await CheckForRolesAsync(user, server.Roles); await user.AddRoles(r); } else { await CheckForRolesAsync(user, server.Roles); string roleName = string.Format("{0}{1}", rolePrefix, Capitalize(colorName)); await user.AddRoles(await server.CreateRole(roleName, color: c)); } } else { await channel.SendMessage(user.Mention + " Wrong colour input, check help for working colours."); } } catch (Exception ex) { isError = true; errorMessage = ex.Message.ToString(); } if (isError) await channel.SendMessage(user.Mention + " " + errorMessage); await DeleteUnusedRolesAsync(server.Roles); }