## Examples

### Hello World !

<pre class="prettyprint">
from telegram.ext import Updater, CommandHandler

def start(bot, update):
	update.message.reply_text("Hello World ! I'm a Bot\n")

updater = Updater('insert-your-token-here')

updater.dispatcher.add_handler(CommandHandler('start', start))

updater.start_polling()
updater.idle()
</pre>


### Hello World with active led

This is the same Hello World example but using the on board
Arietta led to show the command acknoledge.
It uses the [acmepins library](https://github.com/acmesystems/acmepins) no manage the on board red led.

<pre class="prettyprint">
from telegram.ext import Updater, CommandHandler
from acmepins import ARIETTA_LED

arietta_led=ARIETTA_LED()

def start(bot, update):
	arietta_led.on()
	update.message.reply_text("Hello World !\n I'm a Bot\n")
	arietta_led.off()

updater = Updater('insert-your-token-here')

updater.dispatcher.add_handler(CommandHandler('start', start))

updater.start_polling()
updater.idle()
</pre>

### Send an alert message

<pre class="prettyprint">
from telegram.ext import Updater, CommandHandler
from acmepins import ARIETTA_LED,GPIO

job_queue=None
chat_ids=[]

def button_handler():
	global job_queue
	global jchat_ids
	 
	if len(chat_ids)>=0:
		for chat_id in chat_ids:
			job_queue.bot.sendMessage(chat_id, "Button pressed")

def cmd_start(bot, update):
	global chat_ids
	update.message.reply_text('Command list:\n/start, /stop')
	chat_ids+=[update.message.chat_id]
	
def cmd_stop(bot, update):	
	global chat_ids

	try:
		chat_ids.remove(update.message.chat_id)	
		return
	except ValueError:
		pass

updater = Updater('insert-your-token-here')
job_queue = updater.job_queue

updater.dispatcher.add_handler(CommandHandler('start', cmd_start))
updater.dispatcher.add_handler(CommandHandler('stop', cmd_stop))

button=GPIO('PC17','INPUT')
button.set_edge('falling',button_handler)

updater.start_polling()
updater.idle()
</pre>

### Send a photo

<pre class="prettyprint">
from telegram.ext import Updater, CommandHandler

def start(bot, update):
	update.message.reply_text(" \
		Help:\n \
		/start\n \
		/photo\n \
	")

def photo(bot, update):
	update.message.reply_text('This is me...')
	bot.sendPhoto(update.message.chat_id, photo=open('me.jpg'))

updater = Updater('insert-your-token-here')

updater.dispatcher.add_handler(CommandHandler('start', start))
updater.dispatcher.add_handler(CommandHandler('photo', photo))

updater.start_polling()
updater.idle()
</pre>
