patch
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -36,7 +36,11 @@ public class level : DBCommand
|
|||||||
Title = "Leveling System",
|
Title = "Leveling System",
|
||||||
Description = message.Author.Mention
|
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("Level", cLv);
|
||||||
embed.AddField("Current EXP", cEXP);
|
embed.AddField("Current EXP", cEXP);
|
||||||
embed.AddField("Required Exp to Level up", rEXP);
|
embed.AddField("Required Exp to Level up", rEXP);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace DiscordBot
|
|||||||
private static bool listPluginsAtStartup = false;
|
private static bool listPluginsAtStartup = false;
|
||||||
private static bool listLanguagAtStartup = false;
|
private static bool listLanguagAtStartup = false;
|
||||||
|
|
||||||
|
private static bool PluginsLoaded = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -218,7 +220,13 @@ namespace DiscordBot
|
|||||||
|
|
||||||
case "loadplugins":
|
case "loadplugins":
|
||||||
case "lp":
|
case "lp":
|
||||||
|
if (PluginsLoaded)
|
||||||
|
{
|
||||||
|
Console_Utilities.WriteColorText("&rPlugins are already loaded");
|
||||||
|
break;
|
||||||
|
}
|
||||||
LoadPlugins(discordbooter);
|
LoadPlugins(discordbooter);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "help":
|
case "help":
|
||||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||||
@@ -284,6 +292,8 @@ namespace DiscordBot
|
|||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
};
|
};
|
||||||
loader.LoadPlugins();
|
loader.LoadPlugins();
|
||||||
|
|
||||||
|
PluginsLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class LevelingSystem : DBEvent
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
//Console_Utilities.WriteColorText("Message from : " + arg.Author.Username);
|
||||||
if (Core.playerMessages.ContainsKey(arg.Author.Id))
|
if (Core.playerMessages.ContainsKey(arg.Author.Id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace PluginManager.Loaders
|
|||||||
Plugins = new List<DBCommand>();
|
Plugins = new List<DBCommand>();
|
||||||
Events = new List<DBEvent>();
|
Events = new List<DBEvent>();
|
||||||
|
|
||||||
Functions.WriteLogFile("Starting plugin loader...");
|
Functions.WriteLogFile("Starting plugin loader ... Client: " + client.CurrentUser.Username);
|
||||||
if (LanguageSystem.Language.ActiveLanguage != null)
|
if (LanguageSystem.Language.ActiveLanguage != null)
|
||||||
Console_Utilities.WriteColorText(
|
Console_Utilities.WriteColorText(
|
||||||
LanguageSystem.Language.ActiveLanguage.FormatText(
|
LanguageSystem.Language.ActiveLanguage.FormatText(
|
||||||
|
|||||||
@@ -133,19 +133,21 @@ namespace PluginManager.Others
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The text</param>
|
/// <param name="text"></param>
|
||||||
|
/// <param name="appendNewLine"></param>
|
||||||
public static void WriteColorText(string text, bool appendNewLine = true)
|
public static void WriteColorText(string text, bool appendNewLine = true)
|
||||||
{
|
{
|
||||||
string[] words = text.Split(' ');
|
string[] words = text.Split(' ');
|
||||||
|
ConsoleColor fg = Console.ForegroundColor;
|
||||||
Dictionary<string, ConsoleColor> colors = new Dictionary<string, ConsoleColor>()
|
Dictionary<string, ConsoleColor> colors = new Dictionary<string, ConsoleColor>()
|
||||||
{
|
{
|
||||||
{"&g", ConsoleColor.Green },
|
{"&g", ConsoleColor.Green },
|
||||||
{"&b", ConsoleColor.Blue },
|
{"&b", ConsoleColor.Blue },
|
||||||
{"&r", ConsoleColor.Red },
|
{"&r", ConsoleColor.Red },
|
||||||
{"&m", ConsoleColor.Magenta },
|
{"&m", ConsoleColor.Magenta },
|
||||||
{"&c", Console.ForegroundColor }
|
{"&c", fg }
|
||||||
};
|
};
|
||||||
foreach (string word in words)
|
foreach (string word in words)
|
||||||
{
|
{
|
||||||
@@ -161,6 +163,8 @@ namespace PluginManager.Others
|
|||||||
}
|
}
|
||||||
if (appendNewLine)
|
if (appendNewLine)
|
||||||
Console.Write('\n');
|
Console.Write('\n');
|
||||||
|
|
||||||
|
Console.ForegroundColor = fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
|
using Discord;
|
||||||
|
|
||||||
public class OnUserJoin : DBEvent
|
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";
|
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)
|
public async void Start(Discord.WebSocket.DiscordSocketClient client)
|
||||||
{
|
{
|
||||||
|
|
||||||
string UtilsPath = Functions.dataFolder + "StartupEvents/";
|
|
||||||
string ConfigFile = UtilsPath + "UserJoinEvent.txt";
|
|
||||||
|
|
||||||
System.IO.Directory.CreateDirectory(UtilsPath);
|
System.IO.Directory.CreateDirectory(UtilsPath);
|
||||||
|
|
||||||
@@ -29,29 +32,28 @@ public class OnUserJoin : DBEvent
|
|||||||
"MessageFiled1Text=Custom Filed 1 text\n" +
|
"MessageFiled1Text=Custom Filed 1 text\n" +
|
||||||
"MessageField2Title=Custom Title\n" +
|
"MessageField2Title=Custom Title\n" +
|
||||||
"MessageFiled2Text=Custom Filed 2 text\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;
|
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");
|
Title = Functions.readCodeFromFile(ConfigFile, "MessageTitle", '='),
|
||||||
Discord.EmbedBuilder embed = new Discord.EmbedBuilder
|
Description = Functions.readCodeFromFile(ConfigFile, "MessageDescription", '=')
|
||||||
{
|
};
|
||||||
Title = Functions.readCodeFromFile(ConfigFile, "MessageTitle", '='),
|
embed
|
||||||
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, "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()))
|
.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()));
|
.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 user.Guild.DefaultChannel.SendMessageAsync(embed: embed.Build());
|
|
||||||
await (await user.CreateDMChannelAsync()).SendMessageAsync(embed: embed.Build());
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user