Fix Initial Setup issues
This commit is contained in:
parent
0e217b8db1
commit
38eb9f02a1
1 changed files with 18 additions and 5 deletions
|
@ -206,12 +206,25 @@ namespace Geekbot.net
|
||||||
private async Task<Task> FinishSetup()
|
private async Task<Task> FinishSetup()
|
||||||
{
|
{
|
||||||
var appInfo = await client.GetApplicationInfoAsync();
|
var appInfo = await client.GetApplicationInfoAsync();
|
||||||
redis.StringSet("botOwner", appInfo.Owner.Id);
|
logger.Information($"[Setup] Just a moment while i setup everything {appInfo.Owner.Username}");
|
||||||
|
try
|
||||||
var req = HttpWebRequest.Create(appInfo.IconUrl);
|
|
||||||
using (Stream stream = req.GetResponse().GetResponseStream() )
|
|
||||||
{
|
{
|
||||||
await client.CurrentUser.ModifyAsync(Avatar => new Image(stream));
|
redis.StringSet("botOwner", appInfo.Owner.Id);
|
||||||
|
var req = HttpWebRequest.Create(appInfo.IconUrl);
|
||||||
|
using (Stream stream = req.GetResponse().GetResponseStream())
|
||||||
|
{
|
||||||
|
await client.CurrentUser.ModifyAsync(User =>
|
||||||
|
{
|
||||||
|
User.Avatar = new Image(stream);
|
||||||
|
User.Username = appInfo.Name.ToString();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
logger.Information($"[Setup] Everything done, enjoy!");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.Warning(e, $"[Setup] Oha, it seems like something went wrong while running the setup");
|
||||||
|
logger.Warning(e, $"[Setup] Geekbot will work never the less, some features might be disabled though");
|
||||||
}
|
}
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue