func (ab *AutoBot) TweetYoutubeVideo(ctx context.Context) error {
	log.Println("tweeting youtube video")
	// get all the videos that have not been in last 3 months
	fmt.Println(ab.dbclient.Ping())
	video, err := ab.dbclient.SelectOneRandomVideo(ctx, "GoWest Conference")
	if err != nil {
		return fmt.Errorf("error getting random video: %w", err)
	}
	// create and send tweet
	err = ab.twitterClient.SendTweet(makeVideoTweet(video))
	if err != nil {
		return fmt.Errorf("error sending tweet: %w", err)
	}

	// last send time of video
	err = ab.dbclient.UpdateSentAt(ctx, video)
	if err != nil {
		return fmt.Errorf("error updating sent at: %w", err)
	}

	return nil
}
// TweetYoutubeVideo is a function that will tweet a random youtube video
TweetYoutubeVideo is a function that will tweet a random youtube video
// TweetYoutubeVideo is a function that will tweet a random youtube video
func (ab *AutoBot) TweetYoutubeVideo(ctx context.Context) error {
	log.Println("tweeting youtube video")
	fmt.Println(ab.dbclient.Ping())
	video, err := ab.dbclient.SelectOneRandomVideo(ctx, "GoWest Conference")
	if err != nil {
		return fmt.Errorf("error getting random video: %w", err)
	}
	err = ab.twitterClient.SendTweet(makeVideoTweet(video))
	if err != nil {
		return fmt.Errorf("error sending tweet: %w", err)
	}
	err = ab.dbclient.UpdateSentAt(ctx, video)
	if err != nil {
		return fmt.Errorf("error updating sent at: %w", err)
	}
	return nil
}
func ( ab * AutoBot ) TweetYoutubeVideo ( ctx context . Context ) error { log . Println ( " " ) fmt . Println ( ab . dbclient . Ping ( ) ) video , err := ab . dbclient . SelectOneRandomVideo ( ctx , " " ) if err != nil { return fmt . Errorf ( " " , err ) } err = ab . twitterClient . SendTweet ( makeVideoTweet ( video ) ) if err != nil { return fmt . Errorf ( " " , err ) } err = ab . dbclient . UpdateSentAt ( ctx , video ) if err != nil { return fmt . Errorf ( " " , err ) } return nil }
TweetYoutubeVideo is a function that will tweet a random youtube video
TweetYoutubeVideo is a function that will tweet a random youtube video
// get all the videos that have not been in last 3 months // create and send tweet // last send time of video