add discord bot

change net6.0 net7.0
This commit is contained in:
Дмитрий Шиманский
2023-10-26 11:35:42 +03:00
parent 7c6fafa9e6
commit 9a8a4cad5d
35 changed files with 1132 additions and 37 deletions

View File

@@ -1,25 +1,40 @@
var builder = WebApplication.CreateBuilder(args);
namespace DiscordApp;
// Add services to the container.
builder.Services.AddRazorPages();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
public class Program
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
static void Main()
{
/**
Discord.Discord discord = new("MTE1Mjk0Njg2NTMwNjg4MjExOA.GL4wd6.XXhH5cam_zhxBCGYKJI-Z1IfbUQ5J-80H5Jpds");
Console.WriteLine("Hello! Starts discord bot...");
discord.InitBot().GetAwaiter().GetResult();
**/
Console.WriteLine("Starts Web-API...");
CreateHostBuilder()
.Build()
.Run();
}
private static IHostBuilder CreateHostBuilder()
{
return Host.CreateDefaultBuilder()
.ConfigureWebHostDefaults(webHost => {
webHost.UseStartup<Startup>();
webHost.UseKestrel(kestrelOptions => { kestrelOptions.ListenAnyIP(80); });
});
}
public static bool IsDebug()
{
#if DEBUG
return true;
#else
return false;
#endif
}
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();