mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 23:36:02 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51634c1caf | ||
|
|
0e00da6617 |
@@ -35,6 +35,7 @@ required_deps = {
|
|||||||
"telegram": "python-telegram-bot",
|
"telegram": "python-telegram-bot",
|
||||||
"certifi": "certifi",
|
"certifi": "certifi",
|
||||||
"mcp": "mcp",
|
"mcp": "mcp",
|
||||||
|
"telegramify_markdown":"telegramify-markdown",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,13 +31,6 @@ spec:
|
|||||||
type: int
|
type: int
|
||||||
required: true
|
required: true
|
||||||
default: 2288
|
default: 2288
|
||||||
- name: host
|
|
||||||
label:
|
|
||||||
en_US: Host
|
|
||||||
zh_CN: 监听主机
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: 0.0.0.0
|
|
||||||
execution:
|
execution:
|
||||||
python:
|
python:
|
||||||
path: ./slack.py
|
path: ./slack.py
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import telegram
|
|||||||
import telegram.ext
|
import telegram.ext
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, MessageHandler, filters
|
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, MessageHandler, filters
|
||||||
|
import telegramify_markdown
|
||||||
import typing
|
import typing
|
||||||
import asyncio
|
import asyncio
|
||||||
import traceback
|
import traceback
|
||||||
@@ -86,9 +86,10 @@ class TelegramMessageConverter(adapter.MessageConverter):
|
|||||||
if message.text:
|
if message.text:
|
||||||
message_text = message.text
|
message_text = message.text
|
||||||
message_components.extend(parse_message_text(message_text))
|
message_components.extend(parse_message_text(message_text))
|
||||||
|
|
||||||
if message.photo:
|
if message.photo:
|
||||||
message_components.extend(parse_message_text(message.caption))
|
if message.caption:
|
||||||
|
message_components.extend(parse_message_text(message.caption))
|
||||||
|
|
||||||
file = await message.photo[-1].get_file()
|
file = await message.photo[-1].get_file()
|
||||||
|
|
||||||
@@ -201,19 +202,20 @@ class TelegramAdapter(adapter.MessagePlatformAdapter):
|
|||||||
|
|
||||||
for component in components:
|
for component in components:
|
||||||
if component['type'] == 'text':
|
if component['type'] == 'text':
|
||||||
|
content = telegramify_markdown.markdownify(
|
||||||
|
content= component['text'],
|
||||||
|
)
|
||||||
args = {
|
args = {
|
||||||
"chat_id": message_source.source_platform_object.effective_chat.id,
|
"chat_id": message_source.source_platform_object.effective_chat.id,
|
||||||
"text": component['text'],
|
"text": content,
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.config['markdown_card'] is True:
|
if self.config['markdown_card'] is True:
|
||||||
args["parse_mode"] = "MarkdownV2"
|
args["parse_mode"] = "MarkdownV2"
|
||||||
|
if quote_origin:
|
||||||
|
args['reply_to_message_id'] = message_source.source_platform_object.message.id
|
||||||
|
|
||||||
if quote_origin:
|
await self.bot.send_message(**args)
|
||||||
args['reply_to_message_id'] = message_source.source_platform_object.message.id
|
|
||||||
|
|
||||||
await self.bot.send_message(**args)
|
|
||||||
|
|
||||||
async def is_muted(self, group_id: int) -> bool:
|
async def is_muted(self, group_id: int) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
semantic_version = "v3.4.12"
|
semantic_version = "v3.4.12.1"
|
||||||
|
|
||||||
debug_mode = False
|
debug_mode = False
|
||||||
|
|
||||||
|
|||||||
@@ -35,5 +35,6 @@ python-telegram-bot
|
|||||||
certifi
|
certifi
|
||||||
mcp
|
mcp
|
||||||
slack_sdk
|
slack_sdk
|
||||||
|
telegramify-markdown
|
||||||
# indirect
|
# indirect
|
||||||
taskgroup==0.0.0a4
|
taskgroup==0.0.0a4
|
||||||
Reference in New Issue
Block a user