File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44riderModule.iml
55/DisBot.DiscordBot /appsettings.json
66/DisBot.DiscordBot /appsettings.Development.json
7+ /DisBot.API /appsettings.json
8+ /DisBot.API /appsettings.Development.json
9+ /DisBot.DiscordBot /appsettings.Development.json
710/_ReSharper.Caches /
8- Docker /.env
11+ Docker /.env
Original file line number Diff line number Diff line change 1+ using Microsoft . AspNetCore . Mvc ;
2+ using Microsoft . OpenApi ;
3+ using Shared . Helper ;
4+
5+ namespace DisBot . API . Controller . Http . General ;
6+
7+ [ ApiController ]
8+ [ Route ( "/" ) ]
9+ public class IndexController : ControllerBase
10+ {
11+ [ HttpGet ]
12+ public async Task < ActionResult < object > > Get ( )
13+ {
14+ return new
15+ {
16+ version = await GitHubHelper . FetchLatestTagAsync ( ) ,
17+ status = "ok" ,
18+ docs = "https://docs.disbot.app/doc/api-2xx3snx3sb"
19+ } ;
20+ }
21+ }
Original file line number Diff line number Diff line change @@ -18,6 +18,5 @@ private static async Task InitialiseBase(this WebApplicationBuilder builder)
1818 private static async Task LoadBase ( this WebApplication application )
1919 {
2020 application . MapOpenApi ( ) ;
21- application . UseHttpsRedirection ( ) ;
2221 }
2322}
Original file line number Diff line number Diff line change @@ -12,11 +12,18 @@ private static async Task InitialiseDatabase(this WebApplicationBuilder builder)
1212
1313 private static async Task LoadDatabase ( this WebApplication application )
1414 {
15+ application . Logger . Log ( LogLevel . Information , "Loading database..." ) ;
16+
1517 await using var scope = application . Services . CreateAsyncScope ( ) ;
1618 var dataContext = scope . ServiceProvider . GetService < DataContext > ( ) ;
1719 var migrations = await dataContext . Database . GetPendingMigrationsAsync ( ) ;
1820 if ( dataContext == null ) throw new Exception ( "No Database Context found..." ) ;
21+ application . Logger . Log ( LogLevel . Information , "Database initialized." ) ;
1922 if ( migrations . ToArray ( ) . Length > 0 )
23+ {
2024 await dataContext . Database . MigrateAsync ( ) ;
25+ application . Logger . Log ( LogLevel . Information , "Database migrated." ) ;
26+ }
27+ application . Logger . Log ( LogLevel . Information , "Database ready to accept connections." ) ;
2128 }
2229}
Original file line number Diff line number Diff line change 4040 <Content Include =" ..\.dockerignore" >
4141 <Link >.dockerignore</Link >
4242 </Content >
43+ <Content Update =" appsettings.json" >
44+ <ExcludeFromSingleFile >true</ExcludeFromSingleFile >
45+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
46+ <CopyToPublishDirectory >PreserveNewest</CopyToPublishDirectory >
47+ </Content >
4348 </ItemGroup >
4449
4550 <ItemGroup >
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public static partial class Startup
1515{
1616 private static async Task InitialiseBot ( this HostApplicationBuilder builder )
1717 {
18- var version = await GitHubHelper . FetchLatestTag ( ) ;
18+ var version = await GitHubHelper . FetchLatestTagAsync ( ) ;
1919
2020 builder . Services
2121 . AddApplicationCommands ( )
@@ -40,7 +40,7 @@ private static async Task InitialiseBot(this HostApplicationBuilder builder)
4040 | GatewayIntents . DirectMessageReactions
4141 | GatewayIntents . GuildMessageReactions
4242 | GatewayIntents . Guilds
43- | GatewayIntents . GuildPresences
43+ // | GatewayIntents.GuildPresences
4444 | GatewayIntents . GuildVoiceStates
4545 | GatewayIntents . GuildMessages
4646 | GatewayIntents . DirectMessages
Original file line number Diff line number Diff line change 1+ using DisBot . DiscordBot . Database ;
2+ using Microsoft . Extensions . DependencyInjection ;
13using Microsoft . Extensions . Hosting ;
24
35namespace DisBot . DiscordBot . Startup ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public static class GitHubHelper
88{
99 public static readonly HttpClient HttpClient = new HttpClient ( ) ;
1010
11- public static async Task < string > FetchLatestTag ( )
11+ public static async Task < string > FetchLatestTagAsync ( )
1212 {
1313 HttpClient . DefaultRequestHeaders . Add ( "User-Agent" , "DisBot-Github Helper" ) ;
1414 var data = await HttpClient . GetFromJsonAsync < GitHubTag [ ] > (
You can’t perform that action at this time.
0 commit comments