前言

主播不做违法犯罪的事情(

腾讯那个机器人太司马

创建一个机器人

先去telegram

import os
import json
import telebot
import random

provinces = [
    '北京市', '天津市', '河北省', '山西省', '内蒙古自治区', '辽宁省', '吉林省', '黑龙江省',
    '上海市', '江苏省', '浙江省', '安徽省', '福建省', '江西省', '山东省', '河南省', '湖北省',
    '湖南省', '广东省', '广西壮族自治区', '海南省', '重庆市', '四川省', '贵州省', '云南省',
    '西藏自治区', '陕西省', '甘肃省', '青海省', '宁夏回族自治区', '新疆维吾尔自治区', '台湾省',
    '香港特别行政区', '澳门特别行政区'
]


luckly = ["农村","市区","郊区","职高女厕所","省会","工地",'大HOUSE',"下水道"]


wood = ["xyn","xxn","鼠鼠","唐氏","郭楠","✌","刀哥",'龙鸣']


def fresh_data(user,action):
    """

    :param user: about the user id of tele
    :param action: in this time it could get :"cum,cum_shower,master_bate,eat"
    :return:Bool --> True/False
    """
    cum_sector = 3
    speach = "null"
    with open('user.json', 'r', encoding='utf-8') as file:
        data = json.load(file)
        if user in data:
            if action == "cum":
                if data["user"]["cum_left"]  < cum_sector:
                    speach = "您射干净了,没法射了"
                else:
                    data["user"]["cum_left"] -= cum_sector

    with open("user.json",'w',encoding="utf-8") as file:
        """
        the json should like:{"tele_id":[user_name,cum_times,cum_left],.....}
        """
        json.dump()




def remaker():
    if random.randint(0,9) >= 1 :
        fina = "恭喜你出生在 _"+provinces[random.randint(0,len(provinces)-1)]+"_ 的 _"+luckly[random.randint(0,7)]+"_ 是 _"+wood[random.randint(0,7)]+"_。"
    else:
        fina = "重开失败,您未能重开"
    return fina




BOT_TOKEN = "哼哼哼啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊"

bot = telebot.TeleBot(BOT_TOKEN)

@bot.message_handler(commands=['start', 'hello'])
def send_welcome(message):
    print(message.from_user.id)
    bot.reply_to(message, "看看你的")

@bot.message_handler(commands=['remake'])
def send_welcome(message):
    # bot.reply_to(message, "重生中")
    bot.reply_to(message, remaker(), parse_mode='markdown')


bot.infinity_polling()