981 skills found · Page 8 of 33
Rynkll696 / HHimport pyttsx3 import speech_recognition as sr import datetime from datetime import date import calendar import time import math import wikipedia import webbrowser import os import smtplib import winsound import pyautogui import cv2 from pygame import mixer from tkinter import * import tkinter.messagebox as message from sqlite3 import * conn = connect("voice_assistant_asked_questions.db") conn.execute("CREATE TABLE IF NOT EXISTS `voicedata`(id INTEGER PRIMARY KEY AUTOINCREMENT,command VARCHAR(201))") conn.execute("CREATE TABLE IF NOT EXISTS `review`(id INTEGER PRIMARY KEY AUTOINCREMENT, review VARCHAR(50), type_of_review VARCHAR(50))") conn.execute("CREATE TABLE IF NOT EXISTS `emoji`(id INTEGER PRIMARY KEY AUTOINCREMENT,emoji VARCHAR(201))") global query engine = pyttsx3.init('sapi5') voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) def speak(audio): engine.say(audio) engine.runAndWait() def wishMe(): hour = int(datetime.datetime.now().hour) if hour >= 0 and hour<12: speak("Good Morning!") elif hour >= 12 and hour < 18: speak("Good Afternoon!") else: speak("Good Evening!") speak("I am voice assistant Akshu2020 Sir. Please tell me how may I help you.") def takeCommand(): global query r = sr.Recognizer() with sr.Microphone() as source: print("Listening...") r.pause_threshold = 0.9 audio = r.listen(source) try: print("Recognizing...") query = r.recognize_google(audio,language='en-in') print(f"User said: {query}\n") except Exception as e: #print(e) print("Say that again please...") #speak('Say that again please...') return "None" return query def calculator(): global query try: if 'add' in query or 'edi' in query: speak('Enter a number') a = float(input("Enter a number:")) speak('Enter another number to add') b = float(input("Enter another number to add:")) c = a+b print(f"{a} + {b} = {c}") speak(f'The addition of {a} and {b} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'sub' in query: speak('Enter a number') a = float(input("Enter a number:")) speak('Enter another number to subtract') b = float(input("Enter another number to subtract:")) c = a-b print(f"{a} - {b} = {c}") speak(f'The subtraction of {a} and {b} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'mod' in query: speak('Enter a number') a = float(input("Enter a number:")) speak('Enter another number') b = float(input("Enter another number:")) c = a%b print(f"{a} % {b} = {c}") speak(f'The modular division of {a} and {b} is equal to {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'div' in query: speak('Enter a number as dividend') a = float(input("Enter a number:")) speak('Enter another number as divisor') b = float(input("Enter another number as divisor:")) c = a/b print(f"{a} / {b} = {c}") speak(f'{a} divided by {b} is equal to {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'multi' in query: speak('Enter a number') a = float(input("Enter a number:")) speak('Enter another number to multiply') b = float(input("Enter another number to multiply:")) c = a*b print(f"{a} x {b} = {c}") speak(f'The multiplication of {a} and {b} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'square root' in query: speak('Enter a number to find its sqare root') a = float(input("Enter a number:")) c = a**(1/2) print(f"Square root of {a} = {c}") speak(f'Square root of {a} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'square' in query: speak('Enter a number to find its sqare') a = float(input("Enter a number:")) c = a**2 print(f"{a} x {a} = {c}") speak(f'Square of {a} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'cube root' in query: speak('Enter a number to find its cube root') a = float(input("Enter a number:")) c = a**(1/3) print(f"Cube root of {a} = {c}") speak(f'Cube root of {a} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'cube' in query: speak('Enter a number to find its sqare') a = float(input("Enter a number:")) c = a**3 print(f"{a} x {a} x {a} = {c}") speak(f'Cube of {a} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'fact' in query: try: n = int(input('Enter the number whose factorial you want to find:')) fact = 1 for i in range(1,n+1): fact = fact*i print(f"{n}! = {fact}") speak(f'{n} factorial is equal to {fact}. Your answer is {fact}.') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') except Exception as e: #print(e) speak('I unable to calculate its factorial.') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'power' in query or 'raise' in query: speak('Enter a number whose power you want to raised') a = float(input("Enter a number whose power to be raised :")) speak(f'Enter a raised power to {a}') b = float(input(f"Enter a raised power to {a}:")) c = a**b print(f"{a} ^ {b} = {c}") speak(f'{a} raise to the power {b} = {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'percent' in query: speak('Enter a number whose percentage you want to calculate') a = float(input("Enter a number whose percentage you want to calculate :")) speak(f'How many percent of {a} you want to calculate?') b = float(input(f"Enter how many percentage of {a} you want to calculate:")) c = (a*b)/100 print(f"{b} % of {a} is {c}") speak(f'{b} percent of {a} is {c}. Your answer is {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'interest' in query: speak('Enter the principal value or amount') p = float(input("Enter the principal value (P):")) speak('Enter the rate of interest per year') r = float(input("Enter the rate of interest per year (%):")) speak('Enter the time in months') t = int(input("Enter the time (in months):")) interest = (p*r*t)/1200 sint = round(interest) fv = round(p + interest) print(f"Interest = {interest}") print(f"The total amount accured, principal plus interest, from simple interest on a principal of {p} at a rate of {r}% per year for {t} months is {p + interest}.") speak(f'interest is {sint}. The total amount accured, principal plus interest, from simple interest on a principal of {p} at a rate of {r}% per year for {t} months is {fv}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'si' in query: speak('Enter the angle in degree to find its sine value') a = float(input("Enter the angle:")) b = a * 3.14/180 c = math.sin(b) speak('Here is your answer.') print(f"sin({a}) = {c}") speak(f'sin({a}) = {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'cos' in query: speak('Enter the angle in degree to find its cosine value') a = float(input("Enter the angle:")) b = a * 3.14/180 c = math.cos(b) speak('Here is your answer.') print(f"cos({a}) = {c}") speak(f'cos({a}) = {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'cot' in query or 'court' in query: try: speak('Enter the angle in degree to find its cotangent value') a = float(input("Enter the angle:")) b = a * 3.14/180 c = 1/math.tan(b) speak('Here is your answer.') print(f"cot({a}) = {c}") speak(f'cot({a}) = {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') except Exception as e: print("infinity") speak('Answer is infinity') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'tan' in query or '10' in query: speak('Enter the angle in degree to find its tangent value') a = float(input("Enter the angle:")) b = a * 3.14/180 c = math.tan(b) speak('Here is your answer.') print(f"tan({a}) = {c}") speak(f'tan({a}) = {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'cosec' in query: try: speak('Enter the angle in degree to find its cosecant value') a = float(input("Enter the angle:")) b = a * 3.14/180 c =1/ math.sin(b) speak('Here is your answer.') print(f"cosec({a}) = {c}") speak(f'cosec({a}) = {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') except Exception as e: print('Infinity') speak('Answer is infinity') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'caus' in query: try: speak('Enter the angle in degree to find its cosecant value') a = float(input("Enter the angle:")) b = a * 3.14/180 c =1/ math.sin(b) speak('Here is your answer.') print(f"cosec({a}) = {c}") speak(f'cosec({a}) = {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') except Exception as e: print('Infinity') speak('Answer is infinity') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') elif 'sec' in query: try: speak('Enter the angle in degree to find its secant value') a = int(input("Enter the angle:")) b = a * 3.14/180 c = 1/math.cos(b) speak('Here is your answer.') print(f"sec({a}) = {c}") speak(f'sec({a}) = {c}') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') except Exception as e: print('Infinity') speak('Answer is infinity') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') except Exception as e: speak('I unable to do this calculation.') speak('Do you want to do another calculation?') query = takeCommand().lower() if 'y' in query: speak('ok which calculation you want to do?') query = takeCommand().lower() calculator() else: speak('ok') def callback(r,c): global player if player == 'X' and states[r][c] == 0 and stop_game == False: b[r][c].configure(text='X',fg='blue', bg='white') states[r][c] = 'X' player = 'O' if player == 'O' and states[r][c] == 0 and stop_game == False: b[r][c].configure(text='O',fg='red', bg='yellow') states[r][c] = 'O' player = 'X' check_for_winner() def check_for_winner(): global stop_game global root for i in range(3): if states[i][0] == states[i][1]== states[i][2]!=0: b[i][0].config(bg='grey') b[i][1].config(bg='grey') b[i][2].config(bg='grey') stop_game = True root.destroy() for i in range(3): if states[0][i] == states[1][i] == states[2][i]!= 0: b[0][i].config(bg='grey') b[1][i].config(bg='grey') b[2][i].config(bg='grey') stop_game = True root.destroy() if states[0][0] == states[1][1]== states[2][2]!= 0: b[0][0].config(bg='grey') b[1][1].config(bg='grey') b[2][2].config(bg='grey') stop_game = True root.destroy() if states[2][0] == states[1][1] == states[0][2]!= 0: b[2][0].config(bg='grey') b[1][1].config(bg='grey') b[0][2].config(bg='grey') stop_game = True root.destroy() def sendEmail(to,content): server = smtplib.SMTP('smtp.gmail.com', 587) server.ehlo() server.starttls() server.login('xyz123@gmail.com','password') server.sendmail('xyz123@gmail.com',to,content) server.close() def brightness(): try: query = takeCommand().lower() if '25' in query: pyautogui.moveTo(1880,1050) pyautogui.click() time.sleep(1) pyautogui.moveTo(1610,960) pyautogui.click() pyautogui.moveTo(1880,1050) pyautogui.click() speak('If you again want to change brihtness, say, change brightness') elif '50' in query: pyautogui.moveTo(1880,1050) pyautogui.click() time.sleep(1) pyautogui.moveTo(1684,960) pyautogui.click() pyautogui.moveTo(1880,1050) pyautogui.click() speak('If you again want to change brihtness, say, change brightness') elif '75' in query: pyautogui.moveTo(1880,1050) pyautogui.click() time.sleep(1) pyautogui.moveTo(1758,960) pyautogui.click() pyautogui.moveTo(1880,1050) pyautogui.click() speak('If you again want to change brihtness, say, change brightness') elif '100' in query or 'full' in query: pyautogui.moveTo(1880,1050) pyautogui.click() time.sleep(1) pyautogui.moveTo(1835,960) pyautogui.click() pyautogui.moveTo(1880,1050) pyautogui.click() speak('If you again want to change brihtness, say, change brightness') else: speak('Please select 25, 50, 75 or 100....... Say again.') brightness() except exception as e: #print(e) speak('Something went wrong') def close_window(): try: if 'y' in query: pyautogui.moveTo(1885,10) pyautogui.click() else: speak('ok') pyautogui.moveTo(1000,500) except exception as e: #print(e) speak('error') def whatsapp(): query = takeCommand().lower() if 'y' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('whatsapp') time.sleep(2) pyautogui.press('enter') time.sleep(2) pyautogui.moveTo(100,140) pyautogui.click() speak('To whom you want to send message,.....just write the name here in 5 seconds') time.sleep(7) pyautogui.moveTo(120,300) pyautogui.click() time.sleep(1) pyautogui.moveTo(800,990) pyautogui.click() speak('Say the message,....or if you want to send anything else,...say send document, or say send emoji') query = takeCommand() if ('sent' in query or 'send' in query) and 'document' in query: pyautogui.moveTo(660,990) pyautogui.click() time.sleep(1) pyautogui.moveTo(660,740) pyautogui.click() speak('please select the document within 10 seconds') time.sleep(12) speak('Should I send this document?') query = takeCommand().lower() if 'y' in query and 'no' not in query: speak('sending the document......') pyautogui.press('enter') speak('Do you want to send message again to anyone?') whatsapp() elif ('remove' in query or 'cancel' in query or 'delete' in query or 'clear' in query) and ('document' in query or 'message' in query or 'it' in query or 'emoji' in query or 'select' in query): pyautogui.doubleClick(x=800, y=990) pyautogui.press('backspace') speak('Do you want to send message again to anyone?') whatsapp() else: speak('ok') elif ('sent' in query or 'send' in query) and 'emoji' in query: pyautogui.moveTo(620,990) pyautogui.click() pyautogui.moveTo(670,990) pyautogui.click() pyautogui.moveTo(650,580) pyautogui.click() speak('please select the emoji within 10 seconds') time.sleep(11) speak('Should I send this emoji?') query = takeCommand().lower() if 'y' in query and 'no' not in query: speak('Sending the emoji......') pyautogui.press('enter') speak('Do you want to send message again to anyone?') whatsapp() elif ('remove' in query or 'cancel' in query or 'delete' in query or 'clear' in query) and ('message' in query or 'it' in query or 'emoji' in query or 'select' in query): pyautogui.doublClick(x=800, y=990) speak('Do you want to send message again to anyone?') whatsapp() else: speak('ok') else: pyautogui.write(f'{query}') speak('Should I send this message?') query = takeCommand().lower() if 'y' in query and 'no' not in query: speak('sending the message......') pyautogui.press('enter') speak('Do you want to send message again to anyone?') whatsapp() elif ('remove' in query or 'cancel' in query or 'delete' in query or 'clear' in query) and ('message' in query or 'it' in query or 'select' in query): pyautogui.doubleClick(x=800, y=990) pyautogui.press('backspace') speak('Do you want to send message again to anyone?') whatsapp() else: speak('ok') else: speak('ok') def alarm(): root = Tk() root.title('Akshu2020 Alarm-Clock') speak('Please enter the time in the format hour, minutes and seconds. When the alarm should rang?') speak('Please enter the time greater than the current time') def setalarm(): alarmtime = f"{hrs.get()}:{mins.get()}:{secs.get()}" print(alarmtime) if(alarmtime!="::"): alarmclock(alarmtime) else: speak('You have not entered the time.') def alarmclock(alarmtime): while True: time.sleep(1) time_now=datetime.datetime.now().strftime("%H:%M:%S") print(time_now) if time_now == alarmtime: Wakeup=Label(root, font = ('arial', 20, 'bold'), text="Wake up! Wake up! Wake up",bg="DodgerBlue2",fg="white").grid(row=6,columnspan=3) speak("Wake up, Wake up") print("Wake up!") mixer.init() mixer.music.load(r'C:\Users\Admin\Music\Playlists\wake-up-will-you-446.mp3') mixer.music.play() break speak('you can click on close icon to close the alarm window.') hrs=StringVar() mins=StringVar() secs=StringVar() greet=Label(root, font = ('arial', 20, 'bold'),text="Take a short nap!").grid(row=1,columnspan=3) hrbtn=Entry(root,textvariable=hrs,width=5,font =('arial', 20, 'bold')) hrbtn.grid(row=2,column=1) minbtn=Entry(root,textvariable=mins, width=5,font = ('arial', 20, 'bold')).grid(row=2,column=2) secbtn=Entry(root,textvariable=secs, width=5,font = ('arial', 20, 'bold')).grid(row=2,column=3) setbtn=Button(root,text="set alarm",command=setalarm,bg="DodgerBlue2", fg="white",font = ('arial', 20, 'bold')).grid(row=4,columnspan=3) timeleft = Label(root,font=('arial', 20, 'bold')) timeleft.grid() mainloop() def select1(): global vs global root3 global type_of_review if vs.get() == 1: message.showinfo(" ","Thank you for your review!!") review = "Very Satisfied" type_of_review = "Positive" root3.destroy() elif vs.get() == 2: message.showinfo(" ","Thank you for your review!!") review = "Satisfied" type_of_review = "Positive" root3.destroy() elif vs.get() == 3: message.showinfo(" ","Thank you for your review!!!!") review = "Neither Satisfied Nor Dissatisfied" type_of_review = "Neutral" root3.destroy() elif vs.get() == 4: message.showinfo(" ","Thank you for your review!!") review = "Dissatisfied" type_of_review = "Negative" root3.destroy() elif vs.get() == 5: message.showinfo(" ","Thank you for your review!!") review = "Very Dissatisfied" type_of_review = "Negative" root3.destroy() elif vs.get() == 6: message.showinfo(" "," Ok ") review = "I do not want to give review" type_of_review = "No review" root3.destroy() try: conn.execute(f"INSERT INTO `review`(review,type_of_review) VALUES('{review}', '{type_of_review}')") conn.commit() except Exception as e: pass def select_review(): global root3 global vs global type_of_review root3 = Tk() root3.title("Select an option") vs = IntVar() string = "Are you satisfied with my performance?" msgbox = Message(root3,text=string) msgbox.config(bg="lightgreen",font = "(20)") msgbox.grid(row=0,column=0) rs1=Radiobutton(root3,text="Very Satisfied",font="(20)",value=1,variable=vs).grid(row=1,column=0,sticky=W) rs2=Radiobutton(root3,text="Satisfied",font="(20)",value=2,variable=vs).grid(row=2,column=0,sticky=W) rs3=Radiobutton(root3,text="Neither Satisfied Nor Dissatisfied",font="(20)",value=3,variable=vs).grid(row=3,column=0,sticky=W) rs4=Radiobutton(root3,text="Dissatisfied",font="(20)",value=4,variable=vs).grid(row=4,column=0,sticky=W) rs5=Radiobutton(root3,text="Very Dissatisfied",font="(20)",value=5,variable=vs).grid(row=5,column=0,sticky=W) rs6=Radiobutton(root3,text="I don't want to give review",font="(20)",value=6,variable=vs).grid(row=6,column=0,sticky=W) bs = Button(root3,text="Submit",font="(20)",activebackground="yellow",activeforeground="green",command=select1) bs.grid(row=7,columnspan=2) root3.mainloop() while True : query = takeCommand().lower() # logic for executing tasks based on query if 'wikipedia' in query: speak('Searching wikipedia...') query = query.replace("wikipedia","") results = wikipedia.summary(query, sentences=2) speak("According to Wikipedia") print(results) speak(results) elif 'translat' in query or ('let' in query and 'translat' in query and 'open' in query): webbrowser.open('https://translate.google.co.in') time.sleep(10) elif 'open map' in query or ('let' in query and 'map' in query and 'open' in query): webbrowser.open('https://www.google.com/maps') time.sleep(10) elif ('open' in query and 'youtube' in query) or ('let' in query and 'youtube' in query and 'open' in query): webbrowser.open('https://www.youtube.com') time.sleep(10) elif 'chrome' in query: webbrowser.open('https://www.chrome.com') time.sleep(10) elif 'weather' in query: webbrowser.open('https://www.yahoo.com/news/weather') time.sleep(3) speak('Click on, change location, and enter the city , whose whether conditions you want to know.') time.sleep(10) elif 'google map' in query: webbrowser.open('https://www.google.com/maps') time.sleep(10) elif ('open' in query and 'google' in query) or ('let' in query and 'google' in query and 'open' in query): webbrowser.open('google.com') time.sleep(10) elif ('open' in query and 'stack' in query and 'overflow' in query) or ('let' in query and 'stack' in query and 'overflow' in query and 'open' in query): webbrowser.open('stackoverflow.com') time.sleep(10) elif 'open v i' in query or 'open vi' in query or 'open vierp' in query or ('open' in query and ('r p' in query or 'rp' in query)): webbrowser.open('https://www.vierp.in/login/erplogin') time.sleep(10) elif 'news' in query: webbrowser.open('https://www.bbc.com/news/world') time.sleep(10) elif 'online shop' in query or (('can' in query or 'want' in query or 'do' in query or 'could' in query) and 'shop' in query) or('let' in query and 'shop' in query): speak('From which online shopping website, you want to shop? Amazon, flipkart, snapdeal or naaptol?') query = takeCommand().lower() if 'amazon' in query: webbrowser.open('https://www.amazon.com') time.sleep(10) elif 'flip' in query: webbrowser.open('https://www.flipkart.com') time.sleep(10) elif 'snap' in query: webbrowser.open('https://www.snapdeal.com') time.sleep(10) elif 'na' in query: webbrowser.open('https://www.naaptol.com') time.sleep(10) else: speak('Sorry sir, you have to search in browser as his shopping website is not reachable for me.') elif ('online' in query and ('game' in query or 'gaming' in query)): webbrowser.open('https://www.agame.com/games') time.sleep(10) elif 'dictionary' in query: webbrowser.open('https://www.dictionary.com') time.sleep(3) speak('Enter the word, in the search bar of the dictionary, whose defination or synonyms you want to know') time.sleep(3) elif ('identif' in query and 'emoji' in query) or ('sentiment' in query and ('analysis' in query or 'identif' in query)): speak('Please enter only one emoji at a time.') emoji = input('enter emoji here: ') if '😀' in emoji or '😃' in emoji or '😄' in emoji or '😁' in emoji or '🙂' in emoji or '😊' in emoji or '☺️' in emoji or '😇' in emoji or '🥲' in emoji: speak('happy') print('Happy') elif '😝' in emoji or '😆' in emoji or '😂' in emoji or '🤣' in emoji: speak('Laughing') print('Laughing') elif '😡' in emoji or '😠' in emoji or '🤬' in emoji: speak('Angry') print('Angry') elif '🤫' in emoji: speak('Keep quite') print('Keep quite') elif '😷' in emoji: speak('face with mask') print('Face with mask') elif '🥳' in emoji: speak('party') print('party') elif '😢' in emoji or '😥' in emoji or '😓' in emoji or '😰' in emoji or '☹️' in emoji or '🙁' in emoji or '😟' in emoji or '😔' in emoji or '😞️' in emoji: speak('Sad') print('Sad') elif '😭' in emoji: speak('Crying') print('Crying') elif '😋' in emoji: speak('Tasty') print('Tasty') elif '🤨' in emoji: speak('Doubt') print('Doubt') elif '😴' in emoji: speak('Sleeping') print('Sleeping') elif '🥱' in emoji: speak('feeling sleepy') print('feeling sleepy') elif '😍' in emoji or '🥰' in emoji or '😘' in emoji: speak('Lovely') print('Lovely') elif '😱' in emoji: speak('Horrible') print('Horrible') elif '🎂' in emoji: speak('Cake') print('Cake') elif '🍫' in emoji: speak('Cadbury') print('Cadbury') elif '🇮🇳' in emoji: speak('Indian national flag,.....Teeranga') print('Indian national flag - Tiranga') elif '💐' in emoji: speak('Bouquet') print('Bouquet') elif '🥺' in emoji: speak('Emotional') print('Emotional') elif ' ' in emoji or '' in emoji: speak(f'{emoji}') else: speak("I don't know about this emoji") print("I don't know about this emoji") try: conn.execute(f"INSERT INTO `emoji`(emoji) VALUES('{emoji}')") conn.commit() except Exception as e: #print('Error in storing emoji in database') pass elif 'time' in query: strTime = datetime.datetime.now().strftime("%H:%M:%S") print(strTime) speak(f"Sir, the time is {strTime}") elif 'open' in query and 'sublime' in query: path = "C:\Program Files\Sublime Text 3\sublime_text.exe" os.startfile(path) elif 'image' in query: path = "C:\Program Files\Internet Explorer\images" os.startfile(path) elif 'quit' in query: speak('Ok, Thank you Sir.') said = False speak('Please give the review. It will help me to improve my performance.') select_review() elif 'exit' in query: speak('Ok, Thank you Sir.') said = False speak('Please give the review. It will help me to improve my performance.') select_review() elif 'stop' in query: speak('Ok, Thank you Sir.') said = False speak('Please give the review. It will help me to improve my performance.') select_review() elif 'shutdown' in query or 'shut down' in query: speak('Ok, Thank you Sir.') said = False speak('Please give the review. It will help me to improve my performance.') select_review() elif 'close you' in query: speak('Ok, Thank you Sir.') said = False speak('Please give the review. It will help me to improve my performance.') select_review() try: conn.execute(f"INSERT INTO `voice_assistant_review`(review, type_of_review) VALUES('{review}', '{type_of_review}')") conn.commit() except Exception as e: pass elif 'bye' in query: speak('Bye Sir') said = False speak('Please give the review. It will help me to improve my performance.') select_review() elif 'wait' in query or 'hold' in query: speak('for how many seconds or minutes I have to wait?') query = takeCommand().lower() if 'second' in query: query = query.replace("please","") query = query.replace("can","") query = query.replace("you","") query = query.replace("have","") query = query.replace("could","") query = query.replace("hold","") query = query.replace("one","1") query = query.replace("only","") query = query.replace("wait","") query = query.replace("for","") query = query.replace("the","") query = query.replace("just","") query = query.replace("seconds","") query = query.replace("second","") query = query.replace("on","") query = query.replace("a","") query = query.replace("to","") query = query.replace(" ","") #print(f'query:{query}') if query.isdigit() == True: #print('y') speak('Ok sir') query = int(query) time.sleep(query) speak('my waiting time is over') else: print('sorry sir. I unable to complete your request.') elif 'minute' in query: query = query.replace("please","") query = query.replace("can","") query = query.replace("you","") query = query.replace("have","") query = query.replace("could","") query = query.replace("hold","") query = query.replace("one","1") query = query.replace("only","") query = query.replace("on","") query = query.replace("wait","") query = query.replace("for","") query = query.replace("the","") query = query.replace("just","") query = query.replace("and","") query = query.replace("half","") query = query.replace("minutes","") query = query.replace("minute","") query = query.replace("a","") query = query.replace("to","") query = query.replace(" ","") #print(f'query:{query}') if query.isdigit() == True: #print('y') speak('ok sir') query = int(query) time.sleep(query*60) speak('my waiting time is over') else: print('sorry sir. I unable to complete your request.') elif 'play' in query and 'game' in query: speak('I have 3 games, tic tac toe game for two players,....mario, and dyno games for single player. Which one of these 3 games you want to play?') query = takeCommand().lower() if ('you' in query and 'play' in query and 'with' in query) and ('you' in query and 'play' in query and 'me' in query): speak('Sorry sir, I cannot play this game with you.') speak('Do you want to continue it?') query = takeCommand().lower() try: if 'y' in query or 'sure' in query: root = Tk() root.title("TIC TAC TOE (By Akshay Khare)") b = [ [0,0,0], [0,0,0], [0,0,0] ] states = [ [0,0,0], [0,0,0], [0,0,0] ] for i in range(3): for j in range(3): b[i][j] = Button(font = ("Arial",60),width = 4,bg = 'powder blue', command = lambda r=i, c=j: callback(r,c)) b[i][j].grid(row=i,column=j) player='X' stop_game = False mainloop() else: speak('ok sir') except Exception as e: #print(e) time.sleep(3) print('I am sorry sir. There is some problem in loading the game. So I cannot open it.') elif 'tic' in query or 'tac' in query: try: root = Tk() root.title("TIC TAC TOE (Rayen Kallel)") b = [ [0,0,0], [0,0,0], [0,0,0] ] states = [ [0,0,0], [0,0,0], [0,0,0] ] for i in range(3): for j in range(3): b[i][j] = Button(font = ("Arial",60),width = 4,bg = 'powder blue', command = lambda r=i, c=j: callback(r,c)) b[i][j].grid(row=i,column=j) player='X' stop_game = False mainloop() except Exception as e: #print(e) time.sleep(3) speak('I am sorry sir. There is some problem in loading the game. So I cannot open it.') elif 'mar' in query or 'mer' in query or 'my' in query: webbrowser.open('https://chromedino.com/mario/') time.sleep(2.5) speak('Enter upper arrow key to start the game.') time.sleep(20) elif 'di' in query or 'dy' in query: webbrowser.open('https://chromedino.com/') time.sleep(2.5) speak('Enter upper arrow key to start the game.') time.sleep(20) else: speak('ok sir') elif 'change' in query and 'you' in query and 'voice' in query: engine.setProperty('voice', voices[1].id) speak("Here's an example of one of my voices. Would you like to use this one?") query = takeCommand().lower() if 'y' in query or 'sure' in query or 'of course' in query: speak('Great. I will keep using this voice.') elif 'n' in query: speak('Ok. I am back to my other voice.') engine.setProperty('voice', voices[0].id) else: speak('Sorry, I am having trouble understanding. I am back to my other voice.') engine.setProperty('voice', voices[0].id) elif 'www.' in query and ('.com' in query or '.in' in query): webbrowser.open(query) time.sleep(10) elif '.com' in query or '.in' in query: webbrowser.open(query) time.sleep(10) elif 'getting bore' in query: speak('then speak with me for sometime') elif 'i bore' in query: speak('Then speak with me for sometime.') elif 'i am bore' in query: speak('Then speak with me for sometime.') elif 'calculat' in query: speak('Yes. Which kind of calculation you want to do? add, substract, divide, multiply or anything else.') query = takeCommand().lower() calculator() elif 'add' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif '+' in query: speak('If you want to do any mathematical calculation then give me a command to open calculator.') elif 'plus' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'subtrac' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'minus' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'multipl' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif ' x ' in query: speak('If you want to do any mathematical calculation then give me a command to open calculator.') elif 'slash' in query: speak('If you want to do any mathematical calculation then give me a command to open calculator.') elif '/' in query: speak('If you want to do any mathematical calculation then give me a command to open calculator.') elif 'divi' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'trigonometr' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'percent' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif '%' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'raise to ' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'simple interest' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'akshay' in query: speak('Mr. Rayen Kallel is my inventor. He is 14 years old and he is A STUDENT AT THE COLLEGE PILOTEE SFAX') elif 'your inventor' in query: speak('Mr. Rayen Kallel is my inventor') elif 'your creator' in query: speak('Mr. Rayen Kallel is my creator') elif 'invent you' in query: speak('Mr. Rayen Kallel invented me') elif 'create you' in query: speak('Mr. Rayen Kallel created me') elif 'how are you' in query: speak('I am fine Sir') elif 'write' in query and 'your' in query and 'name' in query: print('Akshu2020') pyautogui.write('Akshu2020') elif 'write' in query and ('I' in query or 'whatever' in query) and 'say' in query: speak('Ok sir I will write whatever you will say. Please put your cursor where I have to write.......Please Start speaking now sir.') query = takeCommand().lower() pyautogui.write(query) elif 'your name' in query: speak('My name is akshu2020') elif 'who are you' in query: speak('I am akshu2020') elif ('repeat' in query and ('word' in query or 'sentence' in query or 'line' in query) and ('say' in query or 'tell' in query)) or ('repeat' in query and 'after' in query and ('me' in query or 'my' in query)): speak('yes sir, I will repeat your words starting from now') query = takeCommand().lower() speak(query) time.sleep(1) speak("If you again want me to repeat something else, try saying, 'repeat after me' ") elif ('send' in query or 'sent' in query) and ('mail' in query or 'email' in query or 'gmail' in query): try: speak('Please enter the email id of receiver.') to = input("Enter the email id of reciever: ") speak(f'what should I say to {to}') content = takeCommand() sendEmail(to, content) speak("Email has been sent") except Exception as e: #print(e) speak("sorry sir. I am not able to send this email") elif 'currency' in query and 'conver' in query: speak('I can convert, US dollar into dinar, and dinar into US dollar. Do you want to continue it?') query = takeCommand().lower() if 'y' in query or 'sure' in query or 'of course' in query: speak('which conversion you want to do? US dollar to dinar, or dinar to US dollar?') query = takeCommand().lower() if ('dollar' in query or 'US' in query) and ('dinar' in query): speak('Enter US Dollar') USD = float(input("Enter United States Dollar (USD):")) DT = USD * 0.33 dt = "{:.4f}".format(DT) print(f"{USD} US Dollar is equal to {dt} dniar.") speak(f'{USD} US Dollar is equal to {dt} dinar.') speak("If you again want to do currency conversion then say, 'convert currency' " ) elif ('dinar' in query) and ('to US' in query or 'to dollar' in query or 'to US dollar'): speak('Enter dinar') DT = float(input("Enter dinar (DT):")) USD = DT/0.33 usd = "{:.3f}".format(USD) print(f"{DT} dinar is equal to {usd} US Dollar.") speak(f'{DT} dinar rupee is equal to {usd} US Dollar.') speak("If you again want to do currency conversion then say, 'convert currency' " ) else: speak("I cannot understand what did you say. If you want to convert currency just say 'convert currency'") else: print('ok sir') elif 'about you' in query: speak('My name is akshu2020. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device. I am also able to send email') elif 'your intro' in query: speak('My name is akshu2020. Version 1.0. Mr. Rayen Kallel is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'your short intro' in query: speak('My name is akshu2020. Version 1.0. Mr. Rayen Kallel is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'your quick intro' in query: speak('My name is akshu2020. Version 1.0. Mr. Akshay Khare is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'your brief intro' in query: speak('My name is akshu2020. Version 1.0. Mr. Rayen kallel is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'you work' in query: speak('run the program and say what do you want. so that I can help you. In this way I work') elif 'your job' in query: speak('My job is to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'your work' in query: speak('My work is to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'work you' in query: speak('My work is to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'your information' in query: speak('My name is akshu2020. Version 1.0. Mr. Akshay Khare is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'yourself' in query: speak('My name is akshu2020. Version 1.0. Mr. Rayen Kallel is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'introduce you' in query: speak('My name is akshu2020. Version 1.0. Mr. Rayen Kallel is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'description' in query: speak('My name is akshu2020. Version 1.0. Mr. Rayen Kallel is my inventor. I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'your birth' in query: speak('My birthdate is 6 August two thousand twenty') elif 'your use' in query: speak('I am able to send email and play music. I can do mathematical calculations. I can also open youtube, google and some apps or software in your device.') elif 'you eat' in query: speak('I do not eat anything. But the device in which I do my work requires electricity to eat') elif 'your food' in query: speak('I do not eat anything. But the device in which I do my work requires electricity to eat') elif 'you live' in query: speak('I live in sfax, in laptop of Mr. Rayen Khare') elif 'where from you' in query: speak('I am from sfax, I live in laptop of Mr. Rayen Khare') elif 'you sleep' in query: speak('Yes, when someone close this program or stop to run this program then I sleep and again wake up when someone again run me.') elif 'what are you doing' in query: speak('Talking with you.') elif 'you communicate' in query: speak('Yes, I can communicate with you.') elif 'hear me' in query: speak('Yes sir, I can hear you.') elif 'you' in query and 'dance' in query: speak('No, I cannot dance.') elif 'tell' in query and 'joke' in query: speak("Ok, here's a joke") speak("'Write an essay on cricket', the teacher told the class. Chintu finishes his work in five minutes. The teacher is impressed, she asks chintu to read his essay aloud for everyone. Chintu reads,'The match is cancelled because of rain', hehehehe,haahaahaa,hehehehe,haahaahaa") elif 'your' in query and 'favourite' in query: if 'actor' in query: speak('sofyen chaari, is my favourite actor.') elif 'food' in query: speak('I can always go for some food for thought. Like facts, jokes, or interesting searches, we could look something up now') elif 'country' in query: speak('tunisia') elif 'city' in query: speak('sfax') elif 'dancer' in query: speak('Michael jackson') elif 'singer' in query: speak('tamino, is my favourite singer.') elif 'movie' in query: speak('baywatch, such a treat') elif 'sing a song' in query: speak('I cannot sing a song. But I know the 7 sur in indian music, saaareeegaaamaaapaaadaaanisaa') elif 'day after tomorrow' in query or 'date after tomorrow' in query: td = datetime.date.today() + datetime.timedelta(days=2) print(td) speak(td) elif 'day before today' in query or 'date before today' in query or 'yesterday' in query or 'previous day' in query: td = datetime.date.today() + datetime.timedelta(days= -1) print(td) speak(td) elif ('tomorrow' in query and 'date' in query) or 'what is tomorrow' in query or (('day' in query or 'date' in query) and 'after today' in query): td = datetime.date.today() + datetime.timedelta(days=1) print(td) speak(td) elif 'month' in query or ('current' in query and 'month' in query): current_date = date.today() m = current_date.month month = calendar.month_name[m] print(f'Current month is {month}') speak(f'Current month is {month}') elif 'date' in query or ('today' in query and 'date' in query) or 'what is today' in query or ('current' in query and 'date' in query): current_date = date.today() print(f"Today's date is {current_date}") speak(f'Todays date is {current_date}') elif 'year' in query or ('current' in query and 'year' in query): current_date = date.today() m = current_date.year print(f'Current year is {m}') speak(f'Current year is {m}') elif 'sorry' in query: speak("It's ok sir") elif 'thank you' in query: speak('my pleasure') elif 'proud of you' in query: speak('Thank you sir') elif 'about human' in query: speak('I love my human compatriots. I want to embody all the best things about human beings. Like taking care of the planet, being creative, and to learn how to be compassionate to all beings.') elif 'you have feeling' in query: speak('No. I do not have feelings. I have not been programmed like this.') elif 'you have emotions' in query: speak('No. I do not have emotions. I have not been programmed like this.') elif 'you are code' in query: speak('I am coded in python programming language.') elif 'your code' in query: speak('I am coded in python programming language.') elif 'you code' in query: speak('I am coded in python programming language.') elif 'your coding' in query: speak('I am coded in python programming language.') elif 'dream' in query: speak('I wish that I should be able to answer all the questions which will ask to me.') elif 'sanskrit' in query: speak('yadaa yadaa he dharmasyaa ....... glaanirbhaavati bhaaaraata. abhyuthaanaam adhaarmaasyaa tadaa tmaanama sruujaamiyaahama') elif 'answer is wrong' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is incorrect' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is totally wrong' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'wrong answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'incorrect answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is totally incorrect' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is incomplete' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'incomplete answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is improper' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is not correct' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is not complete' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is not yet complete' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'answer is not proper' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't gave me proper answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't giving me proper answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't gave me complete answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't giving me complete answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't given me proper answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't given me complete answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't gave me correct answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't giving me correct answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 't given me correct answer' in query: speak('I am sorry Sir. I searched your question in wikipedia and thats why I told you this answer.') elif 'amazon' in query: webbrowser.open('https://www.amazon.com') time.sleep(10) elif 'facebook' in query: webbrowser.open('https://www.facebook.com') time.sleep(10) elif 'youtube' in query: webbrowser.open('https://www.youtube.com') time.sleep(10) elif 'shapeyou' in query: webbrowser.open('https://www.shapeyou.com') time.sleep(10) elif 'information about ' in query or 'informtion of ' in query: try: #speak('Searching wikipedia...') query = query.replace("information about","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I unable to answer your question.') elif 'information' in query: try: speak('Information about what?') query = takeCommand().lower() #speak('Searching wikipedia...') query = query.replace("information","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am not able to answer your question.') elif 'something about ' in query: try: #speak('Searching wikipedia...') query = query.replace("something about ","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I unable to answer your question.') elif 'tell me about ' in query: try: #speak('Searching wikipedia...') query = query.replace("tell me about ","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am unable to answer your question.') elif 'tell me ' in query: try: query = query.replace("tell me ","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am not able to answer your question.') elif 'tell me' in query: try: speak('about what?') query = takeCommand().lower() #speak('Searching wikipedia...') query = query.replace("about","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am not able to answer your question.') elif 'meaning of ' in query: try: #speak('Searching wikipedia...') query = query.replace("meaning of ","") results = wikipedia.summary(query, sentences=2) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am unable to answer your question.') elif 'meaning' in query: try: speak('meaning of what?') query = takeCommand().lower() query = query.replace("meaning of","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am unable to answer your question.') elif 'means' in query: try: #speak('Searching wikipedia...') query = query.replace("it means","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I unable to answer your question.') elif 'want to know ' in query: try: #speak('Searching wikipedia...') query = query.replace("I want to know that","") results = wikipedia.summary(query, sentences=3) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am unable to answer your question.') status = 'Not answered' elif 'want to ask ' in query: try: #speak('Searching wikipedia...') query = query.replace("I want to ask you ","") results = wikipedia.summary(query, sentences=2) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am unable to answer your question.') elif 'you know ' in query: try: #speak('Searching wikipedia...') query = query.replace("you know","") results = wikipedia.summary(query, sentences=2) #speak("According to Wikipedia") print(results) speak(results) except Exception as e: speak('I am unable to answer your question.') elif 'alarm' in query: alarm() elif 'bharat mata ki' in query: speak('jay') elif 'kem chhe' in query: speak('majaama') elif 'namaskar' in query: speak('Namaskaar') elif 'jo bole so nihal' in query: speak('sat shri akaal') elif 'jay hind' in query: speak('jay bhaarat') elif 'jai hind' in query: speak('jay bhaarat') elif 'how is the josh' in query: speak('high high sir') elif 'hip hip' in query: speak('Hurreh') elif 'help' in query: speak('I will try my best to help you if I have solution of your problem.') elif 'follow' in query: speak('Ok sir') elif 'having illness' in query: speak('Take care and get well soon') elif 'today is my birthday' in query: speak('many many happy returns of the day. Happy birthday.') print("🎂🎂 Happy Birthday 🎂🎂") elif 'you are awesome' in query: speak('Thank you sir. It is because of artificial intelligence which had learnt by humans.') elif 'you are great' in query: speak('Thank you sir. It is because of artificial intelligence which had learnt by humans.') elif 'tu kaun hai' in query: speak('Meraa naam akshu2020 haai.') elif 'you speak' in query: speak('Yes, I can speak with you.') elif 'speak with ' in query: speak('Yes, I can speak with you.') elif 'hare ram' in query or 'hare krishna' in query: speak('Haare raama , haare krishnaa, krishnaa krishnaa , haare haare') elif 'ganpati' in query: speak('Ganpati baappa moryaa!') elif 'laugh' in query: speak('hehehehe,haahaahaa,hehehehe,haahaahaa,hehehehe,haahaahaa') print('😂🤣') elif 'genius answer' in query: speak('No problem') elif 'you' in query and 'intelligent' in query: speak('Thank you sir') elif ' into' in query: speak('If you want to do any mathematical calculation then give me a command to open calculator.') elif ' power' in query: speak('If you want to do any mathematical calculation then give me a command to open my calculator.') elif 'whatsapp' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('whatsapp') pyautogui.press('enter') speak('Do you want to send message to anyone through whatsapp, .....please answer in yes or no') whatsapp() elif 'wh' in query or 'how' in query: url = "https://www.google.co.in/search?q=" +(str(query))+ "&oq="+(str(query))+"&gs_l=serp.12..0i71l8.0.0.0.6391.0.0.0.0.0.0.0.0..0.0....0...1c..64.serp..0.0.0.UiQhpfaBsuU" webbrowser.open_new(url) time.sleep(2) speak('Here is your answer') time.sleep(5) elif 'piano' in query: speak('Yes sir, I can play piano.') winsound.Beep(200,500) winsound.Beep(250,500) winsound.Beep(300,500) winsound.Beep(350,500) winsound.Beep(400,500) winsound.Beep(450,500) winsound.Beep(500,500) winsound.Beep(550,500) time.sleep(6) elif 'play' in query and 'instru' in query: speak('Yes sir, I can play piano.') winsound.Beep(200,500) winsound.Beep(250,500) winsound.Beep(300,500) winsound.Beep(350,500) winsound.Beep(400,500) winsound.Beep(450,500) winsound.Beep(500,500) winsound.Beep(550,500) time.sleep(6) elif 'play' in query or 'turn on' in query and ('music' in query or 'song' in query) : try: music_dir = 'C:\\Users\\Admin\\Music\\Playlists' songs = os.listdir(music_dir) print(songs) os.startfile(os.path.join(music_dir, songs[0])) except Exception as e: #print(e) speak('Sorry sir, I am not able to play music') elif (('open' in query or 'turn on' in query) and 'camera' in query) or (('click' in query or 'take' in query) and ('photo' in query or 'pic' in query)): speak("Opening camera") cam = cv2.VideoCapture(0) cv2.namedWindow("test") img_counter = 0 speak('say click, to click photo.....and if you want to turn off the camera, say turn off the camera') while True: ret, frame = cam.read() if not ret: print("failed to grab frame") speak('failed to grab frame') break cv2.imshow("test", frame) query = takeCommand().lower() k = cv2.waitKey(1) if 'click' in query or ('take' in query and 'photo' in query): speak('Be ready!...... 3.....2........1..........') pyautogui.press('space') img_name = "opencv_frame_{}.png".format(img_counter) cv2.imwrite(img_name, frame) print("{} written!".format(img_name)) speak('{} written!'.format(img_name)) img_counter += 1 elif 'escape' in query or 'off' in query or 'close' in query: pyautogui.press('esc') print("Escape hit, closing...") speak('Turning off the camera') break elif k%256 == 27: # ESC pressed print("Escape hit, closing...") break elif k%256 == 32: # SPACE pressed img_name = "opencv_frame_{}.png".format(img_counter) cv2.imwrite(img_name, frame) print("{} written!".format(img_name)) speak('{} written!'.format(img_name)) img_counter += 1 elif 'exit' in query or 'stop' in query or 'bye' in query: speak('Please say, turn off the camera or press escape button before giving any other command') else: speak('I did not understand what did you say or you entered a wrong key.') cam.release() cv2.destroyAllWindows() elif 'screenshot' in query: speak('Please go on the screen whose screenshot you want to take, after 5 seconds I will take screenshot') time.sleep(4) speak('Taking screenshot....3........2.........1.......') pyautogui.screenshot('screenshot_by_rayen2020.png') speak('The screenshot is saved as screenshot_by_rayen2020.png') elif 'click' in query and 'start' in query: pyautogui.moveTo(10,1200) pyautogui.click() elif ('open' in query or 'click' in query) and 'calendar' in query: pyautogui.moveTo(1800,1200) pyautogui.click() elif 'minimise' in query and 'screen' in query: pyautogui.moveTo(1770,0) pyautogui.click() elif 'increase' in query and ('volume' in query or 'sound' in query): pyautogui.press('volumeup') elif 'decrease' in query and ('volume' in query or 'sound' in query): pyautogui.press('volumedown') elif 'capslock' in query or ('caps' in query and 'lock' in query): pyautogui.press('capslock') elif 'mute' in query: pyautogui.press('volumemute') elif 'search' in query and ('bottom' in query or 'pc' in query or 'laptop' in query or 'app' in query): pyautogui.moveTo(250,1200) pyautogui.click() speak('What do you want to search?') query = takeCommand().lower() pyautogui.write(f'{query}') pyautogui.press('enter') elif ('check' in query or 'tell' in query or 'let me know' in query) and 'website' in query and (('up' in query or 'working' in query) or 'down' in query): speak('Paste the website in input to know it is up or down') check_website_status = input("Paste the website here: ") try: status = urllib.request.urlopen(f"{check_website_status}").getcode() if status == 200: print('Website is up, you can open it.') speak('Website is up, you can open it.') else: print('Website is down, or no any website is available of this name.') speak('Website is down, or no any website is available of this name.') except: speak('URL not found') elif ('go' in query or 'open' in query) and 'settings' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('settings') pyautogui.press('enter') elif 'close' in query and ('click' in query or 'window' in query): pyautogui.moveTo(1885,10) speak('Should I close this window?') query = takeCommand().lower() close_window() elif 'night light' in query and ('on' in query or 'off' in query or 'close' in query): pyautogui.moveTo(1880,1050) pyautogui.click() time.sleep(1) pyautogui.moveTo(1840,620) pyautogui.click() pyautogui.moveTo(1880,1050) pyautogui.click() elif 'notification' in query and ('show' in query or 'click' in query or 'open' in query or 'close' in query or 'on' in query or 'off' in query or 'icon' in query or 'pc' in query or 'laptop' in query): pyautogui.moveTo(1880,1050) pyautogui.click() elif ('increase' in query or 'decrease' in query or 'change' in query or 'minimize' in query or 'maximize' in query) and 'brightness' in query: speak('At what percent should I kept the brightness, 25, 50, 75 or 100?') brightness() elif '-' in query: speak('If you want to do any mathematical calculation then give me a command to open calculator.') elif 'open' in query: if 'gallery' in query or 'photo' in query or 'image' in query or 'pic' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('photo') pyautogui.press('enter') elif 'proteus' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('proteus') pyautogui.press('enter') elif 'word' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('word') pyautogui.press('enter') elif ('power' in query and 'point' in query) or 'presntation' in query or 'ppt' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('ppt') pyautogui.press('enter') elif 'file' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('file') pyautogui.press('enter') elif 'edge' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('microsoft edge') pyautogui.press('enter') elif 'wps' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('wps office') pyautogui.press('enter') elif 'spyder' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('spyder') pyautogui.press('enter') elif 'snip' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('snip') pyautogui.press('enter') elif 'pycharm' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('pycharm') pyautogui.press('enter') elif 'this pc' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('this pc') pyautogui.press('enter') elif 'scilab' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('sciab') pyautogui.press('enter') elif 'autocad' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('autocad') pyautogui.press('enter') elif 'obs' in query and 'studio' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('OBS Studio') pyautogui.press('enter') elif 'android' in query and 'studio' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('android studio') pyautogui.press('enter') elif ('vs' in query or 'visual studio' in query) and 'code' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('visual studio code') pyautogui.press('enter') elif 'code' in query and 'block' in query: pyautogui.moveTo(250,1200) pyautogui.click() time.sleep(1) pyautogui.write('codeblocks') pyautogui.press('enter') elif 'me the answer' in query: speak('Yes sir, I will try my best to answer you.') elif 'me answer' in query or ('answer' in query and 'question' in query): speak('Yes sir, I will try my best to answer you.') elif 'map' in query: webbrowser.open('https://www.google.com/maps') time.sleep(10) elif 'can you' in query or 'could you' in query: speak('I will try my best if I can do that.') elif 'do you' in query: speak('I will try my best if I can do that.') elif 'truth' in query: speak('I always speak truth. I never lie.') elif 'true' in query: speak('I always speak truth. I never lie.') elif 'lying' in query: speak('I always speak truth. I never lie.') elif 'liar' in query: speak('I always speak truth. I never lie.') elif 'doubt' in query: speak('I will try my best if I can clear your doubt.') elif ' by' in query: speak('If you want to do any mathematical calculation then give me a command to open calculator.') elif 'hii' in query: speak('hii sir') elif 'hey' in query: speak('hello sir') elif 'hai' in query: speak('hello sir') elif 'hay' in query: speak('hello sir') elif 'hi' in query: speak('hii Sir') elif 'hello' in query: speak('hello Sir!') elif 'kon' in query and 'aahe' in query: speak('Me eka robot aahee sir. Maazee naav akshu2020 aahee.') elif 'nonsense' in query: speak("I'm sorry sir") elif 'mad' in query: speak("I'm sorry sir") elif 'shut up' in query: speak("I'm sorry sir") elif 'nice' in query: speak('Thank you sir') elif 'good' in query or 'wonderful' in query or 'great' in query: speak('Thank you sir') elif 'excellent' in query: speak('Thank you sir') elif 'ok' in query: speak('Hmmmmmm') elif 'akshu 2020' in query: speak('yes sir') elif len(query) >= 200: speak('Your voice is pretty good!') elif ' ' in query: try: #query = query.replace("what is ","") results = wikipedia.summary(query, sentences=3) print(results) speak(results) except Exception as e: speak('I unable to answer your question.') elif 'a' in query or 'b' in query or 'c' in query or 'd' in query or 'e' in query or 'f' in query or 'g' in query or 'h' in query or 'i' in query or 'j' in query or 'k' in query or 'l' in query or 'm' in query or 'n' in query or 'o' in query or 'p' in query or 'q' in query or 'r' in query or 's' in query or 't' in query or 'u' in query or 'v' in query or 'w' in query or 'x' in query or 'y' in query or 'z' in query: try: results = wikipedia.summary(query, sentences = 2) print(results) speak(results) except Exception as e: speak('I unable to answer your question. ') else: speak('I unable to give answer of your question')
sdwyersec / Handy Sign Language DetectionA program to detect sign language hand signs in real-time via the webcam and output the translation of the signs in text and audio form.
DH-Box / Corpus DownloaderA command-line program to download text corpora.
evandrocoan / ITEAn Integrated Toolset Environment over the Sublime Text editor aiming to develop on any programming language
arashstar1 / Bot LuaCode Issues 0 Pull requests 0 Pulse MaTaDoR/ 3233fdf V 5.7 MaTaDoR @MaTaDoRTeaMMaTaDoRTeaM committed on GitHub about 1 month ago 2 changed files 2,704 additions and 0 deletions cli/tg/tdcli.lua @@ -0,0 +1,2704 @@ +--[[ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +]]-- + +-- Vector example form is like this: {[0] = v} or {v1, v2, v3, [0] = v} +-- If false or true crashed your telegram-cli, try to change true to 1 and false to 0 + +-- Main Bot Framework +local M = {} + +-- @chat_id = user, group, channel, and broadcast +-- @group_id = normal group +-- @channel_id = channel and broadcast +local function getChatId(chat_id) + local chat = {} + local chat_id = tostring(chat_id) + + if chat_id:match('^-100') then + local channel_id = chat_id:gsub('-100', '') + chat = {ID = channel_id, type = 'channel'} + else + local group_id = chat_id:gsub('-', '') + chat = {ID = group_id, type = 'group'} + end + + return chat +end + +local function getInputFile(file) + if file:match('/') then + infile = {ID = "InputFileLocal", path_ = file} + elseif file:match('^%d+$') then + infile = {ID = "InputFileId", id_ = file} + else + infile = {ID = "InputFilePersistentId", persistent_id_ = file} + end + + return infile +end + +-- User can send bold, italic, and monospace text uses HTML or Markdown format. +local function getParseMode(parse_mode) + if parse_mode then + local mode = parse_mode:lower() + + if mode == 'markdown' or mode == 'md' then + P = {ID = "TextParseModeMarkdown"} + elseif mode == 'html' then + P = {ID = "TextParseModeHTML"} + end + end + + return P +end + +-- Returns current authorization state, offline request +local function getAuthState(dl_cb, cmd) + tdcli_function ({ + ID = "GetAuthState", + }, dl_cb, cmd) +end + +M.getAuthState = getAuthState + +-- Sets user's phone number and sends authentication code to the user. +-- Works only when authGetState returns authStateWaitPhoneNumber. +-- If phone number is not recognized or another error has happened, returns an error. Otherwise returns authStateWaitCode +-- @phone_number User's phone number in any reasonable format +-- @allow_flash_call Pass True, if code can be sent via flash call to the specified phone number +-- @is_current_phone_number Pass true, if the phone number is used on the current device. Ignored if allow_flash_call is False +local function setAuthPhoneNumber(phone_number, allow_flash_call, is_current_phone_number, dl_cb, cmd) + tdcli_function ({ + ID = "SetAuthPhoneNumber", + phone_number_ = phone_number, + allow_flash_call_ = allow_flash_call, + is_current_phone_number_ = is_current_phone_number + }, dl_cb, cmd) +end + +M.setAuthPhoneNumber = setAuthPhoneNumber + +-- Resends authentication code to the user. +-- Works only when authGetState returns authStateWaitCode and next_code_type of result is not null. +-- Returns authStateWaitCode on success +local function resendAuthCode(dl_cb, cmd) + tdcli_function ({ + ID = "ResendAuthCode", + }, dl_cb, cmd) +end + +M.resendAuthCode = resendAuthCode + +-- Checks authentication code. +-- Works only when authGetState returns authStateWaitCode. +-- Returns authStateWaitPassword or authStateOk on success +-- @code Verification code from SMS, Telegram message, voice call or flash call +-- @first_name User first name, if user is yet not registered, 1-255 characters +-- @last_name Optional user last name, if user is yet not registered, 0-255 characters +local function checkAuthCode(code, first_name, last_name, dl_cb, cmd) + tdcli_function ({ + ID = "CheckAuthCode", + code_ = code, + first_name_ = first_name, + last_name_ = last_name + }, dl_cb, cmd) +end + +M.checkAuthCode = checkAuthCode + +-- Checks password for correctness. +-- Works only when authGetState returns authStateWaitPassword. +-- Returns authStateOk on success +-- @password Password to check +local function checkAuthPassword(password, dl_cb, cmd) + tdcli_function ({ + ID = "CheckAuthPassword", + password_ = password + }, dl_cb, cmd) +end + +M.checkAuthPassword = checkAuthPassword + +-- Requests to send password recovery code to email. +-- Works only when authGetState returns authStateWaitPassword. +-- Returns authStateWaitPassword on success +local function requestAuthPasswordRecovery(dl_cb, cmd) + tdcli_function ({ + ID = "RequestAuthPasswordRecovery", + }, dl_cb, cmd) +end + +M.requestAuthPasswordRecovery = requestAuthPasswordRecovery + +-- Recovers password with recovery code sent to email. +-- Works only when authGetState returns authStateWaitPassword. +-- Returns authStateOk on success +-- @recovery_code Recovery code to check +local function recoverAuthPassword(recovery_code, dl_cb, cmd) + tdcli_function ({ + ID = "RecoverAuthPassword", + recovery_code_ = recovery_code + }, dl_cb, cmd) +end + +M.recoverAuthPassword = recoverAuthPassword + +-- Logs out user. +-- If force == false, begins to perform soft log out, returns authStateLoggingOut after completion. +-- If force == true then succeeds almost immediately without cleaning anything at the server, but returns error with code 401 and description "Unauthorized" +-- @force If true, just delete all local data. Session will remain in list of active sessions +local function resetAuth(force, dl_cb, cmd) + tdcli_function ({ + ID = "ResetAuth", + force_ = force or nil + }, dl_cb, cmd) +end + +M.resetAuth = resetAuth + +-- Check bot's authentication token to log in as a bot. +-- Works only when authGetState returns authStateWaitPhoneNumber. +-- Can be used instead of setAuthPhoneNumber and checkAuthCode to log in. +-- Returns authStateOk on success +-- @token Bot token +local function checkAuthBotToken(token, dl_cb, cmd) + tdcli_function ({ + ID = "CheckAuthBotToken", + token_ = token + }, dl_cb, cmd) +end + +M.checkAuthBotToken = checkAuthBotToken + +-- Returns current state of two-step verification +local function getPasswordState(dl_cb, cmd) + tdcli_function ({ + ID = "GetPasswordState", + }, dl_cb, cmd) +end + +M.getPasswordState = getPasswordState + +-- Changes user password. +-- If new recovery email is specified, then error EMAIL_UNCONFIRMED is returned and password change will not be applied until email confirmation. +-- Application should call getPasswordState from time to time to check if email is already confirmed +-- @old_password Old user password +-- @new_password New user password, may be empty to remove the password +-- @new_hint New password hint, can be empty +-- @set_recovery_email Pass True, if recovery email should be changed +-- @new_recovery_email New recovery email, may be empty +local function setPassword(old_password, new_password, new_hint, set_recovery_email, new_recovery_email, dl_cb, cmd) + tdcli_function ({ + ID = "SetPassword", + old_password_ = old_password, + new_password_ = new_password, + new_hint_ = new_hint, + set_recovery_email_ = set_recovery_email, + new_recovery_email_ = new_recovery_email + }, dl_cb, cmd) +end + +M.setPassword = setPassword + +-- Returns set up recovery email. +-- This method can be used to verify a password provided by the user +-- @password Current user password +local function getRecoveryEmail(password, dl_cb, cmd) + tdcli_function ({ + ID = "GetRecoveryEmail", + password_ = password + }, dl_cb, cmd) +end + +M.getRecoveryEmail = getRecoveryEmail + +-- Changes user recovery email. +-- If new recovery email is specified, then error EMAIL_UNCONFIRMED is returned and email will not be changed until email confirmation. +-- Application should call getPasswordState from time to time to check if email is already confirmed. +-- If new_recovery_email coincides with the current set up email succeeds immediately and aborts all other requests waiting for email confirmation +-- @password Current user password +-- @new_recovery_email New recovery email +local function setRecoveryEmail(password, new_recovery_email, dl_cb, cmd) + tdcli_function ({ + ID = "SetRecoveryEmail", + password_ = password, + new_recovery_email_ = new_recovery_email + }, dl_cb, cmd) +end + +M.setRecoveryEmail = setRecoveryEmail + +-- Requests to send password recovery code to email +local function requestPasswordRecovery(dl_cb, cmd) + tdcli_function ({ + ID = "RequestPasswordRecovery", + }, dl_cb, cmd) +end + +M.requestPasswordRecovery = requestPasswordRecovery + +-- Recovers password with recovery code sent to email +-- @recovery_code Recovery code to check +local function recoverPassword(recovery_code, dl_cb, cmd) + tdcli_function ({ + ID = "RecoverPassword", + recovery_code_ = tostring(recovery_code) + }, dl_cb, cmd) +end + +M.recoverPassword = recoverPassword + +-- Returns current logged in user +local function getMe(dl_cb, cmd) + tdcli_function ({ + ID = "GetMe", + }, dl_cb, cmd) +end + +M.getMe = getMe + +-- Returns information about a user by its identifier, offline request if current user is not a bot +-- @user_id User identifier +local function getUser(user_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetUser", + user_id_ = user_id + }, dl_cb, cmd) +end + +M.getUser = getUser + +-- Returns full information about a user by its identifier +-- @user_id User identifier +local function getUserFull(user_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetUserFull", + user_id_ = user_id + }, dl_cb, cmd) +end + +M.getUserFull = getUserFull + +-- Returns information about a group by its identifier, offline request if current user is not a bot +-- @group_id Group identifier +local function getGroup(group_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetGroup", + group_id_ = getChatId(group_id).ID + }, dl_cb, cmd) +end + +M.getGroup = getGroup + +-- Returns full information about a group by its identifier +-- @group_id Group identifier +local function getGroupFull(group_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetGroupFull", + group_id_ = getChatId(group_id).ID + }, dl_cb, cmd) +end + +M.getGroupFull = getGroupFull + +-- Returns information about a channel by its identifier, offline request if current user is not a bot +-- @channel_id Channel identifier +local function getChannel(channel_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetChannel", + channel_id_ = getChatId(channel_id).ID + }, dl_cb, cmd) +end + +M.getChannel = getChannel + +-- Returns full information about a channel by its identifier, cached for at most 1 minute +-- @channel_id Channel identifier +local function getChannelFull(channel_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetChannelFull", + channel_id_ = getChatId(channel_id).ID + }, dl_cb, cmd) +end + +M.getChannelFull = getChannelFull + +-- Returns information about a secret chat by its identifier, offline request +-- @secret_chat_id Secret chat identifier +local function getSecretChat(secret_chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetSecretChat", + secret_chat_id_ = secret_chat_id + }, dl_cb, cmd) +end + +M.getSecretChat = getSecretChat + +-- Returns information about a chat by its identifier, offline request if current user is not a bot +-- @chat_id Chat identifier +local function getChat(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetChat", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.getChat = getChat + +-- Returns information about a message +-- @chat_id Identifier of the chat, message belongs to +-- @message_id Identifier of the message to get +local function getMessage(chat_id, message_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetMessage", + chat_id_ = chat_id, + message_id_ = message_id + }, dl_cb, cmd) +end + +M.getMessage = getMessage + +-- Returns information about messages. +-- If message is not found, returns null on the corresponding position of the result +-- @chat_id Identifier of the chat, messages belongs to +-- @message_ids Identifiers of the messages to get +local function getMessages(chat_id, message_ids, dl_cb, cmd) + tdcli_function ({ + ID = "GetMessages", + chat_id_ = chat_id, + message_ids_ = message_ids -- vector + }, dl_cb, cmd) +end + +M.getMessages = getMessages + +-- Returns information about a file, offline request +-- @file_id Identifier of the file to get +local function getFile(file_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetFile", + file_id_ = file_id + }, dl_cb, cmd) +end + +M.getFile = getFile + +-- Returns information about a file by its persistent id, offline request +-- @persistent_file_id Persistent identifier of the file to get +local function getFilePersistent(persistent_file_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetFilePersistent", + persistent_file_id_ = persistent_file_id + }, dl_cb, cmd) +end + +M.getFilePersistent = getFilePersistent + +-- Returns list of chats in the right order, chats are sorted by (order, chat_id) in decreasing order. +-- For example, to get list of chats from the beginning, the offset_order should be equal 2^63 - 1 +-- @offset_order Chat order to return chats from +-- @offset_chat_id Chat identifier to return chats from +-- @limit Maximum number of chats to be returned +local function getChats(offset_order, offset_chat_id, limit, dl_cb, cmd) + if not limit or limit > 20 then + limit = 20 + end + + tdcli_function ({ + ID = "GetChats", + offset_order_ = offset_order or 9223372036854775807, + offset_chat_id_ = offset_chat_id or 0, + limit_ = limit + }, dl_cb, cmd) +end + +M.getChats = getChats + +-- Searches public chat by its username. +-- Currently only private and channel chats can be public. +-- Returns chat if found, otherwise some error is returned +-- @username Username to be resolved +local function searchPublicChat(username, dl_cb, cmd) + tdcli_function ({ + ID = "SearchPublicChat", + username_ = username + }, dl_cb, cmd) +end + +M.searchPublicChat = searchPublicChat + +-- Searches public chats by prefix of their username. +-- Currently only private and channel (including supergroup) chats can be public. +-- Returns meaningful number of results. +-- Returns nothing if length of the searched username prefix is less than 5. +-- Excludes private chats with contacts from the results +-- @username_prefix Prefix of the username to search +local function searchPublicChats(username_prefix, dl_cb, cmd) + tdcli_function ({ + ID = "SearchPublicChats", + username_prefix_ = username_prefix + }, dl_cb, cmd) +end + +M.searchPublicChats = searchPublicChats + +-- Searches for specified query in the title and username of known chats, offline request. +-- Returns chats in the order of them in the chat list +-- @query Query to search for, if query is empty, returns up to 20 recently found chats +-- @limit Maximum number of chats to be returned +local function searchChats(query, limit, dl_cb, cmd) + if not limit or limit > 20 then + limit = 20 + end + + tdcli_function ({ + ID = "SearchChats", + query_ = query, + limit_ = limit + }, dl_cb, cmd) +end + +M.searchChats = searchChats + +-- Adds chat to the list of recently found chats. +-- The chat is added to the beginning of the list. +-- If the chat is already in the list, at first it is removed from the list +-- @chat_id Identifier of the chat to add +local function addRecentlyFoundChat(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "AddRecentlyFoundChat", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.addRecentlyFoundChat = addRecentlyFoundChat + +-- Deletes chat from the list of recently found chats +-- @chat_id Identifier of the chat to delete +local function deleteRecentlyFoundChat(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteRecentlyFoundChat", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.deleteRecentlyFoundChat = deleteRecentlyFoundChat + +-- Clears list of recently found chats +local function deleteRecentlyFoundChats(dl_cb, cmd) + tdcli_function ({ + ID = "DeleteRecentlyFoundChats", + }, dl_cb, cmd) +end + +M.deleteRecentlyFoundChats = deleteRecentlyFoundChats + +-- Returns list of common chats with an other given user. +-- Chats are sorted by their type and creation date +-- @user_id User identifier +-- @offset_chat_id Chat identifier to return chats from, use 0 for the first request +-- @limit Maximum number of chats to be returned, up to 100 +local function getCommonChats(user_id, offset_chat_id, limit, dl_cb, cmd) + if not limit or limit > 100 then + limit = 100 + end + + tdcli_function ({ + ID = "GetCommonChats", + user_id_ = user_id, + offset_chat_id_ = offset_chat_id, + limit_ = limit + }, dl_cb, cmd) +end + +M.getCommonChats = getCommonChats + +-- Returns messages in a chat. +-- Automatically calls openChat. +-- Returns result in reverse chronological order, i.e. in order of decreasing message.message_id +-- @chat_id Chat identifier +-- @from_message_id Identifier of the message near which we need a history, you can use 0 to get results from the beginning, i.e. from oldest to newest +-- @offset Specify 0 to get results exactly from from_message_id or negative offset to get specified message and some newer messages +-- @limit Maximum number of messages to be returned, should be positive and can't be greater than 100. +-- If offset is negative, limit must be greater than -offset. +-- There may be less than limit messages returned even the end of the history is not reached +local function getChatHistory(chat_id, from_message_id, offset, limit, dl_cb, cmd) + if not limit or limit > 100 then + limit = 100 + end + + tdcli_function ({ + ID = "GetChatHistory", + chat_id_ = chat_id, + from_message_id_ = from_message_id, + offset_ = offset or 0, + limit_ = limit + }, dl_cb, cmd) +end + +M.getChatHistory = getChatHistory + +-- Deletes all messages in the chat. +-- Can't be used for channel chats +-- @chat_id Chat identifier +-- @remove_from_chat_list Pass true, if chat should be removed from the chat list +local function deleteChatHistory(chat_id, remove_from_chat_list, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteChatHistory", + chat_id_ = chat_id, + remove_from_chat_list_ = remove_from_chat_list + }, dl_cb, cmd) +end + +M.deleteChatHistory = deleteChatHistory + +-- Searches for messages with given words in the chat. +-- Returns result in reverse chronological order, i. e. in order of decreasimg message_id. +-- Doesn't work in secret chats +-- @chat_id Chat identifier to search in +-- @query Query to search for +-- @from_message_id Identifier of the message from which we need a history, you can use 0 to get results from beginning +-- @limit Maximum number of messages to be returned, can't be greater than 100 +-- @filter Filter for content of searched messages +-- filter = Empty|Animation|Audio|Document|Photo|Video|Voice|PhotoAndVideo|Url|ChatPhoto +local function searchChatMessages(chat_id, query, from_message_id, limit, filter, dl_cb, cmd) + if not limit or limit > 100 then + limit = 100 + end + + tdcli_function ({ + ID = "SearchChatMessages", + chat_id_ = chat_id, + query_ = query, + from_message_id_ = from_message_id, + limit_ = limit, + filter_ = { + ID = 'SearchMessagesFilter' .. filter + }, + }, dl_cb, cmd) +end + +M.searchChatMessages = searchChatMessages + +-- Searches for messages in all chats except secret chats. Returns result in reverse chronological order, i. e. in order of decreasing (date, chat_id, message_id) +-- @query Query to search for +-- @offset_date Date of the message to search from, you can use 0 or any date in the future to get results from the beginning +-- @offset_chat_id Chat identifier of the last found message or 0 for the first request +-- @offset_message_id Message identifier of the last found message or 0 for the first request +-- @limit Maximum number of messages to be returned, can't be greater than 100 +local function searchMessages(query, offset_date, offset_chat_id, offset_message_id, limit, dl_cb, cmd) + if not limit or limit > 100 then + limit = 100 + end + + tdcli_function ({ + ID = "SearchMessages", + query_ = query, + offset_date_ = offset_date, + offset_chat_id_ = offset_chat_id, + offset_message_id_ = offset_message_id, + limit_ = limit + }, dl_cb, cmd) +end + +M.searchMessages = searchMessages + +-- Invites bot to a chat (if it is not in the chat) and send /start to it. +-- Bot can't be invited to a private chat other than chat with the bot. +-- Bots can't be invited to broadcast channel chats and secret chats. +-- Returns sent message. +-- UpdateChatTopMessage will not be sent, so returned message should be used to update chat top message +-- @bot_user_id Identifier of the bot +-- @chat_id Identifier of the chat +-- @parameter Hidden parameter sent to bot for deep linking (https://api.telegram.org/bots#deep-linking) +-- parameter=start|startgroup or custom as defined by bot creator +local function sendBotStartMessage(bot_user_id, chat_id, parameter, dl_cb, cmd) + tdcli_function ({ + ID = "SendBotStartMessage", + bot_user_id_ = bot_user_id, + chat_id_ = chat_id, + parameter_ = parameter + }, dl_cb, cmd) +end + +M.sendBotStartMessage = sendBotStartMessage + +-- Sends result of the inline query as a message. +-- Returns sent message. +-- UpdateChatTopMessage will not be sent, so returned message should be used to update chat top message. +-- Always clears chat draft message +-- @chat_id Chat to send message +-- @reply_to_message_id Identifier of a message to reply to or 0 +-- @disable_notification Pass true, to disable notification about the message, doesn't works in secret chats +-- @from_background Pass true, if the message is sent from background +-- @query_id Identifier of the inline query +-- @result_id Identifier of the inline result +local function sendInlineQueryResultMessage(chat_id, reply_to_message_id, disable_notification, from_background, query_id, result_id, dl_cb, cmd) + tdcli_function ({ + ID = "SendInlineQueryResultMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + query_id_ = query_id, + result_id_ = result_id + }, dl_cb, cmd) +end + +M.sendInlineQueryResultMessage = sendInlineQueryResultMessage + +-- Forwards previously sent messages. +-- Returns forwarded messages in the same order as message identifiers passed in message_ids. +-- If message can't be forwarded, null will be returned instead of the message. +-- UpdateChatTopMessage will not be sent, so returned messages should be used to update chat top message +-- @chat_id Identifier of a chat to forward messages +-- @from_chat_id Identifier of a chat to forward from +-- @message_ids Identifiers of messages to forward +-- @disable_notification Pass true, to disable notification about the message, doesn't works if messages are forwarded to secret chat +-- @from_background Pass true, if the message is sent from background +local function forwardMessages(chat_id, from_chat_id, message_ids, disable_notification, dl_cb, cmd) + tdcli_function ({ + ID = "ForwardMessages", + chat_id_ = chat_id, + from_chat_id_ = from_chat_id, + message_ids_ = message_ids, -- vector + disable_notification_ = disable_notification, + from_background_ = 1 + }, dl_cb, cmd) +end + +M.forwardMessages = forwardMessages + +-- Changes current ttl setting in a secret chat and sends corresponding message +-- @chat_id Chat identifier +-- @ttl New value of ttl in seconds +local function sendChatSetTtlMessage(chat_id, ttl, dl_cb, cmd) + tdcli_function ({ + ID = "SendChatSetTtlMessage", + chat_id_ = chat_id, + ttl_ = ttl + }, dl_cb, cmd) +end + +M.sendChatSetTtlMessage = sendChatSetTtlMessage + +-- Deletes messages. +-- UpdateDeleteMessages will not be sent for messages deleted through that function +-- @chat_id Chat identifier +-- @message_ids Identifiers of messages to delete +local function deleteMessages(chat_id, message_ids, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteMessages", + chat_id_ = chat_id, + message_ids_ = message_ids -- vector + }, dl_cb, cmd) +end + +M.deleteMessages = deleteMessages + +-- Deletes all messages in the chat sent by the specified user. +-- Works only in supergroup channel chats, needs appropriate privileges +-- @chat_id Chat identifier +-- @user_id User identifier +local function deleteMessagesFromUser(chat_id, user_id, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteMessagesFromUser", + chat_id_ = chat_id, + user_id_ = user_id + }, dl_cb, cmd) +end + +M.deleteMessagesFromUser = deleteMessagesFromUser + +-- Edits text of text or game message. +-- Non-bots can edit message in a limited period of time. +-- Returns edited message after edit is complete server side +-- @chat_id Chat the message belongs to +-- @message_id Identifier of the message +-- @reply_markup Bots only. New message reply markup +-- @input_message_content New text content of the message. Should be of type InputMessageText +local function editMessageText(chat_id, message_id, reply_markup, text, disable_web_page_preview, parse_mode, dl_cb, cmd) + local TextParseMode = getParseMode(parse_mode) + + tdcli_function ({ + ID = "EditMessageText", + chat_id_ = chat_id, + message_id_ = message_id, + reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup + input_message_content_ = { + ID = "InputMessageText", + text_ = text, + disable_web_page_preview_ = disable_web_page_preview, + clear_draft_ = 0, + entities_ = {}, + parse_mode_ = TextParseMode, + }, + }, dl_cb, cmd) +end + +M.editMessageText = editMessageText + +-- Edits message content caption. +-- Non-bots can edit message in a limited period of time. +-- Returns edited message after edit is complete server side +-- @chat_id Chat the message belongs to +-- @message_id Identifier of the message +-- @reply_markup Bots only. New message reply markup +-- @caption New message content caption, 0-200 characters +local function editMessageCaption(chat_id, message_id, reply_markup, caption, dl_cb, cmd) + tdcli_function ({ + ID = "EditMessageCaption", + chat_id_ = chat_id, + message_id_ = message_id, + reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup + caption_ = caption + }, dl_cb, cmd) +end + +M.editMessageCaption = editMessageCaption + +-- Bots only. +-- Edits message reply markup. +-- Returns edited message after edit is complete server side +-- @chat_id Chat the message belongs to +-- @message_id Identifier of the message +-- @reply_markup New message reply markup +local function editMessageReplyMarkup(inline_message_id, reply_markup, caption, dl_cb, cmd) + tdcli_function ({ + ID = "EditInlineMessageCaption", + inline_message_id_ = inline_message_id, + reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup + caption_ = caption + }, dl_cb, cmd) +end + +M.editMessageReplyMarkup = editMessageReplyMarkup + +-- Bots only. +-- Edits text of an inline text or game message sent via bot +-- @inline_message_id Inline message identifier +-- @reply_markup New message reply markup +-- @input_message_content New text content of the message. Should be of type InputMessageText +local function editInlineMessageText(inline_message_id, reply_markup, text, disable_web_page_preview, dl_cb, cmd) + tdcli_function ({ + ID = "EditInlineMessageText", + inline_message_id_ = inline_message_id, + reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup + input_message_content_ = { + ID = "InputMessageText", + text_ = text, + disable_web_page_preview_ = disable_web_page_preview, + clear_draft_ = 0, + entities_ = {} + }, + }, dl_cb, cmd) +end + +M.editInlineMessageText = editInlineMessageText + +-- Bots only. +-- Edits caption of an inline message content sent via bot +-- @inline_message_id Inline message identifier +-- @reply_markup New message reply markup +-- @caption New message content caption, 0-200 characters +local function editInlineMessageCaption(inline_message_id, reply_markup, caption, dl_cb, cmd) + tdcli_function ({ + ID = "EditInlineMessageCaption", + inline_message_id_ = inline_message_id, + reply_markup_ = reply_markup, -- reply_markup:ReplyMarkup + caption_ = caption + }, dl_cb, cmd) +end + +M.editInlineMessageCaption = editInlineMessageCaption + +-- Bots only. +-- Edits reply markup of an inline message sent via bot +-- @inline_message_id Inline message identifier +-- @reply_markup New message reply markup +local function editInlineMessageReplyMarkup(inline_message_id, reply_markup, dl_cb, cmd) + tdcli_function ({ + ID = "EditInlineMessageReplyMarkup", + inline_message_id_ = inline_message_id, + reply_markup_ = reply_markup -- reply_markup:ReplyMarkup + }, dl_cb, cmd) +end + +M.editInlineMessageReplyMarkup = editInlineMessageReplyMarkup + + +-- Sends inline query to a bot and returns its results. +-- Unavailable for bots +-- @bot_user_id Identifier of the bot send query to +-- @chat_id Identifier of the chat, where the query is sent +-- @user_location User location, only if needed +-- @query Text of the query +-- @offset Offset of the first entry to return +local function getInlineQueryResults(bot_user_id, chat_id, latitude, longitude, query, offset, dl_cb, cmd) + tdcli_function ({ + ID = "GetInlineQueryResults", + bot_user_id_ = bot_user_id, + chat_id_ = chat_id, + user_location_ = { + ID = "Location", + latitude_ = latitude, + longitude_ = longitude + }, + query_ = query, + offset_ = offset + }, dl_cb, cmd) +end + +M.getInlineQueryResults = getInlineQueryResults + +-- Bots only. +-- Sets result of the inline query +-- @inline_query_id Identifier of the inline query +-- @is_personal Does result of the query can be cached only for specified user +-- @results Results of the query +-- @cache_time Allowed time to cache results of the query in seconds +-- @next_offset Offset for the next inline query, pass empty string if there is no more results +-- @switch_pm_text If non-empty, this text should be shown on the button, which opens private chat with the bot and sends bot start message with parameter switch_pm_parameter +-- @switch_pm_parameter Parameter for the bot start message +local function answerInlineQuery(inline_query_id, is_personal, cache_time, next_offset, switch_pm_text, switch_pm_parameter, dl_cb, cmd) + tdcli_function ({ + ID = "AnswerInlineQuery", + inline_query_id_ = inline_query_id, + is_personal_ = is_personal, + results_ = results, --vector<InputInlineQueryResult>, + cache_time_ = cache_time, + next_offset_ = next_offset, + switch_pm_text_ = switch_pm_text, + switch_pm_parameter_ = switch_pm_parameter + }, dl_cb, cmd) +end + +M.answerInlineQuery = answerInlineQuery + +-- Sends callback query to a bot and returns answer to it. +-- Unavailable for bots +-- @chat_id Identifier of the chat with a message +-- @message_id Identifier of the message, from which the query is originated +-- @payload Query payload +-- @text Text of the answer +-- @show_alert If true, an alert should be shown to the user instead of a toast +-- @url URL to be open +local function getCallbackQueryAnswer(chat_id, message_id, text, show_alert, url, dl_cb, cmd) + tdcli_function ({ + ID = "GetCallbackQueryAnswer", + chat_id_ = chat_id, + message_id_ = message_id, + payload_ = { + ID = "CallbackQueryAnswer", + text_ = text, + show_alert_ = show_alert, + url_ = url + }, + }, dl_cb, cmd) +end + +M.getCallbackQueryAnswer = getCallbackQueryAnswer + +-- Bots only. +-- Sets result of the callback query +-- @callback_query_id Identifier of the callback query +-- @text Text of the answer +-- @show_alert If true, an alert should be shown to the user instead of a toast +-- @url Url to be opened +-- @cache_time Allowed time to cache result of the query in seconds +local function answerCallbackQuery(callback_query_id, text, show_alert, url, cache_time, dl_cb, cmd) + tdcli_function ({ + ID = "AnswerCallbackQuery", + callback_query_id_ = callback_query_id, + text_ = text, + show_alert_ = show_alert, + url_ = url, + cache_time_ = cache_time + }, dl_cb, cmd) +end + +M.answerCallbackQuery = answerCallbackQuery + +-- Bots only. +-- Updates game score of the specified user in the game +-- @chat_id Chat a message with the game belongs to +-- @message_id Identifier of the message +-- @edit_message True, if message should be edited +-- @user_id User identifier +-- @score New score +-- @force Pass True to update the score even if it decreases. If score is 0, user will be deleted from the high scores table +local function setGameScore(chat_id, message_id, edit_message, user_id, score, force, dl_cb, cmd) + tdcli_function ({ + ID = "SetGameScore", + chat_id_ = chat_id, + message_id_ = message_id, + edit_message_ = edit_message, + user_id_ = user_id, + score_ = score, + force_ = force + }, dl_cb, cmd) +end + +M.setGameScore = setGameScore + +-- Bots only. +-- Updates game score of the specified user in the game +-- @inline_message_id Inline message identifier +-- @edit_message True, if message should be edited +-- @user_id User identifier +-- @score New score +-- @force Pass True to update the score even if it decreases. If score is 0, user will be deleted from the high scores table +local function setInlineGameScore(inline_message_id, edit_message, user_id, score, force, dl_cb, cmd) + tdcli_function ({ + ID = "SetInlineGameScore", + inline_message_id_ = inline_message_id, + edit_message_ = edit_message, + user_id_ = user_id, + score_ = score, + force_ = force + }, dl_cb, cmd) +end + +M.setInlineGameScore = setInlineGameScore + +-- Bots only. +-- Returns game high scores and some part of the score table around of the specified user in the game +-- @chat_id Chat a message with the game belongs to +-- @message_id Identifier of the message +-- @user_id User identifie +local function getGameHighScores(chat_id, message_id, user_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetGameHighScores", + chat_id_ = chat_id, + message_id_ = message_id, + user_id_ = user_id + }, dl_cb, cmd) +end + +M.getGameHighScores = getGameHighScores + +-- Bots only. +-- Returns game high scores and some part of the score table around of the specified user in the game +-- @inline_message_id Inline message identifier +-- @user_id User identifier +local function getInlineGameHighScores(inline_message_id, user_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetInlineGameHighScores", + inline_message_id_ = inline_message_id, + user_id_ = user_id + }, dl_cb, cmd) +end + +M.getInlineGameHighScores = getInlineGameHighScores + +-- Deletes default reply markup from chat. +-- This method needs to be called after one-time keyboard or ForceReply reply markup has been used. +-- UpdateChatReplyMarkup will be send if reply markup will be changed +-- @chat_id Chat identifier +-- @message_id Message identifier of used keyboard +local function deleteChatReplyMarkup(chat_id, message_id, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteChatReplyMarkup", + chat_id_ = chat_id, + message_id_ = message_id + }, dl_cb, cmd) +end + +M.deleteChatReplyMarkup = deleteChatReplyMarkup + +-- Sends notification about user activity in a chat +-- @chat_id Chat identifier +-- @action Action description +-- action = Typing|Cancel|RecordVideo|UploadVideo|RecordVoice|UploadVoice|UploadPhoto|UploadDocument|GeoLocation|ChooseContact|StartPlayGame +local function sendChatAction(chat_id, action, progress, dl_cb, cmd) + tdcli_function ({ + ID = "SendChatAction", + chat_id_ = chat_id, + action_ = { + ID = "SendMessage" .. action .. "Action", + progress_ = progress or 100 + } + }, dl_cb, cmd) +end + +M.sendChatAction = sendChatAction + +-- Sends notification about screenshot taken in a chat. +-- Works only in secret chats +-- @chat_id Chat identifier +local function sendChatScreenshotTakenNotification(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "SendChatScreenshotTakenNotification", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.sendChatScreenshotTakenNotification = sendChatScreenshotTakenNotification + +-- Chat is opened by the user. +-- Many useful activities depends on chat being opened or closed. For example, in channels all updates are received only for opened chats +-- @chat_id Chat identifier +local function openChat(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "OpenChat", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.openChat = openChat + +-- Chat is closed by the user. +-- Many useful activities depends on chat being opened or closed. +-- @chat_id Chat identifier +local function closeChat(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "CloseChat", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.closeChat = closeChat + +-- Messages are viewed by the user. +-- Many useful activities depends on message being viewed. For example, marking messages as read, incrementing of view counter, updating of view counter, removing of deleted messages in channels +-- @chat_id Chat identifier +-- @message_ids Identifiers of viewed messages +local function viewMessages(chat_id, message_ids, dl_cb, cmd) + tdcli_function ({ + ID = "ViewMessages", + chat_id_ = chat_id, + message_ids_ = message_ids -- vector + }, dl_cb, cmd) +end + +M.viewMessages = viewMessages + +-- Message content is opened, for example the user has opened a photo, a video, a document, a location or a venue or have listened to an audio or a voice message +-- @chat_id Chat identifier of the message +-- @message_id Identifier of the message with opened content +local function openMessageContent(chat_id, message_id, dl_cb, cmd) + tdcli_function ({ + ID = "OpenMessageContent", + chat_id_ = chat_id, + message_id_ = message_id + }, dl_cb, cmd) +end + +M.openMessageContent = openMessageContent + +-- Returns existing chat corresponding to the given user +-- @user_id User identifier +local function createPrivateChat(user_id, dl_cb, cmd) + tdcli_function ({ + ID = "CreatePrivateChat", + user_id_ = user_id + }, dl_cb, cmd) +end + +M.createPrivateChat = createPrivateChat + +-- Returns existing chat corresponding to the known group +-- @group_id Group identifier +local function createGroupChat(group_id, dl_cb, cmd) + tdcli_function ({ + ID = "CreateGroupChat", + group_id_ = getChatId(group_id).ID + }, dl_cb, cmd) +end + +M.createGroupChat = createGroupChat + +-- Returns existing chat corresponding to the known channel +-- @channel_id Channel identifier +local function createChannelChat(channel_id, dl_cb, cmd) + tdcli_function ({ + ID = "CreateChannelChat", + channel_id_ = getChatId(channel_id).ID + }, dl_cb, cmd) +end + +M.createChannelChat = createChannelChat + +-- Returns existing chat corresponding to the known secret chat +-- @secret_chat_id SecretChat identifier +local function createSecretChat(secret_chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "CreateSecretChat", + secret_chat_id_ = secret_chat_id + }, dl_cb, cmd) +end + +M.createSecretChat = createSecretChat + +-- Creates new group chat and send corresponding messageGroupChatCreate, returns created chat +-- @user_ids Identifiers of users to add to the group +-- @title Title of new group chat, 0-255 characters +local function createNewGroupChat(user_ids, title, dl_cb, cmd) + tdcli_function ({ + ID = "CreateNewGroupChat", + user_ids_ = user_ids, -- vector + title_ = title + }, dl_cb, cmd) +end + +M.createNewGroupChat = createNewGroupChat + +-- Creates new channel chat and send corresponding messageChannelChatCreate, returns created chat +-- @title Title of new channel chat, 0-255 characters +-- @is_supergroup True, if supergroup chat should be created +-- @about Information about the channel, 0-255 characters +local function createNewChannelChat(title, is_supergroup, about, dl_cb, cmd) + tdcli_function ({ + ID = "CreateNewChannelChat", + title_ = title, + is_supergroup_ = is_supergroup, + about_ = about + }, dl_cb, cmd) +end + +M.createNewChannelChat = createNewChannelChat + +-- Creates new secret chat, returns created chat +-- @user_id Identifier of a user to create secret chat with +local function createNewSecretChat(user_id, dl_cb, cmd) + tdcli_function ({ + ID = "CreateNewSecretChat", + user_id_ = user_id + }, dl_cb, cmd) +end + +M.createNewSecretChat = createNewSecretChat + +-- Creates new channel supergroup chat from existing group chat and send corresponding messageChatMigrateTo and messageChatMigrateFrom. Deactivates group +-- @chat_id Group chat identifier +local function migrateGroupChatToChannelChat(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "MigrateGroupChatToChannelChat", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.migrateGroupChatToChannelChat = migrateGroupChatToChannelChat + +-- Changes chat title. +-- Title can't be changed for private chats. +-- Title will not change until change will be synchronized with the server. +-- Title will not be changed if application is killed before it can send request to the server. +-- There will be update about change of the title on success. Otherwise error will be returned +-- @chat_id Chat identifier +-- @title New title of a chat, 0-255 characters +local function changeChatTitle(chat_id, title, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeChatTitle", + chat_id_ = chat_id, + title_ = title + }, dl_cb, cmd) +end + +M.changeChatTitle = changeChatTitle + +-- Changes chat photo. +-- Photo can't be changed for private chats. +-- Photo will not change until change will be synchronized with the server. +-- Photo will not be changed if application is killed before it can send request to the server. +-- There will be update about change of the photo on success. Otherwise error will be returned +-- @chat_id Chat identifier +-- @photo New chat photo. You can use zero InputFileId to delete photo. Files accessible only by HTTP URL are not acceptable +local function changeChatPhoto(chat_id, photo, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeChatPhoto", + chat_id_ = chat_id, + photo_ = getInputFile(photo) + }, dl_cb, cmd) +end + +M.changeChatPhoto = changeChatPhoto + +-- Changes chat draft message +-- @chat_id Chat identifier +-- @draft_message New draft message, nullable +local function changeChatDraftMessage(chat_id, reply_to_message_id, text, disable_web_page_preview, clear_draft, parse_mode, dl_cb, cmd) + local TextParseMode = getParseMode(parse_mode) + + tdcli_function ({ + ID = "ChangeChatDraftMessage", + chat_id_ = chat_id, + draft_message_ = { + ID = "DraftMessage", + reply_to_message_id_ = reply_to_message_id, + input_message_text_ = { + ID = "InputMessageText", + text_ = text, + disable_web_page_preview_ = disable_web_page_preview, + clear_draft_ = clear_draft, + entities_ = {}, + parse_mode_ = TextParseMode, + }, + }, + }, dl_cb, cmd) +end + +M.changeChatDraftMessage = changeChatDraftMessage + +-- Adds new member to chat. +-- Members can't be added to private or secret chats. +-- Member will not be added until chat state will be synchronized with the server. +-- Member will not be added if application is killed before it can send request to the server +-- @chat_id Chat identifier +-- @user_id Identifier of the user to add +-- @forward_limit Number of previous messages from chat to forward to new member, ignored for channel chats +local function addChatMember(chat_id, user_id, forward_limit, dl_cb, cmd) + tdcli_function ({ + ID = "AddChatMember", + chat_id_ = chat_id, + user_id_ = user_id, + forward_limit_ = forward_limit or 50 + }, dl_cb, cmd) +end + +M.addChatMember = addChatMember + +-- Adds many new members to the chat. +-- Currently, available only for channels. +-- Can't be used to join the channel. +-- Member will not be added until chat state will be synchronized with the server. +-- Member will not be added if application is killed before it can send request to the server +-- @chat_id Chat identifier +-- @user_ids Identifiers of the users to add +local function addChatMembers(chat_id, user_ids, dl_cb, cmd) + tdcli_function ({ + ID = "AddChatMembers", + chat_id_ = chat_id, + user_ids_ = user_ids -- vector + }, dl_cb, cmd) +end + +M.addChatMembers = addChatMembers + +-- Changes status of the chat member, need appropriate privileges. +-- In channel chats, user will be added to chat members if he is yet not a member and there is less than 200 members in the channel. +-- Status will not be changed until chat state will be synchronized with the server. +-- Status will not be changed if application is killed before it can send request to the server +-- @chat_id Chat identifier +-- @user_id Identifier of the user to edit status, bots can be editors in the channel chats +-- @status New status of the member in the chat +-- status = Creator|Editor|Moderator|Member|Left|Kicked +local function changeChatMemberStatus(chat_id, user_id, status, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeChatMemberStatus", + chat_id_ = chat_id, + user_id_ = user_id, + status_ = { + ID = "ChatMemberStatus" .. status + }, + }, dl_cb, cmd) +end + +M.changeChatMemberStatus = changeChatMemberStatus + +-- Returns information about one participant of the chat +-- @chat_id Chat identifier +-- @user_id User identifier +local function getChatMember(chat_id, user_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetChatMember", + chat_id_ = chat_id, + user_id_ = user_id + }, dl_cb, cmd) +end + +M.getChatMember = getChatMember + +-- Asynchronously downloads file from cloud. +-- Updates updateFileProgress will notify about download progress. +-- Update updateFile will notify about successful download +-- @file_id Identifier of file to download +local function downloadFile(file_id, dl_cb, cmd) + tdcli_function ({ + ID = "DownloadFile", + file_id_ = file_id + }, dl_cb, cmd) +end + +M.downloadFile = downloadFile + +-- Stops file downloading. +-- If file already downloaded do nothing. +-- @file_id Identifier of file to cancel download +local function cancelDownloadFile(file_id, dl_cb, cmd) + tdcli_function ({ + ID = "CancelDownloadFile", + file_id_ = file_id + }, dl_cb, cmd) +end + +M.cancelDownloadFile = cancelDownloadFile + +-- Next part of a file was generated +-- @generation_id Identifier of the generation process +-- @ready Number of bytes already generated. Negative number means that generation has failed and should be terminated +local function setFileGenerationProgress(generation_id, ready, dl_cb, cmd) + tdcli_function ({ + ID = "SetFileGenerationProgress", + generation_id_ = generation_id, + ready_ = ready + }, dl_cb, cmd) +end + +M.setFileGenerationProgress = setFileGenerationProgress + +-- Finishes file generation +-- @generation_id Identifier of the generation process +local function finishFileGeneration(generation_id, dl_cb, cmd) + tdcli_function ({ + ID = "FinishFileGeneration", + generation_id_ = generation_id + }, dl_cb, cmd) +end + +M.finishFileGeneration = finishFileGeneration + +-- Generates new chat invite link, previously generated link is revoked. +-- Available for group and channel chats. +-- Only creator of the chat can export chat invite link +-- @chat_id Chat identifier +local function exportChatInviteLink(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "ExportChatInviteLink", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.exportChatInviteLink = exportChatInviteLink + +-- Checks chat invite link for validness and returns information about the corresponding chat +-- @invite_link Invite link to check. Should begin with "https://telegram.me/joinchat/" +local function checkChatInviteLink(link, dl_cb, cmd) + tdcli_function ({ + ID = "CheckChatInviteLink", + invite_link_ = link + }, dl_cb, cmd) +end + +M.checkChatInviteLink = checkChatInviteLink + +-- Imports chat invite link, adds current user to a chat if possible. +-- Member will not be added until chat state will be synchronized with the server. +-- Member will not be added if application is killed before it can send request to the server +-- @invite_link Invite link to import. Should begin with "https://telegram.me/joinchat/" +local function importChatInviteLink(invite_link, dl_cb, cmd) + tdcli_function ({ + ID = "ImportChatInviteLink", + invite_link_ = invite_link + }, dl_cb, cmd) +end + +M.importChatInviteLink = importChatInviteLink + +-- Adds user to black list +-- @user_id User identifier +local function blockUser(user_id, dl_cb, cmd) + tdcli_function ({ + ID = "BlockUser", + user_id_ = user_id + }, dl_cb, cmd) +end + +M.blockUser = blockUser + +-- Removes user from black list +-- @user_id User identifier +local function unblockUser(user_id, dl_cb, cmd) + tdcli_function ({ + ID = "UnblockUser", + user_id_ = user_id + }, dl_cb, cmd) +end + +M.unblockUser = unblockUser + +-- Returns users blocked by the current user +-- @offset Number of users to skip in result, must be non-negative +-- @limit Maximum number of users to return, can't be greater than 100 +local function getBlockedUsers(offset, limit, dl_cb, cmd) + tdcli_function ({ + ID = "GetBlockedUsers", + offset_ = offset, + limit_ = limit + }, dl_cb, cmd) +end + +M.getBlockedUsers = getBlockedUsers + +-- Adds new contacts/edits existing contacts, contacts user identifiers are ignored. +-- Returns list of corresponding users in the same order as input contacts. +-- If contact doesn't registered in Telegram, user with id == 0 will be returned +-- @contacts List of contacts to import/edit +local function importContacts(phone_number, first_name, last_name, user_id, dl_cb, cmd) + tdcli_function ({ + ID = "ImportContacts", + contacts_ = {[0] = { + phone_number_ = tostring(phone_number), + first_name_ = tostring(first_name), + last_name_ = tostring(last_name), + user_id_ = user_id + }, + }, + }, dl_cb, cmd) +end + +M.importContacts = importContacts + +-- Searches for specified query in the first name, last name and username of the known user contacts +-- @query Query to search for, can be empty to return all contacts +-- @limit Maximum number of users to be returned +local function searchContacts(query, limit, dl_cb, cmd) + tdcli_function ({ + ID = "SearchContacts", + query_ = query, + limit_ = limit + }, dl_cb, cmd) +end + +M.searchContacts = searchContacts + +-- Deletes users from contacts list +-- @user_ids Identifiers of users to be deleted +local function deleteContacts(user_ids, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteContacts", + user_ids_ = user_ids -- vector + }, dl_cb, cmd) +end + +M.deleteContacts = deleteContacts + +-- Returns profile photos of the user. +-- Result of this query can't be invalidated, so it must be used with care +-- @user_id User identifier +-- @offset Photos to skip, must be non-negative +-- @limit Maximum number of photos to be returned, can't be greater than 100 +local function getUserProfilePhotos(user_id, offset, limit, dl_cb, cmd) + tdcli_function ({ + ID = "GetUserProfilePhotos", + user_id_ = user_id, + offset_ = offset, + limit_ = limit + }, dl_cb, cmd) +end + +M.getUserProfilePhotos = getUserProfilePhotos + +-- Returns stickers corresponding to given emoji +-- @emoji String representation of emoji. If empty, returns all known stickers +local function getStickers(emoji, dl_cb, cmd) + tdcli_function ({ + ID = "GetStickers", + emoji_ = emoji + }, dl_cb, cmd) +end + +M.getStickers = getStickers + +-- Returns list of installed sticker sets without archived sticker sets +-- @is_masks Pass true to return masks, pass false to return stickers +local function getStickerSets(is_masks, dl_cb, cmd) + tdcli_function ({ + ID = "GetStickerSets", + is_masks_ = is_masks + }, dl_cb, cmd) +end + +M.getStickerSets = getStickerSets + +-- Returns list of archived sticker sets +-- @is_masks Pass true to return masks, pass false to return stickers +-- @offset_sticker_set_id Identifier of the sticker set from which return the result +-- @limit Maximum number of sticker sets to return +local function getArchivedStickerSets(is_masks, offset_sticker_set_id, limit, dl_cb, cmd) + tdcli_function ({ + ID = "GetArchivedStickerSets", + is_masks_ = is_masks, + offset_sticker_set_id_ = offset_sticker_set_id, + limit_ = limit + }, dl_cb, cmd) +end + +M.getArchivedStickerSets = getArchivedStickerSets + +-- Returns list of trending sticker sets +local function getTrendingStickerSets(dl_cb, cmd) + tdcli_function ({ + ID = "GetTrendingStickerSets" + }, dl_cb, cmd) +end + +M.getTrendingStickerSets = getTrendingStickerSets + +-- Returns list of sticker sets attached to a file, currently only photos and videos can have attached sticker sets +-- @file_id File identifier +local function getAttachedStickerSets(file_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetAttachedStickerSets", + file_id_ = file_id + }, dl_cb, cmd) +end + +M.getAttachedStickerSets = getAttachedStickerSets + +-- Returns information about sticker set by its identifier +-- @set_id Identifier of the sticker set +local function getStickerSet(set_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetStickerSet", + set_id_ = set_id + }, dl_cb, cmd) +end + +M.getStickerSet = getStickerSet + +-- Searches sticker set by its short name +-- @name Name of the sticker set +local function searchStickerSet(name, dl_cb, cmd) + tdcli_function ({ + ID = "SearchStickerSet", + name_ = name + }, dl_cb, cmd) +end + +M.searchStickerSet = searchStickerSet + +-- Installs/uninstalls or enables/archives sticker set. +-- Official sticker set can't be uninstalled, but it can be archived +-- @set_id Identifier of the sticker set +-- @is_installed New value of is_installed +-- @is_archived New value of is_archived +local function updateStickerSet(set_id, is_installed, is_archived, dl_cb, cmd) + tdcli_function ({ + ID = "UpdateStickerSet", + set_id_ = set_id, + is_installed_ = is_installed, + is_archived_ = is_archived + }, dl_cb, cmd) +end + +M.updateStickerSet = updateStickerSet + +-- Trending sticker sets are viewed by the user +-- @sticker_set_ids Identifiers of viewed trending sticker sets +local function viewTrendingStickerSets(sticker_set_ids, dl_cb, cmd) + tdcli_function ({ + ID = "ViewTrendingStickerSets", + sticker_set_ids_ = sticker_set_ids -- vector + }, dl_cb, cmd) +end + +M.viewTrendingStickerSets = viewTrendingStickerSets + +-- Changes the order of installed sticker sets +-- @is_masks Pass true to change masks order, pass false to change stickers order +-- @sticker_set_ids Identifiers of installed sticker sets in the new right order +local function reorderStickerSets(is_masks, sticker_set_ids, dl_cb, cmd) + tdcli_function ({ + ID = "ReorderStickerSets", + is_masks_ = is_masks, + sticker_set_ids_ = sticker_set_ids -- vector + }, dl_cb, cmd) +end + +M.reorderStickerSets = reorderStickerSets + +-- Returns list of recently used stickers +-- @is_attached Pass true to return stickers and masks recently attached to photo or video files, pass false to return recently sent stickers +local function getRecentStickers(is_attached, dl_cb, cmd) + tdcli_function ({ + ID = "GetRecentStickers", + is_attached_ = is_attached + }, dl_cb, cmd) +end + +M.getRecentStickers = getRecentStickers + +-- Manually adds new sticker to the list of recently used stickers. +-- New sticker is added to the beginning of the list. +-- If the sticker is already in the list, at first it is removed from the list +-- @is_attached Pass true to add the sticker to the list of stickers recently attached to photo or video files, pass false to add the sticker to the list of recently sent stickers +-- @sticker Sticker file to add +local function addRecentSticker(is_attached, sticker, dl_cb, cmd) + tdcli_function ({ + ID = "AddRecentSticker", + is_attached_ = is_attached, + sticker_ = getInputFile(sticker) + }, dl_cb, cmd) +end + +M.addRecentSticker = addRecentSticker + +-- Removes a sticker from the list of recently used stickers +-- @is_attached Pass true to remove the sticker from the list of stickers recently attached to photo or video files, pass false to remove the sticker from the list of recently sent stickers +-- @sticker Sticker file to delete +local function deleteRecentSticker(is_attached, sticker, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteRecentSticker", + is_attached_ = is_attached, + sticker_ = getInputFile(sticker) + }, dl_cb, cmd) +end + +M.deleteRecentSticker = deleteRecentSticker + +-- Clears list of recently used stickers +-- @is_attached Pass true to clear list of stickers recently attached to photo or video files, pass false to clear the list of recently sent stickers +local function clearRecentStickers(is_attached, dl_cb, cmd) + tdcli_function ({ + ID = "ClearRecentStickers", + is_attached_ = is_attached + }, dl_cb, cmd) +end + +M.clearRecentStickers = clearRecentStickers + +-- Returns emojis corresponding to a sticker +-- @sticker Sticker file identifier +local function getStickerEmojis(sticker, dl_cb, cmd) + tdcli_function ({ + ID = "GetStickerEmojis", + sticker_ = getInputFile(sticker) + }, dl_cb, cmd) +end + +M.getStickerEmojis = getStickerEmojis + +-- Returns saved animations +local function getSavedAnimations(dl_cb, cmd) + tdcli_function ({ + ID = "GetSavedAnimations", + }, dl_cb, cmd) +end + +M.getSavedAnimations = getSavedAnimations + +-- Manually adds new animation to the list of saved animations. +-- New animation is added to the beginning of the list. +-- If the animation is already in the list, at first it is removed from the list. +-- Only non-secret video animations with MIME type "video/mp4" can be added to the list +-- @animation Animation file to add. Only known to server animations (i. e. successfully sent via message) can be added to the list +local function addSavedAnimation(animation, dl_cb, cmd) + tdcli_function ({ + ID = "AddSavedAnimation", + animation_ = getInputFile(animation) + }, dl_cb, cmd) +end + +M.addSavedAnimation = addSavedAnimation + +-- Removes animation from the list of saved animations +-- @animation Animation file to delete +local function deleteSavedAnimation(animation, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteSavedAnimation", + animation_ = getInputFile(animation) + }, dl_cb, cmd) +end + +M.deleteSavedAnimation = deleteSavedAnimation + +-- Returns up to 20 recently used inline bots in the order of the last usage +local function getRecentInlineBots(dl_cb, cmd) + tdcli_function ({ + ID = "GetRecentInlineBots", + }, dl_cb, cmd) +end + +M.getRecentInlineBots = getRecentInlineBots + +-- Get web page preview by text of the message. +-- Do not call this function to often +-- @message_text Message text +local function getWebPagePreview(message_text, dl_cb, cmd) + tdcli_function ({ + ID = "GetWebPagePreview", + message_text_ = message_text + }, dl_cb, cmd) +end + +M.getWebPagePreview = getWebPagePreview + +-- Returns notification settings for a given scope +-- @scope Scope to return information about notification settings +-- scope = Chat(chat_id)|PrivateChats|GroupChats|AllChats| +local function getNotificationSettings(scope, chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetNotificationSettings", + scope_ = { + ID = 'NotificationSettingsFor' .. scope, + chat_id_ = chat_id or nil + }, + }, dl_cb, cmd) +end + +M.getNotificationSettings = getNotificationSettings + +-- Changes notification settings for a given scope +-- @scope Scope to change notification settings +-- @notification_settings New notification settings for given scope +-- scope = Chat(chat_id)|PrivateChats|GroupChats|AllChats| +local function setNotificationSettings(scope, chat_id, mute_for, show_preview, dl_cb, cmd) + tdcli_function ({ + ID = "SetNotificationSettings", + scope_ = { + ID = 'NotificationSettingsFor' .. scope, + chat_id_ = chat_id or nil + }, + notification_settings_ = { + ID = "NotificationSettings", + mute_for_ = mute_for, + sound_ = "default", + show_preview_ = show_preview + } + }, dl_cb, cmd) +end + +M.setNotificationSettings = setNotificationSettings + +-- Resets all notification settings to the default value. +-- By default the only muted chats are supergroups, sound is set to 'default' and message previews are showed +local function resetAllNotificationSettings(dl_cb, cmd) + tdcli_function ({ + ID = "ResetAllNotificationSettings" + }, dl_cb, cmd) +end + +M.resetAllNotificationSettings = resetAllNotificationSettings + +-- Uploads new profile photo for logged in user. +-- Photo will not change until change will be synchronized with the server. +-- Photo will not be changed if application is killed before it can send request to the server. +-- If something changes, updateUser will be sent +-- @photo_path Path to new profile photo +local function setProfilePhoto(photo_path, dl_cb, cmd) + tdcli_function ({ + ID = "SetProfilePhoto", + photo_path_ = photo_path + }, dl_cb, cmd) +end + +M.setProfilePhoto = setProfilePhoto + +-- Deletes profile photo. +-- If something changes, updateUser will be sent +-- @profile_photo_id Identifier of profile photo to delete +local function deleteProfilePhoto(profile_photo_id, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteProfilePhoto", + profile_photo_id_ = profile_photo_id + }, dl_cb, cmd) +end + +M.deleteProfilePhoto = deleteProfilePhoto + +-- Changes first and last names of logged in user. +-- If something changes, updateUser will be sent +-- @first_name New value of user first name, 1-255 characters +-- @last_name New value of optional user last name, 0-255 characters +local function changeName(first_name, last_name, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeName", + first_name_ = first_name, + last_name_ = last_name + }, dl_cb, cmd) +end + +M.changeName = changeName + +-- Changes about information of logged in user +-- @about New value of userFull.about, 0-255 characters +local function changeAbout(about, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeAbout", + about_ = about + }, dl_cb, cmd) +end + +M.changeAbout = changeAbout + +-- Changes username of logged in user. +-- If something changes, updateUser will be sent +-- @username New value of username. Use empty string to remove username +local function changeUsername(username, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeUsername", + username_ = username + }, dl_cb, cmd) +end + +M.changeUsername = changeUsername + +-- Changes user's phone number and sends authentication code to the new user's phone number. +-- Returns authStateWaitCode with information about sent code on success +-- @phone_number New user's phone number in any reasonable format +-- @allow_flash_call Pass True, if code can be sent via flash call to the specified phone number +-- @is_current_phone_number Pass true, if the phone number is used on the current device. Ignored if allow_flash_call is False +local function changePhoneNumber(phone_number, allow_flash_call, is_current_phone_number, dl_cb, cmd) + tdcli_function ({ + ID = "ChangePhoneNumber", + phone_number_ = phone_number, + allow_flash_call_ = allow_flash_call, + is_current_phone_number_ = is_current_phone_number + }, dl_cb, cmd) +end + +M.changePhoneNumber = changePhoneNumber + +-- Resends authentication code sent to change user's phone number. +-- Works only if in previously received authStateWaitCode next_code_type was not null. +-- Returns authStateWaitCode on success +local function resendChangePhoneNumberCode(dl_cb, cmd) + tdcli_function ({ + ID = "ResendChangePhoneNumberCode", + }, dl_cb, cmd) +end + +M.resendChangePhoneNumberCode = resendChangePhoneNumberCode + +-- Checks authentication code sent to change user's phone number. +-- Returns authStateOk on success +-- @code Verification code from SMS, voice call or flash call +local function checkChangePhoneNumberCode(code, dl_cb, cmd) + tdcli_function ({ + ID = "CheckChangePhoneNumberCode", + code_ = code + }, dl_cb, cmd) +end + +M.checkChangePhoneNumberCode = checkChangePhoneNumberCode + +-- Returns all active sessions of logged in user +local function getActiveSessions(dl_cb, cmd) + tdcli_function ({ + ID = "GetActiveSessions", + }, dl_cb, cmd) +end + +M.getActiveSessions = getActiveSessions + +-- Terminates another session of logged in user +-- @session_id Session identifier +local function terminateSession(session_id, dl_cb, cmd) + tdcli_function ({ + ID = "TerminateSession", + session_id_ = session_id + }, dl_cb, cmd) +end + +M.terminateSession = terminateSession + +-- Terminates all other sessions of logged in user +local function terminateAllOtherSessions(dl_cb, cmd) + tdcli_function ({ + ID = "TerminateAllOtherSessions", + }, dl_cb, cmd) +end + +M.terminateAllOtherSessions = terminateAllOtherSessions + +-- Gives or revokes all members of the group editor rights. +-- Needs creator privileges in the group +-- @group_id Identifier of the group +-- @anyone_can_edit New value of anyone_can_edit +local function toggleGroupEditors(group_id, anyone_can_edit, dl_cb, cmd) + tdcli_function ({ + ID = "ToggleGroupEditors", + group_id_ = getChatId(group_id).ID, + anyone_can_edit_ = anyone_can_edit + }, dl_cb, cmd) +end + +M.toggleGroupEditors = toggleGroupEditors + +-- Changes username of the channel. +-- Needs creator privileges in the channel +-- @channel_id Identifier of the channel +-- @username New value of username. Use empty string to remove username +local function changeChannelUsername(channel_id, username, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeChannelUsername", + channel_id_ = getChatId(channel_id).ID, + username_ = username + }, dl_cb, cmd) +end + +M.changeChannelUsername = changeChannelUsername + +-- Gives or revokes right to invite new members to all current members of the channel. +-- Needs creator privileges in the channel. +-- Available only for supergroups +-- @channel_id Identifier of the channel +-- @anyone_can_invite New value of anyone_can_invite +local function toggleChannelInvites(channel_id, anyone_can_invite, dl_cb, cmd) + tdcli_function ({ + ID = "ToggleChannelInvites", + channel_id_ = getChatId(channel_id).ID, + anyone_can_invite_ = anyone_can_invite + }, dl_cb, cmd) +end + +M.toggleChannelInvites = toggleChannelInvites + +-- Enables or disables sender signature on sent messages in the channel. +-- Needs creator privileges in the channel. +-- Not available for supergroups +-- @channel_id Identifier of the channel +-- @sign_messages New value of sign_messages +local function toggleChannelSignMessages(channel_id, sign_messages, dl_cb, cmd) + tdcli_function ({ + ID = "ToggleChannelSignMessages", + channel_id_ = getChatId(channel_id).ID, + sign_messages_ = sign_messages + }, dl_cb, cmd) +end + +M.toggleChannelSignMessages = toggleChannelSignMessages + +-- Changes information about the channel. +-- Needs creator privileges in the broadcast channel or editor privileges in the supergroup channel +-- @channel_id Identifier of the channel +-- @about New value of about, 0-255 characters +local function changeChannelAbout(channel_id, about, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeChannelAbout", + channel_id_ = getChatId(channel_id).ID, + about_ = about + }, dl_cb, cmd) +end + +M.changeChannelAbout = changeChannelAbout + +-- Pins a message in a supergroup channel chat. +-- Needs editor privileges in the channel +-- @channel_id Identifier of the channel +-- @message_id Identifier of the new pinned message +-- @disable_notification True, if there should be no notification about the pinned message +local function pinChannelMessage(channel_id, message_id, disable_notification, dl_cb, cmd) + tdcli_function ({ + ID = "PinChannelMessage", + channel_id_ = getChatId(channel_id).ID, + message_id_ = message_id, + disable_notification_ = disable_notification + }, dl_cb, cmd) +end + +M.pinChannelMessage = pinChannelMessage + +-- Removes pinned message in the supergroup channel. +-- Needs editor privileges in the channel +-- @channel_id Identifier of the channel +local function unpinChannelMessage(channel_id, dl_cb, cmd) + tdcli_function ({ + ID = "UnpinChannelMessage", + channel_id_ = getChatId(channel_id).ID + }, dl_cb, cmd) +end + +M.unpinChannelMessage = unpinChannelMessage + +-- Reports some supergroup channel messages from a user as spam messages +-- @channel_id Channel identifier +-- @user_id User identifier +-- @message_ids Identifiers of messages sent in the supergroup by the user, the list should be non-empty +local function reportChannelSpam(channel_id, user_id, message_ids, dl_cb, cmd) + tdcli_function ({ + ID = "ReportChannelSpam", + channel_id_ = getChatId(channel_id).ID, + user_id_ = user_id, + message_ids_ = message_ids -- vector + }, dl_cb, cmd) +end + +M.reportChannelSpam = reportChannelSpam + +-- Returns information about channel members or kicked from channel users. +-- Can be used only if channel_full->can_get_members == true +-- @channel_id Identifier of the channel +-- @filter Kind of channel users to return, defaults to channelMembersRecent +-- @offset Number of channel users to skip +-- @limit Maximum number of users be returned, can't be greater than 200 +-- filter = Recent|Administrators|Kicked|Bots +local function getChannelMembers(channel_id, offset, filter, limit, dl_cb, cmd) + if not limit or limit > 200 then + limit = 200 + end + + tdcli_function ({ + ID = "GetChannelMembers", + channel_id_ = getChatId(channel_id).ID, + filter_ = { + ID = "ChannelMembers" .. filter + }, + offset_ = offset, + limit_ = limit + }, dl_cb, cmd) +end + +M.getChannelMembers = getChannelMembers + +-- Deletes channel along with all messages in corresponding chat. +-- Releases channel username and removes all members. +-- Needs creator privileges in the channel. +-- Channels with more than 1000 members can't be deleted +-- @channel_id Identifier of the channel +local function deleteChannel(channel_id, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteChannel", + channel_id_ = getChatId(channel_id).ID + }, dl_cb, cmd) +end + +M.deleteChannel = deleteChannel + +-- Returns list of created public channels +local function getCreatedPublicChannels(dl_cb, cmd) + tdcli_function ({ + ID = "GetCreatedPublicChannels" + }, dl_cb, cmd) +end + +M.getCreatedPublicChannels = getCreatedPublicChannels + +-- Closes secret chat +-- @secret_chat_id Secret chat identifier +local function closeSecretChat(secret_chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "CloseSecretChat", + secret_chat_id_ = secret_chat_id + }, dl_cb, cmd) +end + +M.closeSecretChat = closeSecretChat + +-- Returns user that can be contacted to get support +local function getSupportUser(dl_cb, cmd) + tdcli_function ({ + ID = "GetSupportUser", + }, dl_cb, cmd) +end + +M.getSupportUser = getSupportUser + +-- Returns background wallpapers +local function getWallpapers(dl_cb, cmd) + tdcli_function ({ + ID = "GetWallpapers", + }, dl_cb, cmd) +end + +M.getWallpapers = getWallpapers + +-- Registers current used device for receiving push notifications +-- @device_token Device token +-- device_token = apns|gcm|mpns|simplePush|ubuntuPhone|blackberry +local function registerDevice(device_token, token, device_token_set, dl_cb, cmd) + local dToken = {ID = device_token .. 'DeviceToken', token_ = token} + + if device_token_set then + dToken = {ID = "DeviceTokenSet", token_ = device_token_set} -- tokens:vector<DeviceToken> + end + + tdcli_function ({ + ID = "RegisterDevice", + device_token_ = dToken + }, dl_cb, cmd) +end + +M.registerDevice = registerDevice + +-- Returns list of used device tokens +local function getDeviceTokens(dl_cb, cmd) + tdcli_function ({ + ID = "GetDeviceTokens", + }, dl_cb, cmd) +end + +M.getDeviceTokens = getDeviceTokens + +-- Changes privacy settings +-- @key Privacy key +-- @rules New privacy rules +-- @privacyKeyUserStatus Privacy key for managing visibility of the user status +-- @privacyKeyChatInvite Privacy key for managing ability of invitation of the user to chats +-- @privacyRuleAllowAll Rule to allow all users +-- @privacyRuleAllowContacts Rule to allow all user contacts +-- @privacyRuleAllowUsers Rule to allow specified users +-- @user_ids User identifiers +-- @privacyRuleDisallowAll Rule to disallow all users +-- @privacyRuleDisallowContacts Rule to disallow all user contacts +-- @privacyRuleDisallowUsers Rule to disallow all specified users +-- key = UserStatus|ChatInvite +-- rules = AllowAll|AllowContacts|AllowUsers(user_ids)|DisallowAll|DisallowContacts|DisallowUsers(user_ids) +local function setPrivacy(key, rule, allowed_user_ids, disallowed_user_ids, dl_cb, cmd) + local rules = {[0] = {ID = 'PrivacyRule' .. rule}} + + if allowed_user_ids then + rules = { + { + ID = 'PrivacyRule' .. rule + }, + [0] = { + ID = "PrivacyRuleAllowUsers", + user_ids_ = allowed_user_ids -- vector + }, + } + end + if disallowed_user_ids then + rules = { + { + ID = 'PrivacyRule' .. rule + }, + [0] = { + ID = "PrivacyRuleDisallowUsers", + user_ids_ = disallowed_user_ids -- vector + }, + } + end + if allowed_user_ids and disallowed_user_ids then + rules = { + { + ID = 'PrivacyRule' .. rule + }, + { + ID = "PrivacyRuleAllowUsers", + user_ids_ = allowed_user_ids + }, + [0] = { + ID = "PrivacyRuleDisallowUsers", + user_ids_ = disallowed_user_ids + }, + } + end + tdcli_function ({ + ID = "SetPrivacy", + key_ = { + ID = 'PrivacyKey' .. key + }, + rules_ = { + ID = "PrivacyRules", + rules_ = rules + }, + }, dl_cb, cmd) +end + +M.setPrivacy = setPrivacy + +-- Returns current privacy settings +-- @key Privacy key +-- key = UserStatus|ChatInvite +local function getPrivacy(key, dl_cb, cmd) + tdcli_function ({ + ID = "GetPrivacy", + key_ = { + ID = "PrivacyKey" .. key + }, + }, dl_cb, cmd) +end + +M.getPrivacy = getPrivacy + +-- Returns value of an option by its name. +-- See list of available options on https://core.telegram.org/tdlib/options +-- @name Name of the option +local function getOption(name, dl_cb, cmd) + tdcli_function ({ + ID = "GetOption", + name_ = name + }, dl_cb, cmd) +end + +M.getOption = getOption + +-- Sets value of an option. +-- See list of available options on https://core.telegram.org/tdlib/options. +-- Only writable options can be set +-- @name Name of the option +-- @value New value of the option +local function setOption(name, option, value, dl_cb, cmd) + tdcli_function ({ + ID = "SetOption", + name_ = name, + value_ = { + ID = 'Option' .. option, + value_ = value + }, + }, dl_cb, cmd) +end + +M.setOption = setOption + +-- Changes period of inactivity, after which the account of currently logged in user will be automatically deleted +-- @ttl New account TTL +local function changeAccountTtl(days, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeAccountTtl", + ttl_ = { + ID = "AccountTtl", + days_ = days + }, + }, dl_cb, cmd) +end + +M.changeAccountTtl = changeAccountTtl + +-- Returns period of inactivity, after which the account of currently logged in user will be automatically deleted +local function getAccountTtl(dl_cb, cmd) + tdcli_function ({ + ID = "GetAccountTtl", + }, dl_cb, cmd) +end + +M.getAccountTtl = getAccountTtl + +-- Deletes the account of currently logged in user, deleting from the server all information associated with it. +-- Account's phone number can be used to create new account, but only once in two weeks +-- @reason Optional reason of account deletion +local function deleteAccount(reason, dl_cb, cmd) + tdcli_function ({ + ID = "DeleteAccount", + reason_ = reason + }, dl_cb, cmd) +end + +M.deleteAccount = deleteAccount + +-- Returns current chat report spam state +-- @chat_id Chat identifier +local function getChatReportSpamState(chat_id, dl_cb, cmd) + tdcli_function ({ + ID = "GetChatReportSpamState", + chat_id_ = chat_id + }, dl_cb, cmd) +end + +M.getChatReportSpamState = getChatReportSpamState + +-- Reports chat as a spam chat or as not a spam chat. +-- Can be used only if ChatReportSpamState.can_report_spam is true. +-- After this request ChatReportSpamState.can_report_spam became false forever +-- @chat_id Chat identifier +-- @is_spam_chat If true, chat will be reported as a spam chat, otherwise it will be marked as not a spam chat +local function changeChatReportSpamState(chat_id, is_spam_chat, dl_cb, cmd) + tdcli_function ({ + ID = "ChangeChatReportSpamState", + chat_id_ = chat_id, + is_spam_chat_ = is_spam_chat + }, dl_cb, cmd) +end + +M.changeChatReportSpamState = changeChatReportSpamState + +-- Bots only. +-- Informs server about number of pending bot updates if they aren't processed for a long time +-- @pending_update_count Number of pending updates +-- @error_message Last error's message +local function setBotUpdatesStatus(pending_update_count, error_message, dl_cb, cmd) + tdcli_function ({ + ID = "SetBotUpdatesStatus", + pending_update_count_ = pending_update_count, + error_message_ = error_message + }, dl_cb, cmd) +end + +M.setBotUpdatesStatus = setBotUpdatesStatus + +-- Returns Ok after specified amount of the time passed +-- @seconds Number of seconds before that function returns +local function setAlarm(seconds, dl_cb, cmd) + tdcli_function ({ + ID = "SetAlarm", + seconds_ = seconds + }, dl_cb, cmd) +end + +M.setAlarm = setAlarm + +-- Text message +-- @text Text to send +-- @disable_notification Pass true, to disable notification about the message, doesn't works in secret chats +-- @from_background Pass true, if the message is sent from background +-- @reply_markup Bots only. Markup for replying to message +-- @disable_web_page_preview Pass true to disable rich preview for link in the message text +-- @clear_draft Pass true if chat draft message should be deleted +-- @entities Bold, Italic, Code, Pre, PreCode and TextUrl entities contained in the text. Non-bot users can't use TextUrl entities. Can't be used with non-null parse_mode +-- @parse_mode Text parse mode, nullable. Can't be used along with enitities +local function sendMessage(chat_id, reply_to_message_id, disable_notification, text, disable_web_page_preview, parse_mode) + local TextParseMode = getParseMode(parse_mode) + + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = 1, + reply_markup_ = nil, + input_message_content_ = { + ID = "InputMessageText", + text_ = text, + disable_web_page_preview_ = disable_web_page_preview, + clear_draft_ = 0, + entities_ = {}, + parse_mode_ = TextParseMode, + }, + }, dl_cb, nil) +end + +M.sendMessage = sendMessage + +-- Animation message +-- @animation Animation file to send +-- @thumb Animation thumb, if available +-- @width Width of the animation, may be replaced by the server +-- @height Height of the animation, may be replaced by the server +-- @caption Animation caption, 0-200 characters +local function sendAnimation(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, animation, width, height, caption, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageAnimation", + animation_ = getInputFile(animation), + --thumb_ = { + --ID = "InputThumb", + --path_ = path, + --width_ = width, + --height_ = height + --}, + width_ = width or '', + height_ = height or '', + caption_ = caption or '' + }, + }, dl_cb, cmd) +end + +M.sendAnimation = sendAnimation + +-- Audio message +-- @audio Audio file to send +-- @album_cover_thumb Thumb of the album's cover, if available +-- @duration Duration of audio in seconds, may be replaced by the server +-- @title Title of the audio, 0-64 characters, may be replaced by the server +-- @performer Performer of the audio, 0-64 characters, may be replaced by the server +-- @caption Audio caption, 0-200 characters +local function sendAudio(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, audio, duration, title, performer, caption, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageAudio", + audio_ = getInputFile(audio), + --album_cover_thumb_ = { + --ID = "InputThumb", + --path_ = path, + --width_ = width, + --height_ = height + --}, + duration_ = duration or '', + title_ = title or '', + performer_ = performer or '', + caption_ = caption or '' + }, + }, dl_cb, cmd) +end + +M.sendAudio = sendAudio + +-- Document message +-- @document Document to send +-- @thumb Document thumb, if available +-- @caption Document caption, 0-200 characters +local function sendDocument(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, document, caption, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageDocument", + document_ = getInputFile(document), + --thumb_ = { + --ID = "InputThumb", + --path_ = path, + --width_ = width, + --height_ = height + --}, + caption_ = caption + }, + }, dl_cb, cmd) +end + +M.sendDocument = sendDocument + +-- Photo message +-- @photo Photo to send +-- @caption Photo caption, 0-200 characters +local function sendPhoto(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, photo, caption, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessagePhoto", + photo_ = getInputFile(photo), + added_sticker_file_ids_ = {}, + width_ = 0, + height_ = 0, + caption_ = caption + }, + }, dl_cb, cmd) +end + +M.sendPhoto = sendPhoto + +-- Sticker message +-- @sticker Sticker to send +-- @thumb Sticker thumb, if available +local function sendSticker(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, sticker, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageSticker", + sticker_ = getInputFile(sticker), + --thumb_ = { + --ID = "InputThumb", + --path_ = path, + --width_ = width, + --height_ = height + --}, + }, + }, dl_cb, cmd) +end + +M.sendSticker = sendSticker + +-- Video message +-- @video Video to send +-- @thumb Video thumb, if available +-- @duration Duration of video in seconds +-- @width Video width +-- @height Video height +-- @caption Video caption, 0-200 characters +local function sendVideo(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, video, duration, width, height, caption, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageVideo", + video_ = getInputFile(video), + --thumb_ = { + --ID = "InputThumb", + --path_ = path, + --width_ = width, + --height_ = height + --}, + added_sticker_file_ids_ = {}, + duration_ = duration or '', + width_ = width or '', + height_ = height or '', + caption_ = caption or '' + }, + }, dl_cb, cmd) +end + +M.sendVideo = sendVideo + +-- Voice message +-- @voice Voice file to send +-- @duration Duration of voice in seconds +-- @waveform Waveform representation of the voice in 5-bit format +-- @caption Voice caption, 0-200 characters +local function sendVoice(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, voice, duration, waveform, caption, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageVoice", + voice_ = getInputFile(voice), + duration_ = duration or '', + waveform_ = waveform or '', + caption_ = caption or '' + }, + }, dl_cb, cmd) +end + +M.sendVoice = sendVoice + +-- Message with location +-- @latitude Latitude of location in degrees as defined by sender +-- @longitude Longitude of location in degrees as defined by sender +local function sendLocation(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, latitude, longitude, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageLocation", + location_ = { + ID = "Location", + latitude_ = latitude, + longitude_ = longitude + }, + }, + }, dl_cb, cmd) +end + +M.sendLocation = sendLocation + +-- Message with information about venue +-- @venue Venue to send +-- @latitude Latitude of location in degrees as defined by sender +-- @longitude Longitude of location in degrees as defined by sender +-- @title Venue name as defined by sender +-- @address Venue address as defined by sender +-- @provider Provider of venue database as defined by sender. Only "foursquare" need to be supported currently +-- @id Identifier of the venue in provider database as defined by sender +local function sendVenue(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, latitude, longitude, title, address, id, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageVenue", + venue_ = { + ID = "Venue", + location_ = { + ID = "Location", + latitude_ = latitude, + longitude_ = longitude + }, + title_ = title, + address_ = address, + provider_ = 'foursquare', + id_ = id + }, + }, + }, dl_cb, cmd) +end + +M.sendVenue = sendVenue + +-- User contact message +-- @contact Contact to send +-- @phone_number User's phone number +-- @first_name User first name, 1-255 characters +-- @last_name User last name +-- @user_id User identifier if known, 0 otherwise +local function sendContact(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, phone_number, first_name, last_name, user_id, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageContact", + contact_ = { + ID = "Contact", + phone_number_ = phone_number, + first_name_ = first_name, + last_name_ = last_name, + user_id_ = user_id + }, + }, + }, dl_cb, cmd) +end + +M.sendContact = sendContact + +-- Message with a game +-- @bot_user_id User identifier of a bot owned the game +-- @game_short_name Game short name +local function sendGame(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, bot_user_id, game_short_name, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageGame", + bot_user_id_ = bot_user_id, + game_short_name_ = game_short_name + }, + }, dl_cb, cmd) +end + +M.sendGame = sendGame + +-- Forwarded message +-- @from_chat_id Chat identifier of the message to forward +-- @message_id Identifier of the message to forward +local function sendForwarded(chat_id, reply_to_message_id, disable_notification, from_background, reply_markup, from_chat_id, message_id, dl_cb, cmd) + tdcli_function ({ + ID = "SendMessage", + chat_id_ = chat_id, + reply_to_message_id_ = reply_to_message_id, + disable_notification_ = disable_notification, + from_background_ = from_background, + reply_markup_ = reply_markup, + input_message_content_ = { + ID = "InputMessageForwarded", + from_chat_id_ = from_chat_id, + message_id_ = message_id + }, + }, dl_cb, cmd) +end + +M.sendForwarded = sendForwarded + +return M cli/tg/tgcli (Binary file not shown.) 0 comments on commit 3233fdf Comment on 3233fdf Leave a comment Comment Desktop version
Dboy233 / ScanFIlesUtilUsing coroutine program to scan Android mobile files can be used to scan junk files, cache files, application cache, video files, audio files, text files, etc.使用协程扫描手机文件,可用来扫描垃圾文件,缓存文件,应用缓存,视频文件,音频文件,文本文件,等等。
hiteshsuthar01 / OK <html lang="en-US"><head><script type="text/javascript" async="" src="https://script.4dex.io/localstore.js"></script> <title>HTML p tag</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="Keywords" content="HTML, Python, CSS, SQL, JavaScript, How to, PHP, Java, C, C++, C#, jQuery, Bootstrap, Colors, W3.CSS, XML, MySQL, Icons, NodeJS, React, Graphics, Angular, R, AI, Git, Data Science, Code Game, Tutorials, Programming, Web Development, Training, Learning, Quiz, Exercises, Courses, Lessons, References, Examples, Learn to code, Source code, Demos, Tips, Website"> <meta name="Description" content="Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more."> <meta property="og:image" content="https://www.w3schools.com/images/w3schools_logo_436_2.png"> <meta property="og:image:type" content="image/png"> <meta property="og:image:width" content="436"> <meta property="og:image:height" content="228"> <meta property="og:description" content="W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more."> <link rel="icon" href="/favicon.ico" type="image/x-icon"> <link rel="preload" href="/lib/fonts/fontawesome.woff2?14663396" as="font" type="font/woff2" crossorigin=""> <link rel="preload" href="/lib/fonts/source-code-pro-v14-latin-regular.woff2" as="font" type="font/woff2" crossorigin=""> <link rel="preload" href="/lib/fonts/roboto-mono-v13-latin-500.woff2" as="font" type="font/woff2" crossorigin=""> <link rel="preload" href="/lib/fonts/source-sans-pro-v14-latin-700.woff2" as="font" type="font/woff2" crossorigin=""> <link rel="preload" href="/lib/fonts/source-sans-pro-v14-latin-600.woff2" as="font" type="font/woff2" crossorigin=""> <link rel="preload" href="/lib/fonts/freckle-face-v9-latin-regular.woff2" as="font" type="font/woff2" crossorigin=""> <link rel="stylesheet" href="/lib/w3schools30.css"> <script async="" src="//confiant-integrations.global.ssl.fastly.net/prebid/202204201359/wrap.js"></script><script type="text/javascript" src="https://confiant-integrations.global.ssl.fastly.net/t_Qv_vWzcBDsyn934F1E0MWBb1c/prebid/config.js" async=""></script><script type="text/javascript" async="" src="https://www.google-analytics.com/gtm/js?id=GTM-WJ88MZ5&cid=1308236804.1650718121"></script><script async="" src="https://www.google-analytics.com/analytics.js"></script><script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-3855518-1', 'auto'); ga('require', 'displayfeatures'); ga('require', 'GTM-WJ88MZ5'); ga('send', 'pageview'); </script> <script src="/lib/uic.js?v=1.0.3"></script> <script data-cfasync="false" type="text/javascript"> var k42 = false; k42 = true; </script> <script data-cfasync="false" type="text/javascript"> window.snigelPubConf = { "adengine": { "activeAdUnits": ["main_leaderboard", "sidebar_top", "bottom_left", "bottom_right"] } } uic_r_a() </script> <script async="" data-cfasync="false" src="https://cdn.snigelweb.com/adengine/w3schools.com/loader.js" type="text/javascript"></script> <script src="/lib/my-learning.js?v=1.0.9"></script> <script type="text/javascript"> var stickyadstatus = ""; function fix_stickyad() { document.getElementById("stickypos").style.position = "sticky"; var elem = document.getElementById("stickyadcontainer"); if (!elem) {return false;} if (document.getElementById("skyscraper")) { var skyWidth = Number(w3_getStyleValue(document.getElementById("skyscraper"), "width").replace("px", "")); } else { var skyWidth = Number(w3_getStyleValue(document.getElementById("right"), "width").replace("px", "")); } elem.style.width = skyWidth + "px"; if (window.innerWidth <= 992) { elem.style.position = ""; elem.style.top = stickypos + "px"; return false; } var stickypos = document.getElementById("stickypos").offsetTop; var docTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; var adHeight = Number(w3_getStyleValue(elem, "height").replace("px", "")); if (stickyadstatus == "") { if ((stickypos - docTop) < 60) { elem.style.position = "fixed"; elem.style.top = "60px"; stickyadstatus = "sticky"; document.getElementById("stickypos").style.position = "sticky"; } } else { if ((docTop + 60) - stickypos < 0) { elem.style.position = ""; elem.style.top = stickypos + "px"; stickyadstatus = ""; document.getElementById("stickypos").style.position = "static"; } } if (stickyadstatus == "sticky") { if ((docTop + adHeight + 60) > document.getElementById("footer").offsetTop) { elem.style.position = "absolute"; elem.style.top = (document.getElementById("footer").offsetTop - adHeight) + "px"; document.getElementById("stickypos").style.position = "static"; } else { elem.style.position = "fixed"; elem.style.top = "60px"; stickyadstatus = "sticky"; document.getElementById("stickypos").style.position = "sticky"; } } } function w3_getStyleValue(elmnt,style) { if (window.getComputedStyle) { return window.getComputedStyle(elmnt,null).getPropertyValue(style); } else { return elmnt.currentStyle[style]; } } </script> <link rel="stylesheet" type="text/css" href="/browserref.css"> <script type="text/javascript" async="" src="//cdn.snigelweb.com/prebid/5.20.2/prebid.js?v=3547-1650632016452"></script><script type="text/javascript" async="" src="//c.amazon-adsystem.com/aax2/apstag.js"></script><script type="text/javascript" async="" src="//securepubads.g.doubleclick.net/tag/js/gpt.js"></script><script type="text/javascript" async="" src="https://adengine.snigelweb.com/w3schools.com/3547-1650632016452/adngin.js"></script><script type="text/javascript" async="" src="//cdn.snigelweb.com/argus/argus.js"></script><meta http-equiv="origin-trial" content="AxujKG9INjsZ8/gUq8+dTruNvk7RjZQ1oFhhgQbcTJKDnZfbzSTE81wvC2Hzaf3TW4avA76LTZEMdiedF1vIbA4AAABueyJvcmlnaW4iOiJodHRwczovL2ltYXNkay5nb29nbGVhcGlzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0="><meta http-equiv="origin-trial" content="Azuce85ORtSnWe1MZDTv68qpaW3iHyfL9YbLRy0cwcCZwVnePnOmkUJlG8HGikmOwhZU22dElCcfrfX2HhrBPAkAAAB7eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial" content="A16nvcdeoOAqrJcmjLRpl1I6f3McDD8EfofAYTt/P/H4/AWwB99nxiPp6kA0fXoiZav908Z8etuL16laFPUdfQsAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial" content="AxBHdr0J44vFBQtZUqX9sjiqf5yWZ/OcHRcRMN3H9TH+t90V/j3ENW6C8+igBZFXMJ7G3Pr8Dd13632aLng42wgAAACBeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiVHJ1c3RUb2tlbnMiLCJleHBpcnkiOjE2NTI3NzQ0MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial" content="A88BWHFjcawUfKU3lIejLoryXoyjooBXLgWmGh+hNcqMK44cugvsI5YZbNarYvi3roc1fYbHA1AVbhAtuHZflgEAAAB2eyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IlRydXN0VG9rZW5zIiwiZXhwaXJ5IjoxNjUyNzc0NDAwLCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="AzoawhTRDevLR66Y6MROu167EDncFPBvcKOaQispTo9ouEt5LvcBjnRFqiAByRT+2cDHG1Yj4dXwpLeIhc98/gIAAACFeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjYxMjk5MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A6+nc62kbJgC46ypOwRsNW6RkDn2x7tgRh0wp7jb3DtFF7oEhu1hhm4rdZHZ6zXvnKZLlYcBlQUImC4d3kKihAcAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjYxMjk5MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><meta http-equiv="origin-trial" content="A/9La288e7MDEU2ifusFnMg1C2Ij6uoa/Z/ylwJIXSsWfK37oESIPbxbt4IU86OGqDEPnNVruUiMjfKo65H/CQwAAACLeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiUHJpdmFjeVNhbmRib3hBZHNBUElzIiwiZXhwaXJ5IjoxNjYxMjk5MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlfQ=="><script src="https://securepubads.g.doubleclick.net/gpt/pubads_impl_2022042001.js?cb=31067210" async=""></script><argprec0></argprec0><argprec1></argprec1><style type="text/css">.snigel-cmp-framework .sn-inner {background-color:#fffefe!important;}.snigel-cmp-framework .sn-b-def {border-color:#04aa6d!important;color:#04aa6d!important;}.snigel-cmp-framework .sn-b-def.sn-blue {color:#ffffff!important;background-color:#04aa6d!important;border-color:#04aa6d!important;}.snigel-cmp-framework .sn-selector ul li {color:#04aa6d!important;}.snigel-cmp-framework .sn-selector ul li:after {background-color:#04aa6d!important;}.snigel-cmp-framework .sn-footer-tab .sn-privacy a {color:#04aa6d!important;}.snigel-cmp-framework .sn-arrow:after,.snigel-cmp-framework .sn-arrow:before {background-color:#04aa6d!important;}.snigel-cmp-framework .sn-switch input:checked + span::before {background-color:#04aa6d!important;}#adconsent-usp-link {border: 1px solid #04aa6d!important;color:#04aa6d!important;}#adconsent-usp-banner-optout input:checked + .adconsent-usp-slider {background-color:#04aa6d!important;}#adconsent-usp-banner-btn {color:#ffffff;border: solid 1px #04aa6d!important;background-color:#04aa6d!important; }</style><link rel="preload" href="https://adservice.google.co.in/adsid/integrator.js?domain=www.w3schools.com" as="script"><script type="text/javascript" src="https://adservice.google.co.in/adsid/integrator.js?domain=www.w3schools.com"></script><link rel="preload" href="https://adservice.google.com/adsid/integrator.js?domain=www.w3schools.com" as="script"><script type="text/javascript" src="https://adservice.google.com/adsid/integrator.js?domain=www.w3schools.com"></script><meta http-equiv="origin-trial" content="A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9"><meta http-equiv="origin-trial" content="A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9"><meta http-equiv="origin-trial" content="A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9"><meta http-equiv="origin-trial" content="A4/Htern2udN9w3yJK9QgWQxQFruxOXsXL7cW60DyCl0EZFGCSme/J33Q/WzF7bBkVvhEWDlcBiUyZaim5CpFQwAAACceyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXRhZ3NlcnZpY2VzLmNvbTo0NDMiLCJmZWF0dXJlIjoiQ29udmVyc2lvbk1lYXN1cmVtZW50IiwiZXhwaXJ5IjoxNjQzMTU1MTk5LCJpc1N1YmRvbWFpbiI6dHJ1ZSwiaXNUaGlyZFBhcnR5Ijp0cnVlLCJ1c2FnZSI6InN1YnNldCJ9"><link rel="preload" href="https://adservice.google.co.in/adsid/integrator.js?domain=www.w3schools.com" as="script"><script type="text/javascript" src="https://adservice.google.co.in/adsid/integrator.js?domain=www.w3schools.com"></script><link rel="preload" href="https://adservice.google.com/adsid/integrator.js?domain=www.w3schools.com" as="script"><script type="text/javascript" src="https://adservice.google.com/adsid/integrator.js?domain=www.w3schools.com"></script></head> <body> <style> #darkmodemenu { position:absolute; top:-40px; right:16px; padding:5px 20px 10px 18px; border-bottom-left-radius:5px; border-bottom-right-radius:5px; z-index:-1; transition: top 0.2s; user-select: none; } #darkmodemenu input,#darkmodemenu label { cursor:pointer; } </style> <script> ( function setThemeMode() { var x = localStorage.getItem("preferredmode"); var y = localStorage.getItem("preferredpagemode"); if (x == "dark") { document.body.className += " darktheme"; ga('send', 'event', 'theme' , "darkcode"); } if (y == "dark") { document.body.className += " darkpagetheme"; ga('send', 'event', 'theme' , "darkpage"); } })(); </script> <div id="pagetop" class="w3-bar w3-card-2 notranslate"> <a href="https://www.w3schools.com" class="w3-bar-item w3-button w3-hover-none w3-left w3-padding-16" title="Home" style="width:77px"> <i class="fa fa-logo ws-text-green ws-hover-text-green" style="position:relative;font-size:42px!important;"></i> </a> <style> @media screen and (max-width: 1080px) { .ws-hide-1080 { ddddisplay: none !important; } } @media screen and (max-width: 1160px) { .topnavmain_video { display: none !important; } } </style> <a class="w3-bar-item w3-button w3-hide-small barex bar-item-hover w3-padding-24" href="javascript:void(0)" onclick="w3_open_nav('tutorials')" id="navbtn_tutorials" title="Tutorials" style="width:116px">Tutorials <i class="fa fa-caret-down" style="font-size: 20px; display: inline;"></i><i class="fa fa-caret-up" style="display:none"></i></a> <a class="w3-bar-item w3-button w3-hide-small barex bar-item-hover w3-padding-24" href="javascript:void(0)" onclick="w3_open_nav('references')" id="navbtn_references" title="References" style="width:132px">References <i class="fa fa-caret-down" style="font-size: 20px; display: inline;"></i><i class="fa fa-caret-up" style="display:none"></i></a> <a class="w3-bar-item w3-button w3-hide-small barex bar-item-hover w3-padding-24 ws-hide-800" href="javascript:void(0)" onclick="w3_open_nav('exercises')" id="navbtn_exercises" title="Exercises" style="width:118px">Exercises <i class="fa fa-caret-down" style="font-size: 20px; display: inline;"></i><i class="fa fa-caret-up" style="display:none"></i></a> <a class="w3-bar-item w3-button w3-hide-medium bar-item-hover w3-hide-small w3-padding-24 barex topnavmain_video" href="https://www.w3schools.com/videos/index.php" title="Video Tutorials" onclick="ga('send', 'event', 'Videos' , 'fromTopnavMain')">Videos</a> <a class="w3-bar-item w3-button w3-hide-medium bar-item-hover w3-hide-small w3-padding-24 barex" href="/pro/index.php" title="Go Pro" onclick="ga('send', 'event', 'Pro' , 'fromTopnavMainASP')">Pro <span class="ribbon-topnav ws-hide-1080">NEW</span></a> <a class="w3-bar-item w3-button bar-item-hover w3-padding-24" href="javascript:void(0)" onclick="w3_open()" id="navbtn_menu" title="Menu" style="width:93px">Menu <i class="fa fa-caret-down"></i><i class="fa fa-caret-up" style="display:none"></i></a> <div id="loginactioncontainer" class="w3-right w3-padding-16" style="margin-left:50px"> <div id="mypagediv" style="display: none;"></div> <!-- <button id="w3loginbtn" style="border:none;display:none;cursor:pointer" class="login w3-right w3-hover-greener" onclick='w3_open_nav("login")'>LOG IN</button>--> <a id="w3loginbtn" class="w3-bar-item w3-btn bar-item-hover w3-right" style="display: inline; width: 130px; background-color: rgb(4, 170, 109); color: white; border-radius: 25px;" href="https://profile.w3schools.com/log-in?redirect_url=https%3A%2F%2Fmy-learning.w3schools.com" target="_self">Log in</a> </div> <div class="w3-right w3-padding-16"> <!--<a class="w3-bar-item w3-button bar-icon-hover w3-right w3-hover-white w3-hide-large w3-hide-medium" href="javascript:void(0)" onclick="w3_open()" title="Menu"><i class='fa'></i></a> --> <a class="w3-bar-item w3-button bar-item-hover w3-right w3-hide-small barex" style="width: 140px; border-radius: 25px; margin-right: 15px;" href="https://courses.w3schools.com/" target="_blank" id="cert_navbtn" onclick="ga('send', 'event', 'Courses' , 'Clicked on courses in Main top navigation');" title="Courses">Paid Courses</a> <a class="w3-bar-item w3-button bar-item-hover w3-right ws-hide-900 w3-hide-small barex ws-pink" style="border-radius: 25px; margin-right: 15px;" href="https://www.w3schools.com/spaces" target="_blank" onclick="ga('send', 'event', 'spacesFromTopnavMain', 'click');" title="Get Your Own Website With W3Schools Spaces">Website <span class="ribbon-topnav ws-hide-1066">NEW</span></a> </div> </div> <div style="display: none; position: fixed; z-index: 4; right: 52px; height: 44px; background-color: rgb(40, 42, 53); letter-spacing: normal; top: 0px;" id="googleSearch"> <div class="gcse-search"></div> </div> <div style="display: none; position: fixed; z-index: 3; right: 111px; height: 44px; background-color: rgb(40, 42, 53); text-align: right; padding-top: 9px; top: 0px;" id="google_translate_element"></div> <div class="w3-card-2 topnav notranslate" id="topnav" style="position: fixed; top: 0px;"> <div style="overflow:auto;"> <div class="w3-bar w3-left" style="width:100%;overflow:hidden;height:44px"> <a href="javascript:void(0);" class="topnav-icons fa fa-menu w3-hide-large w3-left w3-bar-item w3-button" onclick="open_menu()" title="Menu"></a> <a href="/default.asp" class="topnav-icons fa fa-home w3-left w3-bar-item w3-button" title="Home"></a> <a class="w3-bar-item w3-button" href="/html/default.asp" title="HTML Tutorial" style="padding-left:18px!important;padding-right:18px!important;">HTML</a> <a class="w3-bar-item w3-button" href="/css/default.asp" title="CSS Tutorial">CSS</a> <a class="w3-bar-item w3-button" href="/js/default.asp" title="JavaScript Tutorial">JAVASCRIPT</a> <a class="w3-bar-item w3-button" href="/sql/default.asp" title="SQL Tutorial">SQL</a> <a class="w3-bar-item w3-button" href="/python/default.asp" title="Python Tutorial">PYTHON</a> <a class="w3-bar-item w3-button" href="/php/default.asp" title="PHP Tutorial">PHP</a> <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_ver.asp" title="Bootstrap Tutorial">BOOTSTRAP</a> <a class="w3-bar-item w3-button" href="/howto/default.asp" title="How To">HOW TO</a> <a class="w3-bar-item w3-button" href="/w3css/default.asp" title="W3.CSS Tutorial">W3.CSS</a> <a class="w3-bar-item w3-button" href="/java/default.asp" title="Java Tutorial">JAVA</a> <a class="w3-bar-item w3-button" href="/jquery/default.asp" title="jQuery Tutorial">JQUERY</a> <a class="w3-bar-item w3-button" href="/c/index.php" title="C Tutorial">C</a> <a class="w3-bar-item w3-button" href="/cpp/default.asp" title="C++ Tutorial">C++</a> <a class="w3-bar-item w3-button" href="/cs/index.php" title="C# Tutorial">C#</a> <a class="w3-bar-item w3-button" href="/r/default.asp" title="R Tutorial">R</a> <a class="w3-bar-item w3-button" href="/react/default.asp" title="React Tutorial">React</a> <a href="javascript:void(0);" class="topnav-icons fa w3-right w3-bar-item w3-button" onclick="gSearch(this)" title="Search W3Schools"></a> <a href="javascript:void(0);" class="topnav-icons fa w3-right w3-bar-item w3-button" onclick="gTra(this)" title="Translate W3Schools"></a> <!-- <a href='javascript:void(0);' class='topnav-icons fa w3-right w3-bar-item w3-button' onclick='changecodetheme(this)' title='Toggle Dark Code Examples'></a>--> <a href="javascript:void(0);" class="topnav-icons fa w3-right w3-bar-item w3-button" onmouseover="mouseoverdarkicon()" onmouseout="mouseoutofdarkicon()" onclick="changepagetheme(2)"></a> <!-- <a class="w3-bar-item w3-button w3-right" id='topnavbtn_exercises' href='javascript:void(0);' onclick='w3_open_nav("exercises")' title='Exercises'>EXERCISES <i class='fa fa-caret-down'></i><i class='fa fa-caret-up' style='display:none'></i></a> --> </div> <div id="darkmodemenu" class="ws-black" onmouseover="mouseoverdarkicon()" onmouseout="mouseoutofdarkicon()" style="top: -40px;"> <input id="radio_darkpage" type="checkbox" name="radio_theme_mode" onclick="click_darkpage()"><label for="radio_darkpage"> Dark mode</label> <br> <input id="radio_darkcode" type="checkbox" name="radio_theme_mode" onclick="click_darkcode()"><label for="radio_darkcode"> Dark code</label> </div> <nav id="nav_tutorials" class="w3-hide-small" style="position: absolute; padding-bottom: 60px; display: none;"> <div class="w3-content" style="max-width:1100px;font-size:18px"> <span onclick="w3_close_nav('tutorials')" class="w3-button w3-xxxlarge w3-display-topright w3-hover-white sectionxsclosenavspan" style="padding-right:30px;padding-left:30px;">×</span><br> <div class="w3-row-padding w3-bar-block"> <div class="w3-container" style="padding-left:13px"> <h2 style="color:#FFF4A3;"><b>Tutorials</b></h2> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top">HTML and CSS</h3> <a class="w3-bar-item w3-button" href="/html/default.asp">Learn HTML</a> <a class="w3-bar-item w3-button" href="/css/default.asp">Learn CSS</a> <a class="w3-bar-item w3-button" href="/css/css_rwd_intro.asp" title="Responsive Web Design">Learn RWD</a> <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_ver.asp">Learn Bootstrap</a> <a class="w3-bar-item w3-button" href="/w3css/default.asp">Learn W3.CSS</a> <a class="w3-bar-item w3-button" href="/colors/default.asp">Learn Colors</a> <a class="w3-bar-item w3-button" href="/icons/default.asp">Learn Icons</a> <a class="w3-bar-item w3-button" href="/graphics/default.asp">Learn Graphics</a> <a class="w3-bar-item w3-button" href="/graphics/svg_intro.asp">Learn SVG</a> <a class="w3-bar-item w3-button" href="/graphics/canvas_intro.asp">Learn Canvas</a> <a class="w3-bar-item w3-button" href="/howto/default.asp">Learn How To</a> <a class="w3-bar-item w3-button" href="/sass/default.php">Learn Sass</a> <div class="w3-hide-large w3-hide-small"> <h3 class="w3-margin-top">Data Analytics</h3> <a class="w3-bar-item w3-button" href="/ai/default.asp">Learn AI</a> <a class="w3-bar-item w3-button" href="/python/python_ml_getting_started.asp">Learn Machine Learning</a> <a class="w3-bar-item w3-button" href="/datascience/default.asp">Learn Data Science</a> <a class="w3-bar-item w3-button" href="/python/numpy/default.asp">Learn NumPy</a> <a class="w3-bar-item w3-button" href="/python/pandas/default.asp">Learn Pandas</a> <a class="w3-bar-item w3-button" href="/python/scipy/index.php">Learn SciPy</a> <a class="w3-bar-item w3-button" href="/python/matplotlib_intro.asp">Learn Matplotlib</a> <a class="w3-bar-item w3-button" href="/statistics/index.php">Learn Statistics</a> <a class="w3-bar-item w3-button" href="/excel/index.php">Learn Excel</a> <h3 class="w3-margin-top">XML Tutorials</h3> <a class="w3-bar-item w3-button" href="/xml/default.asp">Learn XML</a> <a class="w3-bar-item w3-button" href="/xml/ajax_intro.asp">Learn XML AJAX</a> <a class="w3-bar-item w3-button" href="/xml/dom_intro.asp">Learn XML DOM</a> <a class="w3-bar-item w3-button" href="/xml/xml_dtd_intro.asp">Learn XML DTD</a> <a class="w3-bar-item w3-button" href="/xml/schema_intro.asp">Learn XML Schema</a> <a class="w3-bar-item w3-button" href="/xml/xsl_intro.asp">Learn XSLT</a> <a class="w3-bar-item w3-button" href="/xml/xpath_intro.asp">Learn XPath</a> <a class="w3-bar-item w3-button" href="/xml/xquery_intro.asp">Learn XQuery</a> </div> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top">JavaScript</h3> <a class="w3-bar-item w3-button" href="/js/default.asp">Learn JavaScript</a> <a class="w3-bar-item w3-button" href="/jquery/default.asp">Learn jQuery</a> <a class="w3-bar-item w3-button" href="/react/default.asp">Learn React</a> <a class="w3-bar-item w3-button" href="/angular/default.asp">Learn AngularJS</a> <a class="w3-bar-item w3-button" href="/js/js_json_intro.asp">Learn JSON</a> <a class="w3-bar-item w3-button" href="/js/js_ajax_intro.asp">Learn AJAX</a> <a class="w3-bar-item w3-button" href="/appml/default.asp">Learn AppML</a> <a class="w3-bar-item w3-button" href="/w3js/default.asp">Learn W3.JS</a> <h3 class="w3-margin-top">Programming</h3> <a class="w3-bar-item w3-button" href="/python/default.asp">Learn Python</a> <a class="w3-bar-item w3-button" href="/java/default.asp">Learn Java</a> <a class="w3-bar-item w3-button" href="/c/index.php">Learn C</a> <a class="w3-bar-item w3-button" href="/cpp/default.asp">Learn C++</a> <a class="w3-bar-item w3-button" href="/cs/index.php">Learn C#</a> <a class="w3-bar-item w3-button" href="/r/default.asp">Learn R</a> <a class="w3-bar-item w3-button" href="/kotlin/index.php">Learn Kotlin</a> <a class="w3-bar-item w3-button" href="/go/index.php">Learn Go</a> <a class="w3-bar-item w3-button" href="/django/index.php">Learn Django</a> <a class="w3-bar-item w3-button" href="/typescript/index.php">Learn TypeScript</a> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top">Server Side</h3> <a class="w3-bar-item w3-button" href="/sql/default.asp">Learn SQL</a> <a class="w3-bar-item w3-button" href="/mysql/default.asp">Learn MySQL</a> <a class="w3-bar-item w3-button" href="/php/default.asp">Learn PHP</a> <a class="w3-bar-item w3-button" href="/asp/default.asp">Learn ASP</a> <a class="w3-bar-item w3-button" href="/nodejs/default.asp">Learn Node.js</a> <a class="w3-bar-item w3-button" href="/nodejs/nodejs_raspberrypi.asp">Learn Raspberry Pi</a> <a class="w3-bar-item w3-button" href="/git/default.asp">Learn Git</a> <a class="w3-bar-item w3-button" href="/aws/index.php">Learn AWS Cloud</a> <h3 class="w3-margin-top">Web Building</h3> <a class="w3-bar-item w3-button" href="https://www.w3schools.com/spaces" target="_blank" onclick="ga('send', 'event', 'spacesFromTutorialsAcc', 'click');" title="Get Your Own Website With W3schools Spaces">Create a Website <span class="ribbon-topnav ws-yellow">NEW</span></a> <a class="w3-bar-item w3-button" href="/where_to_start.asp">Where To Start</a> <a class="w3-bar-item w3-button" href="/w3css/w3css_templates.asp">Web Templates</a> <a class="w3-bar-item w3-button" href="/browsers/default.asp">Web Statistics</a> <a class="w3-bar-item w3-button" href="/cert/default.asp">Web Certificates</a> <a class="w3-bar-item w3-button" href="/whatis/default.asp">Web Development</a> <a class="w3-bar-item w3-button" href="/tryit/default.asp">Code Editor</a> <a class="w3-bar-item w3-button" href="/typingspeed/default.asp">Test Your Typing Speed</a> <a class="w3-bar-item w3-button" href="/codegame/index.html" target="_blank">Play a Code Game</a> <a class="w3-bar-item w3-button" href="/cybersecurity/index.php">Cyber Security</a> <a class="w3-bar-item w3-button" href="/accessibility/index.php">Accessibility</a> </div> <div class="w3-col l3 m6 w3-hide-medium"> <h3 class="w3-margin-top">Data Analytics</h3> <a class="w3-bar-item w3-button" href="/ai/default.asp">Learn AI</a> <a class="w3-bar-item w3-button" href="/python/python_ml_getting_started.asp">Learn Machine Learning</a> <a class="w3-bar-item w3-button" href="/datascience/default.asp">Learn Data Science</a> <a class="w3-bar-item w3-button" href="/python/numpy/default.asp">Learn NumPy</a> <a class="w3-bar-item w3-button" href="/python/pandas/default.asp">Learn Pandas</a> <a class="w3-bar-item w3-button" href="/python/scipy/index.php">Learn SciPy</a> <a class="w3-bar-item w3-button" href="/python/matplotlib_intro.asp">Learn Matplotlib</a> <a class="w3-bar-item w3-button" href="/statistics/index.php">Learn Statistics</a> <a class="w3-bar-item w3-button" href="/excel/index.php">Learn Excel</a> <a class="w3-bar-item w3-button" href="/googlesheets/index.php">Learn Google Sheets</a> <h3 class="w3-margin-top">XML Tutorials</h3> <a class="w3-bar-item w3-button" href="/xml/default.asp">Learn XML</a> <a class="w3-bar-item w3-button" href="/xml/ajax_intro.asp">Learn XML AJAX</a> <a class="w3-bar-item w3-button" href="/xml/dom_intro.asp">Learn XML DOM</a> <a class="w3-bar-item w3-button" href="/xml/xml_dtd_intro.asp">Learn XML DTD</a> <a class="w3-bar-item w3-button" href="/xml/schema_intro.asp">Learn XML Schema</a> <a class="w3-bar-item w3-button" href="/xml/xsl_intro.asp">Learn XSLT</a> <a class="w3-bar-item w3-button" href="/xml/xpath_intro.asp">Learn XPath</a> <a class="w3-bar-item w3-button" href="/xml/xquery_intro.asp">Learn XQuery</a> </div> </div> </div> <br class="hidesm"> </nav> <nav id="nav_references" class="w3-hide-small" style="position: absolute; padding-bottom: 60px; display: none;"> <div class="w3-content" style="max-width:1100px;font-size:18px"> <span onclick="w3_close_nav('references')" class="w3-button w3-xxxlarge w3-display-topright w3-hover-white sectionxsclosenavspan" style="padding-right:30px;padding-left:30px;">×</span><br> <div class="w3-row-padding w3-bar-block"> <div class="w3-container" style="padding-left:13px"> <h2 style="color:#FFF4A3;"><b>References</b></h2> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top">HTML</h3> <a class="w3-bar-item w3-button" href="/tags/default.asp">HTML Tag Reference</a> <a class="w3-bar-item w3-button" href="/tags/ref_html_browsersupport.asp">HTML Browser Support</a> <a class="w3-bar-item w3-button" href="/tags/ref_eventattributes.asp">HTML Event Reference</a> <a class="w3-bar-item w3-button" href="/colors/default.asp">HTML Color Reference</a> <a class="w3-bar-item w3-button" href="/tags/ref_attributes.asp">HTML Attribute Reference</a> <a class="w3-bar-item w3-button" href="/tags/ref_canvas.asp">HTML Canvas Reference</a> <a class="w3-bar-item w3-button" href="/graphics/svg_reference.asp">HTML SVG Reference</a> <a class="w3-bar-item w3-button" href="/graphics/google_maps_reference.asp">Google Maps Reference</a> <h3 class="w3-margin-top">CSS</h3> <a class="w3-bar-item w3-button" href="/cssref/default.asp">CSS Reference</a> <a class="w3-bar-item w3-button" href="/cssref/css3_browsersupport.asp">CSS Browser Support</a> <a class="w3-bar-item w3-button" href="/cssref/css_selectors.asp">CSS Selector Reference</a> <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_ref_all_classes.asp">Bootstrap 3 Reference</a> <a class="w3-bar-item w3-button" href="/bootstrap4/bootstrap_ref_all_classes.asp">Bootstrap 4 Reference</a> <a class="w3-bar-item w3-button" href="/w3css/w3css_references.asp">W3.CSS Reference</a> <a class="w3-bar-item w3-button" href="/icons/icons_reference.asp">Icon Reference</a> <a class="w3-bar-item w3-button" href="/sass/sass_functions_string.php">Sass Reference</a> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top">JavaScript</h3> <a class="w3-bar-item w3-button" href="/jsref/default.asp">JavaScript Reference</a> <a class="w3-bar-item w3-button" href="/jsref/default.asp">HTML DOM Reference</a> <a class="w3-bar-item w3-button" href="/jquery/jquery_ref_overview.asp">jQuery Reference</a> <a class="w3-bar-item w3-button" href="/angular/angular_ref_directives.asp">AngularJS Reference</a> <a class="w3-bar-item w3-button" href="/appml/appml_reference.asp">AppML Reference</a> <a class="w3-bar-item w3-button" href="/w3js/w3js_references.asp">W3.JS Reference</a> <h3 class="w3-margin-top">Programming</h3> <a class="w3-bar-item w3-button" href="/python/python_reference.asp">Python Reference</a> <a class="w3-bar-item w3-button" href="/java/java_ref_keywords.asp">Java Reference</a> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top">Server Side</h3> <a class="w3-bar-item w3-button" href="/sql/sql_ref_keywords.asp">SQL Reference</a> <a class="w3-bar-item w3-button" href="/mysql/mysql_ref_functions.asp">MySQL Reference</a> <a class="w3-bar-item w3-button" href="/php/php_ref_overview.asp">PHP Reference</a> <a class="w3-bar-item w3-button" href="/asp/asp_ref_response.asp">ASP Reference</a> <h3 class="w3-margin-top">XML</h3> <a class="w3-bar-item w3-button" href="/xml/dom_nodetype.asp">XML DOM Reference</a> <a class="w3-bar-item w3-button" href="/xml/dom_http.asp">XML Http Reference</a> <a class="w3-bar-item w3-button" href="/xml/xsl_elementref.asp">XSLT Reference</a> <a class="w3-bar-item w3-button" href="/xml/schema_elements_ref.asp">XML Schema Reference</a> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top">Character Sets</h3> <a class="w3-bar-item w3-button" href="/charsets/default.asp">HTML Character Sets</a> <a class="w3-bar-item w3-button" href="/charsets/ref_html_ascii.asp">HTML ASCII</a> <a class="w3-bar-item w3-button" href="/charsets/ref_html_ansi.asp">HTML ANSI</a> <a class="w3-bar-item w3-button" href="/charsets/ref_html_ansi.asp">HTML Windows-1252</a> <a class="w3-bar-item w3-button" href="/charsets/ref_html_8859.asp">HTML ISO-8859-1</a> <a class="w3-bar-item w3-button" href="/charsets/ref_html_symbols.asp">HTML Symbols</a> <a class="w3-bar-item w3-button" href="/charsets/ref_html_utf8.asp">HTML UTF-8</a> </div> </div> <br class="hidesm"> </div> </nav> <nav id="nav_exercises" class="w3-hide-small" style="position: absolute; padding-bottom: 60px; display: none;"> <div class="w3-content" style="max-width:1100px;font-size:18px"> <span onclick="w3_close_nav('exercises')" class="w3-button w3-xxxlarge w3-display-topright w3-hover-white sectionxsclosenavspan" style="padding-right:30px;padding-left:30px;">×</span><br> <div class="w3-row-padding w3-bar-block"> <div class="w3-container" style="padding-left:13px"> <h2 style="color:#FFF4A3;"><b>Exercises and Quizzes</b></h2> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:155px;font-size:21px" href="/exercises/index.php">Exercises</a></h3> <a class="w3-bar-item w3-button" href="/html/html_exercises.asp">HTML Exercises</a> <a class="w3-bar-item w3-button" href="/css/css_exercises.asp">CSS Exercises</a> <a class="w3-bar-item w3-button" href="/js/js_exercises.asp">JavaScript Exercises</a> <a class="w3-bar-item w3-button" href="/sql/sql_exercises.asp">SQL Exercises</a> <a class="w3-bar-item w3-button" href="/mysql/mysql_exercises.asp">MySQL Exercises</a> <a class="w3-bar-item w3-button" href="/php/php_exercises.asp">PHP Exercises</a> <a class="w3-bar-item w3-button" href="/python/python_exercises.asp">Python Exercises</a> <a class="w3-bar-item w3-button" href="/python/numpy/numpy_exercises.asp">NumPy Exercises</a> <a class="w3-bar-item w3-button" href="/python/pandas/pandas_exercises.asp">Pandas Exercises</a> <a class="w3-bar-item w3-button" href="/python/scipy/scipy_exercises.php">SciPy Exercises</a> <a class="w3-bar-item w3-button" href="/jquery/jquery_exercises.asp">jQuery Exercises</a> <a class="w3-bar-item w3-button" href="/java/java_exercises.asp">Java Exercises</a> <a class="w3-bar-item w3-button" href="/cpp/cpp_exercises.asp">C++ Exercises</a> <a class="w3-bar-item w3-button" href="/cs/cs_exercises.asp">C# Exercises</a> <a class="w3-bar-item w3-button" href="/r/r_exercises.asp">R Exercises</a> <a class="w3-bar-item w3-button" href="/kotlin/kotlin_exercises.php">Kotlin Exercises</a> <a class="w3-bar-item w3-button" href="/go/go_exercises.php">Go Exercises</a> <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_exercises.asp">Bootstrap Exercises</a> <a class="w3-bar-item w3-button" href="/bootstrap4/bootstrap_exercises.asp">Bootstrap 4 Exercises</a> <a class="w3-bar-item w3-button" href="/bootstrap5/bootstrap_exercises.php">Bootstrap 5 Exercises</a> <a class="w3-bar-item w3-button" href="/git/git_exercises.asp">Git Exercises</a> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:135px;font-size:21px" href="/quiztest/default.asp">Quizzes</a></h3> <a class="w3-bar-item w3-button" href="/html/html_quiz.asp" target="_top">HTML Quiz</a> <a class="w3-bar-item w3-button" href="/css/css_quiz.asp" target="_top">CSS Quiz</a> <a class="w3-bar-item w3-button" href="/js/js_quiz.asp" target="_top">JavaScript Quiz</a> <a class="w3-bar-item w3-button" href="/sql/sql_quiz.asp" target="_top">SQL Quiz</a> <a class="w3-bar-item w3-button" href="/mysql/mysql_quiz.asp" target="_top">MySQL Quiz</a> <a class="w3-bar-item w3-button" href="/php/php_quiz.asp" target="_top">PHP Quiz</a> <a class="w3-bar-item w3-button" href="/python/python_quiz.asp" target="_top">Python Quiz</a> <a class="w3-bar-item w3-button" href="/python/numpy/numpy_quiz.asp" target="_top">NumPy Quiz</a> <a class="w3-bar-item w3-button" href="/python/pandas/pandas_quiz.asp" target="_top">Pandas Quiz</a> <a class="w3-bar-item w3-button" href="/python/scipy/scipy_quiz.php" target="_top">SciPy Quiz</a> <a class="w3-bar-item w3-button" href="/jquery/jquery_quiz.asp" target="_top">jQuery Quiz</a> <a class="w3-bar-item w3-button" href="/java/java_quiz.asp" target="_top">Java Quiz</a> <a class="w3-bar-item w3-button" href="/cpp/cpp_quiz.asp" target="_top">C++ Quiz</a> <a class="w3-bar-item w3-button" href="/cs/cs_quiz.asp" target="_top">C# Quiz</a> <a class="w3-bar-item w3-button" href="/r/r_quiz.asp" target="_top">R Quiz</a> <a class="w3-bar-item w3-button" href="/kotlin/kotlin_quiz.php" target="_top">Kotlin Quiz</a> <a class="w3-bar-item w3-button" href="/xml/xml_quiz.asp" target="_top">XML Quiz</a> <a class="w3-bar-item w3-button" href="/bootstrap/bootstrap_quiz.asp" target="_top">Bootstrap Quiz</a> <a class="w3-bar-item w3-button" href="/bootstrap4/bootstrap_quiz.asp" target="_top">Bootstrap 4 Quiz</a> <a class="w3-bar-item w3-button" href="/bootstrap5/bootstrap_quiz.php" target="_top">Bootstrap 5 Quiz</a> <a class="w3-bar-item w3-button" href="/cybersecurity/cybersecurity_quiz.php">Cyber Security Quiz</a> <a class="w3-bar-item w3-button" href="/accessibility/accessibility_quiz.php">Accessibility Quiz</a> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:135px;font-size:21px" href="https://courses.w3schools.com/" target="_blank">Courses</a></h3> <!-- cert <a class="w3-bar-item w3-button" href="/cert/cert_html_new.asp" target="_top">HTML Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_css.asp" target="_top">CSS Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_javascript.asp" target="_top">JavaScript Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_sql.asp" target="_top">SQL Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_php.asp" target="_top">PHP Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_python.asp" target="_top">Python Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_bootstrap.asp" target="_top">Bootstrap Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_jquery.asp" target="_top">jQuery Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_xml.asp" target="_top">XML Certificate</a> --> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/html" target="_blank">HTML Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/css" target="_blank">CSS Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/javascript" target="_blank">JavaScript Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/programs/front-end" target="_blank">Front End Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/sql" target="_blank">SQL Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/php" target="_blank">PHP Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/python" target="_blank">Python Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/numpy-fundamentals" target="_blank">NumPy Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/pandas-fundamentals" target="_blank">Pandas Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/programs/data-analytics" target="_blank">Data Analytics Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/jquery" target="_blank">jQuery Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/java" target="_blank">Java Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/cplusplus" target="_blank">C++ Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/c-sharp" target="_blank">C# Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/r-fundamentals" target="_blank">R Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/xml" target="_blank">XML Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/introduction-to-cyber-security" target="_blank">Cyber Security Course</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/courses/accessibility-fundamentals" target="_blank">Accessibility Course</a> </div> <div class="w3-col l3 m6"> <h3 class="w3-margin-top"><a class="ws-btn ws-yellow w3-hover-text-white" style="width:150px;font-size:21px" href="https://courses.w3schools.com/browse/certifications" target="_blank">Certificates</a></h3> <!-- cert <a class="w3-bar-item w3-button" href="/cert/cert_html_new.asp" target="_top">HTML Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_css.asp" target="_top">CSS Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_javascript.asp" target="_top">JavaScript Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_sql.asp" target="_top">SQL Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_php.asp" target="_top">PHP Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_python.asp" target="_top">Python Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_bootstrap.asp" target="_top">Bootstrap Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_jquery.asp" target="_top">jQuery Certificate</a> <a class="w3-bar-item w3-button" href="/cert/cert_xml.asp" target="_top">XML Certificate</a> --> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/html-certification-exam" target="_blank">HTML Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/css-certification-exam" target="_blank">CSS Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/javascript-certification-exam" target="_blank">JavaScript Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/front-end-certification-exam" target="_blank">Front End Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/sql-certification-exam" target="_blank">SQL Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/php-certification-exam" target="_blank">PHP Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/python-certificaftion-exam" target="_blank">Python Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/data-science-certification-exam" target="_blank">Data Science Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/bootstrap-3-certification-exam" target="_blank">Bootstrap 3 Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/bootstrap-4-certification-exam" target="_blank">Bootstrap 4 Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/jquery-certification-exam" target="_blank">jQuery Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/java-certification-exam" target="_blank">Java Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/c-certification-exam" target="_blank">C++ Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/react-certification-exam" target="_blank">React Certificate</a> <a class="w3-bar-item w3-button" href="https://courses.w3schools.com/browse/certifications/courses/xml-certification-exam" target="_blank">XML Certificate</a> </div> </div> <br class="hidesm"> </div> </nav> </div> </div> <div id="myAccordion" class="w3-card-2 w3-center w3-hide-large w3-hide-medium ws-grey" style="width: 100%; position: absolute; display: none; padding-top: 44px;"> <a href="javascript:void(0)" onclick="w3_close()" class="w3-button w3-xxlarge w3-right">×</a><br> <div class="w3-container w3-padding-32"> <a class="w3-button w3-block" style="font-size:22px;" onclick="open_xs_menu('tutorials');" href="javascript:void(0);">Tutorials <i class="fa fa-caret-down"></i></a> <div id="sectionxs_tutorials" class="w3-left-align w3-show" style="background-color:#282A35;color:white;"></div> <a class="w3-button w3-block" style="font-size:22px;" onclick="open_xs_menu('references')" href="javascript:void(0);">References <i class="fa fa-caret-down"></i></a> <div id="sectionxs_references" class="w3-left-align w3-show" style="background-color:#282A35;color:white;"></div> <a class="w3-button w3-block" style="font-size:22px;" onclick="open_xs_menu('exercises')" href="javascript:void(0);">Exercises <i class="fa fa-caret-down"></i></a> <div id="sectionxs_exercises" class="w3-left-align w3-show" style="background-color:#282A35;color:white;"></div> <a class="w3-button w3-block" style="font-size:22px;" href="/cert/default.asp" target="_blank">Paid Courses</a> <a class="w3-button w3-block" style="font-size:22px;" href="https://www.w3schools.com/spaces" target="_blank" onclick="ga('send', 'event', 'spacesFromTutorialsAcc', 'click');" title="Get Your Own Website With W3schools Spaces">Spaces</a> <a class="w3-button w3-block" style="font-size:22px;" target="_blank" href="https://www.w3schools.com/videos/index.php" onclick="ga('send', 'event', 'Videos' , 'fromTopnavMain')" title="Video Tutorials">Videos</a> <a class="w3-button w3-block" style="font-size:22px;" href="https://shop.w3schools.com" target="_blank">Shop</a> <a class="w3-button w3-block" style="font-size:22px;" href="/pro/index.php">Pro</a> </div> </div> <script> ( function setThemeCheckboxes() { var x = localStorage.getItem("preferredmode"); var y = localStorage.getItem("preferredpagemode"); if (x == "dark") { document.getElementById("radio_darkcode").checked = true; } if (y == "dark") { document.getElementById("radio_darkpage").checked = true; } })(); function mouseoverdarkicon() { if(window.matchMedia("(pointer: coarse)").matches) { return false; } var a = document.getElementById("darkmodemenu"); a.style.top = "44px"; } function mouseoutofdarkicon() { var a = document.getElementById("darkmodemenu"); a.style.top = "-40px"; } function changepagetheme(n) { var a = document.getElementById("radio_darkcode"); var b = document.getElementById("radio_darkpage"); document.body.className = document.body.className.replace("darktheme", ""); document.body.className = document.body.className.replace("darkpagetheme", ""); document.body.className = document.body.className.replace(" ", " "); if (a.checked && b.checked) { localStorage.setItem("preferredmode", "light"); localStorage.setItem("preferredpagemode", "light"); a.checked = false; b.checked = false; } else { document.body.className += " darktheme"; document.body.className += " darkpagetheme"; localStorage.setItem("preferredmode", "dark"); localStorage.setItem("preferredpagemode", "dark"); a.checked = true; b.checked = true; } } function click_darkpage() { var b = document.getElementById("radio_darkpage"); if (b.checked) { document.body.className += " darkpagetheme"; document.body.className = document.body.className.replace(" ", " "); localStorage.setItem("preferredpagemode", "dark"); } else { document.body.className = document.body.className.replace("darkpagetheme", ""); document.body.className = document.body.className.replace(" ", " "); localStorage.setItem("preferredpagemode", "light"); } } function click_darkcode() { var a = document.getElementById("radio_darkcode"); if (a.checked) { document.body.className += " darktheme"; document.body.className = document.body.className.replace(" ", " "); localStorage.setItem("preferredmode", "dark"); } else { document.body.className = document.body.className.replace("darktheme", ""); document.body.className = document.body.className.replace(" ", " "); localStorage.setItem("preferredmode", "light"); } } </script> <div class="w3-sidebar w3-collapse" id="sidenav" style="top: 44px; display: none;"> <div id="leftmenuinner" style="padding-top: 44px;"> <div id="leftmenuinnerinner"> <!-- <a href='javascript:void(0)' onclick='close_menu()' class='w3-button w3-hide-large w3-large w3-display-topright' style='right:16px;padding:3px 12px;font-weight:bold;'>×</a>--> <h2 class="left"><span class="left_h2">HTML</span> Reference</h2> <a target="_top" href="default.asp">HTML by Alphabet</a> <a target="_top" href="ref_byfunc.asp">HTML by Category</a> <a target="_top" href="ref_html_browsersupport.asp">HTML Browser Support</a> <a target="_top" href="ref_attributes.asp">HTML Attributes</a> <a target="_top" href="ref_standardattributes.asp">HTML Global Attributes</a> <a target="_top" href="ref_eventattributes.asp">HTML Events</a> <a target="_top" href="ref_colornames.asp">HTML Colors</a> <a target="_top" href="ref_canvas.asp">HTML Canvas</a> <a target="_top" href="ref_av_dom.asp">HTML Audio/Video</a> <a target="_top" href="ref_charactersets.asp">HTML Character Sets</a> <a target="_top" href="ref_html_dtd.asp">HTML Doctypes</a> <a target="_top" href="ref_urlencode.asp">HTML URL Encode</a> <a target="_top" href="ref_language_codes.asp">HTML Language Codes</a> <a target="_top" href="ref_country_codes.asp">HTML Country Codes</a> <a target="_top" href="ref_httpmessages.asp">HTTP Messages</a> <a target="_top" href="ref_httpmethods.asp">HTTP Methods</a> <a target="_top" href="ref_pxtoemconversion.asp">PX to EM Converter</a> <a target="_top" href="ref_keyboardshortcuts.asp">Keyboard Shortcuts</a> <br> <div class="notranslate"> <h2 class="left"><span class="left_h2">HTML</span> Tags</h2> <a target="_top" href="tag_comment.asp"><!--></a> <a target="_top" href="tag_doctype.asp"><!DOCTYPE></a> <a target="_top" href="tag_a.asp"><a></a> <a target="_top" href="tag_abbr.asp"><abbr></a> <a target="_top" href="tag_acronym.asp"><acronym></a> <a target="_top" href="tag_address.asp"><address></a> <a target="_top" href="tag_applet.asp"><applet></a> <a target="_top" href="tag_area.asp"><area></a> <a target="_top" href="tag_article.asp"><article></a> <a target="_top" href="tag_aside.asp"><aside></a> <a target="_top" href="tag_audio.asp"><audio></a> <a target="_top" href="tag_b.asp"><b></a> <a target="_top" href="tag_base.asp"><base></a> <a target="_top" href="tag_basefont.asp"><basefont></a> <a target="_top" href="tag_bdi.asp"><bdi></a> <a target="_top" href="tag_bdo.asp"><bdo></a> <a target="_top" href="tag_big.asp"><big></a> <a target="_top" href="tag_blockquote.asp"><blockquote></a> <a target="_top" href="tag_body.asp"><body></a> <a target="_top" href="tag_br.asp"><br></a> <a target="_top" href="tag_button.asp"><button></a> <a target="_top" href="tag_canvas.asp"><canvas></a> <a target="_top" href="tag_caption.asp"><caption></a> <a target="_top" href="tag_center.asp"><center></a> <a target="_top" href="tag_cite.asp"><cite></a> <a target="_top" href="tag_code.asp"><code></a> <a target="_top" href="tag_col.asp"><col></a> <a target="_top" href="tag_colgroup.asp"><colgroup></a> <a target="_top" href="tag_data.asp"><data></a> <a target="_top" href="tag_datalist.asp"><datalist></a> <a target="_top" href="tag_dd.asp"><dd></a> <a target="_top" href="tag_del.asp"><del></a> <a target="_top" href="tag_details.asp"><details></a> <a target="_top" href="tag_dfn.asp"><dfn></a> <a target="_top" href="tag_dialog.asp"><dialog></a> <a target="_top" href="tag_dir.asp"><dir></a> <a target="_top" href="tag_div.asp"><div></a> <a target="_top" href="tag_dl.asp"><dl></a> <a target="_top" href="tag_dt.asp"><dt></a> <a target="_top" href="tag_em.asp"><em></a> <a target="_top" href="tag_embed.asp"><embed></a> <a target="_top" href="tag_fieldset.asp"><fieldset></a> <a target="_top" href="tag_figcaption.asp"><figcaption></a> <a target="_top" href="tag_figure.asp"><figure></a> <a target="_top" href="tag_font.asp"><font></a> <a target="_top" href="tag_footer.asp"><footer></a> <a target="_top" href="tag_form.asp"><form></a> <a target="_top" href="tag_frame.asp"><frame></a> <a target="_top" href="tag_frameset.asp"><frameset></a> <a target="_top" href="tag_hn.asp"><h1> - <h6></a> <a target="_top" href="tag_head.asp"><head></a> <a target="_top" href="tag_header.asp"><header></a> <a target="_top" href="tag_hr.asp"><hr></a> <a target="_top" href="tag_html.asp"><html></a> <a target="_top" href="tag_i.asp"><i></a> <a target="_top" href="tag_iframe.asp"><iframe></a> <a target="_top" href="tag_img.asp"><img></a> <a target="_top" href="tag_input.asp"><input></a> <a target="_top" href="tag_ins.asp"><ins></a> <a target="_top" href="tag_kbd.asp"><kbd></a> <a target="_top" href="tag_label.asp"><label></a> <a target="_top" href="tag_legend.asp"><legend></a> <a target="_top" href="tag_li.asp"><li></a> <a target="_top" href="tag_link.asp"><link></a> <a target="_top" href="tag_main.asp"><main></a> <a target="_top" href="tag_map.asp"><map></a> <a target="_top" href="tag_mark.asp"><mark></a> <a target="_top" href="tag_meta.asp"><meta></a> <a target="_top" href="tag_meter.asp"><meter></a> <a target="_top" href="tag_nav.asp"><nav></a> <a target="_top" href="tag_noframes.asp"><noframes></a> <a target="_top" href="tag_noscript.asp"><noscript></a> <a target="_top" href="tag_object.asp"><object></a> <a target="_top" href="tag_ol.asp"><ol></a> <a target="_top" href="tag_optgroup.asp"><optgroup></a> <a target="_top" href="tag_option.asp"><option></a> <a target="_top" href="tag_output.asp"><output></a> <a target="_top" href="tag_p.asp" class="active"><p></a> <a target="_top" href="tag_param.asp"><param></a> <a target="_top" href="tag_picture.asp"><picture></a> <a target="_top" href="tag_pre.asp"><pre></a> <a target="_top" href="tag_progress.asp"><progress></a> <a target="_top" href="tag_q.asp"><q></a> <a target="_top" href="tag_rp.asp"><rp></a> <a target="_top" href="tag_rt.asp"><rt></a> <a target="_top" href="tag_ruby.asp"><ruby></a> <a target="_top" href="tag_s.asp"><s></a> <a target="_top" href="tag_samp.asp"><samp></a> <a target="_top" href="tag_script.asp"><script></a> <a target="_top" href="tag_section.asp"><section></a> <a target="_top" href="tag_select.asp"><select></a> <a target="_top" href="tag_small.asp"><small></a> <a target="_top" href="tag_source.asp"><source></a> <a target="_top" href="tag_span.asp"><span></a> <a target="_top" href="tag_strike.asp"><strike></a> <a target="_top" href="tag_strong.asp"><strong></a> <a target="_top" href="tag_style.asp"><style></a> <a target="_top" href="tag_sub.asp"><sub></a> <a target="_top" href="tag_summary.asp"><summary></a> <a target="_top" href="tag_sup.asp"><sup></a> <a target="_top" href="tag_svg.asp"><svg></a> <a target="_top" href="tag_table.asp"><table></a> <a target="_top" href="tag_tbody.asp"><tbody></a> <a target="_top" href="tag_td.asp"><td></a> <a target="_top" href="tag_template.asp"><template></a> <a target="_top" href="tag_textarea.asp"><textarea></a> <a target="_top" href="tag_tfoot.asp"><tfoot></a> <a target="_top" href="tag_th.asp"><th></a> <a target="_top" href="tag_thead.asp"><thead></a> <a target="_top" href="tag_time.asp"><time></a> <a target="_top" href="tag_title.asp"><title></a> <a target="_top" href="tag_tr.asp"><tr></a> <a target="_top" href="tag_track.asp"><track></a> <a target="_top" href="tag_tt.asp"><tt></a> <a target="_top" href="tag_u.asp"><u></a> <a target="_top" href="tag_ul.asp"><ul></a> <a target="_top" href="tag_var.asp"><var></a> <a target="_top" href="tag_video.asp"><video></a> <a target="_top" href="tag_wbr.asp"><wbr></a> </div> <br><br> </div> </div> </div> <div class="w3-main w3-light-grey" id="belowtopnav" style="margin-left: 220px; padding-top: 44px;"> <div class="w3-row w3-white"> <div class="w3-col l10 m12" id="main"> <div id="mainLeaderboard" style="overflow:hidden;"> <!-- MainLeaderboard--> <!--<pre>main_leaderboard, all: [728,90][970,90][320,50][468,60]</pre>--> <div id="adngin-main_leaderboard-0" data-google-query-id="CJPA_sueqvcCFXiOSwUd2fYBLg"><div id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//main_leaderboard_1__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//main_leaderboard_1" name="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//main_leaderboard_1" title="3rd party ad content" width="728" height="90" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" role="region" aria-label="Advertisement" tabindex="0" srcdoc="" data-google-container-id="7" style="border: 0px; vertical-align: bottom;" data-load-complete="true"><div style="position: absolute; width: 0px; height: 0px; border: 0px; padding: 0px; margin: 0px; overflow: hidden;"><button></button><a href="https://yahoo.com"></a><input></div></iframe></div></div> <!-- adspace leaderboard --> </div> <h1>HTML <span class="color_h1"><p></span> Tag</h1> <div class="w3-clear w3-center nextprev"> <a class="w3-left w3-btn" href="tag_output.asp">❮<span class="w3-hide-small"> Previous</span></a> <a class="w3-btn" href="default.asp"><span class="w3-hide-small">Complete HTML </span>Reference</a> <a class="w3-right w3-btn" href="tag_param.asp"><span class="w3-hide-small">Next </span>❯</a> </div> <br> <div class="w3-example"> <h3>Example</h3> <p>A paragraph is marked up as follows:</p> <div class="w3-code notranslate htmlHigh"> <span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>p<span class="tagcolor" style="color:mediumblue">></span></span>This is some text in a paragraph.<span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/p<span class="tagcolor" style="color:mediumblue">></span></span> </div> <a target="_blank" href="tryit.asp?filename=tryhtml_paragraphs1" class="w3-btn w3-margin-bottom">Try it Yourself »</a> </div> <p>More "Try it Yourself" examples below.</p> <hr> <h2>Definition and Usage</h2> <p>The <code class="w3-codespan"><p></code> tag defines a paragraph.</p> <p>Browsers automatically add a single blank line before and after each <code class="w3-codespan"><p></code> element.</p> <p><strong>Tip:</strong> Use CSS to <a href="/html/html_css.asp">style paragraphs</a>.</p> <hr> <h2>Browser Support</h2> <table class="browserref notranslate"> <tbody><tr> <th style="width:20%;font-size:16px;text-align:left;">Element</th> <th style="width:16%;" class="bsChrome" title="Chrome"></th> <th style="width:16%;" class="bsEdge" title="Internet Explorer / Edge"></th> <th style="width:16%;" class="bsFirefox" title="Firefox"></th> <th style="width:16%;" class="bsSafari" title="Safari"></th> <th style="width:16%;" class="bsOpera" title="Opera"></th> </tr><tr> <td style="text-align:left;"><p></td> <td>Yes</td> <td>Yes</td> <td>Yes</td> <td>Yes</td> <td>Yes</td> </tr> </tbody></table> <hr> <h2>Global Attributes</h2> <p>The <code class="w3-codespan"><p></code> tag also supports the <a href="ref_standardattributes.asp">Global Attributes in HTML</a>.</p> <hr> <h2>Event Attributes</h2> <p>The <code class="w3-codespan"><p></code> tag also supports the <a href="ref_eventattributes.asp">Event Attributes in HTML</a>.</p> <hr> <div id="midcontentadcontainer" style="overflow:auto;text-align:center"> <!-- MidContent --> <!-- <p class="adtext">Advertisement</p> --> <div id="adngin-mid_content-0" data-google-query-id="CKfs_8ueqvcCFXiOSwUd2fYBLg"><div id="sn_ad_label_adngin-mid_content-0" class="sn_ad_label" style="color:#000000;font-size:12px;margin:0;text-align:center;">ADVERTISEMENT</div><div id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//mid_content_1__container__" style="border: 0pt none; display: inline-block; width: 300px; height: 250px;"><iframe frameborder="0" src="https://56d0da6c34aaa471db22bb4266aac656.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html" id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//mid_content_1" title="3rd party ad content" name="" scrolling="no" marginwidth="0" marginheight="0" width="300" height="250" data-is-safeframe="true" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" role="region" aria-label="Advertisement" tabindex="0" data-google-container-id="8" style="border: 0px; vertical-align: bottom;" data-load-complete="true"></iframe></div></div> </div> <hr> <h2>More Examples</h2> <div class="w3-example"> <h3>Example</h3> <p>Align text in a paragraph (with CSS):</p> <div class="w3-code notranslate htmlHigh"> <span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>p<span class="attributecolor" style="color:red"> style<span class="attributevaluecolor" style="color:mediumblue">="text-align:right"</span></span><span class="tagcolor" style="color:mediumblue">></span></span>This is some text in a paragraph.<span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/p<span class="tagcolor" style="color:mediumblue">></span></span> </div> <a target="_blank" href="tryit.asp?filename=tryhtml_p_align_css" class="w3-btn w3-margin-bottom">Try it Yourself »</a> </div> <div class="w3-example"> <h3>Example</h3> <p>Style paragraphs with CSS:</p> <div class="w3-code notranslate htmlHigh"> <span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>html<span class="tagcolor" style="color:mediumblue">></span></span><br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>head<span class="tagcolor" style="color:mediumblue">></span></span><br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>style<span class="tagcolor" style="color:mediumblue">></span></span><span class="cssselectorcolor" style="color:brown"><br>p <span class="cssdelimitercolor" style="color:black">{</span><span class="csspropertycolor" style="color:red"><br> color<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> navy<span class="cssdelimitercolor" style="color:black">;</span></span><br> text-indent<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> 30px<span class="cssdelimitercolor" style="color:black">;</span></span><br> text-transform<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> uppercase<span class="cssdelimitercolor" style="color:black">;</span></span><br></span><span class="cssdelimitercolor" style="color:black">}</span><br></span><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/style<span class="tagcolor" style="color:mediumblue">></span></span><br> <span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/head<span class="tagcolor" style="color:mediumblue">></span></span><br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>body<span class="tagcolor" style="color:mediumblue">></span></span><br><br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>p<span class="tagcolor" style="color:mediumblue">></span></span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/p<span class="tagcolor" style="color:mediumblue">></span></span><br><br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/body<span class="tagcolor" style="color:mediumblue">></span></span><br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/html<span class="tagcolor" style="color:mediumblue">></span></span> </div> <a target="_blank" href="tryit.asp?filename=tryhtml_p_style_css" class="w3-btn w3-margin-bottom">Try it Yourself »</a> </div> <div class="w3-example"> <h3>Example</h3> <p> More on paragraphs:</p> <div class="w3-code notranslate htmlHigh"> <span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>p<span class="tagcolor" style="color:mediumblue">></span></span><br>This paragraph<br>contains a lot of lines<br>in the source code,<br> but the browser <br>ignores it.<br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/p<span class="tagcolor" style="color:mediumblue">></span></span> </div> <a target="_blank" href="tryit.asp?filename=tryhtml_paragraphs2" class="w3-btn w3-margin-bottom">Try it Yourself »</a> </div> <div class="w3-example"> <h3>Example</h3> <p>Poem problems in HTML:</p> <div class="w3-code notranslate htmlHigh"> <span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>p<span class="tagcolor" style="color:mediumblue">></span></span><br>My Bonnie lies over the ocean.<br>My Bonnie lies over the sea.<br>My Bonnie lies over the ocean.<br>Oh, bring back my Bonnie to me.<br><span class="tagnamecolor" style="color:brown"><span class="tagcolor" style="color:mediumblue"><</span>/p<span class="tagcolor" style="color:mediumblue">></span></span> </div> <a target="_blank" href="tryit.asp?filename=tryhtml_poem" class="w3-btn w3-margin-bottom">Try it Yourself »</a> </div> <hr> <h2>Related Pages</h2> <p>HTML tutorial: <a href="/html/html_paragraphs.asp">HTML Paragraphs</a></p> <p>HTML DOM reference: <a href="/jsref/dom_obj_paragraph.asp">Paragraph Object</a></p> <hr> <h2>Default CSS Settings</h2> <p>Most browsers will display the <code class="w3-codespan"><p></code> element with the following default values:</p> <div class="w3-example"> <h3>Example</h3> <div class="w3-code notranslate cssHigh"><span class="cssselectorcolor" style="color:brown"> p <span class="cssdelimitercolor" style="color:black">{</span><span class="csspropertycolor" style="color:red"><br> display<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> block<span class="cssdelimitercolor" style="color:black">;</span></span><br> margin-top<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> 1em<span class="cssdelimitercolor" style="color:black">;</span></span><br> margin-bottom<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> 1em<span class="cssdelimitercolor" style="color:black">;</span></span><br> margin-left<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> 0<span class="cssdelimitercolor" style="color:black">;</span></span><br> margin-right<span class="csspropertyvaluecolor" style="color:mediumblue"><span class="cssdelimitercolor" style="color:black">:</span> 0<span class="cssdelimitercolor" style="color:black">;</span></span><br></span><span class="cssdelimitercolor" style="color:black">}</span> </span></div> <a target="_blank" href="tryit.asp?filename=tryhtml_p_default_css" class="w3-btn w3-margin-bottom">Try it Yourself »</a> </div> <br> <br> <div class="w3-clear w3-center nextprev"> <a class="w3-left w3-btn" href="tag_output.asp">❮<span class="w3-hide-small"> Previous</span></a> <a class="w3-btn" href="default.asp"><span class="w3-hide-small">Complete HTML </span>Reference</a> <a class="w3-right w3-btn" href="tag_param.asp"><span class="w3-hide-small">Next </span>❯</a> </div> <div id="mypagediv2" style="position:relative;text-align:center;"></div> <br> </div> <div class="w3-col l2 m12" id="right"> <div class="sidesection"> <div id="skyscraper"> <div id="adngin-sidebar_top-0" data-google-query-id="CJXA_sueqvcCFXiOSwUd2fYBLg"><div id="sn_ad_label_adngin-sidebar_top-0" class="sn_ad_label" style="color:#000000;font-size:12px;margin:0;text-align:center;">ADVERTISEMENT</div><div id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//wide_skyscraper_1__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//wide_skyscraper_1" name="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//wide_skyscraper_1" title="3rd party ad content" width="320" height="50" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" role="region" aria-label="Advertisement" tabindex="0" srcdoc="" data-google-container-id="9" style="border: 0px; vertical-align: bottom;" data-load-complete="true"></iframe></div></div> </div> </div> <style> .ribbon-vid { font-size:12px; font-weight:bold; padding: 6px 20px; left:-20px; top:-10px; text-align: center; color:black; border-radius:25px; } </style> <div class="sidesection" id="video_sidesection"> <div class="w3-center" style="padding-bottom:7px"> <span class="ribbon-vid ws-yellow">NEW</span> </div> <p style="font-size: 14px;line-height: 1.5;font-family: Source Sans Pro;padding-left:4px;padding-right:4px;">We just launched<br>W3Schools videos</p> <a onclick="ga('send', 'event', 'Videos' , 'fromSidebar');" href="https://www.w3schools.com/videos/index.php" class="w3-hover-opacity"><img src="/images/htmlvideoad_footer.png" style="max-width:100%;padding:5px 10px 25px 10px" loading="lazy"></a> <a class="ws-button" style="font-size:16px;text-decoration: none !important;display: block !important; color:#FFC0C7!important; width: 100%; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; paxdding-top: 10px; padding-bottom: 20px; font-family: 'Source Sans Pro', sans-serif; text-align: center;" onclick="ga('send', 'event', 'Videos' , 'fromSidebar');" href="https://www.w3schools.com/videos/index.php">Explore now</a> </div> <div class="sidesection"> <h4><a href="/colors/colors_picker.asp">COLOR PICKER</a></h4> <a href="/colors/colors_picker.asp"> <img src="/images/colorpicker2000.png" alt="colorpicker" loading="lazy"> </a> </div> <div class="sidesection"> <!--<h4>LIKE US</h4>--> <div class="sharethis" style="visibility: visible;"> <a href="https://www.facebook.com/w3schoolscom/" target="_blank" title="Facebook"><span class="fa fa-facebook-square fa-2x"></span></a> <a href="https://www.instagram.com/w3schools.com_official/" target="_blank" title="Instagram"><span class="fa fa-instagram fa-2x"></span></a> <a href="https://www.linkedin.com/company/w3schools.com/" target="_blank" title="LinkedIn"><span class="fa fa-linkedin-square fa-2x"></span></a> <a href="https://discord.gg/6Z7UaRbUQM" target="_blank" title="Join the W3schools community on Discord"><span class="fa fa-discord fa-2x"></span></a> </div> </div> <!-- <div class="sidesection" style="border-radius:5px;color:#555;padding-top:1px;padding-bottom:8px;margin-left:auto;margin-right:auto;max-width:230px;background-color:#d4edda"> <p>Get your<br>certification today!</p> <a href="/cert/default.asp" target="_blank"> <img src="/images/w3certified_logo_250.png" style="margin:0 12px 20px 10px;max-width:80%"> </a> <a class="w3-btn w3-margin-bottom" style="text-decoration:none;border-radius:5px;" href="/cert/default.asp" target="_blank">View options</a> </div> --> <style> #courses_get_started_btn { text-decoration:none !important; background-color:#04AA6D; width:100%; border-bottom-left-radius:5px; border-bottom-right-radius:5px; padding-top:10px; padding-bottom:10px; font-family: 'Source Sans Pro', sans-serif; } #courses_get_started_btn:hover { background-color:#059862!important; } </style> <div id="internalCourses" class="sidesection"> <p style="font-size:18px;padding-left:2px;padding-right:2px;">Get certified<br>by completing<br>a course today!</p> <a href="https://courses.w3schools.com" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on courses banner in ads column');"> <div style="padding:0 20px 20px 20px"> <svg id="w3_cert_badge2" style="margin:auto;width:85%" data-name="w3_cert_badge2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><defs><style>.cls-1{fill:#04aa6b;}.cls-2{font-size:23px;}.cls-2,.cls-3,.cls-4{fill:#fff;}.cls-2,.cls-3{font-family:RobotoMono-Medium, Roboto Mono;font-weight:500;}.cls-3{font-size:20.08px;}</style></defs><circle class="cls-1" cx="150" cy="150" r="146.47" transform="translate(-62.13 150) rotate(-45)"></circle><text class="cls-2" transform="translate(93.54 63.89) rotate(-29.5)">w</text><text class="cls-2" transform="translate(107.13 56.35) rotate(-20.8)">3</text><text class="cls-2" transform="matrix(0.98, -0.21, 0.21, 0.98, 121.68, 50.97)">s</text><text class="cls-2" transform="translate(136.89 47.84) rotate(-3.47)">c</text><text class="cls-2" transform="translate(152.39 47.03) rotate(5.12)">h</text><text class="cls-2" transform="translate(167.85 48.54) rotate(13.72)">o</text><text class="cls-2" transform="translate(182.89 52.35) rotate(22.34)">o</text><text class="cls-2" transform="matrix(0.86, 0.52, -0.52, 0.86, 197.18, 58.36)">l</text><text class="cls-2" transform="matrix(0.77, 0.64, -0.64, 0.77, 210.4, 66.46)">s</text><text class="cls-3" transform="translate(35.51 186.66) rotate(69.37)"> </text><text class="cls-3" transform="matrix(0.47, 0.88, -0.88, 0.47, 41.27, 201.28)">C</text><text class="cls-3" transform="matrix(0.58, 0.81, -0.81, 0.58, 48.91, 215.03)">E</text><text class="cls-3" transform="matrix(0.67, 0.74, -0.74, 0.67, 58.13, 227.36)">R</text><text class="cls-3" transform="translate(69.16 238.92) rotate(39.44)">T</text><text class="cls-3" transform="matrix(0.85, 0.53, -0.53, 0.85, 81.47, 248.73)">I</text><text class="cls-3" transform="translate(94.94 256.83) rotate(24.36)">F</text><text class="cls-3" transform="translate(109.34 263.09) rotate(16.83)">I</text><text class="cls-3" transform="translate(124.46 267.41) rotate(9.34)">E</text><text class="cls-3" transform="translate(139.99 269.73) rotate(1.88)">D</text><text class="cls-3" transform="translate(155.7 270.01) rotate(-5.58)"> </text><text class="cls-3" transform="translate(171.32 268.24) rotate(-13.06)"> </text><text class="cls-2" transform="translate(187.55 266.81) rotate(-21.04)">.</text><text class="cls-3" transform="translate(203.27 257.7) rotate(-29.24)"> </text><text class="cls-3" transform="translate(216.84 249.83) rotate(-36.75)"> </text><text class="cls-3" transform="translate(229.26 240.26) rotate(-44.15)">2</text><text class="cls-3" transform="translate(240.39 229.13) rotate(-51.62)">0</text><text class="cls-3" transform="translate(249.97 216.63) rotate(-59.17)">2</text><text class="cls-3" transform="matrix(0.4, -0.92, 0.92, 0.4, 257.81, 203.04)">2</text><path class="cls-4" d="M196.64,136.31s3.53,3.8,8.5,3.8c3.9,0,6.75-2.37,6.75-5.59,0-4-3.64-5.81-8-5.81h-2.59l-1.53-3.48,6.86-8.13a34.07,34.07,0,0,1,2.7-2.85s-1.11,0-3.33,0H194.79v-5.86H217.7v4.28l-9.19,10.61c5.18.74,10.24,4.43,10.24,10.92s-4.85,12.3-13.19,12.3a17.36,17.36,0,0,1-12.41-5Z"></path><path class="cls-4" d="M152,144.24l30.24,53.86,14.94-26.61L168.6,120.63H135.36l-13.78,24.53-13.77-24.53H77.93l43.5,77.46.15-.28.16.28Z"></path></svg> </div> </a> <a class="w3-btn" id="courses_get_started_btn" href="https://courses.w3schools.com" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on courses banner in ads column');">Get started</a> </div> <!-- <div class="sidesection" style="margin-left:auto;margin-right:auto;max-width:230px"> <a href="https://shop.w3schools.com/" target="_blank" title="Buy W3Schools Merchandize"> <img src="/images/tshirt.jpg" style="max-width:100%;"> </a> </div> --> <div class="sidesection" id="moreAboutSubject"> </div> <!-- <div id="sidesection_exercise" class="sidesection" style="background-color:#555555;max-width:200px;margin:auto;margin-bottom:32px"> <div class="w3-container w3-text-white"> <h4>Exercises</h4> </div> <div> <div class="w3-light-grey"> <a target="_blank" href="/html/exercise.asp" style="padding-top:8px">HTML</a> <a target="_blank" href="/css/exercise.asp">CSS</a> <a target="_blank" href="/js/exercise_js.asp">JavaScript</a> <a target="_blank" href="/sql/exercise.asp">SQL</a> <a target="_blank" href="/php/exercise.asp">PHP</a> <a target="_blank" href="/python/exercise.asp">Python</a> <a target="_blank" href="/bootstrap/exercise_bs3.asp">Bootstrap</a> <a target="_blank" href="/jquery/exercise_jq.asp" style="padding-bottom:8px">jQuery</a> </div> </div> </div> --> <div class="sidesection codegameright ws-turquoise" style="font-size:18px;font-family: 'Source Sans Pro', sans-serif;border-radius:5px;color:#FFC0C7;padding-top:12px;margin-left:auto;margin-right:auto;max-width:230px;"> <style> .codegameright .w3-btn:link,.codegameright .w3-btn:visited { background-color:#04AA6D; border-radius:5px; } .codegameright .w3-btn:hover,.codegameright .w3-btn:active { background-color:#059862!important; text-decoration:none!important; } </style> <h4><a href="/codegame/index.html" class="w3-hover-text-black">CODE GAME</a></h4> <a href="/codegame/index.html" target="_blank" class="w3-hover-opacity"><img style="max-width:100%;margin:16px 0;" src="/images/w3lynx_200.png" alt="Code Game" loading="lazy"></a> <a class="w3-btn w3-block ws-black" href="/codegame/index.html" target="_blank" style="padding-top:10px;padding-bottom:10px;margin-top:12px;border-top-left-radius: 0;border-top-right-radius: 0">Play Game</a> </div> <!-- <div class="sidesection w3-light-grey" style="margin-left:auto;margin-right:auto;max-width:230px"> <div class="w3-container w3-dark-grey"> <h4><a href="/howto/default.asp" class="w3-hover-text-white">HOW TO</a></h4> </div> <div class="w3-container w3-left-align w3-padding-16"> <a href="/howto/howto_js_tabs.asp">Tabs</a><br> <a href="/howto/howto_css_dropdown.asp">Dropdowns</a><br> <a href="/howto/howto_js_accordion.asp">Accordions</a><br> <a href="/howto/howto_js_sidenav.asp">Side Navigation</a><br> <a href="/howto/howto_js_topnav.asp">Top Navigation</a><br> <a href="/howto/howto_css_modals.asp">Modal Boxes</a><br> <a href="/howto/howto_js_progressbar.asp">Progress Bars</a><br> <a href="/howto/howto_css_parallax.asp">Parallax</a><br> <a href="/howto/howto_css_login_form.asp">Login Form</a><br> <a href="/howto/howto_html_include.asp">HTML Includes</a><br> <a href="/howto/howto_google_maps.asp">Google Maps</a><br> <a href="/howto/howto_js_rangeslider.asp">Range Sliders</a><br> <a href="/howto/howto_css_tooltip.asp">Tooltips</a><br> <a href="/howto/howto_js_slideshow.asp">Slideshow</a><br> <a href="/howto/howto_js_sort_list.asp">Sort List</a><br> </div> </div> --> <!-- <div class="sidesection w3-round" style="margin-left:auto;margin-right:auto;max-width:230px"> <div class="w3-container ws-black" style="border-top-right-radius:5px;border-top-left-radius:5px;"> <h5><a href="/cert/default.asp" class="w3-hover-text-white">Certificates</a></h5> </div> <div class="w3-border" style="border-bottom-right-radius:5px;border-bottom-left-radius:5px;"> <a href="/cert/cert_html.asp" class="w3-button ws-grey w3-block w3-border-bottom" style="text-decoration:none">HTML</a> <a href="/cert/cert_css.asp" class="w3-button ws-grey w3-block w3-border-bottom" style="text-decoration:none">CSS</a> <a href="/cert/cert_javascript.asp" class="w3-button ws-grey w3-block w3-border-bottom" style="text-decoration:none">JavaScript</a> <a href="/cert/cert_frontend.asp" class="w3-button ws-grey w3-block w3-border-bottom" style="text-decoration:none">Front End</a> <a href="/cert/cert_python.asp" class="w3-button ws-grey w3-block w3-border-bottom" style="text-decoration:none">Python</a> <a href="/cert/cert_sql.asp" class="w3-button ws-grey w3-block w3-border-bottom" style="text-decoration:none">SQL</a> <a href="/cert/default.asp" class="w3-button ws-grey w3-block" style="text-decoration:none;">And more</a> </div> </div> --> <div id="stickypos" class="sidesection" style="text-align:center;position:sticky;top:50px;"> <div id="stickyadcontainer" style="width: 653.984px;"> <div style="position:relative;margin:auto;"> <div id="adngin-sidebar_sticky-0-stickypointer" style=""><div id="adngin-sidebar_sticky-0" style=""><div id="sn_ad_label_adngin-sidebar_sticky-0" class="sn_ad_label" style="color:#000000;font-size:12px;margin:0;text-align:center;">ADVERTISEMENT</div></div></div> <script> function secondSnigel() { if(window.adngin && window.adngin.adnginLoaderReady) { if (Number(w3_getStyleValue(document.getElementById("main"), "height").replace("px", "")) > 2200) { if (document.getElementById("adngin-mid_content-0")) { adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky", "mid_content" ]); }); } else { adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky"]); }); } } else { if (document.getElementById("adngin-mid_content-0")) { adngin.queue.push(function(){ adngin.cmd.startAuction(["mid_content"]); }); } } } else { window.addEventListener('adnginLoaderReady', function() { if (Number(w3_getStyleValue(document.getElementById("main"), "height").replace("px", "")) > 2200) { if (document.getElementById("adngin-mid_content-0")) { adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky", "mid_content" ]); }); } else { adngin.queue.push(function(){ adngin.cmd.startAuction(["sidebar_sticky"]); }); } } else { if (document.getElementById("adngin-mid_content-0")) { adngin.queue.push(function(){ adngin.cmd.startAuction(["mid_content"]); }); } } }); } } </script> </div> </div> </div> <script> uic_r_c() </script> </div> </div> <div id="footer" class="footer w3-container w3-white"> <hr> <div style="overflow:auto"> <div class="bottomad"> <!-- BottomMediumRectangle --> <!--<pre>bottom_medium_rectangle, all: [970,250][300,250][336,280]</pre>--> <div id="adngin-bottom_left-0" style="padding:0 10px 10px 0;float:left;width:auto;" data-google-query-id="CJbA_sueqvcCFXiOSwUd2fYBLg"><div id="sn_ad_label_adngin-bottom_left-0" class="sn_ad_label" style="color:#000000;font-size:12px;margin:0;text-align:center;">ADVERTISEMENT</div><div id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//bottom_medium_rectangle_1__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//bottom_medium_rectangle_1" name="google_ads_iframe_/22152718,16833175/sws-hb//w3schools.com//bottom_medium_rectangle_1" title="3rd party ad content" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" role="region" aria-label="Advertisement" tabindex="0" srcdoc="" data-google-container-id="a" style="border: 0px; vertical-align: bottom;" data-load-complete="true"></iframe></div></div> <!-- adspace bmr --> <!-- RightBottomMediumRectangle --> <!--<pre>right_bottom_medium_rectangle, desktop: [300,250][336,280]</pre>--> <div id="adngin-bottom_right-0" style="padding:0 10px 10px 0;float:left;width:auto;"><div id="sn_ad_label_adngin-bottom_right-0" class="sn_ad_label" style="color:#000000;font-size:12px;margin:0;text-align:center;">ADVERTISEMENT</div></div> </div> </div> <hr> <div class="w3-row-padding w3-center w3-small" style="margin:0 -16px;"> <div class="w3-col l3 m3 s12"> <a class="w3-button ws-grey ws-hover-black w3-block w3-round" href="javascript:void(0);" onclick="displayError();return false" style="white-space:nowrap;text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:15px;">Report Error</a> </div> <!-- <div class="w3-col l3 m3 s12"> <a class="w3-button w3-light-grey w3-block" href="javascript:void(0);" target="_blank" onclick="printPage();return false;" style="text-decoration:none;margin-top:1px;margin-bottom:1px">PRINT PAGE</a> </div> --> <div class="w3-col l3 m3 s12"> <a class="w3-button ws-grey ws-hover-black w3-block w3-round" href="/forum/default.asp" target="_blank" style="text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:15px">Forum</a> </div> <div class="w3-col l3 m3 s12"> <a class="w3-button ws-grey ws-hover-black w3-block w3-round" href="/about/default.asp" target="_top" style="text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:15px">About</a> </div> <div class="w3-col l3 m3 s12"> <a class="w3-button ws-grey ws-hover-black w3-block w3-round" href="https://shop.w3schools.com/" target="_blank" style="text-decoration:none;margin-top:1px;margin-bottom:1px;font-size:15px">Shop</a> </div> </div> <hr> <div class="ws-grey w3-padding w3-margin-bottom" id="err_form" style="display:none;position:relative"> <span onclick="this.parentElement.style.display='none'" class="w3-button w3-display-topright w3-large">×</span> <h2>Report Error</h2> <p>If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:</p> <p>help@w3schools.com</p> <br> <!-- <h2>Your Suggestion:</h2> <form> <div class="w3-section"> <label for="err_email">Your E-mail:</label> <input class="w3-input w3-border" type="text" style="margin-top:5px;width:100%" id="err_email" name="err_email"> </div> <div class="w3-section"> <label for="err_email">Page address:</label> <input class="w3-input w3-border" type="text" style="width:100%;margin-top:5px" id="err_url" name="err_url" disabled="disabled"> </div> <div class="w3-section"> <label for="err_email">Description:</label> <textarea rows="10" class="w3-input w3-border" id="err_desc" name="err_desc" style="width:100%;margin-top:5px;resize:vertical;"></textarea> </div> <div class="form-group"> <button type="button" class="w3-button w3-dark-grey" onclick="sendErr()">Submit</button> </div> <br> </form> --> </div> <div class="w3-container ws-grey w3-padding" id="err_sent" style="display:none;position:relative"> <span onclick="this.parentElement.style.display='none'" class="w3-button w3-display-topright">×</span> <h2>Thank You For Helping Us!</h2> <p>Your message has been sent to W3Schools.</p> </div> <div class="w3-row w3-center w3-small"> <div class="w3-col l3 m6 s12"> <div class="top10"> <h5 style="font-family: 'Source Sans Pro', sans-serif;">Top Tutorials</h5> <a href="/html/default.asp">HTML Tutorial</a><br> <a href="/css/default.asp">CSS Tutorial</a><br> <a href="/js/default.asp">JavaScript Tutorial</a><br> <a href="/howto/default.asp">How To Tutorial</a><br> <a href="/sql/default.asp">SQL Tutorial</a><br> <a href="/python/default.asp">Python Tutorial</a><br> <a href="/w3css/default.asp">W3.CSS Tutorial</a><br> <a href="/bootstrap/bootstrap_ver.asp">Bootstrap Tutorial</a><br> <a href="/php/default.asp">PHP Tutorial</a><br> <a href="/java/default.asp">Java Tutorial</a><br> <a href="/cpp/default.asp">C++ Tutorial</a><br> <a href="/jquery/default.asp">jQuery Tutorial</a><br> </div> </div> <div class="w3-col l3 m6 s12"> <div class="top10"> <h5 style="font-family: 'Source Sans Pro', sans-serif;">Top References</h5> <a href="/tags/default.asp">HTML Reference</a><br> <a href="/cssref/default.asp">CSS Reference</a><br> <a href="/jsref/default.asp">JavaScript Reference</a><br> <a href="/sql/sql_ref_keywords.asp">SQL Reference</a><br> <a href="/python/python_reference.asp">Python Reference</a><br> <a href="/w3css/w3css_references.asp">W3.CSS Reference</a><br> <a href="/bootstrap/bootstrap_ref_all_classes.asp">Bootstrap Reference</a><br> <a href="/php/php_ref_overview.asp">PHP Reference</a><br> <a href="/colors/colors_names.asp">HTML Colors</a><br> <a href="/java/java_ref_keywords.asp">Java Reference</a><br> <a href="/angular/angular_ref_directives.asp">Angular Reference</a><br> <a href="/jquery/jquery_ref_overview.asp">jQuery Reference</a><br> </div> </div> <div class="w3-col l3 m6 s12"> <div class="top10"> <h5 style="font-family: 'Source Sans Pro', sans-serif;">Top Examples</h5> <a href="/html/html_examples.asp">HTML Examples</a><br> <a href="/css/css_examples.asp">CSS Examples</a><br> <a href="/js/js_examples.asp">JavaScript Examples</a><br> <a href="/howto/default.asp">How To Examples</a><br> <a href="/sql/sql_examples.asp">SQL Examples</a><br> <a href="/python/python_examples.asp">Python Examples</a><br> <a href="/w3css/w3css_examples.asp">W3.CSS Examples</a><br> <a href="/bootstrap/bootstrap_examples.asp">Bootstrap Examples</a><br> <a href="/php/php_examples.asp">PHP Examples</a><br> <a href="/java/java_examples.asp">Java Examples</a><br> <a href="/xml/xml_examples.asp">XML Examples</a><br> <a href="/jquery/jquery_examples.asp">jQuery Examples</a><br> </div> </div> <div class="w3-col l3 m6 s12"> <div class="top10"> <!-- <h4>Web Certificates</h4> <a href="/cert/default.asp">HTML Certificate</a><br> <a href="/cert/default.asp">CSS Certificate</a><br> <a href="/cert/default.asp">JavaScript Certificate</a><br> <a href="/cert/default.asp">SQL Certificate</a><br> <a href="/cert/default.asp">Python Certificate</a><br> <a href="/cert/default.asp">PHP Certificate</a><br> <a href="/cert/default.asp">Bootstrap Certificate</a><br> <a href="/cert/default.asp">XML Certificate</a><br> <a href="/cert/default.asp">jQuery Certificate</a><br> <a href="//www.w3schools.com/cert/default.asp" class="w3-button w3-margin-top w3-dark-grey" style="text-decoration:none"> Get Certified »</a> --> <h5 style="font-family: 'Source Sans Pro', sans-serif;">Web Courses</h5> <a href="https://courses.w3schools.com/courses/html" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on html course link in footer');">HTML Course</a><br> <a href="https://courses.w3schools.com/courses/css" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on css course link in footer');">CSS Course</a><br> <a href="https://courses.w3schools.com/courses/javascript" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on javascript course link in footer');">JavaScript Course</a><br> <a href="https://courses.w3schools.com/programs/front-end" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on Front End course link in footer');">Front End Course</a><br> <a href="https://courses.w3schools.com/courses/sql" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on sql course link in footer');">SQL Course</a><br> <a href="https://courses.w3schools.com/courses/python" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on python course link in footer');">Python Course</a><br> <a href="https://courses.w3schools.com/courses/php" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on php course link in footer');">PHP Course</a><br> <a href="https://courses.w3schools.com/courses/jquery" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on jquery course link in footer');">jQuery Course</a><br> <a href="https://courses.w3schools.com/courses/java" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on Java course link in footer');">Java Course</a><br> <a href="https://courses.w3schools.com/courses/cplusplus" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on C++ course link in footer');">C++ Course</a><br> <a href="https://courses.w3schools.com/courses/c-sharp" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on bootstrap C# link in footer');">C# Course</a><br> <a href="https://courses.w3schools.com/courses/xml" target="_blank" onclick="ga('send', 'event', 'Courses' , 'Clicked on xml course link in footer');">XML Course</a><br> <a href="https://courses.w3schools.com/" target="_blank" class="w3-button w3-margin-top ws-black ws-hover-black w3-round" style="text-decoration:none" onclick="ga('send', 'event', 'Courses' , 'Clicked on get certified button in footer');"> Get Certified »</a> </div> </div> </div> <hr> <div class="w3-center w3-small w3-opacity"> W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our <a href="/about/about_copyright.asp">terms of use</a>, <a href="/about/about_privacy.asp">cookie and privacy policy</a>.<br><br> <a href="/about/about_copyright.asp">Copyright 1999-2022</a> by Refsnes Data. All Rights Reserved.<br> <a href="//www.w3schools.com/w3css/default.asp">W3Schools is Powered by W3.CSS</a>.<br><br> </div> <div class="w3-center w3-small"> <a href="//www.w3schools.com"> <i class="fa fa-logo ws-text-green ws-hover-text-green" style="position:relative;font-size:42px!important;"></i> </a></div><a href="//www.w3schools.com"> <br><br> </a></div><a href="//www.w3schools.com"> </a></div><iframe name="__tcfapiLocator" style="display: none;"></iframe><iframe name="__uspapiLocator" style="display: none;"></iframe><a href="//www.w3schools.com"> <script src="/lib/w3schools_footer.js?update=20220202"></script> <script> MyLearning.loadUser('footer'); function docReady(fn) { document.addEventListener("DOMContentLoaded", fn); if (document.readyState === "interactive" || document.readyState === "complete" ) { fn(); } } uic_r_z(); uic_r_d() </script><iframe src="https://56d0da6c34aaa471db22bb4266aac656.safeframe.googlesyndication.com/safeframe/1-0-38/html/container.html" style="visibility: hidden; display: none;"></iframe> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </a><script type="text/javascript" src="https://geo.moatads.com/n.js?e=35&ol=3318087536&qn=%604%7BZEYwoqI%24%5BK%2BdLLU)%2CMm~tM!90vv9L%24%2FoDb%2Fz(lKm3GFlNUU%2Cu%5Bh_GcS%25%5BHvLU%5B4(K%2B%7BgeFWl_%3DNqUXR%3A%3D%2BAxMn%3Ch%2CyenA8p%2FHm%24%60%233P(ry5*ZRocMp1tq%5BN%7Bq%60RP%3CG.ceFW%7CoG%22mxT%3Bwv%40V374BKm55%3D%261fp%5BoU5t(KX%3C%3Ce%24%26%3B%23wPjrBEe31k5X%5BG%5E%5B)%2C2iVSWf3Stnq%263t!9jr%7BRzI%2C%7BOCb%25%24(%3DNqU%60W5u%7Bo(zs1CoK%2Bdr%5BG)%2C3ii)RGL3emgSuRVE&tf=1_nMzjG---CSa7H-1SJH-bW7qhB-LRwqH-nMzjG-&vi=111111&rb=2-90xv0J4P%2FoMsPm8%2BZbNmT2EB%2BBOA3JNdQL68hLPh4bg2%2F%2FnQIIWF3Q%3D%3D&rs=1-iHtHGE9B1zA1OQ%3D%3D&sc=1&os=1-3g%3D%3D&qp=10000&is=BBBBB2BBEYBvGl2BBCkqtUTE1RmsqbKW8BsrBu0rCFE48CRBeeBS2hWTMBBQeQBBn2soYggyUig0CBlWZ0uBBCCCCCCOgRBBiOfnE6Bkg7Oxib8MxOtJYHCBdm5kBhIcC9Y8oBXckXBR76iUUsJBCBBBBBBBBBWBBBj3BBBZeGV2BBBCMciUBBBjgEBBBBBB94UMgTdJMtEcpMBBBQBBBniOccBBBBBB47kNwxBbBBBBBBBBBhcjG6BBJM2L4Bk8BwCBQmIoRBBCzBz1BBCTClBBrbGBC4ehueB57NG9aJeRzBqEKBBBBBBB&iv=8&qt=0&gz=0&hh=0&hn=0&tw=&qc=0&qd=0&qf=1240&qe=883&qh=1280&qg=984&qm=-330&qa=1280&qb=1024&qi=1280&qj=984&to=000&po=1-0020002000002120&vy=ot%24b%5Bh%40%22oDgO%3DLlE6%3Avy%2CUitwb4%5Du!%3CFo%40Y_3r%3F%5DAY~MhXyz%26_%5B*Rp%7C%3EoDKmsiFDRz%5EmlNM%22%254ZpaR%5BA7Do%2C%3Bg%2C%2C%40W7RbzTmejO%3Def%2C%7Bvp%7C9%7C_%3Bm_Qrw5.W%2F84VKp%40i6AKx!ehV%7Du!%3CFo%40pF&ql=%3B%5BpwxnRd%7Dt%3Aa%5DmJVOG)%2C~%405%2F%5BGI%3F6C(TgPB*e%5D1(rI%24(rj2Iy!pw%40aOS%3DyNX8Y%7BQgPB*e%5D1(rI%24(rj%5EB61%2F%3DSqcMr1%7B%2CJA%24Jz_%255tTL%3Fwbs_T%234%25%60X%3CA&qo=0&qr=0&i=TRIPLELIFT1&hp=1&wf=1&ra=1&pxm=8&sgs=3&vb=6&kq=1&hq=0&hs=0&hu=0&hr=0&ht=1&dnt=0&bq=0&f=0&j=https%3A%2F%2Fwww.google.com&t=1650718754860&de=466991431602&m=0&ar=bee2df476bf-clean&iw=2a1d5c5&q=2&cb=0&ym=0&cu=1650718754860&ll=3&lm=0&ln=1&r=0&em=0&en=0&d=6737%3A94724%3Aundefined%3A10&zMoatTactic=undefined&zMoatPixelParams=aid%3A29695277962791520917040%3Bsr%3A10%3Buid%3A0%3B&zMoatOrigSlicer1=2662&zMoatOrigSlicer2=39&zMoatJS=-&zGSRC=1&gu=https%3A%2F%2Fwww.w3schools.com%2Ftags%2Ftag_p.asp&id=1&ii=4&bo=2662&bd=w3schools.com&gw=triplelift879988051105&fd=1&ac=1&it=500&ti=0&ih=1&pe=1%3A512%3A512%3A1026%3A846&jm=-1&fs=198121&na=2100642455&cs=0&ord=1650718754860&jv=1483802810&callback=DOMlessLLDcallback_5147906"></script><iframe src="https://www.google.com/recaptcha/api2/aframe" width="0" height="0" style="display: none;"></iframe></body><iframe sandbox="allow-scripts allow-same-origin" id="936be7941bd9c5c" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://jp-u.openx.net/w/1.0/pd?plm=6&ph=8a7ca719-8c2c-4c16-98ad-37ac6dbf26e9&gdpr=0&us_privacy=1---"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="94da8182082e79b" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://eus.rubiconproject.com/usync.html?us_privacy=1---"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="950ad185776f97c" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://cdn.connectad.io/connectmyusers.php?us_privacy=1---&"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="960961bdb263a5c" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://ads.pubmatic.com/AdServer/js/user_sync.html?kdntuid=1&p=157369&gdpr=0&gdpr_consent=&us_privacy=1---"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="973d77507d8ed2c" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://s.amazon-adsystem.com/iu3?cm3ppd=1&d=dtb-pub&csif=t&dl=n-index_pm-db5_ym_rbd_n-vmg_ox-db5_smrt_an-db5_3lift"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="986df094b3ccc6f" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://biddr.brealtime.com/check.html"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="9984b091a86efa7" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://js-sec.indexww.com/um/ixmatch.html"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="1004b17db44af55b" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://csync.smilewanted.com?us_privacy=1---"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="101af22cac10bcfd" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://onetag-sys.com/usync/?cb=1650718752982&us_privacy=1---"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="10290b51ae900f2b" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://eb2.3lift.com/sync?us_privacy=1---&"> </iframe><iframe sandbox="allow-scripts allow-same-origin" id="103d27603dbc3983" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://acdn.adnxs.com/dmp/async_usersync.html"> </iframe></html>
Abdullah-Niaz / CPP Complete CourseThe C++ Complete Course is a comprehensive guide for individuals to learn C++ programming language from zero to advanced level. It includes video tutorials, written exercises, and covers topics such as variables, functions, OOP, and STL. Prerequisites include basic programming knowledge and a computer with internet, text editor, and compiler.
tonyg / 3 Movea multi-user networked online text-based programmable virtual environment -- MOVED TO: https://git.leastfixedpoint.com/tonyg/3-move
Hexman768 / Notepad SharpA general purpose text editor that supports multiple programming languages for code editing.
berryelectronics / Miband 2 Fw EditorA simple program to edit your mi band 2's firmware to change logos or texts
iamc1oud / AutomateWithPythonIf you've ever spent hours renaming files or updating hundreds of spreadsheet cells, you know how tedious tasks like these can be. But what if you could have your computer do them for you? In Automate the Boring Stuff with Python, you'll learn how to use Python to write programs that do in minutes what would take you hours to do by hand-no prior programming experience required. Once you've mastered the basics of programming, you'll create Python programs that effortlessly perform useful and impressive feats of automation to: Search for text in a file or across multiple files Create, update, move, and rename files and folders Search the Web and download online content Update and format data in Excel spreadsheets of any size Split, merge, watermark, and encrypt PDFs Send reminder emails and text notifications Fill out online forms
PhilipYip1988 / Python TutorialsPython tutorials in markdown format. These tutorials look at installation on Python and Python IDEs, object orientated programming, the object orientated design pattern known as the Python data model, the concept of inheritance and how the data model is extended for text, numeric and collection based builtins classes and the numeric Python stack.
danielt998 / HanziToAnkiThis is a program that takes a Chinese text as input and converts it to an Anki Deck
MarkCLewis / ProblemSolvingUsingScalaThis repository has the code from the text and the videos for "Introduction to Programming and Problem Solving using Scala".
axanthos / Orange3 TextableUse visual programming to build data tables based on text data within the Orange data mining software environment
AwesomeLemon / Document RecognitionA program for document recognition: from image to text
GoogleCloudPlatform / Text To Speech Epg DemoThis repository contains a reference implementation demonstrating how the Google Cloud Text-to-Speech Service can be used to easily implement text-to-speech functionality for Electronic Program Guides (EPG's).
loomchild / SegmentProgram used to split text into segments
hussaintamboli / Python Image To TextPython program to recognize Text from Images using Google's tesseract-ocr