Skip to content

Instantly share code, notes, and snippets.

@rotoshine
Created June 12, 2015 05:34
Show Gist options
  • Select an option

  • Save rotoshine/fbbfc14ecfbad1b7bd97 to your computer and use it in GitHub Desktop.

Select an option

Save rotoshine/fbbfc14ecfbad1b7bd97 to your computer and use it in GitHub Desktop.

Revisions

  1. rotoshine created this gist Jun 12, 2015.
    74 changes: 74 additions & 0 deletions gistfile1.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,74 @@
    assembler = {}
    function on_msg_receive (msg)
    print_r(msg)
    local chat_name = msg.to.print_name
    local username = msg.from.print_name
    local receive_msg = string.lower(msg.text)
    if ( string.find(receive_msg, "assemble!") or string.find(receive_msg, "어셈블!") ) then
    assembler[username] = username
    local assemble_users = "";
    for k, v in pairs(assembler) do
    assemble_users = assemble_users .. k .. " "
    end
    send_msg_default(chat_name, "오늘의 어셈블러들 : " .. assemble_users)
    return
    elseif ( receive_msg == "assemble reset" or receive_msg == "어셈블 리셋" ) then
    assembler = {};
    send_msg_default(chat_name, "어셈블이 초기화되었다 임마.")
    elseif ( msg.from.username == "awevengers" ) then
    if ( string.find(receive_msg,"ㅎㅇ") ) then
    send_msg_default(chat_name, "ㅃㅇ")
    elseif ( string.find(receive_msg, "") ) then
    fxxk_string = "";
    for i = 1, string.len(receive_msg) + 1 do
    if( string.sub(receive_msg, i, i + 1) == "") then
    fxxk_string = fxxk_string .. ""
    end
    end
    send_msg_default(chat_name, fxxk_string)
    end
    elseif ( string.find(receive_msg, "부댕해") ) then
    send_msg_default(chat_name, "퓨ㅠㅠㅠㅠㅠㅠ")
    end
    end

    function send_msg_default(chat_name, msg)
    send_msg(chat_name, msg, ok_cb, false)
    end

    function ok_cb(extra, success, result)
    end

    function print_r ( t )
    local print_r_cache={}
    local function sub_print_r(t,indent)
    if (print_r_cache[tostring(t)]) then
    print(indent.."*"..tostring(t))
    else
    print_r_cache[tostring(t)]=true
    if (type(t)=="table") then
    for pos,val in pairs(t) do
    if (type(val)=="table") then
    print(indent.."["..pos.."] => "..tostring(t).." {")
    sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
    print(indent..string.rep(" ",string.len(pos)+6).."}")
    elseif (type(val)=="string") then
    print(indent.."["..pos..'] => "'..val..'"')
    else
    print(indent.."["..pos.."] => "..tostring(val))
    end
    end
    else
    print(indent..tostring(t))
    end
    end
    end
    if (type(t)=="table") then
    print(tostring(t).." {")
    sub_print_r(t," ")
    print("}")
    else
    sub_print_r(t," ")
    end
    print()
    end