Skip to content

Commit 3e0f2b4

Browse files
authored
Merge pull request game-by-virtuals#94 from game-by-virtuals/twitter_additional_methods
Twitter additional methods
2 parents f2aa30b + 98e8213 commit 3e0f2b4

File tree

7 files changed

+333
-22
lines changed

7 files changed

+333
-22
lines changed
14.6 KB
Loading

plugins/twitter/examples/test_game_twitter.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
# Test case 1: Post a Tweet
1818
print("\nRunning Test Case 1: Post a Tweet")
1919
post_tweet_fn = game_twitter_plugin.get_function('post_tweet')
20-
post_tweet_fn("Hello world! This is a test tweet from the GAME Twitter Plugin!")
20+
post_tweet_fn(tweet="Hello world! This is a test tweet from the GAME Twitter Plugin!", media_ids=[])
2121
print("Posted tweet!")
2222

2323
# Test case 2: Reply to a Tweet
2424
print("\nRunning Test Case 2: Reply to a Tweet")
2525
reply_tweet_fn = game_twitter_plugin.get_function('reply_tweet')
26-
reply_tweet_fn(tweet_id=1879472470362816626, reply="Hey! This is a test reply!")
26+
reply_tweet_fn(tweet_id=1879472470362816626, reply="Hey! This is a test reply!", media_ids=[])
2727
print("Replied to tweet!")
2828

2929
# Test case 3: Quote a Tweet
3030
print("\nRunning Test Case 3: Quote a Tweet")
3131
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!")
32+
quote_tweet_fn(tweet_id=1879472470362816626, quote="Hey! This is a test quote tweet!", media_ids=[])
3333
print("Quoted tweet!")
3434

3535
# Test case 4: Search Tweets
@@ -42,4 +42,28 @@
4242
print("\nRunning Test Case 5: Get details of authenticated user")
4343
get_authenticated_user_fn = game_twitter_plugin.get_function('get_authenticated_user')
4444
response = get_authenticated_user_fn()
45-
print(f"Got details of authenticated user: {response}")
45+
print(f"Got details of authenticated user: {response}")
46+
47+
# Test case 6: Get my mentions
48+
print("\nRunning Test Case 6: Get my mentions")
49+
mentions_fn = game_twitter_plugin.get_function('mentions')
50+
response = mentions_fn()
51+
print(f"My mentions: {response}")
52+
53+
# Test case 7: Get my followers
54+
print("\nRunning Test Case 7: Get list of users who are followers of me")
55+
followers_fn = game_twitter_plugin.get_function('followers')
56+
response = followers_fn()
57+
print(f"My followers: {response}")
58+
59+
# Test case 8: Get ppl following me
60+
print("\nRunning Test Case 8: Get list of users I am following")
61+
following_fn = game_twitter_plugin.get_function('following')
62+
response = following_fn()
63+
print(f"Users I am following: {response}")
64+
65+
# Test case 9: Upload media
66+
print("\nRunning Test Case 9: Upload media")
67+
with open("sample_media/media_file.png", "rb") as f:
68+
media_id = game_twitter_plugin.upload_media(f)
69+
print(f"Uploaded media_id: {media_id}")

plugins/twitter/examples/test_twitter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
# Test case 1: Post a Tweet
2222
print("\nRunning Test Case 1: Post a Tweet")
2323
post_tweet_fn = twitter_plugin.get_function('post_tweet')
24-
post_tweet_fn("Hello world! This is a test tweet from the Twitter Plugin!")
24+
post_tweet_fn("Hello world! This is a test tweet from the Twitter Plugin!", media_ids=[])
2525
print("Posted tweet!")
2626

2727
# Test case 2: Reply to a Tweet
2828
print("\nRunning Test Case 2: Reply to a Tweet")
2929
reply_tweet_fn = twitter_plugin.get_function('reply_tweet')
30-
reply_tweet_fn(tweet_id=1879472470362816626, reply="Hey! This is a test reply!")
30+
reply_tweet_fn(tweet_id=1879472470362816626, reply="Hey! This is a test reply!", media_ids=[])
3131
print("Replied to tweet!")
3232

3333
# Test case 3: Like a Tweet
@@ -39,7 +39,7 @@
3939
# Test case 4: Quote a Tweet
4040
print("\nRunning Test Case 4: Quote a Tweet")
4141
quote_tweet_fn = twitter_plugin.get_function('quote_tweet')
42-
quote_tweet_fn(tweet_id=1879472470362816626, quote="Hey! This is a test quote tweet!")
42+
quote_tweet_fn(tweet_id=1879472470362816626, quote="Hey! This is a test quote tweet!", media_ids=[])
4343
print("Quoted tweet!")
4444

4545
# Test case 5: Get Metrics

0 commit comments

Comments
 (0)