mirror of
https://github.com/yawaflua/PL_JusticeBot.git
synced 2025-12-09 20:09:31 +02:00
add discord bot
change net6.0 net7.0
This commit is contained in:
57
Program.cs
57
Program.cs
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user