Package: shadapi
Shad API Framework for PythonHomepage•Documentation•ReleasesShad ApiElegant, modern and asynchronous Shad API framework in Python for users and botsAccountsWebSocket Handler:fromshadapiimportClientapp=Client('my_account_auth')@app.handlerasyncdefmy_bot(bot,message):awaitmessage.reply('``Hello`` __from__ **Shad Api**!')Messages Update Handler:fromshadapiimportClientapp=Client('my_account_auth')@app.updateHandlerasyncdefmy_bot(bot,message):awaitmessage.reply('``Hello`` __from__ **Shad Api**!')ORfromshadapiimportClientapp=Client('my_account_auth')update_delay=5# in seconds@app.updateHandler(update_delay)asyncdefmy_bot(bot,message):awaitmessage.reply('``Hello`` __from__ **Shad Api**!')Another example:fromshadapiimportClientapp=Client("my_account_auth")asyncdefmy_bot(bot):awaitbot.sendText('object_guid','``Hello`` __from__ **Shad Api**!')app.run(my_bot)Bots Examples (ONLY FOR SPECIAL MEMBERS) (NOT TESTED)fromshadapiimportBotapp=Bot('token')asyncdefmy_bot(bot):me=awaitbot.getMe()print(me)app.run(my_bot)ORfromshadapiimportBotapp=Bot('token')asyncdefmy_bot(bot):me=awaitbot.sendMessage('chat_id','text')print(me)app.run(my_bot)Shad-Apiis a modern, elegant and asynchronous framework. It enables you to easily interact with the main Shad API through a user account (custom client) or a bot
identity (bot API alternative) using Python.Key FeaturesReady: Install Shad-Api with pip and start building your applications right away.Easy: Makes the Shad API simple and intuitive, while still allowing advanced usages.Elegant: Low-level details are abstracted and re-presented in a more convenient way.Fast: Boosted up by pycryptodome, a high-performance cryptography library written in C.Async: Fully asynchronous (also usable synchronously if wanted, for convenience).Powerful: Full access to Shad's API to execute any official client action and more.Installingpip3installshadapiNotesbroken message handlerwhen using this library for fethcing messages from a chat, the library will start a WebSocket channel with the server, and because of the present lag in the server, some of the messages will not be sent by the server and wont be processed by the client (this is not an issue with the library, it's from the server! this problem also do exist in the Android and Web versions of Shad)
we can kindof fix this problem by loading every last message every once in a while to ensure that the client have recived every message, but this would make the bot use more internet (around 277MB per day for maden requests every 2 seconds). the problem with this bypass is that the server would consider that as "request spam" (aka DDOS) and will refuse to response to most of the requests, and this would make the bot pretty much slower! i did implement this functionality in the library and with the addition of "request delay", but until shad devs fix the main issue inside the server or until i find an actuall bypass solution, this are the only ways to handle messages in this library.Request methodadvantagesdisadvantageWebSocket syncinginstant triggerignores most messagesgetChatUpdates requesttriggers on every messageslow triggerThanks to:shayanheidari01he did an awesome job at making a rubika library which helped alot to make this project!https://github.com/shayanheidari01/rubika