mirror of
https://github.com/ovosimpatico/Whatsapp-Bulk-Sender
synced 2026-01-15 13:32:52 -03:00
added all files
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -127,3 +127,6 @@ dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# Project-specific files
|
||||
PyWhatKit_DB.txt
|
||||
|
||||
BIN
example.xlsx
Normal file
BIN
example.xlsx
Normal file
Binary file not shown.
13
main.py
Normal file
13
main.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import pywhatkit
|
||||
import time
|
||||
|
||||
from src.file import read_excel_file, saudacao
|
||||
from src.contants import MESSAGE
|
||||
|
||||
file_path = "example.xlsx"
|
||||
name, phone_no, sex, messages = read_excel_file(file_path)
|
||||
|
||||
for i in range(len(phone_no)):
|
||||
message = f"{saudacao()}, {name[i]}.\n{MESSAGE[f'{int(messages[i])}']}"
|
||||
pywhatkit.sendwhatmsg_instantly(phone_no[i], message, tab_close=True)
|
||||
time.sleep(3)
|
||||
7
src/contants.py
Normal file
7
src/contants.py
Normal file
@@ -0,0 +1,7 @@
|
||||
MESSAGE = {
|
||||
"1": "lorem ipsum 1",
|
||||
"2": "lorem ipsum 2",
|
||||
"3": "lorem ipsum 3",
|
||||
"4": "lorem ipsum 4",
|
||||
"5": "lorem ipsum 5"
|
||||
}
|
||||
41
src/file.py
Normal file
41
src/file.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import openpyxl
|
||||
|
||||
def read_excel_file(filename):
|
||||
# Load the workbook
|
||||
wb = openpyxl.load_workbook(filename)
|
||||
|
||||
# Select the active worksheet
|
||||
ws = wb.active
|
||||
|
||||
# Create empty lists to store the data
|
||||
names = []
|
||||
phones = []
|
||||
sexes = []
|
||||
messages = []
|
||||
|
||||
# Iterate through each row (excluding the first row)
|
||||
for row in ws.iter_rows(min_row=2, values_only=True):
|
||||
# Extract the data from the columns
|
||||
name = row[0]
|
||||
phone = row[1]
|
||||
sex = row[2]
|
||||
message = row[3]
|
||||
|
||||
# Append the data to the relevant list
|
||||
names.append(name)
|
||||
phones.append("+" + str(phone))
|
||||
sexes.append(sex)
|
||||
messages.append(str(message))
|
||||
|
||||
# Return the sorted lists
|
||||
return names, phones, sexes, messages
|
||||
|
||||
def saudacao():
|
||||
import datetime
|
||||
hour = int(f"{datetime.datetime.now()}".split()[1].split(":")[0])
|
||||
if hour >= 18 or hour < 6:
|
||||
return "Boa noite"
|
||||
elif hour >= 6 and hour < 12:
|
||||
return "Bom dia"
|
||||
elif hour >= 12 and hour < 18:
|
||||
return "Boa tarde"
|
||||
Reference in New Issue
Block a user