forked from adam/discord-bot-shtik
configuration separated
This commit is contained in:
parent
5bb64f764c
commit
4a60e53798
@ -45,7 +45,7 @@ public class QRify : Behavior
|
|||||||
if(message.Channel.EffectivePermissions.MaxAttachmentBytes < (ulong)(new System.IO.FileInfo($"tmp/qr{todaysnumber}.png").Length))
|
if(message.Channel.EffectivePermissions.MaxAttachmentBytes < (ulong)(new System.IO.FileInfo($"tmp/qr{todaysnumber}.png").Length))
|
||||||
await message.Channel.SendFile($"tmp/qr{todaysnumber}.png", null);
|
await message.Channel.SendFile($"tmp/qr{todaysnumber}.png", null);
|
||||||
else
|
else
|
||||||
message.Channel.SendMessage("resulting qr image 2 big 4 here");
|
await message.Channel.SendMessage("resulting qr image 2 big 4 here");
|
||||||
File.Delete($"tmp/qr{todaysnumber}.svg");
|
File.Delete($"tmp/qr{todaysnumber}.svg");
|
||||||
File.Delete($"tmp/qr{todaysnumber}.png");
|
File.Delete($"tmp/qr{todaysnumber}.png");
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using vassago.TwitchInterface;
|
|
||||||
|
|
||||||
namespace vassago
|
|
||||||
{
|
|
||||||
public class Configuration
|
|
||||||
{
|
|
||||||
public string ExchangePairsLocation { get; set; }
|
|
||||||
public IEnumerable<string> DiscordTokens { get; set; }
|
|
||||||
public IEnumerable<TwitchConfig> TwitchConfigs { get; set; }
|
|
||||||
public string DBConnectionString { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,34 +6,33 @@ namespace vassago
|
|||||||
|
|
||||||
internal class ConsoleService : IHostedService
|
internal class ConsoleService : IHostedService
|
||||||
{
|
{
|
||||||
Configuration config = new Configuration();
|
|
||||||
|
|
||||||
public ConsoleService(IConfiguration aspConfig)
|
public ConsoleService(IConfiguration aspConfig)
|
||||||
{
|
{
|
||||||
config.DBConnectionString = aspConfig["DBConnectionString"];
|
Shared.DBConnectionString = aspConfig["DBConnectionString"];
|
||||||
config.ExchangePairsLocation = aspConfig["ExchangePairsLocation"];
|
DiscordTokens = aspConfig.GetSection("DiscordTokens").Get<IEnumerable<string>>();
|
||||||
config.DiscordTokens = aspConfig.GetSection("DiscordTokens").Get<IEnumerable<string>>();
|
TwitchConfigs = aspConfig.GetSection("TwitchConfigs").Get<IEnumerable<TwitchConfig>>();
|
||||||
config.TwitchConfigs = aspConfig.GetSection("TwitchConfigs").Get<IEnumerable<TwitchConfig>>();
|
Conversion.Converter.Load(aspConfig["ExchangePairsLocation"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEnumerable<string> DiscordTokens { get; }
|
||||||
|
IEnumerable<TwitchConfig> TwitchConfigs { get; }
|
||||||
|
|
||||||
public async Task StartAsync(CancellationToken cancellationToken)
|
public async Task StartAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Shared.DBConnectionString = config.DBConnectionString;
|
|
||||||
var dbc = new ChattingContext();
|
var dbc = new ChattingContext();
|
||||||
dbc.Database.EnsureCreated();
|
dbc.Database.EnsureCreated();
|
||||||
|
|
||||||
Conversion.Converter.Load(config.ExchangePairsLocation);
|
if (DiscordTokens?.Any() ?? false)
|
||||||
|
foreach (var dt in DiscordTokens)
|
||||||
if (config.DiscordTokens?.Any() ?? false)
|
|
||||||
foreach (var dt in config.DiscordTokens)
|
|
||||||
{
|
{
|
||||||
var d = new DiscordInterface.DiscordInterface();
|
var d = new DiscordInterface.DiscordInterface();
|
||||||
await d.Init(dt);
|
await d.Init(dt);
|
||||||
ProtocolInterfaces.ProtocolList.discords.Add(d);
|
ProtocolInterfaces.ProtocolList.discords.Add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.TwitchConfigs?.Any() ?? false)
|
if (TwitchConfigs?.Any() ?? false)
|
||||||
foreach (var tc in config.TwitchConfigs)
|
foreach (var tc in TwitchConfigs)
|
||||||
{
|
{
|
||||||
var t = new TwitchInterface.TwitchInterface();
|
var t = new TwitchInterface.TwitchInterface();
|
||||||
await t.Init(tc);
|
await t.Init(tc);
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Privacy Policy";
|
|
||||||
}
|
|
||||||
<h1>@ViewData["Title"]</h1>
|
|
||||||
|
|
||||||
<p>Use this page to detail your site's privacy policy.</p>
|
|
Loading…
Reference in New Issue
Block a user