Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 45 additions & 35 deletions Lagrange.OneBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,42 @@ public static async Task Main(string[] args)
?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion;

Console.ForegroundColor = ConsoleColor.Magenta;
if (Console.BufferWidth >= 45)
try
{
Console.WriteLine(
$$"""
__
/ / ___ ____ ________ ____ ___ ____
/ /_/ _ `/ _ `/ __/ _ `/ _ \/ _ `/ -_)
/____|_,_/\_, /_/ \_,_/_//_/\_, /\__/
/___/ ____ /___/__ __
/ __ \___ ___ / _ )___ / /_
/ /_/ / _ \/ -_) _ / _ \/ __/
\____/_//_/\__/____/\___/\__/
"""
);
}
else
Console.WriteLine("Lagrange.OneBot");

Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Magenta;
if (Console.BufferWidth >= 45)
{
Console.WriteLine(
$$"""
__
/ / ___ ____ ________ ____ ___ ____
/ /_/ _ `/ _ `/ __/ _ `/ _ \/ _ `/ -_)
/____|_,_/\_, /_/ \_,_/_//_/\_, /\__/
/___/ ____ /___/__ __
/ __ \___ ___ / _ )___ / /_
/ /_/ / _ \/ -_) _ / _ \/ __/
\____/_//_/\__/____/\___/\__/
"""
);
}
else
Console.WriteLine("Lagrange.OneBot");

Console.WriteLine($"Version: {version?[^40..] ?? "unknown"}\n");
Console.ResetColor();
Console.WriteLine($"Version: {version?[^40..] ?? "unknown"}\n");
}
catch (IOException)
{
}


// AutoUpdate
var updater = new Updater.GithubUpdater();
await updater.GetConfig();
if (updater.Config.EnableAutoUpdate)
{
Console.WriteLine("Auto update enabled, Checking for updates...");
try
{
Console.WriteLine("Auto update enabled, Checking for updates...");
if (await updater.CheckUpdate())
{
Console.WriteLine($"Update available, downloading...");
Expand Down Expand Up @@ -80,22 +84,28 @@ public static async Task Main(string[] args)

if (!File.Exists("appsettings.json"))
{
Console.WriteLine("No exist config file, create it now...");
try
{
Console.WriteLine("No exist config file, create it now...");

var assm = Assembly.GetExecutingAssembly();
using var istr = assm.GetManifestResourceStream(
"Lagrange.OneBot.Resources.appsettings.json"
)!;
using var temp = File.Create("appsettings.json");
istr.CopyTo(temp);
var assm = Assembly.GetExecutingAssembly();
using var istr = assm.GetManifestResourceStream(
"Lagrange.OneBot.Resources.appsettings.json"
)!;
using var temp = File.Create("appsettings.json");
istr.CopyTo(temp);

istr.Close();
temp.Close();
istr.Close();
temp.Close();

Console.WriteLine(
"Please Edit the appsettings.json to set configs and press any key to continue"
);
Console.ReadKey(true);
Console.WriteLine(
"Please Edit the appsettings.json to set configs and press any key to continue"
);
Console.ReadKey(true);
}
catch (IOException)
{
}
}

await Host.CreateApplicationBuilder()
Expand Down