本文整理汇总了C#中TweetSharp.TwitterService.SendDirectMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.SendDirectMessage方法的具体用法?C# TwitterService.SendDirectMessage怎么用?C# TwitterService.SendDirectMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TweetSharp.TwitterService
的用法示例。
在下文中一共展示了TwitterService.SendDirectMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TwitterSendDirectMessage
public JsonResult TwitterSendDirectMessage()
{
bool result = false;
string _consumerKey = System.Configuration.ConfigurationManager.AppSettings["consumerKeyLogin"];
string _consumerSecret = System.Configuration.ConfigurationManager.AppSettings["consumerSecretLogin"];
TwitterService service = new TwitterService(_consumerKey, _consumerSecret);
service.AuthenticateWith(Session[Sessionvars.TwitterRequestToken].ToString(), Session[Sessionvars.TwitterRequestTokenSecert].ToString());
string TwitterDirectMessage = Request.Params["TwitterDM"];
string ListSelectUserDM = Convert.ToString(Request.Params["SelectedUserForDM"]);
char[] splitchars = { ',' };
string[] DirectMessageUserId = ListSelectUserDM.Split(splitchars, StringSplitOptions.RemoveEmptyEntries);
if (DirectMessageUserId.Count() > 0)
{
foreach (var list in DirectMessageUserId)
{
TwitterDirectMessage Ds = service.SendDirectMessage(Convert.ToInt32(list), TwitterDirectMessage);
}
result = true;
}
return Json(result, JsonRequestBehavior.AllowGet);
}
示例2: Send
public void Send(ChannelMessage message)
{
var service = new TwitterService(ChannelHelper.ConsumerKey, ChannelHelper.ConsumerSecret, ChannelHelper.Token, ChannelHelper.TokenSecret);
foreach (var singleToName in message.To)
{
service.SendDirectMessage(Int32.Parse(singleToName.Address), message.BodyText.ReadString());
}
}
示例3: TweetRequest
public ActionResult TweetRequest(int[] Id)
{
if (OAuthWebSecurity.IsAuthenticatedWithOAuth)
{
ContextDb _db = new ContextDb();
Models.Service service = _db.User.FirstOrDefault(c => c.UserId == WebSecurity.CurrentUserId).Services.FirstOrDefault(c => c.Provider == "twitter");
if (service != null)
{
TwitterService twitter = new TwitterService(Settings.Settings.TwitterConsumerKey, Settings.Settings.TwitterConsumerSecret, service.Token, service.TokenSecret);
foreach (var item in Id)
{
twitter.SendDirectMessage(item, "Join us at www.botf.azurewebsites.net");
}
}
}
return RedirectToAction("Index");
}
示例4: SendTweet_Start
public static void SendTweet_Start(string sMessage, int userID)
{
// alpascual
// Pass your credentials to the service
TwitterService service = new TwitterService("yASjbX9Zbu1OD0gk89qExA", "mTDH5xPm6Fu1KS3m1NUVTWKXBXi330TCakspt5Dz060");
//OAuthAccessToken access = service.GetAccessTokenWithXAuth("alpascual", ""); // <-- user supplied username and password
//// Step 1 - Retrieve an OAuth Request Token
OAuthRequestToken requestToken = service.GetRequestToken();
//// Step 2 - Redirect to the OAuth Authorization URL
Uri uri = service.GetAuthorizationUri(requestToken);
////Process.Start(uri.ToString());
//WebClient client = new WebClient();
//string sResponse = client.DownloadString(uri);
//// Step 3 - Exchange the Request Token for an Access Token
string verifier = "3479615"; // <-- This is input into your application by your user
OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);
// Step 4 - User authenticates using the Access Token
service.AuthenticateWith(access.Token, access.TokenSecret);
if (userID == 0)
{
TwitterStatus status = service.SendTweet(sMessage);
}
else
service.SendDirectMessage(userID, sMessage);
}