This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user

Overview

max_tweeted_word

This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user

The program uses tweepy to access Twitter API

HOW THE BOT WORKS: The bot will scan through its followers and for every follower, will scan the user's tweets and tweet their most tweeted word in the format: @username's most tweeted word is [word] (number of times word is used)

To find their most tweeted word, a Twitter user will have to follow this bot's account.

As of now, a user following the bot will not act as a trigger. I will manually be running the bot from my machine a few times a day to work it.

LOGIC

  1. Getting a user from followers list:
  • first, I open a blank .txt file
  • next, using the api.followers(user) function, I pulled the bot's followers
  • scan through the followers and filter out the protected accounts -- add the selected user IDs to a followers_list
  • cycle through the followers_list formed in the above step with a for loop
  • IF "follower" in the for loop iteration is not in the .txt file, append users_list with "follower" and also append .txt file
  • the above step makes sure the bot does not run for the same account more than once
  • choose only 5 users at a time.
  1. Finding max tweeted word:
  • This is for chosen user among 5 users in users_list
  • Pull all tweets of the user. Twitter API limits maximum tweets to be pulled at 200. To bypass this and pull all (up to ~3,500) tweets, cycle through tweets by filtering by using tweet_id which is timestamped
  • store all tweets in a list
  • initialize a words_list and a words_count_list to store the words tweeted by the user and corresponding count
  • in a for loop, for every tweet, pull tweet.text to extract the text content mentioned in each element of the tweets list from the step above
  • once tweet.text is extracted, comb through each word with for loop. For word selected in for loop, convert it to small-case to avoid multiple counting. For example, YES, Yes and yes are all considered to be different words if case insensitisation is not done. Check if word selected in for loop iteration exists in words_list. If YES, then find index of word in words_list and increment element at index in words_count. If NO, check if chosen word in the loop is NOT in the words_to_filter.txt file. If word is not in words_to_filter.txt, append word in words_list and then do index matching as mentioned in the YES step
  • after this, sort the words_count_list in reverse order -- element at pos [0] is the count of the max tweeted word. Find index of element at [0] in sorted list in words_count_list and the word at this index is the most tweeted word
  1. Tweeting
  • using api.update_status, tweet in the format @username's most tweeted word is [word] (number of times word is used)
Owner
Yasho Bapat
Yasho Bapat
Discondelete, is a Discord self-bot to delete dm's or purge all messages from a guild.

Discondelete Discondelete, is a Discord self-bot to delete dm's or purge all messages from a guild. Report Bug · Request Feature Table of Contents Abo

core 4 Feb 28, 2022
A simple Telegram bot which handles images in whole different way

zeroimagebot thezeroimagebot 🌟 I Can Edit Dimension Of An image which is required by @stickers 🌟 I Can Extract Text From An Image 🌟 !!! New Updates

RAVEEN KUMAR 4 Jul 01, 2021
SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather

SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather, the c

John Calhoun 372 Jan 02, 2023
Python On WhatsApp - Run your python codes on whatsapp along with talking to a chatbot

Python On WhatsApp Run your python codes on whatsapp along with talking to a chatbot This is a small python project to run python on whatsapp. and i c

Prajjwal Pathak 32 Dec 30, 2022
Get your Pixiv token (for running upbit/pixivpy)

gppt: get-pixivpy-token Get your Pixiv token (for running upbit/pixivpy) Refine pixiv_auth.py + its fork Install ❭ pip install gppt Run Note: In advan

haruna 58 Jan 04, 2023
Open Source Discord bot with many cool features like Weather, Balance, Avatar, User, Server, RP-commands, Gif search, YouTube search, VK post search etc.

Сокобот Дискорд бот с открытым исходным кодом. Содержит в себе экономику, полезные команды (!аватар, !юзер, !сервер и тд.), рп-команды (!обнять, !глад

serverok 2 Jan 16, 2022
An open souce video/music streamer based on MPV and piped.

🎶 Harmony Music An easy way to stream videos or music from Youtube from the command line while regaining your privacy. 📖 Table Of Contents ❔ What's

Zingy Tomato 16 Nov 15, 2022
Rbx-mass-send - mass sends trades to item owners

mass sends trades to item owners proxies should be in ip:port format itemsToSend

0 Feb 20, 2022
Yuichixspam - TLEEGRAM SPAM BOT For Python

𝒀𝑼𝑰𝑪𝑯𝑰 ✘ 𝑺𝑷𝑨𝑴 𝑩𝑶𝑻ノ 🚀 Deploy on Heroku (https://heroku.com/deploy?t

MOHIT X PANDIT 6 Jan 30, 2022
A simple Discord Mass-Ban that's still working with Member Scraper.

Mass-Ban [!] This was made for education / you can use for revenge. Please don't skid it. [!] If you want to use it, please use member scraper before

WoahThatsHot 1 Nov 20, 2021
Scripts to help you win the Pizza Express

Slice of the Prizes Slice of the Prizes is a Python Script designed to enter the "Slice of the Action" competition hosted by Pizza Express the competi

Luke Bendall 1 Nov 04, 2021
Git Plan - a better workflow for git

git plan A better workflow for git. Git plan inverts the git workflow so that you can write your commit message first, before you start writing code.

Rory Byrne 178 Dec 11, 2022
TG-Streaming-bot - TG Simple Streaming bot

TG Simple Streaming bot telegram video straming bot 🎚️ Features Play youtube li

HyDrix 4 May 05, 2022
🔍 📊 Look up information about anime, manga and much more directly in Discord!

AniSearch The source code of the AniSearch Discord Bot. Contribute You have an idea or found a bug? Open a new issue with detailed explanation. You wa

私はレオンです 19 Dec 07, 2022
Simple web browser to visualize HiC tracks

HiCBrowser : A simple web browser to visualize Hi-C and other genomic tracks Fidel Ramirez, José Villaveces, Vivek Bhardwaj Installation You can insta

The deepTools ecosystem 14 Jun 21, 2022
procedurally-generated catppuccin wallpapers

Catppuccin Wallpapers I was in need of wallpapers conforming to the catppuccin colorscheme. So, I wrote a simple script to iteratively generate a set

daylin 11 Nov 29, 2022
A library that allows you to easily mock out tests based on AWS infrastructure.

Moto - Mock AWS Services Install $ pip install moto[ec2,s3,all] In a nutshell Moto is a library that allows your tests to easily mock out AWS Services

Steve Pulec 6.5k Jan 02, 2023
LoL 台版10周年活動自動輸入邀請碼

LoLTW_10Year_88Event LoLTW 8.8 周年慶 邀請碼自動輸入 設定 在 LoLTW_10Year_88Evnet.exe 的位置建立一個檔案 .env,內容如下 Bahamut_Discussion = https://forum.gamer.com.tw/C.php?bsn

古丁丁 5 Dec 13, 2021
A Telegram Most Powerful Media Info Bot.

Media Info Bot Support 🚑 Demo For The Bot -Test Our Bot By Clicking The Button Below Deploy To Heroku 🗳 Press the Deploy Button to Get Your Own Bot.

Anonymous 5 May 16, 2022