//フォロワーさんを励ます機能 public async Task SendMessageToFollowerAsync <TWords>(ICharacter character, TWords word, SerifType type, IUsingDataTable usingDataTable) where TWords : IWords { var timeline = await twitterHelper.GetTimeLineAsync(); var tsuraiTweets = timeline.Where(e => e.RetweetedStatus == null).Where(e => !e.IsFavorited ?? true).Where(e => word.IsContained(e.Text)).Select(e => new { UserId = e.User.Id, e.Id, e.User.Name, e.Text }); foreach (var tsuraiTweet in tsuraiTweets) { if (tsuraiTweet.UserId == await twitterHelper.GetMyId()) { continue; } if (tsuraiTweet.Text.Contains("@")) { continue; } if (tsuraiTweet.Text.Contains("@")) { continue; } string mes = usingDataTable.GetUseSerif(character.Name, type); var txt = mes.Replace("{ScreenName}", tsuraiTweet.Name); await twitterHelper.ReplyAsync(tsuraiTweet.Id, txt); await Task.Delay(100); await twitterHelper.FavoritesAsync(tsuraiTweet.Id); } }
//フォロワーさんを励ましたりする public async Task SendMessageToFollowerAsync <TWords>(ICharacter character, TWords words, SerifType type, IUsingDataTable usingDataTable) where TWords : IWords { foreach (var mastodonHelper in mastodonHelpers) { var timeline = await mastodonHelper.GetTimeLineAsync(); var tsuraiTweets = timeline.Where(e => !e.Reblogged ?? true).Where(e => e.Reblog == null).Where(e => !e.Favourited ?? true).Where(e => words.IsContained(e.Content)).Where(e => e.Account.Id != mastodonHelper.CurrentUser.Id).Where(e => e.Url.Contains(mastodonHelper.Instance)).Select(e => new { UserId = e.Account.Id, e.Id, e.Account.DisplayName, e.Account.AccountName, e.Content }); foreach (var tsuraiTweet in tsuraiTweets) { if (tsuraiTweet.Content.Contains("@")) { continue; } if (tsuraiTweet.Content.Contains("@")) { continue; } string mes = usingDataTable.GetUseSerif(character.Name, SerifType.Ganbare); string name = GetDisplayName(tsuraiTweet.DisplayName, tsuraiTweet.AccountName); var txt = "@" + tsuraiTweet.AccountName + " " + mes.Replace("{ScreenName}", name); await mastodonHelper.ReplyAsync(tsuraiTweet.Id, Mastonet.Visibility.Unlisted, txt); await Task.Delay(100); await mastodonHelper.FavouriteAsync(tsuraiTweet.Id); } } }
public async Task RegularPostAsync(ICharacter character, IUsingDataTable usingDataTable) { foreach (var mastodonHelper in mastodonHelpers) { string message = usingDataTable.GetUseSerif(character.Name, SerifType.Normal); if (mastodonHelper.Instance == "mstdn.jp") { await mastodonHelper.PoststatusAsync(message, Mastonet.Visibility.Unlisted); } else { await mastodonHelper.PoststatusAsync(message, Mastonet.Visibility.Public); } } }
public async Task RegularPostAsync(ICharacter character, IUsingDataTable usingDataTable) { string message = usingDataTable.GetUseSerif(character.Name, SerifType.Normal, record: true); await twitterHelper.UpdateStatusAsync(message); }