discord.net

Discord.net can't stream audio with NAudio

北城以北 提交于 2021-02-05 09:12:10
问题 I want to play an mp3 file in a voice channel. The BOT successfully can connect, but doesn't play anything, and throws an exception. Code public async Task SendAudioAsync(IGuild guild, IMessageChannel channel, string path) { try { if (!File.Exists(path)) { await channel.SendMessageAsync("File does not exist."); return; } IAudioClient client; if (ConnectedChannels.TryGetValue(guild.Id, out client)) { await Log.d($"Starting playback of {path} in {guild.Name}", src); using (var reader = new

Is there a way to insert pictures/gifs to embeds from local storage?

我只是一个虾纸丫 提交于 2021-01-29 17:39:56
问题 I really want to use gifs in embeds in my discord bot, and I've seen other bots do the same but I couldn't find a solution how to insert it from local. So could you help me? I've tried the embed's .WithImageUrl but that didn't work and I haven't found anything else to try. EmbedBuilder confused = new EmbedBuilder(); confused.WithAuthor($"Confused", Context.Guild.CurrentUser.GetAvatarUrl()) .WithDescription($"{Context.User.Mention} is confused") .WithImageUrl("C:/Users/***/***/gifthatIwant.gif

Kicking a user in Discord.Net

牧云@^-^@ 提交于 2021-01-28 09:21:26
问题 I made this code to kick a user from the guild of a discord server The bot console doesn't give me any errors, but this code doesn't work properly when I try to kick a user. What I mean by this is that it doesn't kick the user, and it doesn't output anything in the channel. I also checked the bots permissions, and updated these so this can't be the problem. The version of discord.net is 1.0.2 [Command("kick"), Alias("Kick"), Summary("Kicks a user from the server")] public async Task Kick

ModifyAsync Not Working

最后都变了- 提交于 2021-01-27 19:55:33
问题 I'm attempting to edit an embedded message after it is posted. I was attempting to use this example from the documentation but it just does not work. https://discord.foxbot.me/docs/api/Discord.MessageProperties.html var message = await ReplyAsync("abc"); await message.ModifyAsync(x => { x.Content = ""; x.Embed = new EmbedBuilder() .WithColor(new Color(40, 40, 120)) .WithAuthor(a => a.Name = "foxbot") .WithTitle("Embed!") .WithDescription("This is an embed."); }); Putting the code into one of

Discord.net bot Embed Message

一个人想着一个人 提交于 2021-01-27 12:34:43
问题 I am trying to implement embedded messages for my bot. I know that I need to fill an Embed Object with the specific informations. But how can I send it to the Channel? When I use e.Channel.SendMessage(string); it can't send an Embed object, it will just send strings. 回答1: var eb = new EmbedBuilder(); eb.WithDescription("some text"); await Context.Channel.SendMessageAsync("", false, eb.Build()); In Discord.NET 1.0. 0.9.6 doesn't support embeds. 回答2: With Discord.Net 2.0.1 syntax will look a

Discord.net bot Embed Message

扶醉桌前 提交于 2021-01-27 12:33:49
问题 I am trying to implement embedded messages for my bot. I know that I need to fill an Embed Object with the specific informations. But how can I send it to the Channel? When I use e.Channel.SendMessage(string); it can't send an Embed object, it will just send strings. 回答1: var eb = new EmbedBuilder(); eb.WithDescription("some text"); await Context.Channel.SendMessageAsync("", false, eb.Build()); In Discord.NET 1.0. 0.9.6 doesn't support embeds. 回答2: With Discord.Net 2.0.1 syntax will look a

Guild members are not populated anymore, cannot GetUserAsync as it only returns the bot and no one else

此生再无相见时 提交于 2021-01-13 09:18:48
问题 For some reason I cannot get any members anymore from the guild the bot is in. To make sure I have the users, I construct it with DiscordSocketConfig config = new DiscordSocketConfig { AlwaysDownloadUsers = true }; client = new DiscordSocketClient(config); The event I respond to is long after it has connected. It will pick up messages from the channels themselves in the guild the bot is in, so it's connected, working, and can see all of the members. I go through all the members and I'm trying

Guild members are not populated anymore, cannot GetUserAsync as it only returns the bot and no one else

允我心安 提交于 2021-01-13 09:16:15
问题 For some reason I cannot get any members anymore from the guild the bot is in. To make sure I have the users, I construct it with DiscordSocketConfig config = new DiscordSocketConfig { AlwaysDownloadUsers = true }; client = new DiscordSocketClient(config); The event I respond to is long after it has connected. It will pick up messages from the channels themselves in the guild the bot is in, so it's connected, working, and can see all of the members. I go through all the members and I'm trying

The role is not issued when clicking on the reaction

喜欢而已 提交于 2021-01-01 20:38:25
问题 My exception says that user = null but I don't understand why? UserId is passed in the debugger private async Task ReactionAdd(Cacheable<IUserMessage, ulong> cache, ISocketMessageChannel socketMessageChannel, SocketReaction reaction) { if (reaction.MessageId == 771361839917170748) { var emote = Emote.Parse("<:NepSmug:740928682310500412>").ToString(); if (reaction.Emote.ToString() == emote) { var sockettextChannel = socketMessageChannel as SocketTextChannel; ulong roleid = 741342300499738715;

The role is not issued when clicking on the reaction

梦想的初衷 提交于 2021-01-01 20:38:00
问题 My exception says that user = null but I don't understand why? UserId is passed in the debugger private async Task ReactionAdd(Cacheable<IUserMessage, ulong> cache, ISocketMessageChannel socketMessageChannel, SocketReaction reaction) { if (reaction.MessageId == 771361839917170748) { var emote = Emote.Parse("<:NepSmug:740928682310500412>").ToString(); if (reaction.Emote.ToString() == emote) { var sockettextChannel = socketMessageChannel as SocketTextChannel; ulong roleid = 741342300499738715;