We can allow only 30 participants , Right now 550 registered . Kindly look for upcoming free events , if you unable to get email confirmation
-
-
පලවෙනියටම ස්තූතිවන්ත වෙන්න ඕනි Sayumi Amarasinghe අක්කට මේ වගේම Telegram Bot කෙනෙක් JSON වලින් හදන හැටි කියලා දුන්නට 🙂
අද මම කියලා දෙන්න යන්නේ ඒ වගේම Telegram Bot කෙනෙක් Python වලින් හදන හැටි 🙃
අපි පිලිවෙලට මුල ඉදන් වැඩේ කරමු. හොදේ 🙂මුලින්ම මේ වැඩේට ඉතිං ඔයා Telegram ඇප් එක ඩවුන්ලෝඩ් කරන් ඉන්නෝනි. ඒක මෙන්න මේ ලිංක් එකෙන් කරගන්න පුලුවනි.
Account එකක් හදන වැඩේ නම් මම කියලා දෙන්නේ නෑ.ඒක ඉතිං ඔයා තනියම කරගන්න.තනියම කරගන්නත් එකක් තියෙන්න එපැයි 😜
දැන් ඔයාට උඩින්ම පේන්න තියෙනවා නේද Search Bar එකක්.ඔව් ඔව් ඒක තමයි. අන්න එතන @BotFather ටයිප් කරන්න.
0_1564143238721_5742435f-3950-40a4-8d7f-87c4e575c51d-image.png දැන් Start කියන එක Click කරන්න.විශේෂයෙන්ම මතක් කරන්න ඕනි මේක Python හා සම්බන්ධ වැඩක් නිසා මම බලාපොරොත්තු වෙනවා ඔයාලත් Telegram Desktop ඇප් එක use කරනවා ඇති කියලා. මොකද ඒ හා සම්බන්ධ පිංතූරයි මම දාන්නේ. කොහොමත් Android App එකේ කියලත් වෙනසක් නැහැ. Desktop නොවුනත් මේ පිලිවෙලටම කරන්න.
0_1564143741746_624b62e9-2434-4ac2-8959-6eeac7b25952-image.png
ඊටපස්සේ /newbot කියන command එක දීලා අලුතෙන් ඔයාගෙම බොටෙක් හදාගන්න ඕනි. එකේදි මුලින්ම ඔයා ඔයාගේ Bot ට නමක් දෙන්න.0_1564143969099_c584c825-a362-4d72-bf0f-8a9c586916d7-image.png
දැන් අපේ බොටාට username එකක් දෙන්න ඕනි. එකේදි අවසානෙට bot කියන කොටස එකතු කරන්න. උදාහරණයක් විදිහට ඔයාට ඕනි නම් ඔයාගේ නම දාලා bot කෙනෙක් හදන්න ඒ හදන බොටාට nimsarabot හෝ nimsara_bot වගේ username එකක් දෙන්න පුලුවනි.0_1564144193580_ad59e6b5-957f-46d8-b449-1577cebf6a65-image.png
හරි ඔන්න දැන් ඔයාට එයාලගෙන් message එකක් එයි ඔයාගෙ බොටාගේ API Token එකත් එක්කම.මේක තමා අපිට වැදගත්ම කොටස.ඒක කාටවත් දෙන්නවත් නැති කරගන්නවත් එපා හොදේ.
ආහ් අනිත් එක.මේ token එක try කරන්නත් එපා.මොකද මම ඒක revoke කරලා තියෙන්නේ. 😛 0_1564144374777_64888b39-51fa-4575-a665-86e6ca1b3c00-image.pngදැන් අපි coding වැඩ ටික පටන් ගමූ.මේකට ඕනා Python. අලුත් version එක තියෙනවනම් තවත් හොදයි. කොහොමත් ඒක install කරගන්න එක ඔයාගේ වැඩක්. ඒක Google කරලා හොයලා බලන්න. දැන් ඔයා cmd එක open කරගන්න. cmd කිව්වේ මොකක්ද කියලා නම් අහන්න එපා 😛
දැන් cmd එකේ මෙන්න මෙහෙම ටයිප් කරලා enter ඔබන්න. 👇
pip3 install python-telegram-botInstall වීම Success නම් වඩේ ගොඩ 🙂 නැත්තම් පහලින් කමෙන්ට් එකක් දාන්න.
මම සම්පූර්ණ code එකම පහලින් දාන්නම්. ඒක python අලුත් file එහෙකට copy කරගන්න. ඒ code එකේ imoprt කරපු libraries ගැන වගේම තව දේවල් ගැන එකින් එක විස්තර කරගන්න ඕනිනම් මේ ලිංක් එකෙන් බලන්න. from telegram.ext import Updater, InlineQueryHandler, CommandHandler import requests import re def get_url(): contents = requests.get('https://random.dog/woof.json').json() url = contents['url'] return url def bop(bot, update): url = get_url() chat_id = update.message.chat_id bot.send_photo(chat_id=chat_id, photo=url) def main(): updater = Updater('YOUR_TOKEN') dp = updater.dispatcher dp.add_handler(CommandHandler('bop',bop)) updater.start_polling() updater.idle() if __name__ == '__main__': main() ඔන්න ඕකේ තියේ නේද YOUR_TOKEN කියලා කොටසක්.අන්න එතනට ඔයාගේ අර හදාගත්තු බොටාගේ TOKEN එක දාන්න.11.හරි දැන් වැඩේ හරි වගේ තමා.දැන් python file එක run කරන්න. මතක් කරලා save කරන්න. නැත්තම් run කරන්න බෑ. 😁
ඕක run වෙලා තියෙද්දිම අර ඔයාට ආපු මැසේජ් එකේ මේ ලිංක් එක ක්ලික් කරලා බොටාව start කරන්න.0_1564145447476_335e4054-2ee1-4ddc-8815-6c40d726cfa6-image.png
start කලාට මදි , දැන් එයාට /bop කියලා ටයිප් කරලා මැසේජ් එකක් යවන්න. 0_1564145598971_68f34649-b6e9-4667-a165-127bb6aeb75e-image.png දැන් ඔයාට මෙන්න මේ වගේ අගනා බව්වෙක්ගේ ෆොටෝ එකක් එයි. ඔය command එක යවන යවන සැරේට එක එක බව්වන්ගේ ෆොටෝ ගන්න පුලුවන් 😛 0_1564145709404_b87fd920-2157-41f3-9c7e-8c5140a44157-image.pngඑහෙනම් වැඩේ ඉවරයි. ඔයත් මේ වගේ කෙනෙක් හැදුවනම් පහලින් එයාගේ username එක දාන්න. මගේ බව්වෝ බලන්න මේ ලිංක් එකෙන් යන්න 🙂
ඔයත් ටෙලිග්රෑම් ඉන්නෝ නම් අපේ Channel එකත් එක්ක මේ ලිංක් එකෙන් එකතු වෙන්න 😊
ඒනම් සුභ දවසක්. මොකක්ම හරි ප්රශ්නයක් උනොත් comment එකක් දාන්න. වැඩේ හොද නම් Quote එක Up කරන්න 😉
-
හරි මම ඔයාලට අද අරගෙන ආවේ පයිතන් automation මුල ඉදල සරලව සිංහලෙන්.. ඉගෙන ගන්න කැමති අය මේ වීඩියෝ එක බලන්න.. අඩු පාඩු කියන්න..
build your python environment - https://youtu.be/ZSeSU2kUx8E
alt text
-
මගේ assignment එකකට ඕන කරලා තියෙනවා system එකක් තමන් ගැන කරලා තියන හැඳින්වීමකින් ( my self ) ඒක ඇතුලේ අදාල පුද්ගලයා කැමති මොනවද අකමැති මොනවද කියලා වෙන් කරලා ගන්න ඕනේ. උදාහරණයක් විදියට,
I like hiking. කියලා තිබ්බොත් hiking කියන එක output එකක් විදියට එන්න ඕනේ. I prefer cold environment කියලා තිබ්බොත් output එක cold environment කියලා එන්න ඕනේ. language එක විදියට python පාවිච්චි කරනවා. මේක කරන්න පුළුවන් කොහොමද. පොඩි idea එකක් ඕනේ මට. -
table ekak thiyenawa.. eke eka row ekaka p tag dekak thiyenawa.. eke eka p tag ekaka value eka ganna one using p tag id.
<tr>
<td class="pro-thumbnail"><a href="#"><img src="assets/images/products/product01.jpg" class="img-fluid" alt="Product"></a></td>
<td class="pro-title"><a href="#">Cillum dolore tortor nisl fermentum</a></td>
<td class="pro-price"><span><p id="ProductPrize">28.00</p></span></td>
<td class="pro-quantity"><div class="pro-qty"><input type="text" value="1"></div></td>
<td class="pro-subtotal"><span><p id="totPrize">28.0</p></span></td>
<td class="pro-remove"><a href="#"><i class="fa fa-trash-o"></i></a></td>
</tr>id="ProductPrize" eke thiyena value eka jquery walin multiply karala id="totPrize" mekata assign karanna one
-
-
Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine read more at this link [click]link url(https://futureexpectation.com/blog/machine-learning-ml/)
-
Telegram app එකේ bot එකක් හදන්න කිසිම developing app එකක් ඔනෙ වෙන් na . Telegram app එක විතරක් පාවිච්චි කරගෙන අපිට මෙ bot eka හදාගන්න පුලුවන්.
මුලින්ම telegram app එක phone එකෙන් open කරගෙන,
1."@botfather" කියල telegram app එකේ search කරන්න
නිල් පාට හරි ලකුනක් තියන bot එක select කරන්න.
/help කියන command එක enter කරන්න. එමගින් bot father එකෙන් handle කරන්න පුලුවන් ඔක්කොම commands ටික display වෙනව
**/newbot **commond එක click කරන්න.
5.ඉන්පසු bot එකට කමති නමක් type කරන්න.
Bot එකට username එකක් type කරන්න. එය type වෙන්න ඔනෙ විදි දෙකක් තියනවා, space එකක් නතුව
( eg- TerisBot) space එක ට underscore එකක් බාවීතා කරමින්
( eg- Teris_bot)ඉන්පසු ඒ නම අගට _bot යන වචනය එකතු කරන්න.
(eg- Terisbot_bot හෝ Teris_bot_bot)7.ඉන්පසු අලුත් bot එක message interface එකේ diplay වෙනවා.
නමුත් මෙම bot එක සක්රිය කිරිමට system එකක් download කරන්න වෙනව.
මෙ bot එකට service එකක් add karanna ** now** service එක install කරන්න.
(npm install -g now)9.ඉන්පසු script එකක් start කරන්න ඔයාලාගේ package.json
{
"name" : "telegram-bot",
"version" : " ",
"description" : " ",
"main": "index.js",
"scripts" : {},
"author" : " "
"license" : " "}
Script එක add කරාට පස්සෙ command එක run කරන්න. මතක් කරලා project folder එකෙ root එකේ run කරන්න. මේ script එක first time run කරනවනන්, Sign up වෙන්න instructions පෙන්නයි.
ඉන්පසු NOTE: You can use... යනුවෙන් output එකක් ලබෙයි.
අවසන් පියවර ලෙස telegram එකට මෙය present කරන්න ඔනෙ. එයට terminal එකේ,
curl - F "url=https://my-telegram-bot-tanvxponxj.now.sh/new-message" https://api.telegram.org/bot<your_api_token>/setWebhook
ඉන්පසු එම bot එකත් එක්ක chat කරලා බලන්න. අහන පශ්න වලට එම bot එක පිලිතුරු දෙයි එමෙන්ම එය program කරන්නද හැකියාවක් තිබේ.
Bots gana thawa wisthara idiriyata thawa post magin penwadennan
-
-