public static TwitterActionModel CreateUpdateProfileNameAction(string nameUpdate) { TwitterActionModel action = new TwitterActionModel(TwitterActionTypeEnum.UpdateName); action.NameUpdate = nameUpdate; return(action); }
public static TwitterActionModel CreateTweetAction(string tweetText, string imagePath = null) { TwitterActionModel action = new TwitterActionModel(TwitterActionTypeEnum.SendTweet); action.TweetText = tweetText; action.ImagePath = imagePath; return(action); }
protected override async Task PerformInternal(CommandParametersModel parameters) { if (ChannelSession.Services.Twitter.IsConnected) { if (this.ActionType == TwitterActionTypeEnum.SendTweet) { string tweet = await ReplaceStringWithSpecialModifiers(this.TweetText, parameters); string imagePath = await ReplaceStringWithSpecialModifiers(this.ImagePath, parameters); if (!string.IsNullOrEmpty(tweet)) { if (TwitterActionModel.CheckIfTweetContainsTooManyTags(tweet)) { await ChannelSession.Services.Chat.SendMessage("The tweet you specified can not be sent because it contains an @mention"); return; } Result result = await ChannelSession.Services.Twitter.SendTweet(tweet, imagePath); if (!result.Success) { await ChannelSession.Services.Chat.SendMessage("Twitter Error: " + result.Message); } } } else if (this.ActionType == TwitterActionTypeEnum.UpdateName) { Result result = await ChannelSession.Services.Twitter.UpdateName(this.NameUpdate); if (!result.Success) { await ChannelSession.Services.Chat.SendMessage("Twitter Error: " + result.Message); } } } }