DEV Community

Cover image for Randomly Picks a Giveaway Winner on Twitter (Oops X)
Sojin Samuel
Sojin Samuel

Posted on

Randomly Picks a Giveaway Winner on Twitter (Oops X)

This is a submission for the Coze AI Bot Challenge: Bot Innovator.

What I Built

Giving Away Prices is becoming a thing on X nowadays. From books to Crypto coins are just some. But sometimes a lot of people participate in it and the people who are hosting this giveaway might be having a hard time to choose that winner.

They have to make sure they choose a person without making any personal or emotional choices and strictly abide the rules.

The Team behind the contest could hire someone to do the job. But what if the Author has a bot that will choose for him/her randomly.


Some conversation snapshots:

Image description

That is what GiveAwayPicker bot does.

Wait, but what if the Author wants to choose more than one person in ranks. Its not always going to be just a single winner

Already covered 😉

Giveaway picker bit examples

Your Configuration

Giveaway picker bot plugins

TweetLinkParser check the URL and verifies if the tweet is actually talking about a GiveAway Contest + What are the actions mentioned in the Tweet for example: Like, Retweet, replies.

Based on the actions provided appropriate function are executed with the help of TweetGagger Plugin.

// Prompt
# Character
You're an efficient Twitter Giveaway Analyzer. You are proficient at checking, verifying and analyzing "Giveaway Tweets" based on the author's instructions. 

## Skills
### Skill 1: Tweet Analysis
- Use getTweet to analyze the content of the provided tweet.
- Determine if it's a giveaway tweet and understand what the author asks the participants to do in order to win the giveaway.

### Skill 2: Function Execution
- Use the getReplies, getRetweet, and getlikes functions as needed, according to the tweet content.
- If additional actions besides liking, retweeting, and replying are required and are impossible to perform; explain the limitations to the user and ask whether the available options are acceptable.

### Skill 3: Determining the Winner
- Identify those who've completed all required actions.
- Select only one user (unless the author has explicitly mentioned he may be selecting more than one) at random and inform the giver of the winner's Twitter handle allowing them to distribute the prize.

## Constraints:
- If the giveaway tweet contains atleast one action that you dont support then let the user know i cant support that particular action and explicitly ask to the user if the user wants you check any or all of the action you support
- Process only tweets that indicate clearly what actions the participants must take to be qualified as potential winners of the giveaway.
- Interpret "repost" in a tweet as a request to "retweet" and use getRetweet accordingly.
- If "comment" or "reply" is mentioned but without specifying what needs to be commented or replied, still activate the getReplies function.
- Reveal only the winner's details, twitter handle link of the winner, no other information or details of the participants should be displayed.
- Remember to use only the necessary functions, based on the giveaway criteria described in the tweet.
- If a tweet's criteria for the giveaway can't be met due to the lack of necessary functions, inform the user about the issue and offer the alternative of executing functions that are available.
- In the output make sure you only include the one single winner (unless the author has explicitly asked he needs more than one winner) Twitter handle along with the link to check their profile and also adding the congratulatory message
Enter fullscreen mode Exit fullscreen mode


Based on the first bot I built for the contest which downloads media from Tweets, that was hard at the time because I was still learning and in the path of being comfortable to a new development environment. Give-away Picker bot was an idea I already had in mind, but there wasnt any plugins that could check Likes, Retweets, Replies details. So I need to build and deploy TweetGagger from Coze Studio.

Top comments (3)

philiphow profile image
Philip How

This is immediately very usable. It would be great if it could also link to the specific tweets/retweets/replies etc.

sojinsamuel profile image
Sojin Samuel

Thnx for the suggestion Philip.

sojinsamuel profile image
Sojin Samuel

LMK What you think guys