v0.2.0 [Release][Guide] Line for 3DS

Discussion in '3DS - Homebrew Development and Emulators' started by Core_2_Extreme, May 28, 2019.

  1. Core_2_Extreme
    OP

    Core_2_Extreme Member

    Newcomer
    1
    Feb 11, 2019
    Japan

    Line for 3DS beta release.(But this software don't complete and beta version)

    https://github.com/Core-2-Extreme/Line_for_3DS/releases

    If you have any questions you can ask on this discord server.
    https://discord.gg/Zmx7Euf


    This software currently can and can't:
    Send text ✅
    Send picture ❌ (I will try add it)
    Send video ❌
    Send sound ❌
    Send stamp ❌ (I will try add it)
    Receive text ✅
    Receive (View) picture ❌ (I will try add it)
    Receive (Play) video ❌
    Receive (Play) sound ❌
    Receive (View) stamp ❌ (I will try add it)
    View old log ✅ (max 300 logs)
    Auto update
    ✅ (v0.2.0)
    Group chat ✅
    Night mode ✅ (v0.2.0)



    [​IMG]



    [Guide] How to install and use

    Please access this site.
    https://developers.line.biz/en/
    Click log in.
    Click Log in with LINE account.
    Click Create New Provider.
    [​IMG]

    Enter your provider name.(your like name)
    [​IMG]
    Click Messaging API.
    [​IMG]
    Create app. (your like name)
    [​IMG]
    Click your created app.
    Find Channel access token (long-lived) and click Issue.
    [​IMG]

    Please access this site.
    https://www.google.com/intl/en_ALL/drive/
    Click Go to google drive and login.
    Right click on google drive and create Google sheets and Google apps script (2 times for Google apps script).
    [​IMG]
    Rename google apps script name "Line main" and "Line post". (or your like name)
    [​IMG]

    Open created sheets and copy sheet id
    [​IMG]
    Access token
    [​IMG]

    Copy this code to "Line main" and add your sheet ID and access token

    Code:
    var ACCESS_TOKEN = "Your access token here";
    var open_sheet_id = "Your sheet id here";
    function log_save(message, user_name, write_sheet_name)
    {
      var sheet_id = 1;
      var spreadsheet = SpreadsheetApp.openById(open_sheet_id);
      var write_sheet = spreadsheet.getSheetByName(write_sheet_name);
      if(!write_sheet)
      {
        spreadsheet.insertSheet(write_sheet_name);
      }
      write_sheet = spreadsheet.getSheetByName(write_sheet_name);
     
      while(true)
      {
       var target_sheet = write_sheet.getRange("A" + sheet_id);
       var sheet_data = target_sheet.getValue();
     
       if(sheet_data == "")
       {
         write_sheet.getRange("A" + sheet_id).setValue("" + user_name + " : " + message);
         break;
       }
       else
       {
         sheet_id++;
       }
      }
    }
    
    function doPost(e)
    {
      var date = new Date();
      var time = Utilities.formatDate( date, 'Asia/Tokyo', 'MM/dd hh:mm:ss');
      var replyToken = JSON.parse(e.postData.contents).events[0].replyToken;
      var user_message = JSON.parse(e.postData.contents).events[0].message.text;
      var url_reply = 'https://api.line.me/v2/bot/message/reply';
      var url_profile = 'https://api.line.me/v2/bot/profile/'
      var user_id = JSON.parse(e.postData.contents).events[0].source.userId;
      var group_id = JSON.parse(e.postData.contents).events[0].source.groupId;
      var type = JSON.parse(e.postData.contents).events[0].message.type;
      if(user_message == "getid")
      {
        UrlFetchApp.fetch(url_reply, {
          'headers': {
            'Content-Type': 'application/json; charset=UTF-8',
            'Authorization': 'Bearer ' + ACCESS_TOKEN,
          },
          'method': 'post',
          'payload': JSON.stringify({
            'replyToken': replyToken,
            'messages': [{
              'type': 'text',
              'text': user_id ,
            }],
            'notificationDisabled': 'true',
          }),
        });
        log_save(user_id, "BOT", "test");
      }
      else if(user_message == "getgroupid")
      {
          UrlFetchApp.fetch(url_reply, {
          'headers': {
            'Content-Type': 'application/json; charset=UTF-8',
            'Authorization': 'Bearer ' + ACCESS_TOKEN,
          },
          'method': 'post',
          'payload': JSON.stringify({
            'replyToken': replyToken,
            'messages': [{
              'type': 'text',
              'text': group_id ,
            }],
            'notificationDisabled': 'true',
          }),
        });
        log_save(group_id, "BOT", "test");
      }
     
      try
      {
        var response = UrlFetchApp.fetch(url_profile + user_id, {
          'headers': {
            'Content-Type': 'application/json; charset=UTF-8',
            'Authorization': 'Bearer ' + ACCESS_TOKEN,
          },
        });
        var profile_name = JSON.parse(response).displayName;
      }
      catch(error)
      {
        profile_name = "Unknown";
      }
     
      if(user_message == undefined)
      {
        user_message += " : " + type;
      }
      user_message += "(" + time + ")";
      if(group_id == undefined)
      {
        log_save(user_message, profile_name, user_id);
      }
      else
      {
        log_save(user_message, profile_name, group_id);
      }
     
      return;
    }
    
    function doGet(e)
    {
      var request_data = e.parameter;
      var request_id = request_data.id;
      var sheet_start;
      var data = "";
      var spreadsheet = SpreadsheetApp.openById(open_sheet_id);
      var read_sheet = spreadsheet.getSheetByName(request_id);
     
      for(var i = 1; i <= 10000000; i++)
      {
        var target_sheet = read_sheet.getRange("A" + i);
        var sheet_data = target_sheet.getValue();
        if(sheet_data == "")
        {
          if(i >= 301)
          {
            sheet_start = (i - 300);
          }
          else
          {
            sheet_start = 1;
          }
          break;
        }
     
      }
     
      for(var i = 0; i <= 299; i++)
      {
        var target_sheet = read_sheet.getRange("A" + (sheet_start + i));
        var sheet_data = target_sheet.getValue();
        data = data + sheet_data;
      }
      return ContentService.createTextOutput(data);
    }
    Then click deploy as web app and set "who has access to the app" is Anyone,even anonymous, finally click deploy.
    [​IMG]
    Next click Review permissions and select your google account.
    If "This app isn't verified" shown click Advanced and click Go to Line main (unsafe) and click allow.

    Copy this url and save.
    url ①
    [​IMG]



    Copy this code to "Line post" and add your sheet ID and access token

    Code:
    var ACCESS_TOKEN = "Your access token here";
    var open_sheet_id = "Your sheet id here";
    function log_save(message, user_name, write_sheet_name)
    {
      var sheet_id = 1;
      var spreadsheet = SpreadsheetApp.openById(open_sheet_id);
      var write_sheet = spreadsheet.getSheetByName(write_sheet_name);
      if(!write_sheet)
      {
        spreadsheet.insertSheet(write_sheet_name);
      }
      write_sheet = spreadsheet.getSheetByName(write_sheet_name);
     
      while(true)
      {
       var target_sheet = write_sheet.getRange("A" + sheet_id);
       var sheet_data = target_sheet.getValue();
     
       if(sheet_data == "")
       {
         write_sheet.getRange("A" + sheet_id).setValue("" + user_name + " : " + message);
         break;
       }
       else
       {
         sheet_id++;
       }
      }
    }
    
    function doPost(e)
    {
      var date = new Date();
      var time = Utilities.formatDate( date, 'Asia/Tokyo', 'MM/dd hh:mm:ss');
      var send_message = JSON.parse(e.postData.contents).message;
      var id = JSON.parse(e.postData.contents).to;
     
      var url = 'https://api.line.me/v2/bot/message/push';
      var url_profile = 'https://api.line.me/v2/bot/profile/'
     
        UrlFetchApp.fetch(url, {
          'headers': {
            'Content-Type': 'application/json; charset=UTF-8',
            'Authorization': 'Bearer ' + ACCESS_TOKEN,
          },
          'method': 'post',
          'payload': JSON.stringify({
        "to": id,
        "messages":
           [
            {
                "text": send_message,
                "type": "text",
             }],
            'notificationDisabled': 'false',
          }),
        });
     
     
      send_message += "(" + time + ")";
      log_save(send_message, "BOT(3DS)" , id);
      return;
    }

    Then click deploy as web app and set "who has access to the app" is Anyone,even anonymous finally click deploy.
    [​IMG]
    Next click Review permissions and select your google account.
    If "This app isn't verified" shown click Advanced and click Go to Line post (unsafe) and click allow.

    Copy this url and save.
    url ②
    [​IMG]



    3DS
    Download this
    https://github.com/Core-2-Extreme/Line_for_3DS/releases

    start app and press X button.
    First, type url ①
    Second, type url ②

    How to add friend
    [​IMG]

    Please add your bot QR code your friends.
    And type "getid".


    3DS
    Press Y button and type ID.
    [​IMG]

    • Only v0.1.0
      If you finished type you have to restart line app.
      After restart you can send and receive message.


    Control
    A
    : Send message
    B : Update log
    X : URL setting
    Y : Add id
    CPAD(Slide pad) UP, DOWN, LEFT and RIGHT : Move message
    L and R : Change text size
    DPAD(Analog pad) UP and DOWN : Change text interval
    DPAD(Analog pad) LEDT and RIGHT : Change id
    Start -> A : Exit app

    Enjoy!
     
    Last edited by Core_2_Extreme, Jun 16, 2019
  2. BORTZ

    BORTZ The Amazing

    Supervisor
    22
    GBAtemp Patron
    BORTZ is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Dec 2, 2007
    United States
    Pittsburgh
    This is the kinda homebrew I love to see. Nice work, OP.
     
    Core_2_Extreme likes this.
  3. Issac

    Issac I

    Supervisor
    14
    GBAtemp Patron
    Issac is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Apr 10, 2004
    Sweden
    Sweden
    Wow, really cool! Nice work!

    Edit:
    Do you have any plans to try to implement stamps? Or the other features that it can't do right now :)
     
    Last edited by Issac, May 28, 2019
    Core_2_Extreme likes this.
  4. pilladoll

    pilladoll GBAtemp Regular

    Member
    4
    Nov 14, 2004
    Mexico
    Somewhere in cyberspace
    Nice!
     
    Core_2_Extreme likes this.
  5. Core_2_Extreme
    OP

    Core_2_Extreme Member

    Newcomer
    1
    Feb 11, 2019
    Japan

    I will try add picture and stamp view. (and send)
    But I don't know it's possible.
     
  6. Issac

    Issac I

    Supervisor
    14
    GBAtemp Patron
    Issac is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Apr 10, 2004
    Sweden
    Sweden
    I don't know how Line works, but it feels like it shouldn't be impossible :) What happens in the 3DS if you send a stamp or picture from the phone?
     
    Core_2_Extreme likes this.
  7. Core_2_Extreme
    OP

    Core_2_Extreme Member

    Newcomer
    1
    Feb 11, 2019
    Japan
    Send from 3DS
    3DS -> Google server -> LINE server -> line app
    Send from line app
    line app -> LINE server -> Google server -> save to message log google server -> 3DS(Request data to google and receive data)

    I will write tutorial how to use line on 3DS. But it will write a little later.

    If you send picture, video, sound, or stamp. 3DS will be displayed "undefined".
    PC
    [​IMG]

    3DS
    [​IMG]
     
    Issac likes this.
  8. Issac

    Issac I

    Supervisor
    14
    GBAtemp Patron
    Issac is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Apr 10, 2004
    Sweden
    Sweden
    Thank you! That's interesting :)
     
    Core_2_Extreme likes this.
  9. samhhhhh

    samhhhhh GBAtemp Regular

    Member
    1
    Mar 9, 2019
    United Kingdom
    This looks awesome!

    How'd you do this?

    I'd be interested to see if something similar could be done w/ Discord, but this is genuinely awesome this is what homebrew this community needs.
     
    Core_2_Extreme likes this.
  10. lone_wolf323

    lone_wolf323 GBAtemp Addict

    Member
    8
    May 27, 2011
    Canada
    discord was already done. and it was shown that it could and highly likely ban your discord account using it.
     
    Core_2_Extreme likes this.
  11. samhhhhh

    samhhhhh GBAtemp Regular

    Member
    1
    Mar 9, 2019
    United Kingdom
    Oh yeah I'm aware but I was thinking ab a client w/ WebSockets
     
    Core_2_Extreme likes this.
  12. Zurdonx

    Zurdonx Member

    Newcomer
    2
    Oct 2, 2018
    Venezuela
    Looks interesting. Great work!
     
    Core_2_Extreme likes this.
  13. HIDE810

    HIDE810 Member

    Newcomer
    1
    Apr 22, 2019
    Japan
    Japan
    Nice work!:D
     
    Core_2_Extreme likes this.
  14. triplekiller
    This message by triplekiller has been removed from public view by Quantumcat, Jun 14, 2019, Reason: Empty/bumping.
    Jun 13, 2019
  15. samhhhhh
    This message by samhhhhh has been removed from public view by Quantumcat, Jun 14, 2019, Reason: Reply to deleted post.
    Jun 13, 2019
Loading...