Package: aiodgram
aiodgramWhat is this?The module makes it easier for you to use the basic functions of AIOGRAM, such as sending messages/photos/video and start your bot.UsingLet's import it first:
First, import classTgBot and typesfrom the library (use the 'from...import TgBot, types' construct).
Second, create a object from classTgBot(use 'name= TgBot()' construct)
Third, You must write arguments to this object,token:string,admin_username:stringfrom`...`importTgBotbot=TgBot(`token`,`admin_username`)AFTERobject_botname=botUse in asyng definesExamples:@`bot`.dispatcher.message_handler()asyncdeftest:awaitbot.send_message(`chat_id`,`text`)or@`bot`.dispatcher.message_handler()asyncdeftest:awaitbot.send_photo(`chat_id`,`photo_url`,caption=`text`)or@`bot`.dispatcher.message_handler()asyncdeftest:awaitbot.send_video(`chat_id`,`video_url`,caption=`text`)Beautiful messages to consoleYou can create your beautiful messages to console with color!First, import classMyMessagesfrom the library (use the 'from...import MyMessages' construct)Second, create a object from classMyMessages(use 'name= MyMessage()' construct)Third, you must use amessagedefine based on this object (use, 'name.message()' construct)Fourth, You must write arguments to this define,clear:bool,message:string,colors:string.Example:from`...`importMyMessagesmy_msg=MyMessage()print(my_msg.message(clear=`bool`,text=`text`,color=`[green,blue]`))Download a videos from YouTubeYou can download a video from YouTube using this library!First, import classDownloadVideofrom the library (use the 'from...import DownloadVideo' construct)Second, create a object from classDownloadVideo(use 'name= DownloadVideo()' construct)Third, you must use aDownload_This_Videodefine based on this object (use, 'name.Download_This_Video()' construct)Fourth, you must write arguments to this define,link_on_video:string,video_name:string,resolution:intExample:from`...`importDownloadVideovideo=DownloadVideo()video.download_This_Video(link_on_video=`link`,video_name=`nameoffile`,resolution=`720p`)Create your buttonsYou can create buttons for your messages!For reply_markupExample:from`...`importButtonbtns=Button()keyboard=[[btns.add_button(`text`)],[btns.add_button(`text`)]]reply_btns=btns.add_markup(keyboard)And, you must add object from fourth point tosend_message;send_photo;send_videoinreply_markupargumentFor inline_markupExample:from`...`importButtonbtns=Button()keyboard=[[btns.add_inline_button(`text`,`callback`)],[btns.add_inline_button(`text`,`callback`)]]reply_btns=btns.add_inline_markup(keyboard)And, you must add object from fourth point tosend_messageorsend_photoorsend_videoinreply_markupargumentShow loading animation in your botFirst, you must use a define from TgBot (use 'bot.loading()')Second, you must write argumets to this define,chat_id:int,percentages:intExample:bot=TgBot(`token`)@`bot`.dispatcher.message_handler()asyncdeftest:awaitbot.loading(`chat_id`,`percentages`)Easy work with SQLExample:from`...`importDatabasedb=Database(`filenamedb`)db.create_data(`table`,columns=`list`,values=`list`)#Creating a cell in a DB tabledb.select_data(`table`,column=`str`,search_column=`str`,search_data=`str`)#Return list with your datasdb.edit_data(`table`,column=`str`,new_data=`any`,search_column=`str`,search_data=`str`)#Edit data in your DBdb.delete_data(`table`,search_column=`str`,search_data=`str`)#Delete data fro DBYour custom exceptionsExample:from`...`importMyExceptionMyException(message='',extra_info=any)Logging your projectExample:from`...`importLogged`log`=Logged(type_logging='info',filename='log.log')`log`.info(message='')`log`.error(message='')`log`.warning(message='')`log`.critical(message='')`log`.debug(message='')Password makerExample:from`...`importPasswordMaker,TgBot,typesbot=TgBot(`token`,`admin_username`)password=PasswordMaker(bot=bot)@bot.dispatcher.message_handler()asyncdefpassword_maker(message:types.Message):awaitpassword.make(message.from_user.id,'Input a password lenght')Edit text in your messageExample:from`...`inportTgBotbot=TgBot(`token`,`admin_username`)@dp.message_handler()asyncdefa(message:types.Message):text=message.textchat_id=message.chat.idawaitbot.edit_message_text(text=text,chat_id=chat_id)Edit inline markup in your messageExample:from`...`inportTgBotbot=TgBot(`token`,`admin_username`)your_inline_markup='your markup'@dp.message_handler()asyncdefa(message:types.Message):chat_id=message.chat.idmessage_id=message.message_idawaitbot.edit_message_markup(chat_id=chat_id,message_id=message_id,reply_markup=your_inline_markup)For start your bot, you needbot.start_polling(dispatcher=bot Dispatcher, skip_updates=True or False, on_startup=define for start, on_shutdown=define for shutdown).Example:from`...`importTgBotbot=TgBot()bot.start_polling(`nothingargumentsoryourarguments`)Developersauthors:Darkangel, Arkeepauthors telegrams:t.me/darkangel58414andt.me/Stillcrayg