示例#1
0
        private Embed BuildSetupEmbed()
        {
            var setupPayload = new StringBuilder();

            setupPayload.AppendLine($"{new Emoji("0️⃣✅")} Command prefix (current: `{_behaviourConfigurationService.GetPrefix()}`)");

            var staffRole = _behaviourConfigurationService.GetStaffRoleId();

            setupPayload.AppendLine(staffRole is null
                ? $"{new Emoji("1️⃣🟥")} Staff role"
                : $"{new Emoji("1️⃣✅")} Staff role ({MentionUtils.MentionRole(staffRole.Value)})");

            var categoryId = _behaviourConfigurationService.GetCategoryId();

            setupPayload.AppendLine(categoryId is null
                ? $"{new Emoji("2️⃣🟥")} Category"
                : $"{new Emoji("2️⃣✅")} Category ({MentionUtils.MentionChannel(categoryId.Value)})");

            var logChannelId = _behaviourConfigurationService.GetLogChannelId();

            setupPayload.AppendLine(logChannelId is null
                ? $"{new Emoji("3️⃣🟥")} Log channel"
                : $"{new Emoji("3️⃣✅")} Log channel ({MentionUtils.MentionChannel(logChannelId.Value)})");

            var setupEmbed = new EmbedBuilder()
                             .WithTitle("D2M Setup")
                             .WithDescription(setupPayload.ToString());

            return(setupEmbed.Build());
        }
示例#2
0
        public async Task <ulong> CreateChannelForThread(IUser forUser)
        {
            var category = _behaviourConfigurationService.GetCategoryId();

            if (category is null)
            {
                throw new InvalidOperationException("Cannot create channel for thread without category ID");
            }

            var newChannelId = await _discordGuildService.CreateChannel($"{forUser.Username}-{forUser.Discriminator}", $"Thread for {forUser.Id}", category.Value);

            await _permissionService.SynchronisePermissionsWithCategory(newChannelId);

            return(newChannelId);
        }