Coder Social home page Coder Social logo

fixtwitter's Introduction

fixTwitter Bot

Introduction

fixTwitter is a Discord bot that detects X or Twitter links and converts them to "fixupx" links. It is written in Python and requires a BOT_TOKEN equal to the Discord Bot API token.

At the moment this is not hosted on any server, for users who would like to make use of it you will need the BOT_TOKEN and to run main.py on a machine of your choosing.

You can clone this repo using:

gh repo clone rsh52/fixTwitter

Usage

The fixTwitter bot responds to prompts starting with ??. Once prompted, the bot will respond with a link to the fixupx version of the Twitter/X link if it detects "x.com" or "twitter.com" in the message. This will delete the original users message, but provide a new link from the fixTwitter bot along with a message indicating who requested the fixupx link.

Example Usage

Getting Started

Setting Up the Bot - Discord Side

To set up a Discord bot, you will need to create a new application on the Discord Developer Portal. Once you have created a new application, you will need to create a bot for that application. This can be done by clicking on the "Bot" tab on the left hand side of the screen and then clicking "Add Bot". Note that the appropriate permissions will need to be applied to the servers you wish to have the bot work with.

Be sure to generate and save a token from the "Bot" panel. This will be critical and unique for your purposes. Give your bot a name (feel free to use fixTwitter, or whatever else you like) and a fun icon.

Under the "OAuth2" tab, select the "bot" scope, "Moderate Members" under the general permissions, and all options under text permissions. Do this first under "General" and then again under "URL Generator." The URL generator will provide a URL that will let you invite the bot to servers of your choosing.

Setting Up the Bot - Developer Side

Fortunately, the heavy lifting has mostly been done at this point! It's up to the developer to decide how they wish to host the bot.

I have chosen to use a Raspberry Pi Model 3 with set up with Ubuntu and run via screen. I have also chosen to use a virtual environment to run the bot. This is not necessary, but I have found it to be acceptable for personal use in my social servers. Other options include AWS, Google Cloud, Heroku, or any other hosting service that can run Python. For me, the Raspberry Pi was the most cost effective option and I had one lying around.

As mentioned above, once a hosting location has been identified, simply clone or fork the repo:

gh repo clone rsh52/fixTwitter

Using your terminal, cd to the location, set up your virtual environment, and install the packages listed in the requirement.txt file (refer to the Python docs for more information on this process).

Now all that's needed is to run python3 main.py and the bot should be up and running! You can confirm by checking the bot's status in the server you invited it to. Try out locally first to see it in action.

fixtwitter's People

Contributors

rsh52 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.