I want to send a tweet via the Twitter API. The bot connects but it simply does not do anything.
I've tried to send direct messages or simply read tweets but nothing happens.
The app does not execute the code in the _twitterService.SendTweet() Method. No exceptions are thrown.
private const string ApiKey = "*************";
private const string ApiSecretKey = "*********************";
private const string AccessToken = "**************-****************";
private const string AccessTokenSecret = "*********************";
private static readonly TwitterService _twitterService = new TwitterService(ApiKey, ApiSecretKey, AccessToken, AccessTokenSecret);
static void Main(string[] args)
{
Console.WriteLine($"{DateTime.Now} - Start");
SendTweet();
}
public static void SendTweet()
{
var result = _twitterService.SendTweet(new SendTweetOptions { Status = "Hello World" }, (tweet, response) =>
{
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"{DateTime.Now} - Tweet sent");
Console.ResetColor();
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"{DateTime.Now} - ERROR - {response.Error.Message}");
Console.ResetColor();
}
});
}