diff options
| author | Alee <Alee14498@gmail.com> | 2019-05-06 16:58:06 -0400 |
|---|---|---|
| committer | Alee <Alee14498@gmail.com> | 2019-05-06 16:58:06 -0400 |
| commit | 414ea5e42170386d4df79db2debc493d0eb4d393 (patch) | |
| tree | befcbd3b19467c9dd98676ea350a01b1514358b5 /AleeBot | |
| parent | 9289ab03d85f415db36242beb489bb22ee6152bf (diff) | |
| download | AleeBot.NET-414ea5e42170386d4df79db2debc493d0eb4d393.tar.gz AleeBot.NET-414ea5e42170386d4df79db2debc493d0eb4d393.tar.bz2 AleeBot.NET-414ea5e42170386d4df79db2debc493d0eb4d393.zip | |
Added a new command and finally getting rid of the hardcoded stuff
Diffstat (limited to 'AleeBot')
| -rw-r--r-- | AleeBot/AleeBot.csproj | 8 | ||||
| -rw-r--r-- | AleeBot/AleeBot.ico | bin | 0 -> 134483 bytes | |||
| -rw-r--r-- | AleeBot/Data.cs | 29 | ||||
| -rw-r--r-- | AleeBot/Program.cs | 52 |
4 files changed, 71 insertions, 18 deletions
diff --git a/AleeBot/AleeBot.csproj b/AleeBot/AleeBot.csproj index 2cff4bd..3e59679 100644 --- a/AleeBot/AleeBot.csproj +++ b/AleeBot/AleeBot.csproj @@ -8,6 +8,10 @@ <Copyright>(C) Copyright 2019</Copyright> <NeutralLanguage>en</NeutralLanguage> <Company>AleeCorp</Company> + <ApplicationIcon>AleeBot.ico</ApplicationIcon> + <AssemblyName>AleeBot.NET</AssemblyName> + <RootNamespace>AleeBot</RootNamespace> + <RepositoryUrl>https://github.com/AleeCorp/AleeBot.NET</RepositoryUrl> </PropertyGroup> <ItemGroup> @@ -16,4 +20,8 @@ <PackageReference Include="System.IO.FileSystem" Version="4.3.0" /> </ItemGroup> + <Target Name="PreBuild" BeforeTargets="PreBuildEvent"> + <Exec Command="" /> + </Target> + </Project> diff --git a/AleeBot/AleeBot.ico b/AleeBot/AleeBot.ico Binary files differnew file mode 100644 index 0000000..d79600b --- /dev/null +++ b/AleeBot/AleeBot.ico diff --git a/AleeBot/Data.cs b/AleeBot/Data.cs new file mode 100644 index 0000000..0f1ab10 --- /dev/null +++ b/AleeBot/Data.cs @@ -0,0 +1,29 @@ +/******************************************* + * + * AleeBot.NET: A Discord bot that's made in Discord.NET, .NET Core 3.0 and a revival. + * Copyright (C) 2019 AleeCorp + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + **********************************************/ +namespace AleeBot +{ + public class Data + { + //This will be storing public variables such as versions and stuff. + + public static string Version = "3.0 Beta 1"; + public static string prefix = "ab:"; + } +} diff --git a/AleeBot/Program.cs b/AleeBot/Program.cs index d4ae19b..c996cc7 100644 --- a/AleeBot/Program.cs +++ b/AleeBot/Program.cs @@ -30,12 +30,20 @@ namespace AleeBot { public static void Main(string[] args) { + Console.Title = "AleeBot " + Data.Version + " Console"; Console.WriteLine("Starting AleeBot.NET"); - Console.WriteLine("Version: 3.0 Beta 1\n"); + Console.WriteLine("Version: "+ Data.Version +"\n"); Console.WriteLine("Machine Name: " + Environment.MachineName); Console.WriteLine("OS Version: " + Environment.OSVersion); Console.WriteLine("\n"); - new Program().MainAsync().GetAwaiter().GetResult(); + if (File.Exists("token.txt")) + { + new Program().MainAsync().GetAwaiter().GetResult(); + } else + { + Console.WriteLine("[ERROR] token.txt isn't found."); + Environment.Exit(0); + } } private DiscordSocketClient _client; @@ -45,36 +53,44 @@ namespace AleeBot _client = new DiscordSocketClient(); + #if DEBUG _client.Log += Log; + #endif - await _client.LoginAsync(TokenType.Bot, File.ReadAllText("config.json")); + await _client.LoginAsync(TokenType.Bot, File.ReadAllText("token.txt")); await _client.StartAsync(); _client.MessageReceived += Message; - - // Block this task until the program is closed. + + _client.Ready += () => + { + Console.WriteLine("[SUCCESS] AleeBot "+ Data.Version + " is now ready!"); + return Task.CompletedTask; + }; + await Task.Delay(-1); } private async Task Message(SocketMessage message) { - if (message.Content == "ab:ping") + + if (message.Content == Data.prefix + "help") { - await message.Channel.SendMessageAsync("Pong! Running on .NET Core!"); + var embed = new EmbedBuilder(); + embed.WithTitle("AleeBot.NET "+ Data.Version +" Help"); + embed.WithDescription("Every command you input into AleeBot is `ab:`"); + embed.WithColor(Color.Green); + embed.AddField("Commands:", "ab:help\nab:ping"); + await message.Channel.SendMessageAsync(embed: embed.Build()); } - else if (message.Content == "ab:version") + else if (message.Content == Data.prefix + "ping") { - await message.Channel.SendMessageAsync("AleeBot 3.0 Beta 1"); + await message.Channel.SendMessageAsync("🏓 Pong! Running on .NET Core!"); } - else if (message.Content == "ab:embed") + else if (message.Content == Data.prefix + "poweroff") { - Color darkGrey = new Color(96, 125, 139); - var embed = new EmbedBuilder - { - Title = "Hello World", - Color = darkGrey, - Description = "This is a embed!", - }; - await message.Channel.SendMessageAsync(embed: embed.Build()); + //if (message.Author = 242775871059001344) + await message.Channel.SendMessageAsync("⚠ AleeBot will now exit!"); + Environment.Exit(0); } } |
