Merge branch 'master' of ssh://git.chaoticlogic.us:2302/discord-bots/chaosbot

This commit is contained in:
Daniel_I_Am 2020-06-03 23:20:16 +02:00
commit fac3b7152e
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84
2 changed files with 8 additions and 5 deletions

View File

@ -6,12 +6,12 @@ using NLog;
namespace ChaosBot.Controllers namespace ChaosBot.Controllers
{ {
public class Database public class DBWork
{ {
private SqliteConnection _conn = new SqliteConnection($"Data Source={System.IO.Directory.GetCurrentDirectory()}{Program.Cfg.GetValue<string>("Bot:Database")}"); private static SqliteConnection _conn = new SqliteConnection($"Data Source={System.IO.Directory.GetCurrentDirectory()}{Program.Cfg.GetValue<string>("Bot:Database")}");
private static Logger _logger = Program._logger; private static Logger _logger = Program._logger;
public DataTable RawQuery(string query) public static DataTable RawQuery(string query)
{ {
DataTable dt = new DataTable(); DataTable dt = new DataTable();
@ -32,7 +32,7 @@ namespace ChaosBot.Controllers
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Fatal($"Controllers.Database.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>."); _logger.Fatal($"Controllers.DBWork.RawQuery: Exception [{ex}] thrown, <[{ex.Message}]>.");
} }
return dt; return dt;

View File

@ -4,11 +4,11 @@ using System.Text;
using Discord.Commands; using Discord.Commands;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using ChaosBot.Controllers; using ChaosBot.Controllers;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using NLog; using NLog;
namespace ChaosBot.Discord.Modules namespace ChaosBot.Discord.Modules
{ {
public class InfoCommands : ModuleBase public class InfoCommands : ModuleBase
@ -31,7 +31,10 @@ namespace ChaosBot.Discord.Modules
sb.AppendLine(); sb.AppendLine();
sb.AppendLine($"Bot Version: {Program.Cfg.GetValue<string>("Bot:Version")}"); sb.AppendLine($"Bot Version: {Program.Cfg.GetValue<string>("Bot:Version")}");
sb.AppendLine($"Bot Prefix: {Program.Cfg.GetValue<string>("Discord:Prefix")}"); sb.AppendLine($"Bot Prefix: {Program.Cfg.GetValue<string>("Discord:Prefix")}");
sb.AppendLine($"");
DataTable dr = DBWork.RawQuery("Show Create Table RaffleTable;");
/* /*
* Add the string to the Embed * Add the string to the Embed
*/ */