-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
25 lines (21 loc) · 807 Bytes
/
utils.py
File metadata and controls
25 lines (21 loc) · 807 Bytes
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
#!/usr/bin/env python
# pylint: disable=C0116,W0613
from telegram.utils.helpers import escape_markdown
from telegram import Update
from telegram.ext import CallbackContext
def escape_md(text):
return escape_markdown(text, version=2)
def private_none(func, text="Run this command in a group."):
def wrapper(update: Update, context: CallbackContext):
if update.message.chat.type == "private":
update.message.reply_text(text)
else:
func(update, context)
return wrapper
def private_only(func, text="Run this command in my DMs. 😸"):
def wrapper(update: Update, context: CallbackContext):
if update.message.chat.type != "private":
update.message.reply_text(text)
else:
func(update, context)
return wrapper