Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would I use this Twitter API module to post a tweet?

Asked by 4 years ago

Hello! I am attempting to make it so pressing a button will post a tweet to a bot account. I am using this API module script: https://www.roblox.com/library/458958433/Twitter-API

I understand that I need to use something along the lines of module.api_call("post", "somepath/here", {--[[data here]]) , I just don't know how because I'm still kind of new to scripting. The part that is most confusing for me is what path I need for tweeting, and what I need to put for data. All help would be greatly appreciated, thank you!

also, if anyone knows a better way of doing this, please tell me!

0
did you register your bot on twitter? royaltoe 5144 — 4y

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

The api_call function sends a post request to twitter with a link we specified in the parameters. If we were to call the link ourselves, this is what the link would look like: https://api.twitter.com/1.1/statuses/update.json?status=hello

Anyway, since we want to update the status, we'd make the second parameter "statuses/update" like in the link above. The third parameter are the possible parameters.

You can see here for a list of possible parameters, but right now, we just want to send a tweet that says hello world, so we'll only specify the text we want in the tweet for the third parameter.

The code should end up looking like this

api_call("post", "statuses/update", {"hello, this is my first tweet!"})

if that doesn't work, try:

api_call("post", "statuses/update", {status = "hello, this is my first tweet!"})

0
Hello! Thank you so much for your answer! Funny thing is that I found the API docs with this information right before you answered lol. This is still helpful though, thanks! hpenney2 53 — 4y
0
no problem. i'm glad you found the information yourself. I'm too lazy to make a twitter but, but if you mind me asking which of the following code did you have to use? A or B? I think B might be the right way to do it but im not sure since i didn't get to test it royaltoe 5144 — 4y
0
After some more testing, apparently neither work?? hpenney2 53 — 4y
0
i'll look into it tomorrow royaltoe 5144 — 4y
View all comments (7 more)
0
okay, thank you!! i'll talk to you tomorrow in that case hpenney2 53 — 4y
0
alright, twitter is making me verify with my phone and i have no clue where my phone is. hopefully i find it by then lol royaltoe 5144 — 4y
0
what error are you getting btw? royaltoe 5144 — 4y
0
A doesn't give an error but no tweet is seen on my page, B returns this error: `Unable to cast value to std::string` hpenney2 53 — 4y
0
so A doesn't give you an error or is that some other way that doesnt give you an error? royaltoe 5144 — 4y
0
do you have Discord? it'd probably be easier for us to talk there hpenney2 53 — 4y
0
yeah,Lucy#4854 in school right now thouhg royaltoe 5144 — 4y
Ad

Answer this question