From fdc207f1508ad61914608cf3abc131ed594ffddc Mon Sep 17 00:00:00 2001 From: Aadit Agrawal Date: Fri, 6 Sep 2024 08:57:03 +0530 Subject: [PATCH] Add vcf_gen.py --- vcf_gen.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 vcf_gen.py diff --git a/vcf_gen.py b/vcf_gen.py new file mode 100644 index 0000000..44468ed --- /dev/null +++ b/vcf_gen.py @@ -0,0 +1,24 @@ +import os + +numbers = [] +group_name = input("Enter the group name: ") + +while True: + number = input("Enter a phone number (or press Enter to finish): ") + if number == "": + break + numbers.append(number) + +filename = f"{group_name}_contacts.vcf" +with open(filename, 'w') as f: + for i, number in enumerate(numbers, start=1): + f.write("BEGIN:VCARD\n") + f.write("VERSION:3.0\n") + f.write(f"N:{group_name}_{i:03d};;;\n") + f.write(f"FN:{group_name}_{i:03d}\n") + f.write(f"TEL;TYPE=CELL:+91{number}\n") + f.write(f"X-WhatsApp-Group:{group_name}\n") # Add WhatsApp group tag + f.write("END:VCARD\n\n") + +print(f"A single VCF file '{filename}' with {len(numbers)} contacts has been created in the current directory.") +print(f"These contacts are tagged for easy addition to a WhatsApp group named '{group_name}'.") \ No newline at end of file