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",
|
||||
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);
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace DiscordBot
|
||||
private static bool listPluginsAtStartup = false;
|
||||
private static bool listLanguagAtStartup = false;
|
||||
|
||||
private static bool PluginsLoaded = false;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace PluginManager.Loaders
|
||||
Plugins = new List<DBCommand>();
|
||||
Events = new List<DBEvent>();
|
||||
|
||||
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(
|
||||
|
||||
@@ -133,19 +133,21 @@ namespace PluginManager.Others
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// <param name="text">The text</param>
|
||||
/// <param name="text"></param>
|
||||
/// <param name="appendNewLine"></param>
|
||||
public static void WriteColorText(string text, bool appendNewLine = true)
|
||||
{
|
||||
string[] words = text.Split(' ');
|
||||
ConsoleColor fg = Console.ForegroundColor;
|
||||
Dictionary<string, ConsoleColor> colors = new Dictionary<string, ConsoleColor>()
|
||||
{
|
||||
{"&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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user