-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
216 additions
and
97 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
""" | ||
@某个用户的示例 | ||
本示例所涉及的 Entity 在将在下个版本重构 | ||
""" | ||
|
||
from typing import Union | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import asyncio | ||
|
||
from nonebot import on_command | ||
from nonebot.adapters.telegram import Bot | ||
from nonebot.adapters.telegram.event import MessageEvent | ||
from nonebot.adapters.telegram.message import Message, MessageSegment | ||
|
||
|
||
@on_command("location").handle() | ||
async def _(bot: Bot, event: MessageEvent): | ||
await bot.send(event, MessageSegment.location(31.2001033, 121.4326496)) | ||
|
||
|
||
@on_command("venue").handle() | ||
async def _(bot: Bot, event: MessageEvent): | ||
await bot.send( | ||
event, | ||
MessageSegment.venue(31.2001033, 121.4326496, "NoneBot 研讨会", "上海交通大学"), | ||
) | ||
|
||
|
||
@on_command("poll").handle() | ||
async def _(bot: Bot, event: MessageEvent): | ||
await bot.send( | ||
event, | ||
MessageSegment.poll("NoneBot 3.0?", ["Breaking!", "No!", "DDL!DDL!DDL!"]), | ||
) | ||
|
||
|
||
@on_command("dice").handle() | ||
async def _(bot: Bot, event: MessageEvent): | ||
await bot.send(event, MessageSegment.dice()) | ||
|
||
|
||
@on_command("chat_action").handle() | ||
async def _(bot: Bot, event: MessageEvent): | ||
await bot.send(event, MessageSegment.chat_action("typing")) | ||
await asyncio.sleep(1) | ||
await bot.send(event, "Typing complete!") |
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 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
Oops, something went wrong.