Skip to content

Instantly share code, notes, and snippets.

@makiftasova
Created December 6, 2016 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makiftasova/29c60503897409356dbc15a5d5458f26 to your computer and use it in GitHub Desktop.
Save makiftasova/29c60503897409356dbc15a5d5458f26 to your computer and use it in GitHub Desktop.
async def command_start(bot, chat_id, args):
if args['chat_type'] in ('group', 'supergroup'):
bot.broadcast_targets.append(chat_id)
async def command_broadcast(bot, chat_id, args):
"""
args = {'user_id': TELEGRM_USER_ID, 'username': TELEGRAM_USER_NAME, 'params': ['hello', 'world']}
"""
user_id = args['user_id']
if user_id in bot.mods:
message = ' '.join(args['params'])
for group in bot.broadcast_targets:
await bot.sendMessage(group, message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment