public async Task BasicSetupCommand(CommandContext ctx, [Description("Partner channel.")] DiscordChannel channel, [RemainingText] [Description("Partner message.")] string message) { GuildBan?ban; if ((ban = await this._ban.GetBanAsync(ctx.Guild.Id)) is not null || (ban = await this._ban.GetBanAsync(ctx.Guild.OwnerId)) is not null) { await RespondError($"Your server is banned due to: {ban.Reason}\n\n" + $"Contact a staff member on the [support server](https://discord.gg/3SCTnhCMam) to learn more."); await ctx.Guild.LeaveAsync(); return; } if (string.IsNullOrWhiteSpace(message)) { await RespondError("The partner message can not be null or white space!"); return; } if (GuildVerificationService.VerifyChannel(channel)) { IReadOnlyList <string>?links = message.GetUrls(); foreach (string?l in links) { message = message.Remove(message.IndexOf(l), l.Length); } int drank = await this._donor.GetDonorRankAsync(ctx.Guild.OwnerId); (Partner?, string)res = await this._partners.UpdateOrAddPartnerAsync(ctx.Guild.Id, () => { PartnerUpdater dat = new() { Active = true, ChannelId = channel.Id, Message = message, GuildIcon = ctx.Guild.IconUrl, GuildName = ctx.Guild.Name, UserCount = ctx.Guild.MemberCount, OwnerId = ctx.Guild.OwnerId, DonorRank = drank }; return(dat); });
public async Task <DiscordEmbedBuilder> GetRequiermentsEmbed(Partner partner, DiscordChannel?channel = null) { // Required: message, channel. // Optional: banner, embed, links. bool validChannel = false; if (channel is not null) { validChannel = GuildVerificationService.VerifyChannel(channel); } bool invalidMessage = string.IsNullOrWhiteSpace(partner.Message); bool invalidBanner = string.IsNullOrWhiteSpace(partner.Banner); bool maxLinks = partner.LinksUsed >= DonorService.HIGHEST_RANK; bool linkCap = partner.LinksUsed >= partner.DonorRank; int maxEmbeds = partner.DonorRank == 2 ? DonorService.TRIPPLE_EMBEDS : partner.DonorRank >= 3 ? DonorService.QUADRUPLE_EMBEDS : 0; bool embedsRemaining = partner.MessageEmbeds.Count < maxEmbeds; bool embedAllowed = partner.DonorRank >= DonorService.EMBED_LIMIT && !(!embedsRemaining && partner.DonorRank == DonorService.EMBED_LIMIT); bool defaultColor = partner.BaseColor.Value == DiscordColor.Gray.Value; bool usedTags = partner.Tags.Count >= TAG_LIMIT; bool usedVanity = partner.VanityInvite is not null; DiscordInvite?vanity; try { vanity = await this.Context.Guild.GetVanityInviteAsync(); } catch { vanity = null; } bool hasVanity = vanity is not null; bool canUseVanity = partner.DonorRank >= 1; DiscordEmbedBuilder?requirementsEmbed = new DiscordEmbedBuilder() .WithColor(partner.BaseColor) .WithTitle("Partner Bot Setup Requirements") .AddField($"{(partner.Active ? this.Check.GetDiscordName() : this.Cross.GetDiscordName())} Active", partner.Active ? "Partner Bot is **Active** on this server!" : "Partner Bot is **Inactive** on this server." + " Complete the required options then `toggle` to activate Partner Bot!", false) .AddField("_ _", "``` ```", false) .AddField("**Required Settings**", "_ _") .AddField($"{(validChannel ? this.Check.GetDiscordName() : this.Cross.GetDiscordName())} Channel", validChannel ? $"The current channel ({channel?.Mention}) is valid! Change it with `channel`." : "Please set a valid Partner Channel with `channel`.", true) .AddField($"{(invalidMessage ? this.Cross.GetDiscordName() : this.Check.GetDiscordName())} Message", invalidMessage ? "You have no message set! Set one with `message`." : "Your message is set. Change it with `message`.", true) .AddField("_ _", "``` ```", false) .AddField("**Optional Settings**", "_ _", false) .AddField($"{(invalidBanner ? this.Cross.GetDiscordName() : this.Check.GetDiscordName())} Banner", invalidBanner ? "You have no banner set! Set one with `banner`." : "You have a banner set! Change it with `banner`.", true) .AddField($"{(linkCap ? (maxLinks ? this.Check.GetDiscordName() : this.Lock.GetDiscordName()) : this.Cross.GetDiscordName())} Links", linkCap ? (maxLinks ? "You have used all your links! Modify your message to change the links with `message`." : "You can't use any more links! Consider [donating](https://www.patreon.com/cessumdevelopment?fan_landing=true) to get more links.") : $"You have used {partner.LinksUsed} of {partner.DonorRank} avalible links. Edit your message with `message` to use them!", true) .AddField($"{(embedAllowed ? (embedsRemaining ? this.Cross.GetDiscordName() : this.Check.GetDiscordName()) : this.Lock.GetDiscordName())} Embeds", embedAllowed ? (embedsRemaining ? $"You have used {partner.MessageEmbeds.Count} of {maxEmbeds} embeds. Use `add-embed` to add a new embed!" : "You have used all of your embeds! Consider editing or removing some to update your message with `edit-embed` or `remove-embed`!") : "You can't add any embeds! Consider [donating](https://www.patreon.com/cessumdevelopment?fan_landing=true) to get access to more embeds.", true) .AddField($"{(defaultColor ? this.Cross.GetDiscordName() : this.Check.GetDiscordName())} Color", defaultColor ? "You have no custom color set! Set one with `color`." : $"You have your custom color set to `R{partner.BaseColor.R}, G{partner.BaseColor.G}, B{partner.BaseColor.B}`! Change it with `color`.", true) .AddField($"{(usedTags ? this.Check.GetDiscordName() : this.Cross.GetDiscordName())} Tags", usedTags ? $"You have used all {TAG_LIMIT} of your tags. Edit your current tags with `tags`!" : $"You have used {partner.Tags.Count} of your {TAG_LIMIT} avalible tags. Add some with `tags`!", true) .AddField($"{(canUseVanity ? (hasVanity ? (usedVanity ? this.Check.GetDiscordName() : this.Cross.GetDiscordName()) : this.Check.GetDiscordName()) : this.Lock.GetDiscordName())} Vanity Invite", canUseVanity ? (hasVanity ? (usedVanity ? "You have enabled your vanity URL! Want to disable it? Use `vanity`!" : "Want to use your vanity URL? Use `vanity`!") : "You don't have a vanity URL for your server!") : $"You can't use a vanity URL! Consider [donating](https://www.patreon.com/cessumdevelopment?fan_landing=true) to use your servers vanity URL with Partner Bot" + $" (You must have a vanity URL from Discord to use this option).", true) .AddField("_ _", "``` ```", false) .AddField("**Server Settings**", "_ _", false) .AddField($"{(partner.NSFW ? this.Yes.GetDiscordName() : this.No.GetDiscordName())} NSFW Server", partner.NSFW ? "Your server is marked as NSFW. **This does not allow NSFW content in your banner or advertisment!**. This means your" + " server advertisment is mentioning NSFW content, but does not include it. Use `set-nsfw` to toggle this option." : "Your server is **not** marked as NSFW. No mention of NSFW content can be in your advertisment. Use `set-nsfw` to toggle this option.", true) .AddField($"{(partner.ReceiveNSFW ? this.Yes.GetDiscordName() : this.No.GetDiscordName())} Get NSFW Server Adverts", partner.ReceiveNSFW ? "Your server is allowed to receive advertisments from NSFW servers. This means advertisments mentioning NSFW" + " content are allowed. **Please report any advertisments with NSFW images.** Use `get-nsfw` to toggle this option." : "Your server is **not** allowed to receive advertisments from NSFW servers. **Please report any advertisments that are or mention" + " NSFW content that you receive.** Use `get-nsfw` to toggle this option.", true); return(requirementsEmbed); }