Closed jonrozen closed 5 years ago
I dropped to the previous version and now the plugin works.
Can confirm, overwriting OverlayPlugin's Newtonsoft.Json.dll
file with the one in ACT_DiscordTriggers-1.0.1.1 release and using ACT_DiscordTriggers v1.0.1.0 works.
Does 1.0.1.1 work for you if you disable overlayplugin completely then restart ACT?
With OverlayPlugin v0.3.4.0 disabled and ACT_DiscordTriggers v1.0.1.1 enabled on ACT startup, attempting to connect my bot to a server has it connect and then immediately disconnect. The debug log shows:
[Discord] Discord.Net v2.1.0 (API v6)
[Gateway] Connecting
[Gateway] Connected
Bot in ready state. Populating servers...
Found X discord server(s).
Found X available voice channel(s) for DISCORD SERVER
[Gateway] Ready
[Audio #1] Connecting
[Audio #1] Disconnecting
Error joining channel.
[Audio #1] Disconnected
A task was canceled.
Unable to join channel. Does your bot have permission to join this channel?
Found X discord server(s).
Found X available voice channel(s) for DISCORD SERVER
Experienced this issue (Discord Plugin 1.0.1.1, Windows 10 Build 1903) with OverlayPlugin and Triggernometry disabled.
Attempted the Newtonsoft.Json.dll downgrade.
Now when attempting to connect to Discord, I receive:
Error connecting to Discord. Error converting value {null} to type 'Discord.Optional`1[System.String]'. Path 'email', line 1, position 219. Error connecting to Discord.
Providing this info in hopes that it might assist in locating the cause. If I'm wrong, apologies, and disregard.
linoth, thanks for checking that. I can confirm that specific error happens if you are using an old version of Newtonsoft.Json, so it makes since for it to appear if you manually use an older version.
For the original issue, I will have to look into it. I know it has to do with ACT having versions of the dependencies loaded in the AppDomain that are not compatible with the Discord API I'm using, but I'm not exactly sure how to solve it yet. Even if I force load mine (like we do with Newtonsoft.Json) it may cause issues with ACT or other plugins.
Is there any other fix for this by chance? I'm seeing the same thing and have copied over the latest Newtonsoft from the zip file. The bot will join and immediately disconnect with the same error message Webberjo posted above. Downgrading fixes the problem, but replacing all other Newtonsoft instances I can find on my computer does not resolve the issue using the current version.
@linoth I resolved this by overwriting the DLL files with the ones included in 1.0.1.1
However, I also am having trouble connecting to channels with this version.
I have localized the issue to this line:
audioClient = await chan.ConnectAsync();
#130
The failure is here, but I'm not sure why.
https://github.com/discord-net/Discord.Net/commit/fc48c6606d293f1cd9d9a7df10f747e1e9fc93de ? Similar issue: https://github.com/discord-net/Discord.Net/issues/1343
I'm just going to revert back to 1.0.1.0 but hope this helps.
I'm not even using this plugin. This is with Discord.NET.
Someone suggested just using .NET Core which i'm gonna do.
@Moonbase2004 Hi. I was using your issue as reference, not the other way around. Apologies for the confusion but it was not meant for you. Thank you for the suggestion, however.
Well I just discovered that .NET Core fixed nothing. Back to the drawing board.
Problem Solved: It's a bug with WS4NET.
I believe we can remove WS4NET if we swap to .NET Core. I was planning on doing this once .NET 5 releases so that I can use the same .NET for both the plugin and the Discord API.
From what I remember, WS4NET is only needed for Windows 7 support. This was the case a year or two ago, but maybe now most users have upgraded already and it is safe to remove that support.
Wouldn't be a bad idea. Since 1.0.1.0 works for the most part, it can serve as a legacy release for people still running Win 7 and earlier.
I have hopefully fixed this issue with the latest release. Please give it a try.
Also, thanks to a new feature in ACT, you can change the load order of the plugins. By making sure the discord plugin loads first (at the top), we can avoid the conflicts caused by OverlayPlugin and replacing files is not needed.
Make sure to delete the old discord plugin folder too. With the removal of WS4Net, many of the old .dll files in the release are not longer necessary.
This new update appears to have solved the problem for me. This is the first release it has worked. Thanks for your help and hard work!
Sweet. I will close this issue then. Feel free to open again if this issue comes up again.
[Command("join", RunMode = RunMode.Async)]
[Summary("Connects the bot to the voice channel")]
public async Task JoinVoiceChannelAsync(IVoiceChannel channel = null)
{
channel = channel ?? (Context.User as IGuildUser)?.VoiceChannel;
if (channel == null)
{
await Context.Channel.SendMessageAsync("User must be in a voice channel, or a voice channel must be specified");
}
else
{
var audioClient = await channel.ConnectAsync();
}
}
This command is still throwing error and I can't find a way to make if work. The bot joins the voice channel and then it immediately leaves.
As before, the error is thrown at this line: var audioClient = await channel.ConnectAsync();
.
The error says "the task has been canceled" -> System.Threading.Tasks.TaskCanceledException in mscorlib.dll.
I've seeked help in Discord API, but none is taking me seriously or none knows how to solve this problem... .
Uh and yes, I have the right binaries in the right folder (since I'm working with .NET framework it shoud be bin/debug, correct me if I'm wrong) and as you can see from the block of code above, the command is marked with RunMode.Async.
What OS are you using?
Windows 7, I'm in fact using WS4NetProvider as WebSocketProvider for the client.
What version of the plugin are you using?
By plugin I suppose you're talking about the Discord.Net package. If that's the case, I'm using v2.1.1. Thanks for your patience!
I meant what version of the ACT_DiscordTriggers.dll
plugin are you using?
Sorry for my inexperience, It's just my first day working with this project. In the discord documentation I don't see anything about plugins... are they needed to just sustain a connection to a voice channel? I don't need to reproduce any audio right now, I just want it to sustain a stable connection to a voice channel without disconnecting...
I am assuming you are building from source? I think WS4Net is just buggy, since removing it fixes the problem, but unfortunately this comes at the cost of Windows 7 support. I will migrate the DiscordAPI part of the project to .NET Core eventually since from what I have read, it fixes the need for WS4Net in the first place. The only concern is that SpeechSynthesis doesn't exist in .NET Core, so I will have to move that over to the ACT Plugin project (which will be using .NET Framework probably until .NET 5 releases as long as ACT itself can support it).
So there is no way for me to connect my bot to a voice channel since my OS is Windows 7 and I need .NET framework...
The only concern is that SpeechSynthesis doesn't exist in .NET Core
It's because of Speech Recognition and Speech Synthesis that I'd like to work with .NET framework instead of .NET core...
Anyway I'll try to upgrade my OS since Windows 7 is way outdated. Thank you all for your kind help and patience! :)
Wouldn't be a bad idea. Since 1.0.1.0 works for the most part, it can serve as a legacy release for people still running Win 7 and earlier.
This means no Windows 7 Support until I decide to migrate this project to .NET Core. If you need to use this plugin with Windows 7, please try v1.0.1.0
Is what is shown. Attempted to reinstall ACT, did not fix. Issue persistent over 2-3 days now. Bot has administrator permissions, so it should have no permission issues for joining the channel.