twitter leaks for mao

This commit is contained in:
esef committed 2026-07-01 17:33:36 +03:00
1 parent becfa5a568
commit 58f46611a6
3 files changed
+16 -5

No files matched your search

+2
View File
@@ -11,9 +11,11 @@ TELEGRAM_GROUP_ID="yo telegram group id here"
#twitter things
TWITTER_RSS_URL="yo nitter id here"
TWITTER_DISCORD_WEBHOOK="yo discord twitter channel here"
TWITTER_DISCORD_WEBHOOK_MAO="yo discord twitter channel here for mao server"
#strinova stats voice channel
STRINOVA_STAT_CHANNEL_ID="yo strinova stat channel here"
STRINOVA_STAT_CHANNEL_ID_MAO="yo strinova stat channel here for mao server"
#me (for purging and other owner only things)
OWNER_ID="your discord servers owner id here"
+8
View File
@@ -37,11 +37,18 @@ twitter = TwitterRSSForwarder(
webhook_url=os.getenv('TWITTER_DISCORD_WEBHOOK'),
)
twitter_mao = TwitterRSSForwarder(
rss_url=os.getenv('TWITTER_RSS_URL'),
webhook_url=os.getenv('TWITTER_DISCORD_WEBHOOK_MAO'),
guid_file='data/last_tweet_mao.txt',
)
@bot.event
async def on_ready():
print(f'✅ {bot.user} is online!')
asyncio.create_task(forwarder.start())
asyncio.create_task(twitter.start())
asyncio.create_task(twitter_mao.start())
async def main():
async with bot:
@@ -65,6 +72,7 @@ async def main():
finally:
await forwarder.stop()
twitter.stop()
twitter_mao.stop()
logging.basicConfig(level=logging.INFO)
logging.getLogger('httpx').setLevel(logging.WARNING)
+6 -5
View File
@@ -4,13 +4,14 @@ import asyncio
import aiohttp
import feedparser
POLL_INTERVAL = 1800 # 30 minutes
POLL_INTERVAL = 300 # 5 minutes
GUID_FILE = 'data/last_tweet.txt'
class TwitterRSSForwarder:
def __init__(self, rss_url, webhook_url):
def __init__(self, rss_url, webhook_url, guid_file='data/last_tweet.txt'):
self.rss_url = rss_url
self.webhook_url = webhook_url
self.guid_file = guid_file
self.last_guid = None
self._running = False
@@ -32,13 +33,13 @@ class TwitterRSSForwarder:
print('twitter rss forwarder stopped')
def _load_last_guid(self):
if os.path.exists(GUID_FILE):
with open(GUID_FILE, 'r') as f:
if os.path.exists(self.guid_file):
with open(self.guid_file, 'r') as f:
self.last_guid = f.read().strip() or None
def _save_last_guid(self):
os.makedirs('data', exist_ok=True)
with open(GUID_FILE, 'w') as f:
with open(self.guid_file, 'w') as f:
f.write(self.last_guid or '')
async def _poll(self):