Initial Commit
This commit is contained in:
25
LaDOSE.DiscordBot/LaDOSE.DiscordBot/LaDOSE.DiscordBot.sln
Normal file
25
LaDOSE.DiscordBot/LaDOSE.DiscordBot/LaDOSE.DiscordBot.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2041
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaDOSE.DiscordBot", "LaDOSE.DiscordBot\LaDOSE.DiscordBot.csproj", "{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C1E8FAF6-3A75-44AC-938D-CA56A5322D1C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D47DEDD0-C906-439D-81E4-D86BBE723B8C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DSharpPlus" Version="3.2.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="settings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using DSharpPlus;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace LaDOSE.DiscordBot
|
||||
{
|
||||
class Program
|
||||
{
|
||||
|
||||
static DiscordClient discord;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
|
||||
MainAsync(args).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
static async Task MainAsync(string[] args)
|
||||
{
|
||||
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("settings.json", optional: true, reloadOnChange: true).Build();
|
||||
|
||||
var discordToken = builder["Discord:Token"].ToString();
|
||||
|
||||
|
||||
Console.WriteLine($"LaDOSE.Net Discord Bot");
|
||||
|
||||
discord = new DiscordClient(new DiscordConfiguration
|
||||
{
|
||||
Token = discordToken,
|
||||
TokenType = TokenType.Bot
|
||||
});
|
||||
|
||||
discord.MessageCreated += async e =>
|
||||
{
|
||||
if (e.Message.Content.ToLower().StartsWith("ping"))
|
||||
await e.Message.RespondAsync("pong!");
|
||||
};
|
||||
|
||||
await discord.ConnectAsync();
|
||||
await Task.Delay(-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"Discord": {
|
||||
"Token" : "APITOKEN Here"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user