diff --git a/ModLauncher/App.config b/ModLauncher/App.config
index 71a06ba..757ddce 100644
--- a/ModLauncher/App.config
+++ b/ModLauncher/App.config
@@ -9,6 +9,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/ShiftOS.MFSProfiler/App.config b/ShiftOS.MFSProfiler/App.config
index efb416e..a0a13df 100644
--- a/ShiftOS.MFSProfiler/App.config
+++ b/ShiftOS.MFSProfiler/App.config
@@ -10,6 +10,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/ShiftOS.Modding.VB.LegacySkinConverter/App.config b/ShiftOS.Modding.VB.LegacySkinConverter/App.config
index 71a06ba..757ddce 100644
--- a/ShiftOS.Modding.VB.LegacySkinConverter/App.config
+++ b/ShiftOS.Modding.VB.LegacySkinConverter/App.config
@@ -9,6 +9,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/ShiftOS.Modding.VirtualMachine/App.config b/ShiftOS.Modding.VirtualMachine/App.config
index 71a06ba..757ddce 100644
--- a/ShiftOS.Modding.VirtualMachine/App.config
+++ b/ShiftOS.Modding.VirtualMachine/App.config
@@ -9,6 +9,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/ShiftOS.Server.WebAdmin/App.config b/ShiftOS.Server.WebAdmin/App.config
index 71a06ba..2a7dffa 100644
--- a/ShiftOS.Server.WebAdmin/App.config
+++ b/ShiftOS.Server.WebAdmin/App.config
@@ -7,7 +7,11 @@
-
+
+
+
+
+
diff --git a/ShiftOS.Server/App.config b/ShiftOS.Server/App.config
index efb416e..a0a13df 100644
--- a/ShiftOS.Server/App.config
+++ b/ShiftOS.Server/App.config
@@ -10,6 +10,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/ShiftOS.Server/ChatBackend.cs b/ShiftOS.Server/ChatBackend.cs
index 6779fd8..8de2fec 100644
--- a/ShiftOS.Server/ChatBackend.cs
+++ b/ShiftOS.Server/ChatBackend.cs
@@ -9,39 +9,42 @@ using Newtonsoft.Json;
using System.IO;
using static ShiftOS.Server.Program;
using Discord;
+using Discord.WebSocket;
namespace ShiftOS.Server
{
public static class ChatBackend
{
- public static void StartDiscordBots()
+ public static async Task StartDiscordBots()
{
Reinitialized?.Invoke();
+ if (!File.Exists("chats.json"))
+ File.WriteAllText("chats.json", "[]");
foreach (var chat in JsonConvert.DeserializeObject>(File.ReadAllText("chats.json")))
{
bool chatKilled = false;
if (chat.IsDiscordProxy == true)
{
- DiscordConfigBuilder builder = new DiscordConfigBuilder();
- builder.AppName = "ShiftOS";
- builder.AppVersion = System.Reflection.Assembly.GetExecutingAssembly().FullName;
- builder.AppUrl = "http://getshiftos.ml/";
- var client = new DiscordClient(builder);
- client.Connect(chat.DiscordBotToken, TokenType.Bot);
- client.SetGame("ShiftOS");
- client.SetStatus(UserStatus.Online);
- client.MessageReceived += (s, e) =>
+ DiscordSocketConfig builder = new DiscordSocketConfig();
+ builder.AudioMode = Discord.Audio.AudioMode.Disabled;
+ var client = new DiscordSocketClient(builder);
+ await client.LoginAsync(TokenType.Bot, chat.DiscordBotToken);
+
+ await client.ConnectAsync();
+ await client.SetGameAsync("ShiftOS");
+ await client.SetStatusAsync(UserStatus.Online);
+ client.MessageReceived += async (s) =>
{
if (chatKilled == false)
{
- if (e.Channel.Id.ToString() == chat.DiscordChannelID)
+ if (s.Channel.Id == Convert.ToUInt64(chat.DiscordChannelID))
{
server.DispatchAll(new NetObject("chat_msgreceived", new ServerMessage
{
Name = "chat_msgreceived",
GUID = "server",
- Contents = JsonConvert.SerializeObject(new ChatMessage(e.User.Name, "discord_" + e.Channel.Name, e.Message.Text, chat.ID))
+ Contents = JsonConvert.SerializeObject(new ChatMessage(s.Author.Mention, "discord_" + s.Channel.Name, s.Content, chat.ID))
}));
}
}
@@ -54,9 +57,9 @@ namespace ShiftOS.Server
if (msg.Channel == chat.ID)
{
//Get the Discord channel for this chat.
- var dChan = client.GetChannel(Convert.ToUInt64(chat.DiscordChannelID));
+ var dChan = client.GetChannel(Convert.ToUInt64(chat.ID)) as ISocketMessageChannel;
//Relay the message to Discord.
- dChan.SendMessage($"**[{msg.Username}@{msg.SystemName} ({msg.Channel})]: {msg.Message}");
+ dChan.SendMessageAsync($"**[{msg.Username}@{msg.SystemName}] ` {msg.Message}");
}
//Relay it back to all MUD clients.
@@ -65,8 +68,8 @@ namespace ShiftOS.Server
};
Reinitialized += () =>
{
- client.Disconnect();
- client.Dispose();
+ client.DisconnectAsync();
+
chatKilled = true;
};
}
diff --git a/ShiftOS.Server/ShiftOS.Server.csproj b/ShiftOS.Server/ShiftOS.Server.csproj
index 890d160..b2b3a1e 100644
--- a/ShiftOS.Server/ShiftOS.Server.csproj
+++ b/ShiftOS.Server/ShiftOS.Server.csproj
@@ -33,8 +33,24 @@
4
-
- ..\packages\Discord.Net.0.9.6\lib\net45\Discord.Net.dll
+
+ ..\packages\Discord.Net.Commands.1.0.0-rc-00595\lib\netstandard1.1\Discord.Net.Commands.dll
+ True
+
+
+ ..\packages\Discord.Net.Core.1.0.0-rc-00595\lib\netstandard1.1\Discord.Net.Core.dll
+ True
+
+
+ ..\packages\Discord.Net.Rest.1.0.0-rc-00595\lib\netstandard1.1\Discord.Net.Rest.dll
+ True
+
+
+ ..\packages\Discord.Net.Rpc.1.0.0-rc-00595\lib\netstandard1.1\Discord.Net.Rpc.dll
+ True
+
+
+ ..\packages\Discord.Net.WebSocket.1.0.0-rc-00595\lib\netstandard1.1\Discord.Net.WebSocket.dll
True
@@ -61,8 +77,28 @@
True
+
+ ..\packages\System.Collections.Immutable.1.3.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
+ True
+
+
+
+ ..\packages\System.Interactive.Async.3.1.0\lib\net45\System.Interactive.Async.dll
+ True
+
+
+
+
+
+
+ ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll
+ True
+
+
+
+
diff --git a/ShiftOS.Server/packages.config b/ShiftOS.Server/packages.config
index 1bde8a9..f90dec0 100644
--- a/ShiftOS.Server/packages.config
+++ b/ShiftOS.Server/packages.config
@@ -1,9 +1,49 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ShiftOS.WinForms/App.config b/ShiftOS.WinForms/App.config
index 5ce46cf..a0a13df 100644
--- a/ShiftOS.WinForms/App.config
+++ b/ShiftOS.WinForms/App.config
@@ -8,7 +8,11 @@
-
+
+
+
+
+
diff --git a/ShiftOS_TheReturn/App.config b/ShiftOS_TheReturn/App.config
index 5ce46cf..a0a13df 100644
--- a/ShiftOS_TheReturn/App.config
+++ b/ShiftOS_TheReturn/App.config
@@ -8,7 +8,11 @@
-
+
+
+
+
+