Aika saƙo ga masu amfani da Telegram daga Rasberi Pi

sakon waya

Idan kai mai amfani da wayoyin zamani ne, tabbas zaka san cewa daya daga cikin kwatankwacin kuma shahararrun aikace-aikacen WhatsApp shine Telegram, a sosai m saƙon saƙon abokin ciniki wanda ke gabatar da abubuwa daban-daban kamar yiwuwar iya amfani da lambar waya iri ɗaya daga na'urori daban-daban lokaci guda. Godiya madaidaiciya ga wannan fasalin, a yau ina son gabatar muku da ƙaramin darasi wanda zaku iya aika saƙonnin rubutu da shi har ma da fayilolin multimedia zuwa lambobinku daga Rasberi Pi.

Abinda yafi ban sha'awa shine gaskiyar cewa zamu iya saita Rasberi na Pi domin, kafin wani umarnin da Telegram ya karɓa, katin mu na iya motsa jiki ƙarin aiki, ma'ana, bari muyi tunanin cewa mun aika kalmar «photo»Kuma wannan yana bamu hoto na kowane daki a cikin gidan,«haske»Don kunna kowane haske ta atomatik ko«bude baki»Don buɗe kofar garejin kai tsaye

Wannan ƙarin aikin tabbas ya ja hankalin ku. Idan haka ne, zamu sauka zuwa aiki amma ba kafin mu fada muku cewa zamu buƙaci Rasberi Pi B ko Rasberi Pi B + don aiwatar da aikin da kuma katin 8 GB Class 10 microSD tare da sabuwar sigar Raspbian da aka riga aka girka.

Da zarar mun sami duk abubuwan da ke sama, zamu fara kuma daga wani Terminal Muna farawa tare da sabuntawa da daidaitaccen tsari. Tabbas za a sami masu amfani da yawa waɗanda ba sa buƙatar wannan amma mun fi kyau mu yi komai mataki-mataki kuma bisa kyakkyawar hanya don kada mu tsallake komai. Muna farawa da gudana da sabunta abubuwan fakiti tare da:

sudo apt-get update
sudo apt-get upgrade

Muna ci gaba da sanyawa da sabunta wasu ɗakunan karatu masu mahimmanci inda tsarin zai sami duk ɗakunan karatu da muke buƙata

sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 li-blua5.2-dev libevent-dev make

Canja wurin wurin ajiyewa GitHub

git clone --recursive https://github.com/vysheng/td.git && cd tg
./configure
make

sakon waya

Da zarar mun girka komai, lokaci yayi da za mu daidaita lua, harshe mai saurin rubutu da sauri. Aikin gabatarwa yana da sauƙi, a cikin Terminal ɗin da muke aiwatarwa:

sudo nano /home/pi/tg/action.lua

kuma mun ƙara waɗannan abubuwan masu zuwa:

function on_msg_receive (msg)
      if msg.out then
          return
      end
      if (msg.text=='ping') then
         send_msg (msg.from.print_name, 'pong', ok_cb, false)
      end
  end
   
  function on_our_id (id)
  end
   
  function on_secret_chat_created (peer)
  end
   
  function on_user_update (user)
  end
   
  function on_chat_update (user)
  end
   
  function on_get_difference_end ()
  end
   
  function on_binlog_replay_end ()
  end

Tare da abin da ke sama, da mun kusan daidaita komai ta yadda, lokacin da muka aika rubutun «ping»Wannan zai dawo«pong".

Muna matsawa zuwa tg directory

cd /home/pi/tg

Muna aiwatar da wannan tsari

bin/telegram-cli -k tg-server.pub -W -s action.lua

Yanzu ne lokacin fara gwaji da ƙaddamar da «ping»Zuwa Telegram, nan da nan daga baya kuma kamar yadda kuke gani a hoto amsar amsar da muke tsammani«pong«. Dole ne muyi la'akari idan muna amfani da manyan baƙaƙe ko a'a tunda tsarin yana da masaniyar amfani da shi.

Idan abin da muke so shine, a maimakon "pong" Rasberi Pi ɗinmu ya dawo da hoto, a cikin aikin da muke aika amsa sai kawai muyi gaya wa tsarin suyi hoto ta amfani da kyamarar da aka sanya a baya kuma aika mana.

Linin: masu koyarwa


Abubuwan da ke cikin labarin suna bin ka'idodinmu na ka'idojin edita. Don yin rahoton kuskure danna a nan.

3 comments, bar naka

Bar tsokaci

Your email address ba za a buga. Bukata filayen suna alama da *

*

*

  1. Mai alhakin bayanan: Miguel Ángel Gatón
  2. Dalilin bayanan: Gudanar da SPAM, gudanar da sharhi.
  3. Halacci: Yarda da yarda
  4. Sadarwar bayanan: Ba za a sanar da wasu bayanan ga wasu kamfanoni ba sai ta hanyar wajibcin doka.
  5. Ajiye bayanai: Bayanin yanar gizo wanda Occentus Networks (EU) suka dauki nauyi
  6. Hakkoki: A kowane lokaci zaka iyakance, dawo da share bayanan ka.

  1.   Guillermo m

    Ganin yuwuwar wannan ya faru a gare ni cewa watakila zai yi kyau in sami damar amintar da kowane irin umarni zuwa rasberi na (ko kowane sabar Linux) daga sakon waya kuma in sami abin fitarwa. Ko da ƙirƙirar sunayen laƙabi na umarni don kauce wa yawan buga abubuwa da yawa, sarrafa masu amfani waɗanda zasu iya yin hakan a kan inji ɗaya ta yadda kowa ba zai iya yin abin da yake so ba ... da dai sauransu

    Na fara yi kuma a yau na buga 'Biyayya'.
    Idan wani yana son yin rikici da gwadawa, ci gaba

    https://github.com/GuillermoPena/obedience

  2.   Juan Luis Arboledas m

    Sannu Guillermo,

    Ba ni da lokaci da yawa don nazarin komai amma dole ne in gaya muku cewa yana da kyau sosai. Idan ina da lokaci a karshen wannan makon zan gwada komai don ganin yadda yake aiki.

    Na gode sosai da aikinku !!!

  3.   Jonathan m

    Sannu, kyakkyawan matsayi, ina son shi! Ina so in sani idan akwai wata hanyar da za a gudanar da rubutun .lua kai tsaye a farawa, gaisuwa!