Esempio n. 1
0
        private async Task CreateRequest(string title, string text, SupportType supportType, int atLeastAdminLevel)
        {
            await Context.Message.DeleteAsync();

            if (_guildEntity is null)
            {
                return;
            }


            if (title.Length == 0)
            {
                await Context.User.SendMessageAsync($"The title has to contain atleast {_guildEntity.SupportRequestMinTitleLength} characters." +
                                                    $"\nDid you maybe forget to use quotation marks for the title?");

                return;
            }

            if (title.Length < _guildEntity.SupportRequestMinTitleLength)
            {
                await Context.User.SendMessageAsync($"The title has to contain atleast {_guildEntity.SupportRequestMinTitleLength} characters." +
                                                    $"\nDid you maybe forget to use quotation marks for the title?");

                return;
            }
            if (title.Length > _guildEntity.SupportRequestMaxTitleLength)
            {
                await Context.User.SendMessageAsync($"The title can be a maximum of {_guildEntity.SupportRequestMaxTitleLength} characters long.");

                return;
            }

            if (title.Length < _guildEntity.SupportRequestMinTextLength)
            {
                await Context.User.SendMessageAsync($"The text has to contain atleast {_guildEntity.SupportRequestMinTextLength} characters.");

                return;
            }
            if (title.Length > _guildEntity.SupportRequestMaxTextLength)
            {
                await Context.User.SendMessageAsync($"The text can be a maximum of {_guildEntity.SupportRequestMaxTextLength} characters long.");

                return;
            }

            await _supportRequestHandler.CreateRequest(Context.Guild, Context.User, Context.User.Nickname, title, text, supportType, atLeastAdminLevel, true);
        }