Не удается отреагировать на сообщение о несоответствии с помощью Discord. net: Ошибка: сервер ответил с ошибкой 404: NotFound - PullRequest
0 голосов
/ 08 апреля 2020

Я программирую на VB чуть больше года и решил заняться кодированием Discord Bots. В настоящее время я пытаюсь создать функцию конфигурации, где пользователь может изменить несколько настроек. Хотя ни один из этих интерфейсов не завершен, в настоящее время у меня возникают проблемы с настройкой интерактивных частей меню, в частности с применением реакций, применяемых к выходному сообщению.

Вот как должно выглядеть меню в клиент: Реакции были введены мною как вторым стандартным пользователем Discord с помощью кнопки «Добавить реакцию».

Вот код, который создает вывод, как показано выше (минус реакции ):

<Command>
Public Async Function Config() As Task
    'Need to create emojis for the options and add them as reactions
    Dim firstEmoji As New Emoji(":one:")
    Dim secondEmoji As New Emoji(":two:")
    Dim thirdEmoji As New Emoji(":three:") '("\u0033")
    Dim fourthEmoji As New Emoji(":four:") '("\u0034")
    Dim closeEmoji As New Emoji("")
    Dim tempEmote As Emote
    Try
        tempEmote = Emote.Parse(":ok:")
    Catch ex As Exception
    End Try
    Dim footerVar As New EmbedFooterBuilder With {
        .Text = "Updated: 04/08/2020",
        .IconUrl = $"{Context.Client.CurrentUser.GetAvatarUrl}"
    }
    Dim authorVar As New EmbedAuthorBuilder With {
        .IconUrl = $"{Context.Client.CurrentUser.GetAvatarUrl}",
        .Name = $"{closeEmoji} {Context.Client.CurrentUser.Username}#{Context.Client.CurrentUser.DiscriminatorValue}"
    }
    Dim fieldVar As New EmbedFieldBuilder With {
        .IsInline = False,
        .Name = "Staff Roles",
        .Value = $"{firstEmoji} This page allows administrators to set what roles are considered Secretaries, Moderators, and Asministrators. These roles' permissions are not considered when setting this bot up. Any role can be made any of the 3 previously stated ranks."
    }
    Dim fieldVar1 As New EmbedFieldBuilder With {
        .IsInline = False,
        .Name = "Punishment Roles",
        .Value = $"{secondEmoji} This page allows administrators to set what roles are considered as the Muted and Trap roles."
    }
    Dim fieldVar2 As New EmbedFieldBuilder With {
        .IsInline = False,
        .Name = "Banned Words List",
        .Value = $"{thirdEmoji} This page allows administrators to set what words are considered banned. Anyone that is not a recognized staff member will be punished according to a value provided during configuration."
    }
    Dim embeddedMessage As New EmbedBuilder With {
        .Title = "Pioneer12 Configuration Menu",
        .Description = "This is the configuration menu for Pioneer12. React with one of the following to continue.",
        .Color = Color.Purple,
        .Footer = footerVar,
        .Author = authorVar,
        .Fields = New List(Of EmbedFieldBuilder) From {fieldVar, fieldVar1, fieldVar2},
        .Timestamp = DateTimeOffset.Now
        }

    Dim intialReply As Task(Of IUserMessage) = ReplyAsync(embed:=embeddedMessage.Build())
    Dim message As IUserMessage = Await intialReply
    'Add reactions after the message is sent.
    'Dim addReactionTask As Task(Of IMessage) = 
    Try
        'Await message.AddReactionAsync(Emote.TryParse())
        Await ReactWithEmote(message, "GWbowsuBlobThonkeng")
    Catch ex As Exception
        Dim errorReplyTask As Task(Of IUserMessage) = ReplyAsync($"Error : {ex.Message}")
    End Try
    'Dim temp = Await addReactionTask
End Function

Что касается подходов, использованных до сих пор, я попробовал Emojis и Emotes, и оба раза я получаю одну и ту же проблему. Многое из того, что вы видите в коде, не является окончательным, поскольку я все еще пытаюсь выяснить, как все это работает вместе. Что касается поддержки, которую я пробовал до сих пор, я использовал следующие веб-сайты: https://www.fileformat.info/info/unicode/char/0031/index.htm https://docs.stillu.cc/guides/emoji/emoji.html https://discord.foxbot.me/stable/api/Discord.Emote.html Я пытался почти все перечисленные методы для входных данных для функций TryParse (), Parse () и AddReactionAsyn c ().

Если вы чувствуете, что очень хотите мне помочь, вы также можете выбросить некоторые идеи о том, как я мог бы отслеживать их использование, чтобы я мог перейти к нужному меню после того, как пользователь отреагирует.

Спасибо, ребята !!

...