اسکریپت باران | دانلود اسکریپت و سورس اندروید

بزرگترین فروشگاه سورس کد، اسکریپت، افزونه و قالب : codemilo.ir
برای درخواست هر سورس اندروید، اسکریپت و قالب از سایت کدکنیون و تم فارست با این ایمیل در ارتباط باشید : codingshop20@yahoo.com
https://codingshop.net
اسکریپت باران اسکریپت باران
تبلیغات
آخرین محصولات

دانلود php Telegram Bot 0.44.1 Final – اسکریپت ربات ساز تلگرام

4238 بازدید

نسخه :

در این پست از سایت اسکریپت باران قصد داریم اسکریپت خالص ربات ساز تلگرام را قرار دهیم که بطور کامل توسط پلاگین هایی توسعه یافته است. تلگرام به تازگی اعلام کرده که از API های روبات بطور رسمی پشتیبانی می کند.

برخی امکانات :

  • retrieve updates with webhook and getUpdate methods.
  • supports all types and methods according to Telegram API (25 May 2016).
  • supports supergroups.
  • handle commands in chat with other bots.
  • manage Channel from the bot admin interface.
  • full support for inline bots.
  • inline keyboard.
  • Messages, InlineQuery and ChosenInlineQuery are stored in the Database.
  • Botan.io integration and database cache system. (new!)
  • Conversation feature

تغییرات نسخه جدید :

Add request limiter
Small fix in logger

آموزش ایجاد اولین ربات :

1 . به آیدی https://telegram.me/botfather در تلگرام این پیام را ارسال کنید : newbot/

اگر نمیدانید چطور به وسیله آیدی، به شخصی پیام ارسال کنید، در برنامه تلگرام بر روی سرچ فیلد کلیک کنید و تایپ کنید botfather@ . حالا می توانید به روبات پیام ارسال کنید. مراقب باشید که به اکانت های مشابه این یوزرنیم در لیست سرچ پیام ارسال نکنید.

2. بوت فادر پاسخ می دهد : Alright, a new bot. How are we going to call it? Please choose a name for your bot.

3. هر نامی را که میخواهید، برای روبات خود تایپ کنید.

4. بوت فادر پاسخ می دهد : Good. Now let’s choose a username for your bot. It must end in bot. Like this, for example: TetrisBot or tetris_bot.

5. هر یوزر نیمی که برای روبات خود مد نظر دارید را تایپ کنید. نام باید حداقل 5 کاراکتر باشد و در انتهای نامش به کلمه bot ختم شود، مثلا : scriptbaran_bot

6. بوت فادر پاسخ می دهد :

7. کد token دریافتی در انتهای پیام را در جایی یادداشت و کپی کنید.

8. این پیام را به بوت فادر ارسال کنید : setprivacy/

9 بوت فادر پاسخ می دهد : Choose a bot to change group messages settings.

10. نام یوزنیم ربات خود را که در مراحل قبل ایجاد کردید همراه با @ در ابتدای آن، تایپ کنید.

11. بوت فادر پاسخ می دهد :

12. کلمه disable را تایپ کنید تا ربات شما همه پیام هایی که در گروه ارسال می شود را دریافت کند.

13. بوت فادر پاسخ می دهد : Success! The new status is: DISABLED. /help

 

نصب پکیج با استفاده از Composer :

فایل ستاپ composer برای ویندوز را از این آدرس دانلود کنید : https://getcomposer.org/download/

فایل composer.json پروژه خود را در ویرایش کرده تا این مسیر را حتما لود کند : longman/telegram-bot مانند مثال زیر :

و این دستور را اجرا کنید : composer update

یا این دستور را در command line خود اجرا کنید :

انتخاب چگونگی دریافت آپدیت های تلگرام :

این ربات می تواند آپدیت های تلگرام را با استفاده از دو متد webhook یا getUpdate دریافت کند:

 

Webhook getUpdate
توضیحات تلگرام اطلاعات را مستقیما به هاست شما ارسال می کند شما باید آپدیت های تلگرام را بصورت دستی دریافت کنید
Host with https الزامی غیر الزامی
MySQL غیر الزامی الزامی

 

نصب Webhook :

برای استفاده از متد webhook شما به سروری اختیاج دارید که https و composer را پشتیبانی کند. (برای امنیت بیشتر نیاز هست تا کد های بیشتری قرار دهید)

یک فایل به نام set.php بسازید (یا فقط کد زیر را در مسیر examples/set.php کپی کنید) :

فایل set.php را با مرورگر خود باز کنید تا webhook را با تلگرام همگام سازی کنید.

حالا یک فایل به نام hook.php بسازید (یا فقط کد زیر را در مسیر examples/hook.php کپی کنید) :

ایجاد Certificate :

برای آپلود فایل certificate، پارامتر certificate path را در فایل set.php قرار دهید:

غیرفعالسازی Webhook :

فایل example/unset.php را با اطلاعات ربات خود ویرایش کرده و فایل را اجرا کنید.

نصب getUpdate :

برای نصب، دیتابیس MYSQL باید حتما فعال باشد!

حالا یک فایل به نام getUpdateCLI.php بسازید (یا فقط کد زیر را در مسیر examples/getUpdateCLI.php کپی کنید) :

پرمیشن های فایل را با دستور زیر تعیین کنید :

سپس دستور زیر را اجرا کتید :

پشتیبانی از :

Types

All types are implemented according to Telegram API (20 January 2016).

Inline Query

Full support for inline query according to Telegram API (20 January 2016).

Methods

All methods are implemented according to Telegram API (20 January 2016).

Send Message

Messages longer than 4096 characters are split up into multiple messages.

Send Photo

To send a local photo, provide the file path as the second parameter:

If you know the file_id of a previously uploaded file, just include it in the data array:

sendAudio, sendDocument, sendSticker, sendVideo and sendVoice all work in the same way. See examples/Commands/ImageCommand.php for a full example.

Send Chat Action

getUserProfilePhoto

Retrieve the user photo, see src/Commands/WhoamiCommand.php for a full example.

getFile and dowloadFile

Get the file path and download it, see src/Commands/WhoamiCommand.php for a full example.

Send message to all active chats

To do this you have to enable the MySQL connection. Here’s an example of use:

You can also broadcast a message to users, from the private chat with your bot. Take a look at the admin commands below.

Utils

MySQL storage (Recommended)

If you want to save messages/users/chats for further usage in commands, create a new database, import structure.sql and enable MySQL support after object creation and BEFORE handle method:

You can set a custom prefix to all the tables while you are enabling MySQL:

Consider to use the utf8mb4 branch if you find some special characters problems. You can also store inline query and chosen inline query in the database.

External Database connection

Is possible to provide to the library an external mysql connection. Here’s how to configure it:

Channels Support

All methods implemented can be used to manage channels. With admin commands you can manage your channels directly with your bot private chat.

Botan.io integration (Optional)

You can enable the integration using this line:

Replace 'your_token' with your Botan.io token, check this page to see how to obtain one.

The following actions will be tracked:

  • Commands (shown as Command (/command_name) in the stats
  • Inline Queries, Chosen Inline Results and Callback Queries
  • Messages sent to the bot (or replies in groups)

In order to use the URL shortener you must include the class use Longman\TelegramBot\Botan; and call it like this:

Botan::shortenUrl('https://github.com/akalongman/php-telegram-bot', $user_id);

Shortened URLs are cached in the database (if MySQL storage is enabled).

Commands

Predefined Commands

The bot is able to recognise commands in a chat with multiple bots (/command@mybot). It can execute command triggering a chat event. Here’s the list:

  • New chat participant (NewchatparticipantCommand.php)
  • Left chat participant (LeftchatparticipantCommand.php)
  • New chat title (NewchattitleCommand.php)
  • Delete chat photo (DeletechatphotoCommand.php)
  • Group chat created (GroupchatcreatedCommand.php)
  • Super group chat created (SupergroupchatcreatedCommand.php)
  • Channel chat created (ChannelchatcreatedCommand.php)
  • Inline query (InlinequeryCommand.php)
  • Chosen inline result (ChoseninlineresultCommand.php)

GenericCommand.php lets you handle commands that don’t exist or to use commands as a variable:

Favourite colour? /black, /red

Favourite number? /1, /134

GenericmessageCommand.php lets you handle any type of message.

Custom Commands

Maybe you would like to develop your own commands. A good practice is to store them outside vendor/. This can be done using:

Inside examples/Commands/ there are some samples that show how to use types.

Commands Configuration

With this method you can set some command specific parameters:

Admin Commands

Enabling this feature, the admin bot can perform some super user commands like:

  • Send message to all chats /sendtoall
  • List all the chats started with the bot /chats
  • Post any content to your channels /sendtochannel
  • inspect a user or a chat with /whois (new!)

Set Admins

You can specify one or more admins with this option:

Telegram user id can be retrieved with the command /whoami. Admin commands are stored in src/Admin/ folder. To get a list of all available commands, type /help.

Channel Administration

To enable this feature follow these steps:

  • Add your bot as channel administrator, this can be done with any telegram client.
  • Enable admin interface for your user as explained in the admin section above.
  • Enter your channel name as a parameter for the /sendtochannel command:
  • If you want to manage more channels:
  • Enjoy!

Upload and Download directory path

You can override the default Upload and Download directory with:

 

در صورتی که درخواست کاربران زیاد باشد، آموزش ساخت و راه اندازی آن را بصورت اختصاصی و کامل در اسکریپت باران قرار می دهیم. کامنت های شما می تواند باعث دلگرمی ما در ادامه این آموزش شود.

توجه : این پست برای درج آموزش های جدیدتر، هرچند وقت آپدیت می شود.




سورس کتاب اندروید سورس شبکه اجتماعی اندروید سورس تاکسی یاب اندروید سورس فروشگاه اینترنتی اندروید سورس کد برنامه تاکسی یاب مشابه تپ سی و اسنپ
سورس فروشگاه اینترنتی اندروید سورس کتاب اندروید
دانلود سورس موبوگرام دانلود سورس تلگرام

لینک های دانلود

گزارش خرابی لینک
  • پسورد فایل ها : www.scriptbaran.com
  • نسخه :
  • قابل توجه مدیران وبسایت های ایرانی : تمامی مطالب سایت اسکریپت باران بصورت اختصاصی ترجمه و منتشر می شوند و کپی برداری از آن ها ( مطالب رایگان ) فقط با ذکر نام منبع مجاز است.
  • پیشنمایش محصول
    قوانین و مقررات

    برنامه نویسی را معنایی دوباره بخشیم !