11import os
22from twitter_plugin_gamesdk .game_twitter_plugin import GameTwitterPlugin
3+ import base64
34
45# Define your options with the necessary credentials
56options = {
2627reply_tweet_fn (tweet_id = 1879472470362816626 , reply = "Hey! This is a test reply!" , media_ids = [])
2728print ("Replied to tweet!" )
2829
29- # # Test case 3: Quote a Tweet
30- # print("\nRunning Test Case 3: Quote a Tweet")
31- # quote_tweet_fn = game_twitter_plugin.get_function('quote_tweet')
32- # quote_tweet_fn(tweet_id=1879472470362816626, quote="Hey! This is a test quote tweet!", media_ids=[])
33- # print("Quoted tweet!")
34-
35- # # Test case 4: Search Tweets
36- # print("\nRunning Test Case 4: Search Tweets")
37- # search_tweets_fn = game_twitter_plugin.get_function('search_tweets')
38- # response = search_tweets_fn(query="Python")
39- # print(f"Searched tweets: {response}")
40-
41- # # Test case 5: Get authenticated user
42- # print("\nRunning Test Case 5: Get details of authenticated user")
43- # get_authenticated_user_fn = game_twitter_plugin.get_function('get_authenticated_user')
44- # response = get_authenticated_user_fn()
45- # print(f"Got details of authenticated user: {response}")
30+ # Test case 3: Quote a Tweet
31+ print ("\n Running Test Case 3: Quote a Tweet" )
32+ quote_tweet_fn = game_twitter_plugin .get_function ('quote_tweet' )
33+ quote_tweet_fn (tweet_id = 1879472470362816626 , quote = "Hey! This is a test quote tweet!" , media_ids = [])
34+ print ("Quoted tweet!" )
35+
36+ # Test case 4: Search Tweets
37+ print ("\n Running Test Case 4: Search Tweets" )
38+ search_tweets_fn = game_twitter_plugin .get_function ('search_tweets' )
39+ response = search_tweets_fn (query = "Python" )
40+ print (f"Searched tweets: { response } " )
41+
42+ # Test case 5: Get authenticated user
43+ print ("\n Running Test Case 5: Get details of authenticated user" )
44+ get_authenticated_user_fn = game_twitter_plugin .get_function ('get_authenticated_user' )
45+ response = get_authenticated_user_fn ()
46+ print (f"Got details of authenticated user: { response } " )
47+
48+ # Test case 6: Get my mentions
49+ print ("\n Running Test Case 6: Get my mentions" )
50+ mentions_fn = game_twitter_plugin .get_function ('mentions' )
51+ response = mentions_fn ()
52+ print (f"My mentions: { response } " )
53+
54+ # Test case 7: Get my followers
55+ print ("\n Running Test Case 7: Get list of users who are followers of me" )
56+ followers_fn = game_twitter_plugin .get_function ('followers' )
57+ response = followers_fn ()
58+ print (f"My followers: { response } " )
59+
60+ # Test case 8: Get ppl following me
61+ print ("\n Running Test Case 8: Get list of users I am following" )
62+ following_fn = game_twitter_plugin .get_function ('following' )
63+ response = following_fn ()
64+ print (f"Users I am following: { response } " )
65+
66+ # Test case 9: Upload media
67+ print ("\n Running Test Case 9: Upload media" )
68+ with open ("sample_media/media_file.png" , "rb" ) as f :
69+ media_id = game_twitter_plugin .upload_media (f )
70+ print (f"Uploaded media_id: { media_id } " )
0 commit comments