protected override async Task OnMessageAsync(MessageEvent ev) { var textMessage = (ev.Message as TextEventMessage); if (textMessage == null) { return; } if (textMessage.Text == "RegisterMenu") { var debugUser = ConfigurationManager.AppSettings["DebugUser"]; if (debugUser != null && debugUser == ev.Source.UserId) { var menuManager = new BingoMenuManager(_messagingClient); await menuManager.RegisterBingoMenuAsync(); await _messagingClient.ReplyMessageAsync(ev.ReplyToken, "Registerd Bingo Menus."); return; } } var user = await _messagingClient.GetUserProfileAsync(ev.Source.UserId); await TalkAsync(ev.ReplyToken, user, textMessage.Text); }
protected override async Task OnIntentRequestAsync(Intent intent, Session session, CancellationToken cancellationToken) { switch (intent.Name) { case "Clova.GuideIntent": Response .AddText("LINEに入力をした内容をしゃべります。準備はいいですか?") .KeepListening(); break; case "Clova.YesIntent": case "ReadyIntent": // 友だち追加チェック try { await LineMessagingClient.GetUserProfileAsync(session.User.UserId); } catch { Response.AddText("連携するLINEアカウントが友だち追加されていません。" + "Clovaアプリの本スキルのページから、連携するLINEアカウントを友だち追加してください。"); break; } await DurableClient.StartNewAsync(nameof(ClovaFunctions.WaitForLineInput), session.User.UserId); Response.AddText("LINEに入力をした内容をしゃべります。好きな内容をLINEから送ってね。"); // 無音無限ループに入る KeepClovaWaiting(); break; case "Clova.PauseIntent": // 無限ループ中の一時停止指示に対し、スキル終了をする await DurableClient.TerminateAsync(session.User.UserId, "intent"); Response.AddText("腹話術を終了します。"); break; case "Clova.NoIntent": case "Clova.CancelIntent": case "NotReadyIntent": // オーケストレーターが起動していないなら終了 var status = await DurableClient.GetStatusAsync(session.User.UserId); if (status?.RuntimeStatus == OrchestrationRuntimeStatus.ContinuedAsNew || status?.RuntimeStatus == OrchestrationRuntimeStatus.Pending || status?.RuntimeStatus == OrchestrationRuntimeStatus.Running) { Response.AddText("腹話術を終了します。"); } else { KeepClovaWaiting(); } break; } }
/// <summary> /// Get User Profile details from Line /// </summary> /// <param name="userId">User Id</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public async Task <UserProfile> GetUserProfileAsync(string userId) { if (string.IsNullOrWhiteSpace(userId)) { throw new ArgumentNullException(nameof(userId)); } return(await _lineMessagingClient.GetUserProfileAsync(userId).ConfigureAwait(false)); }
public async Task <object> GetProfile(string userid) { return(await _lineMessagingClient.GetUserProfileAsync(userid).ConfigureAwait(false)); }
public async Task <object> GetProfile(string lineChannelAccessToken, string userid) { _lineMessagingClient = new LineMessagingClient(lineChannelAccessToken); return(await _lineMessagingClient.GetUserProfileAsync(userid).ConfigureAwait(false)); }