test templates more

This commit is contained in:
Von Random 2024-11-21 15:48:34 +02:00
parent 822982e21c
commit 616695b8f5

View file

@ -92,18 +92,16 @@ class Responder:
async def template(self, response: str, async def template(self, response: str,
event: telethon.events.common.EventBuilder) -> str: event: telethon.events.common.EventBuilder) -> str:
template = None
result = response result = response
if '<username>' in response: if '<username>' in response:
template = '<username>'
sender = await event.get_sender() sender = await event.get_sender()
result = result.replace(template, username) result = result.replace('<username>', username)
result += ' I AM TEST'
if '<randomname>' in response: if '<randomname>' in response:
template = '<randomname>'
peer_id = event.message.peer_id peer_id = event.message.peer_id
users = await self.client.get_participants(entity=peer_id) users = await self.client.get_participants(entity=peer_id)
sender = random.choice(users)[0] sender = random.choice(users)[0]
result = result.replace(template, username) result = result.replace('<randomname>', username)
return result return result
async def respond(self, async def respond(self,