-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Howard
authored and
Michael Howard
committed
Sep 25, 2021
1 parent
c003aa6
commit 35b777c
Showing
14 changed files
with
176 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
CloudTheWolf.DSharpPlus.Scaffolding.Data/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
CloudTheWolf.DSharpPlus.Scaffolding.Example.Module/Classes/Database.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
|
||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
CloudTheWolf.DSharpPlus.Scaffolding.Example.Module/Commands/ExampleCommands.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]}]"); | ||
}; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
CloudTheWolf.DSharpPlus.Scaffolding.Example.Module/Options.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
CloudTheWolf.DSharpPlus.Scaffolding.Worker/config.json.example
This file was deleted.
Oops, something went wrong.