public Task Avatar([DisallowNull] FileBox file) { if (Logger.IsEnabled(LogLevel.Trace)) { Logger.LogTrace($"avatar({file.Name})"); } if (Id != Puppet.SelfId) { throw new InvalidOperationException("set avatar only available for user self"); } return(Puppet.ContactAvatar(Id, file)); }
public Task <FileBox> Avatar() { if (Logger.IsEnabled(LogLevel.Trace)) { Logger.LogTrace("avatar()"); } try { return(Puppet.ContactAvatar(Id)); } catch (Exception exception) { Logger.LogError(exception, "avatar() failed."); return(Task.FromResult(FileBox.FromQRCode("https://u.wechat.com/EJ7pw_ug6XdWRdko3nortP0"))); } }