Exiled-Team / DiscordIntegration

GNU General Public License v3.0
14 stars 38 forks source link

Error when using pterodactyl panel #30

Closed Oyplap closed 3 years ago

Oyplap commented 3 years ago

[14:00:22] [ERROR] [DiscordIntegration_Plugin] System.InvalidOperationException: Tcp Client not connected! at DiscordIntegration_Plugin.ProcessSTT.ReceiveData () [0x00013] in <7380954c0d81418c90be33a2d3777a91>:0

I have no idea what it means. This only happens when i enable egg mode on both the bot and plugin config. The bot won't connect to the server what so ever.

Schermafbeelding 2021-01-04 152257

Oyplap commented 3 years ago

Hmm i got some new error when i tried messing arround:

[22:42:32] [ERROR] [DiscordIntegration_Plugin] System.InvalidOperationException: The operation is not allowed on non-connected sockets. at System.Net.Sockets.TcpClient.GetStream () [0x00036] in :0 at DiscordIntegration_Plugin.ProcessSTT.ReceiveData () [0x00027] in <7380954c0d81418c90be33a2d3777a91>:0

Oyplap commented 3 years ago

I also tried to run the bot directly via putty but i got this:

root@45:/home/Bot_#1# mono DiscordIntegration_Bot.exe 23:43:31 Discord Discord.Net v2.1.1 (API v6) 23:43:32 LOG Login successful, starting STT.. 23:43:32 Gateway Connecting 23:43:32 LOG STT started for 7777 23:43:32 LOG STT: Starting listener.

Unhandled Exception: System.Net.Sockets.SocketException (0x80004005): Address already in use at System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) [0x00043] in <6bc04dcac0a443ee834a449c98b8ed9d>:0 at System.Net.Sockets.TcpListener.Start (System.Int32 backlog) [0x00044] in <6bc04dcac0a443ee834a449c98b8ed9d>:0 at System.Net.Sockets.TcpListener.Start () [0x00000] in <6bc04dcac0a443ee834a449c98b8ed9d>:0 at DiscordIntegration_Bot.ProcessSTT.Init (DiscordIntegration_Bot.Program program) [0x00097] in <123613a09fd94e278bfe95649c4e812f>:0 at DiscordIntegration_Bot.Bot.b__11_0 () [0x00000] in <123613a09fd94e278bfe95649c4e812f>:0 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0 at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.Net.Sockets.SocketException (0x80004005): Address already in use at System.Net.Sockets.Socket.Bind (System.Net.EndPoint localEP) [0x00043] in <6bc04dcac0a443ee834a449c98b8ed9d>:0 at System.Net.Sockets.TcpListener.Start (System.Int32 backlog) [0x00044] in <6bc04dcac0a443ee834a449c98b8ed9d>:0 at System.Net.Sockets.TcpListener.Start () [0x00000] in <6bc04dcac0a443ee834a449c98b8ed9d>:0 at DiscordIntegration_Bot.ProcessSTT.Init (DiscordIntegration_Bot.Program program) [0x00097] in <123613a09fd94e278bfe95649c4e812f>:0 at DiscordIntegration_Bot.Bot.b__11_0 () [0x00000] in <123613a09fd94e278bfe95649c4e812f>:0 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0 at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0

aurelienblais commented 3 years ago

Hello,

I've also tried running it in egg mode and running separate containers on ptero but it never worked. So here's the solution we use.

cd bot
mono DiscordIntegration_Bot.exe &
cd ..

./LocalAdmin 7777

Not the sexiest thing on Earth, but it works. (Btw, if you don't cd into the bot folder, the config file will be generated in the same folder than start.sh)

If you want to use multiadmin, you'll need to create a folder per bot eg:

cd bot_server_1
mono DiscordIntegration_Bot.exe &
cd ..

cd bot_server_2
mono DiscordIntegration_Bot.exe &
cd ..

mono MultiAdmin.exe --port {{SERVER_PORT}}
Oyplap commented 3 years ago

Thanks my guy, i'll will try this when i get home from work!

Oyplap commented 3 years ago

Yes this worked out perfectly, thanks for helping me out!

joker-119 commented 3 years ago

Your issue is because ptero doesn't let you bind 2 'servers' (IE 2 seperate panels) to the same port, which means, if the bot is on a different port than the server, it can talk to the server, but the server won't be able to reply back (because ptero won't let the bot receive data on that port, because it's reserved for another container)

You also can't run it outside of ptero because when you allocate a port to a container on ptero, it binds to both the TCP and UDP sockets for that port, meaning the bot can't bind to the TCP one.

Also, as I've stated many times, egg_mode is for advanced users and will never be supported in any way. It's kind of a fringe feature I will ensure 'works', but will not actively offer support for, due to the security concerns it can bring.

The recommended way to run the bot & server in ptero is indeed as described above, launching both the bot and server in the same container.