Event: CHAT

Follow

Comments

19 comments

  • Avatar
    Wesley Bellah

    So, does this still include the chat id in the object?? (I can't test cuz plug is still in maintenance atm, but a script I have has a bunch of different parts of code that use that chat id when needing to delete the message via moderateDeleteChat.

    Thanks for these updates by the way!

  • Avatar
    FourBit

    chatID has been replaced with cid

  • Avatar
    Darius

    Norlm.

  • Avatar
    Fabricio20

    data.cid is not working and data.chatid too, what i need to use to delete the chat message?

  • Avatar
    FourBit

    Here is what you're looking for:
    API.on(API.CHAT, function(data){
    if(/whatever you're looking for in chat/){
    API.moderateDeleteChat(data.cid);
    //do whatever else
    }
    });

    Cheers,
    FourBit

  • Avatar
    Fabricio20

    data.cid is not working actually. the chat doesn't get deleted.

  • Avatar
    Colin

    Same for me, API.moderateDeleteChat(data.cid); is not working.

  • Avatar
    FourBit

    I think it hasn't been updated for the new site yet. It is also expected because each message has a new "format" for the chatid.

  • Avatar
    FourBit

    Getting user ids from the chat obj isn't working.
    Here's what I'm doing:
    http://pastebin.com/6jH2J5ej

    a.uid returns "undefined" even though up there is says that it returns the userID

  • Avatar
    Narcis

    Please admins remove HTML from .message
    If I type message example
    "Hello world :D",
    the .message is
    "Hello wolrd <span class="emoji emoji-1f600"></span>"

    Update it please.

  • Avatar
    skintkingle

    I agree with David Lences, I would like the unformatted original message sent across. maybe as an additional field holding the original, unformatted message.

  • Avatar
    FourBit

    You could just
    var msg = $('#chat-messages').children('[data-cid="'+data.cid+'"]);
    Which returns the message html

  • Avatar
    skintkingle

    this does indeed give me back the entry on the client, the problem being that innerHTML gives me just as much, if not more HTML formatting for that entry, and textContent has no recollection of the emoji. (as far as the browser is concerned, the emoji is not text, so this makes sense) This does not get me the original message content. I am after, for example "Hahaha :eyes:" should return me "Hahaha :eyes:" and not, as it currently does. "Hahaha <span class="emoji-glow"><span class="emoji emoji-1f440"></span></span>"

  • Avatar
    Grant Sommer

    When I put an API.sendChat(data.un+" has sent the command!");
    In
    API.on(API.CHAT, function(data){
    if(data.type === "message" && data.message === "!commands"){
    API.moderateDeleteChat(data.cid);
    }
    });
    Tons of stuff pops up then in chat it says "System Alert: If you keep this going you will be temp. banned from this site."

  • Avatar
    Aedificavit

    @Grant Sommer

    API.on(API.CHAT, function(data){
    var id = data.uid;
    var msg = data.message;
    var role = API.getUser(id).role;
    /* method what i use to see emote,message etc. content*/
    if(msg.indexOf("!commands") == 0 && role >=0){
    API.moderateDeleteChat(data.cid);
    API.sendChat(data.un+" has sent the command!");
    }
    });

    Maybe?
    [Not sure]

  • Avatar
    Grant Sommer

    @FactusFox

    That will repeat 3 times in chat with a lot of Chat is running in slow mode. You can send your message in 1 second.

  • Avatar
    Brian

    is the chat method not working for anyone else? I can't get my bot to recognize chat events all of a sudden...?

  • Avatar
    Aedificavit

    @Grant Sommer

    function name(data) {
    var id = data.uid;
    var msg = data.message;
    var username = data.un;
    var role = API.getUser(id).role;
    /* method what i use to see emote,message etc. content*/
    if(msg.indexOf("!commands") == 0 && role >=0) {
    API.moderateDeleteChat(data.cid);
    API.sendChat(username +" has sent the command!");
    }}
    API.on(API.CHAT, name);
    ?

    @Brian

    For me it works fine.

  • Avatar
    Benjamin

    API.on(API.sendChat("msg")); //Sends a message as the user

    API.on(API.chatLog("msg")); //Places a mess in the chat log (Only the user can see it)

Please sign in to leave a comment.

Powered by Zendesk