public async Task GetAvatar(AvatarCommand avatarCommand, Contexts contexts) { var messageService = this._messagesServiceFactory.Create(contexts); if (string.IsNullOrEmpty(contexts.User.AvatarUrl)) { await messageService.SendResponse(x => x.UserDoesntHaveAvatar(contexts.User)); return; } await messageService.SendMessage(contexts.User.AvatarUrl); }
public async Task GetAvatar(AvatarCommand avatarCommand, Contexts contexts) { var messageService = this._messagesServiceFactory.Create(contexts); var user = contexts.User; if (avatarCommand.User != 0) { user = await this._usersService.GetUserByIdAsync(contexts.Server, avatarCommand.User); } if (string.IsNullOrEmpty(user.AvatarUrl)) { await messageService.SendResponse(x => x.UserDoesntHaveAvatar(user)); } await messageService.SendMessage(user.AvatarUrl); }
/** This function create a Bolt-usable AvatarCommandInput, polling the physical inputs that the game is receiving. */ public IAvatarCommandInput CreateCommandInput() { // we create the new command input IAvatarCommandInput avatarCommandInput = AvatarCommand.Create(); // we check the physical state of each input physicalInputPoller.Poll(); // we copy the data we gathered with the poll, into the command input avatarCommandInput.MoveUp = physicalInputPoller.isUpButtonDown; avatarCommandInput.MoveDown = physicalInputPoller.isDownButtonDown; avatarCommandInput.MoveLeft = physicalInputPoller.isLeftButtonDown; avatarCommandInput.MoveRight = physicalInputPoller.isRightButtonDown; avatarCommandInput.Fire1 = physicalInputPoller.isAction1ButtonDown; avatarCommandInput.Fire2 = physicalInputPoller.isAction2ButtonDown; avatarCommandInput.Fire3 = physicalInputPoller.isAction3ButtonDown; return(avatarCommandInput); }