telegram bot for mailings (spammer)
telegram bot for creating newsletters and their subsequent sending using the user's mail or using the bot's mail. The bot has integration with a database that stores account data (mail and key, encrypted). The database also stores the mailing history of each user. The sample letter contains (header, body text, attachment, recipients and the number of pieces for each recipient).
If you will not use docker, then you need to have a working RabbitMQ server with the necessary queue and exchange. As well as the postgreSQL database. Use gradlew to build. You need to configure 2 yaml files in module [client-telegram] and [send-mail-worker]. Then use for build two service:
./gradlew :send-mail-worker:build
And
./gradlew :client-telegram:build
Model content
Document and PhotoSize date types from telegram librarypublic record Message(
long accountId,
SendMode sendMode,
String title,
String text,
FileData fileData,
List<String> recipients,
int countForRecipient,
LocalDate sentDate
) implements Serializable {}
enum SendMode {
ANONYMOUSLY,
CURRENT_MAIL;
}
record FileData(
String id,
String name,
FileType type
) {}
enum FileType {
PHOTO,
DOCUMENT;
}
Config for client-telegram
server:
port: 8080
#telegram
bot:
name:
token:
service:
# (addresses to the tg-api file system)
file-info:
uri: https://api.telegram.org/bot{token}/getFile?file_id={fileId}
file-storage:
uri: https://api.telegram.org/file/bot{token}/{filePath}
# database
spring:
datasource:
# (address of database)
url: jdbc:postgresql://localhost:5432/
username:
password:
jpa:
# (schema generation for database)
generate-ddl: true
show-sql: true
hibernate:
# (ddl mode)
ddl-auto: create-drop
# rabbitMQ
rabbitmq:
# used default host and port
username: guest
password: guest
# (specifying the name of the queue to be created)
queue-name: send.mail
# (specifying the name of the exchange to be created)
exchange-name: exchange
#for Crypto !keys specified in .yaml(client) and .yaml(worker) must will be equals
cipher:
# (fist 128-bit key)
initVector: F-JaNdRgUjXn2r5u
# (second 128-bit key)
key: hVmYp3s6v9y$B&E)
Config for send-mail-worker
server:
port: 8081
bot:
name:
token:
service:
# (addresses to the tg-api file system)
file-info:
uri: https://api.telegram.org/bot{token}/getFile?file_id={fileId}
file-storage:
uri: https://api.telegram.org/file/bot{token}/{filePath}
# database
spring:
datasource:
# (address of database)
url: jdbc:postgresql://localhost:5432/
username:
password:
jpa:
# (schema generation for database)
generate-ddl: false
show-sql: true
# rabbitMQ
rabbitmq:
addresses: localhost:5672
username: guest
password: guest
# (specifying the name of the queue to be listening)
queue-name: send.mail
# for send-worker
base:
# (specifying mails and keys(keys for app) to them through ' , ' which will be used by the bot for anonymous mailing (ONLY GMAIL))
mails:
keys:
#for Crypto !keys specified in .yaml(client) and .yaml(worker) must will be equals
cipher:
# (fist 128-bit key)
initVector: F-JaNdRgUjXn2r5u
# (second 128-bit key)
key: hVmYp3s6v9y$B&E)