Add vcf_gen.py
This commit is contained in:
commit
fdc207f150
24
vcf_gen.py
Normal file
24
vcf_gen.py
Normal file
@ -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}'.")
|
Loading…
Reference in New Issue
Block a user