Skip to content

Instantly share code, notes, and snippets.

@DimasInchidi
Last active June 30, 2018 09:28
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 DimasInchidi/60c757a6ed211b39f9836386e65cf41c to your computer and use it in GitHub Desktop.
Save DimasInchidi/60c757a6ed211b39f9836386e65cf41c to your computer and use it in GitHub Desktop.
replied = set()
@client.on(events.NewMessage)
async def greet(event: events.NewMessage.Event):
chat_room = await client.get_entity(event.chat_id)
if event.message.is_group and not event.message.from_id in replied:
sender = await event.message.get_sender()
text = 'hi'
replied.add(event.message.from_id)
await client.send_message(chat_room, text)
await client.send_message(
await client.get_entity(inchidi_id),
f'''Replying to user with id {sender.id} in
group {chat_room.title}: {text}'''
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment