-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
69 lines (61 loc) · 2.28 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*
import telebot
from config import TOKEN
# from pixivBot.main import main
from weather import *
import datetime
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.reply_to(message, "狗东西你好 我是CorgiBot")
@bot.message_handler(commands=['help'])
def send_help(message):
help_info = '''
天气查询: /weather 城市名
'''
bot.reply_to(message, help_info)
@bot.message_handler(commands=['weather'])
def get_weather(message):
print("* Weather Request: ", message)
city = message.text
city = city.replace('/weather', '').strip()
print("查询城市:", city)
status, weather_info = get_info(city)
print(status, weather_info)
if status == -1:
bot.reply_to(message, "你这个xjb输的城市名老子找不到啊?你再试试?")
bot.send_sticker(message.chat.id, 'CAADBQADQAADvXbGBbm8R2q8xH5QAg')
else:
bot.reply_to(message, weather_info)
bot.send_sticker(message.chat.id, 'CAADBQADCAADvXbGBYdALs5Bu1fNAg')
@bot.message_handler(content_types=['sticker'])
def sticker(message):
print(message)
print("Sticker id Get:", message.sticker.file_id)
bot.reply_to(message, "想必你就是{}吧。我日!是表情包!".format(message.from_user.first_name))
bot.reply_to(message, "你这个表情包的id是: {}".format(message.sticker.file_id))
bot.send_sticker(message.chat.id, 'CAADBQADMQADrGw9CcqcHEC7hwa8Ag')
@bot.message_handler(content_types=['photo'])
def sticker(message):
print(message)
bot.reply_to(message, "我日!是图片!我必复读")
bot.send_message(message.chat.id, "想必你就是{}吧。".format(message.from_user.first_name))
bot.send_photo(message.chat.id, message.photo[0].file_id)
# @bot.message_handler(func=lambda m: True)
# def echo_all(message):
# # print(message)
# ret = None
# try:
# NSFW_ret = main(message.text)
# print(NSFW_ret, '\n', message)
# except Exception as e:
# ret = f"别试了 我色图库崩了: {e}"
# print("***")
# print(message)
# # photo = open('/tmp/photo.png', 'rb')
# # bot.send_photo(, photo)
# # bot.send_photo(chat_id, "FILEID")
# #
# if not ret:
# bot.reply_to(message, ret)
bot.polling()