Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChatItem Util #27

Open
neverclear86 opened this issue Nov 26, 2021 · 3 comments
Open

ChatItem Util #27

neverclear86 opened this issue Nov 26, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@neverclear86
Copy link
Collaborator

メッセージのテキストjoinとかのUtil系をChatItemに関数を追加したら便利そう
もしくは少ないなら処理済みのものを要素に追加する

@neverclear86 neverclear86 added the enhancement New feature or request label Nov 26, 2021
@neverclear86
Copy link
Collaborator Author

あったら便利そうな関数を思いついたら羅列

  • getMessageText()
    • runs内のtextや絵文字を一つの文字列に結合して取得

@fu-raz
Copy link

fu-raz commented Jan 1, 2022

Right now the object is only data. So it feels a little counter intuitive to add a getMessageText() function to it. Adding the processed one to the object makes more sense.

If you're going to add a function to the object I would suggest you also have a toJSON() function. Also if you're adding the getMessageText() function, I would also love a toggle to remove the emoji. Like:

getMessageText(includeEmoji: true/false) if you know what I mean?

@FlashlightXi
Copy link

自分のチャットボット用に使用しようしているテキストjoinの関数はこんな感じです(拙くすいません)

// liveChat.on("chat", (chatItem) => {

joinedText = "";
chatItem.message.forEach(function(item) {
    textItem = "";
    if ("emojiText" in item) {
        textItem = item.emojiText;
    } else if ("text" in item) {
        textItem = item.text;
    }
    joinedText += textItem;
});

// });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants