Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

TZGyn/discord-twitter-bot-with-replit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WARNING

This project is no longer in development

Twitter notification on discord

A discord bot that gets the latest tweets and display it in the text channel

How to use the bot

Add the bot to your server, add users to follow by typing '-follow {the tweet account id (start with @)}'

The bot will start getting new tweets from the user and display it in the channel where the command is executed

Requirements

A discord developer account to create a bot token for the discord bot

An account on replit

A twitter developer account

Installation

Create a twitter app in your twitter developer portal , remember to keep the keys as it will only be shown on the creation of the app, otherwise have to be regenerated.

Create a discord bot application in your discord developer portal with channel permissions and remember the bot token

Download the code and upload it to replit, create a .env file with the following properties

The following 4 keys are obtained in your twitter developer portal

  • ACCESS_KEY
  • ACCESS_SECRET
  • CONSUMER_KEY
  • CONSUMER_SECRET
  • bot_token, this is the bot token generated on discord developer portal

Commands

Default prefix= '-'

follow @{username}, username is the twitter user's unique name, '@' can be ignored

stopfollow @{username}, unfollows a user in your followed list

followlist, displays a list of the users you followed in the text channel

help, displays all command names

Custom settings

On the free plan of a twitter developer account, the limit is one request a second. The delay of each request in the code is 2 seconds, change it by going to main.py and manually change the async time to your desired amount.

How to keep the bot active?

The code will run prefectly on replit but if the web session is closed for more than an hour, replit will push the code into a idle state. The bot will enter a sleep mode and can be re-activate by logging back the replit account and open the code.

To prevent the bot to enter sleep mode

Constantly ping your bot, I recommend using UptimeRobot

How to use UptimeRobot

When running the bot, you will find a box appeared on top of your console/shell showing "running" with a link on top. Copy the link.

Log into your UptimeRobot account and click on "Add New Monitor" and enter the following.

  • Monitor Type: HTTP(s)
  • Friendly Name: {Put whatever name your want here}
  • URL (or IP): {Put the link mentioned above here}
  • Monitoring Interval: under 15 minutes

Change the rest of the setting to your likings or keep it default

Click "Create Monitor" and you're done, add the bot to your discord server and start using it.

About

Discord bot that notifies when a followed twitter user tweets, as a discord message.

Topics

Resources

Stars

Watchers

Forks

Languages