Discord.Net 2.0 send message to specific channel

1.1k Views Asked by At
Public Async Function Kick(ByVal user As IGuildUser, <Remainder> ByVal reason As String) As Task
        Dim guild = Context.Guild
        Dim bot = Context.Client
        Dim message = Context.Message
        Dim u = Context.User
'Channel Info
        Dim _client As New DiscordSocketClient
        Dim id As ULong = 1235234987 'Random numbers not a channel id
        Dim chnl As IMessageChannel = _client.GetChannel(id)

        If u.Id = "id" Or "id" Or "id" Then

            Dim embed As New EmbedBuilder With {
                .Author = New EmbedAuthorBuilder With {
                .IconUrl = u.GetAvatarUrl,
                .Name = u.Username
            },
            .Title = $"{user.Username}#{user.Discriminator}'s Kick Information",
            .ImageUrl = "https://i.imgur.com/vc241Ku.jpeg",
            .Description = reason,
            .Color = New Color(masterClass.randomEmbedColor),
            .ThumbnailUrl = user.GetAvatarUrl,
            .Timestamp = Context.Message.Timestamp,
            .Footer = New EmbedFooterBuilder With {
                    .Text = "Kick Data",
                    .IconUrl = guild.IconUrl
                }
            }

            Await chnl.SendMessageAsync("", False, embed.Build())
            Await user.SendMessageAsync("", False, embed.Build())
            Await user.KickAsync(reason)
        Else

            Await Context.Channel.SendMessageAsync("You do not match the IDs that are required for this. Bye.")
        End If



    End Function

This is my kick command, how would I make it so it sends the embed to a specific channel? I already have it set so it sends the user the embed but I would like for it to now send that embed to a certain channel in the server. Also a side note. Does anyone know where I could have the bot hosted online instead of self hosting or a good tutorial on where I could host it?

1

There are 1 best solutions below

12
On BEST ANSWER
Public Async Function Kick(ByVal user As IGuildUser, <Remainder> ByVal reason As String) As Task
    Dim guild = Context.Guild
    Dim chnl = guild.GetTextChannel(123456789)
    Dim embed As New EmbedBuilder With {
        .Author = New EmbedAuthorBuilder With {
            .IconUrl = user.GetAvatarUrl,
            .Name = user.Username
        },
        .Title = $"{user.toString()}'s Kick Information",
        .ImageUrl = "https://i.imgur.com/vc241Ku.jpeg",
        .Description = reason,
        .Color = New Color(masterClass.randomEmbedColor),
        .ThumbnailUrl = user.GetAvatarUrl,
        .Timestamp = Context.Message.Timestamp,
        .Footer = New EmbedFooterBuilder With {
                        .Text = "Kick Data",
                        .IconUrl = guild.IconUrl
                    }
        }

    Await chnl.SendMessageAsync("", False, embed.Build())
    Await user.SendMessageAsync("", False, embed.Build())
    Await user.KickAsync(reason)
End Function