This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.server | |
import socketserver | |
import os.path | |
def make_http_handler(root_path): | |
class HTTPHandler(http.server.BaseHTTPRequestHandler): | |
def __init__(self, *args, **kwargs): | |
super(HTTPHandler, self).__init__(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twx.botapi import TelegramBot, ReplyKeyboardMarkup | |
""" | |
Setup the bot | |
""" | |
bot = TelegramBot('116456440:AAEys8uNPIONg-7nYWDb5Qob1K1KS2cuBjc') | |
bot.update_bot_info().wait() | |
print(bot.username) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tgl | |
users = [] | |
def cinfo(success, chat): | |
for userid in chat.user_list: | |
user = tgl.Peer(type=tgl.PEER_USER, id=userid) | |
users.append(user) | |
if user.username == 'Surye': | |
tgl.create_group_chat(users, "Testing You Can leave") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tgl | |
def cinfo(success, chat): | |
for userid in chat.user_list: | |
user = tgl.Peer(type=tgl.PEER_USER, id=userid) | |
print(user) | |
def dlist(success, dialog_list): | |
for dialog in dialog_list: | |
if dialog['peer'].type is tgl.PEER_CHAT: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tgl | |
def cinfo(success, chat): | |
for userid in chat.user_list: | |
user = tgl.Peer(type=tgl.PEER_USER, id=userid) | |
print(user) | |
def on_msg_receive(msg): | |
peer = msg.dest | |
if peer.type is tgl.PEER_CHAT: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tgl | |
def info(success, peer): | |
print(peer.user_list) | |
def on_msg_receive(msg): | |
peer = msg.dest | |
if peer.type is tgl.PEER_CHAT: | |
tgl.chat_info(peer, info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
sys.path.append(os.path.dirname(os.path.abspath(__file__))) # TODO Ugly Hack, find a better way | |
from telegrambot.plugin import TelegramPlugin | |
from py3owm import OpenWeatherMap | |
from py3wu import WeatherUnderground | |
class WeatherPlugin(TelegramPlugin): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"results":[{"serving_weight":85,"serving_qty":85,"ndb_no":11081,"serving_unit":"g","tier":1,"nutrients":[{"attr_id":255,"value":74.001,"unit":"g","name":"Water","usda_tag":"WATER"},{"attr_id":208,"value":37.4,"unit":"kcal","name":"Energy","usda_tag":"ENERC_KCAL"},{"attr_id":268,"value":156.4,"unit":"kJ","name":"Energy","usda_tag":"ENERC_KJ"},{"attr_id":203,"value":1.428,"unit":"g","name":"Protein","usda_tag":"PROCNT"},{"attr_id":204,"value":0.153,"unit":"g","name":"Total lipid (fat)","usda_tag":"FAT"},{"attr_id":207,"value":0.9520000000000001,"unit":"g","name":"Ash","usda_tag":"ASH"},{"attr_id":205,"value":8.466000000000001,"unit":"g","name":"Carbohydrate, by difference","usda_tag":"CHOCDF"},{"attr_id":291,"value":1.7,"unit":"g","name":"Fiber, total dietary","usda_tag":"FIBTG"},{"attr_id":269,"value":6.766,"unit":"g","name":"Sugars, total","usda_tag":"SUGAR"},{"attr_id":301,"value":13.6,"unit":"mg","name":"Calcium, Ca","usda_tag":"CA"},{"attr_id":303,"value":0.6715,"unit":"mg","name":"Iron, Fe","usda_tag":"F |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ---------------------------------------------------------------------------- | |
* This file was automatically generated by SWIG (http://www.swig.org). | |
* Version 3.0.5 | |
* | |
* This file is not intended to be easily readable and contains a number of | |
* coding conventions designed to improve portability and efficiency. Do not make | |
* changes to this file unless you know what you are doing--modify the SWIG | |
* interface file instead. | |
* ----------------------------------------------------------------------------- */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ---------------------------------------------------------------------------- | |
* This file was automatically generated by SWIG (http://www.swig.org). | |
* Version 3.0.5 | |
* | |
* This file is not intended to be easily readable and contains a number of | |
* coding conventions designed to improve portability and efficiency. Do not make | |
* changes to this file unless you know what you are doing--modify the SWIG | |
* interface file instead. | |
* ----------------------------------------------------------------------------- */ |
NewerOlder