diff --git a/BUILDS/net6.0/CMD_LevelingSystem.dll b/BUILDS/net6.0/CMD_LevelingSystem.dll
index 533182c..9092cf7 100644
Binary files a/BUILDS/net6.0/CMD_LevelingSystem.dll and b/BUILDS/net6.0/CMD_LevelingSystem.dll differ
diff --git a/BUILDS/net6.0/PluginManager.dll b/BUILDS/net6.0/PluginManager.dll
index d7791de..8ac35de 100644
Binary files a/BUILDS/net6.0/PluginManager.dll and b/BUILDS/net6.0/PluginManager.dll differ
diff --git a/BUILDS/net6.0/StartupEvents.dll b/BUILDS/net6.0/StartupEvents.dll
index 916b19a..b86303b 100644
Binary files a/BUILDS/net6.0/StartupEvents.dll and b/BUILDS/net6.0/StartupEvents.dll differ
diff --git a/CMD_LevelingSystem/Commands/level.cs b/CMD_LevelingSystem/Commands/level.cs
index 7bea3e4..d709e67 100644
--- a/CMD_LevelingSystem/Commands/level.cs
+++ b/CMD_LevelingSystem/Commands/level.cs
@@ -36,7 +36,11 @@ public class level : DBCommand
Title = "Leveling System",
Description = message.Author.Mention
};
- embed.WithColor(Color.Blue);
+ Random r = new Random();
+ int _r = r.Next(0, 256);
+ int _g = r.Next(0, 256);
+ int _b = r.Next(0, 256);
+ embed.WithColor(new Color(_r, _g, _b));
embed.AddField("Level", cLv);
embed.AddField("Current EXP", cEXP);
embed.AddField("Required Exp to Level up", rEXP);
diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs
index dad195a..8bc41b1 100644
--- a/DiscordBot/Program.cs
+++ b/DiscordBot/Program.cs
@@ -24,6 +24,8 @@ namespace DiscordBot
private static bool listPluginsAtStartup = false;
private static bool listLanguagAtStartup = false;
+ private static bool PluginsLoaded = false;
+
///
/// The main entry point for the application.
///
@@ -218,7 +220,13 @@ namespace DiscordBot
case "loadplugins":
case "lp":
+ if (PluginsLoaded)
+ {
+ Console_Utilities.WriteColorText("&rPlugins are already loaded");
+ break;
+ }
LoadPlugins(discordbooter);
+
break;
case "help":
Console.ForegroundColor = ConsoleColor.DarkYellow;
@@ -284,6 +292,8 @@ namespace DiscordBot
Console.ForegroundColor = ConsoleColor.Red;
};
loader.LoadPlugins();
+
+ PluginsLoaded = true;
}
///
diff --git a/EVE_LevelingSystem/LevelingSystem.cs b/EVE_LevelingSystem/LevelingSystem.cs
index 1edfa6b..7f7195b 100644
--- a/EVE_LevelingSystem/LevelingSystem.cs
+++ b/EVE_LevelingSystem/LevelingSystem.cs
@@ -30,7 +30,7 @@ public class LevelingSystem : DBEvent
)
)
return;
-
+ //Console_Utilities.WriteColorText("Message from : " + arg.Author.Username);
if (Core.playerMessages.ContainsKey(arg.Author.Id))
return;
diff --git a/PluginManager/Loaders/PluginLoader.cs b/PluginManager/Loaders/PluginLoader.cs
index 36a192a..520112d 100644
--- a/PluginManager/Loaders/PluginLoader.cs
+++ b/PluginManager/Loaders/PluginLoader.cs
@@ -59,7 +59,7 @@ namespace PluginManager.Loaders
Plugins = new List();
Events = new List();
- Functions.WriteLogFile("Starting plugin loader...");
+ Functions.WriteLogFile("Starting plugin loader ... Client: " + client.CurrentUser.Username);
if (LanguageSystem.Language.ActiveLanguage != null)
Console_Utilities.WriteColorText(
LanguageSystem.Language.ActiveLanguage.FormatText(
diff --git a/PluginManager/Others/Console Utilities.cs b/PluginManager/Others/Console Utilities.cs
index 80e3330..408544b 100644
--- a/PluginManager/Others/Console Utilities.cs
+++ b/PluginManager/Others/Console Utilities.cs
@@ -133,19 +133,21 @@ namespace PluginManager.Others
}
///
- /// Write the text using color options( &g-green; &b-blue; &r-red; &c-clear; )
+ /// Write text using colors: &g - green, &r - red, &b - blue, &m - magenta, &c - Clear
///
- /// The text
+ ///
+ ///
public static void WriteColorText(string text, bool appendNewLine = true)
{
string[] words = text.Split(' ');
+ ConsoleColor fg = Console.ForegroundColor;
Dictionary colors = new Dictionary()
{
{"&g", ConsoleColor.Green },
{"&b", ConsoleColor.Blue },
{"&r", ConsoleColor.Red },
{"&m", ConsoleColor.Magenta },
- {"&c", Console.ForegroundColor }
+ {"&c", fg }
};
foreach (string word in words)
{
@@ -161,6 +163,8 @@ namespace PluginManager.Others
}
if (appendNewLine)
Console.Write('\n');
+
+ Console.ForegroundColor = fg;
}
}
diff --git a/StartupEvents/OnUserJoin.cs b/StartupEvents/OnUserJoin.cs
index b5830cb..ebcc5ba 100644
--- a/StartupEvents/OnUserJoin.cs
+++ b/StartupEvents/OnUserJoin.cs
@@ -1,5 +1,6 @@
using PluginManager.Others;
using PluginManager.Interfaces;
+using Discord;
public class OnUserJoin : DBEvent
{
@@ -7,11 +8,13 @@ public class OnUserJoin : DBEvent
public string description => "An event that is triggered when an user joins the server";
+ private string UtilsPath = Functions.dataFolder + "/StartupEvents";
+ private string ConfigFile = Functions.dataFolder + "/StartupEvents/" + "UserJoinEvent.txt";
+
public async void Start(Discord.WebSocket.DiscordSocketClient client)
{
- string UtilsPath = Functions.dataFolder + "StartupEvents/";
- string ConfigFile = UtilsPath + "UserJoinEvent.txt";
+
System.IO.Directory.CreateDirectory(UtilsPath);
@@ -29,29 +32,28 @@ public class OnUserJoin : DBEvent
"MessageFiled1Text=Custom Filed 1 text\n" +
"MessageField2Title=Custom Title\n" +
"MessageFiled2Text=Custom Filed 2 text\n" +
- "MessageFooter=Today: {time.date} at {time.time}");
+ "MessageFooter=Today: {time.date} at {time.time}\n");
}
if (Functions.readCodeFromFile(ConfigFile, "Enabled", '=') != "True") return;
+ System.Console.WriteLine("Awaiting user join event ...");
- client.UserJoined += async (user) =>
+ client.UserJoined += Client_UserJoined;
+
+ }
+
+ private async System.Threading.Tasks.Task Client_UserJoined(Discord.WebSocket.SocketGuildUser user)
+ {
+ // Console_Utilities.WriteColorText("A new user joins: " + user.Username);
+ EmbedBuilder embed = new EmbedBuilder
{
- Console_Utilities.WriteColorText("da");
- Discord.EmbedBuilder embed = new Discord.EmbedBuilder
- {
- Title = Functions.readCodeFromFile(ConfigFile, "MessageTitle", '='),
- Description = Functions.readCodeFromFile(ConfigFile, "MessageDescription", '=')
- };
-
- embed
+ Title = Functions.readCodeFromFile(ConfigFile, "MessageTitle", '='),
+ Description = Functions.readCodeFromFile(ConfigFile, "MessageDescription", '=')
+ };
+ embed
.AddField(Functions.readCodeFromFile(ConfigFile, "MessageField1Title", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString()), Functions.readCodeFromFile(ConfigFile, "MessageField1Text", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString()))
.AddField(Functions.readCodeFromFile(ConfigFile, "MessageField2Title", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString()), Functions.readCodeFromFile(ConfigFile, "MessageField2Text", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString()))
.WithFooter(Functions.readCodeFromFile(ConfigFile, "MessageFooter", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString()));
- Console_Utilities.WriteColorText("da");
- //await user.Guild.DefaultChannel.SendMessageAsync(embed: embed.Build());
- await (await user.CreateDMChannelAsync()).SendMessageAsync(embed: embed.Build());
- };
-
-
+ await user.Guild.DefaultChannel.SendMessageAsync(embed: embed.Build());
}
}
\ No newline at end of file