基础回复
会返回pong 🐹
(证明存活呢没坏)
和上一条一样的功能
返回Win!
(没什么 就是赢!)
返回 哪里有盒?开盒!😋
(开盒咯)
返回 🥰
返回 😈/👿
(没什么 就是恶魔头)
返回一张图 《小丑竟在我身边》
让机器人叫你些什么(一般是叫爹)
返回一个随机数
从17句共4225字的发病文学中随机选取一句
调用api的回复
返回一句话
返回一句话(毒鸡汤)
返回历史上的今天
返回xx月xx日历史上的今天
返回钱塘24小时天气预报
返回一个ARK模板 内容包括我的头像、名称、加入频道的日期
返回一个ARK模板 内容包括xxx的头像、名称、加入频道的日期
调用数据库的回复
返回签到信息
返回积分信息
返回排名信息
文件目录结构
│ active_speak.py # 主动说话(上号夺舍咯) │ apis.py # api调用 │ botpy.log # 日志文件 │ config.yaml # 配置文件 │ douapi.py # api调用 │ emoji.py # emoji表情 │ forbid.py # 禁止广告 │ history.py # 历史上的今天 │ main.py # 主程序 │ mongo.py # mongo数据库 │ reply.py # 回复 │ sign.py # 签到 │ weather.py # 天气 │ who.py # 查询用户信息
│ active_speak.py # 主动说话(上号夺舍咯) │ apis.py # api调用 │ botpy.log # 日志文件 │ config.yaml # 配置文件 │ douapi.py # api调用 │ emoji.py # emoji表情 │ forbid.py # 禁止广告 │ history.py # 历史上的今天 │ main.py # 主程序 │ mongo.py # mongo数据库 │ reply.py # 回复 │ sign.py # 签到 │ weather.py # 天气 │ who.py # 查询用户信息
import datetime from botpy.message import Message from playwright.async_api import async_playwright async def get_history(self, message: Message): day = str(datetime.datetime.now())[5:10].replace('-', '') url = 'http://www.people.com.cn/GB/historic/{}/'.format(day) async with async_playwright() as p: browser = await p.chromium.launch() page = await browser.new_page() await page.goto(url) a = await page.locator("td.t14l14").inner_text() await browser.close() await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id) async def get_someday_history(self, message: Message, day): url = 'http://www.people.com.cn/GB/historic/{}/'.format(str(day)) async with async_playwright() as p: browser = await p.chromium.launch() page = await browser.new_page() await page.goto(url) a = await page.locator("td.t14l14").inner_text() await browser.close() await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id)
import datetime from botpy.message import Message from playwright.async_api import async_playwright async def get_history(self, message: Message): day = str(datetime.datetime.now())[5:10].replace('-', '') url = 'http://www.people.com.cn/GB/historic/{}/'.format(day) async with async_playwright() as p: browser = await p.chromium.launch() page = await browser.new_page() await page.goto(url) a = await page.locator("td.t14l14").inner_text() await browser.close() await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id) async def get_someday_history(self, message: Message, day): url = 'http://www.people.com.cn/GB/historic/{}/'.format(str(day)) async with async_playwright() as p: browser = await p.chromium.launch() page = await browser.new_page() await page.goto(url) a = await page.locator("td.t14l14").inner_text() await browser.close() await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id)