Welcome to the Twitter Announcement Discord Bot template! This template is designed to help you create a bot that automatically posts updates to Twitter whenever your Discord server reaches a new milestone in member count. Specifically, it will tweet every time another hundred users join your server. This is a fantastic way to engage your community and celebrate growth milestones together.
To begin using this template, simply click on "Start with this Template" on the Lazy platform. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy, paste, or delete any code manually.
Before you can test and use the bot, you'll need to set up some environment secrets within the Lazy Builder. These secrets include your Discord token and Twitter API credentials. Here's how to acquire and set them up:
DISCORD_TOKEN
.TWITTER_API_KEY
, TWITTER_API_SECRET
, TWITTER_ACCESS_TOKEN
, and TWITTER_ACCESS_TOKEN_SECRET
.Make sure your Twitter access tokens are created with Read, Write, and Direct Messages permissions.
Once you have set up your environment secrets, press the "Test" button to begin the deployment of the app. The Lazy CLI will handle the deployment process, and you won't need to install any libraries or set up your environment.
After pressing the "Test" button and the app is deployed, the bot will be live and running on your Discord server. It will monitor the server's member count and automatically post a tweet every time the member count reaches a new hundred-member milestone.
If you wish to integrate this bot with other services or frontends, you can refer to the provided sample code for API request handlers in the template. For example, if you want to create a custom dashboard that displays the status of your Discord server and the bot's activity, you can use the provided some_get_request_handler.py
and some_post_request_handler.py
as a starting point.
For API interactions, after deployment, Lazy will provide you with a dedicated server link to use the API. If you're using FastAPI, you will also receive a docs link to help you understand and interact with the API endpoints.
Here's a sample request and response for the provided API handlers:
# Sample GET request
GET /api/status
# Sample response
{
"message": "OK"
}
# Sample POST request with JSON body
POST /api/data
Content-Type: application/json
{
"field": "example"
}
# Sample response
{
"message": "Received data: example"
}
Remember, the Lazy platform handles all the deployment details, so you can focus on building and integrating your application. Enjoy creating your Twitter Announcement Discord Bot and celebrating your community's growth!