Docker sync finished
This commit is contained in:
parent
70235f361a
commit
5e0939db3d
7 changed files with 50 additions and 32 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,6 +3,7 @@
|
||||||
##
|
##
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
config.json
|
config.json
|
||||||
|
launchSettings.json
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.rsuser
|
*.rsuser
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,16 @@
|
||||||
using DSharpPlus;
|
using DSharpPlus;
|
||||||
using DSharpPlus.CommandsNext;
|
using DSharpPlus.CommandsNext;
|
||||||
using DSharpPlus.EventArgs;
|
using DSharpPlus.EventArgs;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bot_Discord_CSharp.Dto;
|
|
||||||
using Bot_Discord_CSharp.Commands;
|
using Bot_Discord_CSharp.Commands;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using DSharpPlus.Interactivity;
|
using DSharpPlus.Interactivity;
|
||||||
using DSharpPlus.Interactivity.Extensions;
|
using DSharpPlus.Interactivity.Extensions;
|
||||||
using DSharpPlus.Entities;
|
using DSharpPlus.Entities;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Bot_Discord_CSharp.Dto;
|
||||||
|
|
||||||
namespace Bot_Discord_CSharp
|
namespace Bot_Discord_CSharp
|
||||||
{
|
{
|
||||||
|
|
@ -25,22 +23,18 @@ namespace Bot_Discord_CSharp
|
||||||
public async Task RunAsync()
|
public async Task RunAsync()
|
||||||
{
|
{
|
||||||
string token, prefix;
|
string token, prefix;
|
||||||
if (!Environment.GetEnvironmentVariables().Contains("TOKEN"))
|
if (Environment.GetEnvironmentVariable("TOKEN") != null)
|
||||||
{
|
|
||||||
var json = string.Empty;
|
|
||||||
|
|
||||||
using (var fs = File.OpenRead(@"E:\Proyectos Visual Studio\Bot_Discord_CSharp\Bot_Discord_CSharp\config.json"))
|
|
||||||
using (var sr = new StreamReader(fs, new UTF8Encoding(false)))
|
|
||||||
json = await sr.ReadToEndAsync().ConfigureAwait(false);
|
|
||||||
|
|
||||||
var configJson = JsonConvert.DeserializeObject<ConfigDto>(json);
|
|
||||||
token = configJson.Token;
|
|
||||||
prefix = configJson.Prefix;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
token = Environment.GetEnvironmentVariable("TOKEN");
|
token = Environment.GetEnvironmentVariable("TOKEN");
|
||||||
prefix = Environment.GetEnvironmentVariable("PREFIX");
|
prefix = Environment.GetEnvironmentVariable("PREFIX");
|
||||||
|
Console.WriteLine(0);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ProfilesDto profiles = JsonConvert.DeserializeObject<ProfilesDto>(System.IO.File.ReadAllText("./launchSettings.json"));
|
||||||
|
SecretsDto secrets = profiles.Bot_Discord_CSharp.EnvironmentVariables.Secrets;
|
||||||
|
token = secrets.Token;
|
||||||
|
prefix = secrets.Prefix;
|
||||||
|
Console.WriteLine(System.IO.File.ReadAllText("./launchSettings.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = new DiscordConfiguration
|
var config = new DiscordConfiguration
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
|
|
@ -6,14 +6,18 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DSharpPlus" Version="4.0.0-nightly-00760" />
|
<PackageReference Include="DSharpPlus" Version="4.0.0-rc1" />
|
||||||
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.0.0-nightly-00760" />
|
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.0.0-rc1" />
|
||||||
<PackageReference Include="DSharpPlus.Interactivity" Version="4.0.0-nightly-00760" />
|
<PackageReference Include="DSharpPlus.Interactivity" Version="4.0.0-rc1" />
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.28" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.11.28" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ProjectExtensions><VisualStudio><UserProperties config_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
|
<ItemGroup>
|
||||||
|
<Folder Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,6 @@ WORKDIR /app
|
||||||
COPY --from=build-env /app/out .
|
COPY --from=build-env /app/out .
|
||||||
|
|
||||||
#COPY config.json ./
|
#COPY config.json ./
|
||||||
|
COPY Properties/launchSettings.json ./
|
||||||
|
|
||||||
ENTRYPOINT ["dotnet", "Bot_Discord_CSharp.dll"]
|
ENTRYPOINT ["dotnet", "Bot_Discord_CSharp.dll"]
|
||||||
|
|
@ -5,11 +5,29 @@ using System.Text;
|
||||||
|
|
||||||
namespace Bot_Discord_CSharp.Dto
|
namespace Bot_Discord_CSharp.Dto
|
||||||
{
|
{
|
||||||
class ConfigDto
|
class ProfilesDto
|
||||||
{
|
{
|
||||||
[JsonProperty("token")]
|
[JsonProperty("profiles")]
|
||||||
|
public Bot_Discord_CSharpDto Bot_Discord_CSharp { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bot_Discord_CSharpDto
|
||||||
|
{
|
||||||
|
[JsonProperty("Bot_Discord_CSharp")]
|
||||||
|
public EnvironmentVariablesDto EnvironmentVariables { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class EnvironmentVariablesDto
|
||||||
|
{
|
||||||
|
[JsonProperty("environmentVariables")]
|
||||||
|
public SecretsDto Secrets { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class SecretsDto
|
||||||
|
{
|
||||||
|
[JsonProperty("TOKEN")]
|
||||||
public string Token { get; private set; }
|
public string Token { get; private set; }
|
||||||
[JsonProperty("Prefix")]
|
[JsonProperty("PREFIX")]
|
||||||
public string Prefix { get; private set; }
|
public string Prefix { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
using Microsoft.AspNetCore.Hosting;
|
namespace Bot_Discord_CSharp
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace Bot_Discord_CSharp
|
|
||||||
{
|
{
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
bot:
|
bot:
|
||||||
build: .
|
build: .
|
||||||
image: mydiscordbot
|
image: mydiscordbot
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue