Add the ability to send a message to a specific user

This commit is contained in:
moshferatu 2024-01-18 10:56:46 -08:00
parent 31624e30a8
commit bb6a5ce70d

View File

@ -5,9 +5,11 @@ from os import getenv
load_dotenv()
def send_message(message: str) -> None:
def send_message(message: str, to_user_id: str = None) -> None:
if to_user_id:
message = f'<@{to_user_id}> {message}'
message_data = {'content': message}
requests.post(getenv('WEBHOOK_URL'), json = message_data)
if __name__ == '__main__':
send_message('Hello, world!')
send_message('Hello, world!', to_user_id = getenv('USER_ID'))