Hallo zusammen,
ich möchte mir ein WhatsApp Bot bauen, komme aber nicht an die Werte für **:::
Anbei mein Quellcode:
using System;
using System.Collections.Generic;
using System.IO;
using WhatsAppApi;
namespace WhatsApp_Bot
{
public class Bot
{
String message;
WhatsApp wa;
public Bot(List<String> reciver)
{
this.wa = new WhatsApp("0123456789","password","nickname");
this.message = "";
readFile();
foreach(String recive in reciver)
{
sendMessage(recive);
}
}
bool sendMessage(String recive)
{
wa.SendMessage(recive, this.message);
wa.Login();
return true;
}
bool readFile()
{
String line = "";
try{
StreamReader file = new StreamReader("WhatsAppMessage.txt");
while((line = file.ReadLine()) != null){
message += line;
}
return true;
}catch{
return false;
}
}
}
}
Res Servea Verum Gaudium
Dir ist bewusst, dass WhatsApp Bots verbietet?
Oder ist das ein WhatsApp Business Account?
Hast Du Dir überhaupt die API angeschaut, die Du nutzt?
Dass diese bereits über 2 Jahre alt ist und nicht mehr gepflegt wird, das ist Dir aufgefallen? 😉
Ansonsten ist Deine Frage mit einem Blick in den Quellcode beantwortet
https://github.com/mgp25/Chat-API-NET/blob/master/WhatsAppApi/WhatsApp.cs
- performance is a feature -
Microsoft MVP - @Website - @AzureStuttgart - github.com/BenjaminAbt - Sustainable Code