diff options
| -rw-r--r-- | AleeBot/AleeBot.csproj | 6 | ||||
| -rw-r--r-- | AleeBot/Program.cs | 63 | ||||
| -rw-r--r-- | AleeBot/config.json | 3 |
3 files changed, 69 insertions, 3 deletions
diff --git a/AleeBot/AleeBot.csproj b/AleeBot/AleeBot.csproj index 30b8db4..2cff4bd 100644 --- a/AleeBot/AleeBot.csproj +++ b/AleeBot/AleeBot.csproj @@ -3,11 +3,17 @@ <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.0</TargetFramework> + <Version>3.0.0</Version> + <Authors>Andrew Lee</Authors> + <Copyright>(C) Copyright 2019</Copyright> + <NeutralLanguage>en</NeutralLanguage> + <Company>AleeCorp</Company> </PropertyGroup> <ItemGroup> <PackageReference Include="Discord.Net" Version="2.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> + <PackageReference Include="System.IO.FileSystem" Version="4.3.0" /> </ItemGroup> </Project> diff --git a/AleeBot/Program.cs b/AleeBot/Program.cs index 127e6cc..decd5a6 100644 --- a/AleeBot/Program.cs +++ b/AleeBot/Program.cs @@ -19,14 +19,71 @@ **********************************************/ using System; +using System.IO; +using System.Threading.Tasks; +using Discord; +using Discord.API; +using Discord.WebSocket; namespace AleeBot { - internal class Program + public class Program { - private static void Main(string[] args) + public static void Main(string[] args) { - Console.WriteLine("Welcome to AleeBot!"); + Console.WriteLine("Starting AleeBot.NET"); + Console.WriteLine("Version: 3.0 Beta 1\n"); + Console.WriteLine("Machine Name: " + Environment.MachineName); + Console.WriteLine("OS Version: " + Environment.OSVersion); + Console.WriteLine("\n"); + new Program().MainAsync().GetAwaiter().GetResult(); + } + + private DiscordSocketClient _client; + + public async Task MainAsync() + { + string token = "token"; + + _client = new DiscordSocketClient(); + + _client.Log += Log; + + await _client.LoginAsync(TokenType.Bot, token); + await _client.StartAsync(); + + _client.MessageReceived += Message; + + // Block this task until the program is closed. + await Task.Delay(-1); + } + private async Task Message(SocketMessage message) + { + if (message.Content == "ab:ping") + { + await message.Channel.SendMessageAsync("Pong! Running on .NET Core!"); + } + else if (message.Content == "ab:version") + { + await message.Channel.SendMessageAsync("AleeBot 3.0 Beta 1"); + } + else if (message.Content == "ab:embed") + { + 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()); + } + } + + private Task Log(LogMessage msg) + { + Console.WriteLine(msg.ToString()); + return Task.CompletedTask; } } } diff --git a/AleeBot/config.json b/AleeBot/config.json new file mode 100644 index 0000000..ec5b9cd --- /dev/null +++ b/AleeBot/config.json @@ -0,0 +1,3 @@ +{ + "token": "" +} |
