Fixed invalid ownerids crashing bot on startup
Updated changelog, version to 6.1.3
This commit is contained in:
parent
682ecb6f08
commit
427a011590
3 changed files with 61 additions and 45 deletions
|
@ -2,6 +2,12 @@
|
|||
|
||||
*a,c,f,r,o*
|
||||
|
||||
## [6.1.3] - 05.04.2025
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bot will no longer fail to startup if ownerids are wrong
|
||||
|
||||
## [6.1.2] - 03.04.2025
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
<Version>6.1.2</Version>
|
||||
<Version>6.1.3</Version>
|
||||
|
||||
<!-- Output/build -->
|
||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||
|
|
|
@ -101,7 +101,9 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, IEService
|
|||
}
|
||||
}
|
||||
|
||||
if (_client.ShardId == 0)
|
||||
if (_client.ShardId != 0)
|
||||
return;
|
||||
|
||||
await LoadOwnerChannels();
|
||||
}
|
||||
|
||||
|
@ -165,13 +167,21 @@ public sealed class SelfService : IExecNoCommand, IReadyExecutor, IEService
|
|||
|
||||
private async Task LoadOwnerChannels()
|
||||
{
|
||||
var channels = await _creds.OwnerIds.Select(id =>
|
||||
var channels = await _creds.OwnerIds.Select(async id =>
|
||||
{
|
||||
var user = _client.GetUser(id);
|
||||
if (user is null)
|
||||
return Task.FromResult<IDMChannel>(null);
|
||||
return null;
|
||||
|
||||
return user.CreateDMChannelAsync();
|
||||
try
|
||||
{
|
||||
return await user.CreateDMChannelAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Log.Error("Unable to DM Owner {UserId} - please remove that id from the owner list", user.Id);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.WhenAll();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue