Skip to content

Commit

Permalink
Initital Public Release Push
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howard authored and Michael Howard committed Sep 25, 2021
1 parent c003aa6 commit 35b777c
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
<Copyright>© 2021 CloudTheWolf Ltd</Copyright>
<Description>Database System for CloudTheWolf.DSharpPlus.Scaffolding</Description>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<Version>$(AssemblyVersion)-beta</Version>
<Version>$(AssemblyVersion)</Version>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl />
</PropertyGroup>

<ItemGroup>
Expand All @@ -20,4 +23,15 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
<None Include="..\logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>C:\Users\CloudTheWolf\source\repos\CloudTheWolf.DSharpPlus.Scaffolding\CloudTheWolf.DSharpPlus.Scaffolding.Worker\bin\Debug\net5.0\Plugins</OutputPath>
</PropertyGroup>

</Project>
6 changes: 2 additions & 4 deletions CloudTheWolf.DSharpPlus.Scaffolding.Data/MySqlDataAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ namespace CloudTheWolf.DSharpPlus.Scaffolding.Data
{
public class MySqlDataAccess : DataAccess
{
private string _sqlConnectionString;
private MySqlConnection _sqlConnection;

public override string LoadConnectionString(string connStr)
{
_sqlConnectionString = connStr;
return _sqlConnectionString;
_sqlConnection = new MySqlConnection(connStr);
return _sqlConnection.ConnectionString;
}

public override string Request(string sqlCommandString)
Expand All @@ -37,7 +36,6 @@ public override string Request(string sqlCommandString)

private void DbConnect()
{
_sqlConnection.ConnectionString = _sqlConnectionString;
try
{
_sqlConnection.Open();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"CloudTheWolf.DSharpPlus.Scaffolding.Data": {
"commandName": "Executable",
"executablePath": "C:\\Users\\CloudTheWolf\\source\\repos\\CloudTheWolf.DSharpPlus.Scaffolding\\CloudTheWolf.DSharpPlus.Scaffolding.Worker\\bin\\Debug\\net5.0\\CloudTheWolf.DSharpPlus.Scaffolding.Worker.exe",
"workingDirectory": "C:\\Users\\CloudTheWolf\\source\\repos\\CloudTheWolf.DSharpPlus.Scaffolding\\CloudTheWolf.DSharpPlus.Scaffolding.Worker\\bin\\Debug\\net5.0",
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using CloudTheWolf.DSharpPlus.Scaffolding.Data;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CloudTheWolf.DSharpPlus.Scaffolding.Example.Module.Classes
{
class Database {

private DataAccess sda;

internal Database()
{
var MySql = true;
sda = MySql ? new MySqlDataAccess() : new SqlSvrDataAccess();

sda.LoadConnectionString($"Server={Options.MySqlHost};Port={Options.MySqlPort};Uid={Options.MySqlUsername};Pwd={Options.MySqlPassword};Database={Options.MySqlDatabase};");

}


internal JArray GetConfig()
{

var json = sda.Request("SELECT * FROM config;");
return JArray.Parse(json);
}




}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
Expand All @@ -7,11 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CloudTheWolf.DSharpPlus.Scaffolding.Data" Version="1.0.0-beta" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CloudTheWolf.DSharpPlus.Scaffolding.Shared\CloudTheWolf.DSharpPlus.Scaffolding.Shared.csproj" />
<PackageReference Include="CloudTheWolf.DSharpPlus.Scaffolding.Data" Version="1.0.0.1" />
<PackageReference Include="CloudTheWolf.DSharpPlus.Scaffolding.Shared" Version="1.0.0.4-beta" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using CloudTheWolf.DSharpPlus.Scaffolding.Example.Module.Classes;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Attributes;
using DSharpPlus.Entities;
using Newtonsoft.Json.Linq;
using System.Threading.Tasks;

namespace CloudTheWolf.DSharpPlus.Scaffolding.Example.Module.Commands
{
class ExampleCommands : BaseCommandModule
{

private Database _dba = new Database();

[Command("configs")]
public async Task GetConfigSettings(CommandContext ctx)
{
var exampleArray = _dba.GetConfig();
foreach(JObject jObject in exampleArray )
{
await ctx.Channel.SendMessageAsync($"Setting {jObject["name"]} [bValue = {jObject["bValue"]}, iValue = {jObject["iValue"]}]");
};
}

}
}
27 changes: 24 additions & 3 deletions CloudTheWolf.DSharpPlus.Scaffolding.Example.Module/Example.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CloudTheWolf.DSharpPlus.Scaffolding.Logging;
using CloudTheWolf.DSharpPlus.Scaffolding.Example.Module.Commands;
using CloudTheWolf.DSharpPlus.Scaffolding.Logging;
using CloudTheWolf.DSharpPlus.Scaffolding.Shared.Interfaces;
using DSharpPlus;
using Microsoft.Extensions.Configuration;
Expand All @@ -9,7 +10,7 @@ namespace CloudTheWolf.DSharpPlus.Scaffolding.Example.Module
{
public class Example : IPlugin
{
public string Name => "Example";
public string Name => "Example Plugin";

public string Description => "An Example Plugin to demo the system";

Expand All @@ -20,8 +21,28 @@ public class Example : IPlugin
public void InitPlugin(IBot bot, ILogger<Logger> logger, DiscordConfiguration discordConfiguration, IConfigurationRoot applicationConfig)
{
Logger = logger;
LoadConfig(applicationConfig);
RegisterCommands(bot);
Console.WriteLine("Hello World");
//Console.WriteLine(applicationConfig.Get<string>("a:b"));

}

private void RegisterCommands(IBot bot)
{

bot.Commands.RegisterCommands<Commands.ExampleCommands>();
Logger.LogInformation($"{Name}: Registared {nameof(ExampleCommands)}!");

}

private void LoadConfig(IConfigurationRoot applicationConfig)
{
Options.MySqlHost = applicationConfig.GetValue<string>("SQL:Host");
Options.MySqlPort = applicationConfig.GetValue<int>("SQL:Port");
Options.MySqlUsername = applicationConfig.GetValue<string>("SQL:Username");
Options.MySqlPassword = applicationConfig.GetValue<string>("SQL:Password");
Options.MySqlDatabase = applicationConfig.GetValue<string>("SQL:Database");
}

}
}
19 changes: 19 additions & 0 deletions CloudTheWolf.DSharpPlus.Scaffolding.Example.Module/Options.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CloudTheWolf.DSharpPlus.Scaffolding.Example.Module
{
public class Options
{
public static string MySqlHost { get; set; }
public static int MySqlPort { get; set; }
public static string MySqlUsername { get; set; }
public static string MySqlPassword { get; set; }
public static string MySqlDatabase { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
<Copyright>© 2021 CloudTheWolf Ltd</Copyright>
<Description>Logger for CloudTheWolf.DSharpPlus.Scaffolding</Description>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<AssemblyVersion>1.0.0.1</AssemblyVersion>
<AssemblyVersion>1.0.0.3</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<Version>$(AssemblyVersion)</Version>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl />
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,5 +27,9 @@
<None Update="docs\readme.md" Pack="true" PackagePath="\">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,30 @@
<Copyright>© 2021 CloudTheWolf Ltd</Copyright>
<Description>Shared Interfaces for CloudTheWolf.DSharpPlus.Scaffolding</Description>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<AssemblyVersion>1.0.0.3</AssemblyVersion>
<AssemblyVersion>1.0.0.4</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<Version>$(AssemblyVersion)-beta</Version>
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl />
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CloudTheWolf.DSharpPlus.Scaffolding.Logging" Version="1.0.0.1" />
<PackageReference Include="DSharpPlus" Version="4.2.0-nightly-00995" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.2.0-nightly-00995" />
<PackageReference Include="DSharpPlus.Interactivity" Version="4.2.0-nightly-00995" />
<PackageReference Include="DSharpPlus.Lavalink" Version="4.2.0-nightly-00995" />
<PackageReference Include="DSharpPlus.Rest" Version="4.2.0-nightly-00995" />
<PackageReference Include="DSharpPlus.VoiceNext" Version="4.2.0-nightly-00995" />
<PackageReference Include="CloudTheWolf.DSharpPlus.Scaffolding.Logging" Version="1.0.0.3" />
<PackageReference Include="DSharpPlus" Version="4.2.0-nightly-01004" />
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.2.0-nightly-01004" />
<PackageReference Include="DSharpPlus.Interactivity" Version="4.2.0-nightly-01004" />
<PackageReference Include="DSharpPlus.Lavalink" Version="4.2.0-nightly-01004" />
<PackageReference Include="DSharpPlus.Rest" Version="4.2.0-nightly-01004" />
<PackageReference Include="DSharpPlus.VoiceNext" Version="4.2.0-nightly-01004" />
<PackageReference Include="DSharpPlus.VoiceNext.Natives" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@
</PropertyGroup>

<ItemGroup>
<None Remove="appsettings.json.example" />
</ItemGroup>

<ItemGroup>
<Content Include="appsettings.json.example">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<PackageReference Include="CloudTheWolf.DSharpPlus.Scaffolding.Data" Version="1.0.0.1" />
<PackageReference Include="CloudTheWolf.DSharpPlus.Scaffolding.Shared" Version="1.0.0.4-beta" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CloudTheWolf.DSharpPlus.Scaffolding.Data\CloudTheWolf.DSharpPlus.Scaffolding.Data.csproj" />
<ProjectReference Include="..\CloudTheWolf.DSharpPlus.Scaffolding.Shared\CloudTheWolf.DSharpPlus.Scaffolding.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<Content Update="appsettings.Development.json" Pack="False">
</Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,5 @@
"user": "mySqlUser",
"pass": "MySqlPass",
"name": "MyDatabaseName"
},
"twitch": {
"autostart": true,
"ClientId": "MyTwitchClient",
"AccessToken": "MyTwitchToken",
"AutoAssign": true,
"AutoPurge": true,
"LogChannel": "ChannelIdForLogging"
},
"Level": {
"MsgExp": 0.012,
"VoiceExp": 0.012,
"PurgeExpOnBan": false,
"RevokeOnMsgDelete": true
}
}
28 changes: 0 additions & 28 deletions CloudTheWolf.DSharpPlus.Scaffolding.Worker/config.json.example

This file was deleted.

Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 35b777c

Please sign in to comment.