lunarflu HF Staff commited on
Commit
4df4bab
·
verified ·
1 Parent(s): 861aabd

update twitter test

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -8,7 +8,7 @@ import random
8
  import time
9
  import re
10
  from discord import Embed, Color
11
- from discord.ext import commands
12
  from gradio_client import Client
13
  from PIL import Image
14
  from ratelimiter import RateLimiter
@@ -17,6 +17,7 @@ from pytz import timezone # for times
17
  import asyncio # check if used
18
  import logging
19
  import urllib.parse
 
20
 
21
  from discord.ui import Button, View
22
 
@@ -35,6 +36,12 @@ logging.basicConfig(level=logging.DEBUG)
35
  #rate_limiter = RateLimiter(max_calls=10, period=60) # needs testing
36
  message_cache = {}
37
 
 
 
 
 
 
 
38
  # stats stuff ---------------------------------------------------------------------------------------------------------------------------------------------------------
39
  number_of_messages = 0
40
  user_cooldowns = {}
@@ -130,14 +137,19 @@ async def on_message(message):
130
  user_cooldowns[message.author.id]['timestamp'] = message.created_at
131
 
132
 
133
- if message.channel.id == 1356901938981240932: # bot-test for now, switch to official one if it works + give perms to ping the role
 
134
  new_content = message.content.replace("https://x.com", "https://fxtwitter.com").replace("https://twitter.com", "https://fxtwitter.com")
135
  # 1375548644379332658 = alerts
136
  # 1359026656114638858 = tweets
 
 
 
137
 
138
  try:
139
- await message.delete()
140
- await message.channel.send(f'Hey <@&1359026656114638858> , **yeet** just posted a new banger! 😎 \n{new_content}') #
 
141
  except discord.Forbidden:
142
  print("Missing permissions to delete or send messages.")
143
  except discord.HTTPException as e:
 
8
  import time
9
  import re
10
  from discord import Embed, Color
11
+ from discord.ext import commands, tasks
12
  from gradio_client import Client
13
  from PIL import Image
14
  from ratelimiter import RateLimiter
 
17
  import asyncio # check if used
18
  import logging
19
  import urllib.parse
20
+ import feedparser
21
 
22
  from discord.ui import Button, View
23
 
 
36
  #rate_limiter = RateLimiter(max_calls=10, period=60) # needs testing
37
  message_cache = {}
38
 
39
+
40
+ # twitter
41
+ WATCHED_USER = 'Awk20000'
42
+ CHANNEL_ID = 123456789012345678 # replace with your channel ID
43
+ last_tweet = None
44
+
45
  # stats stuff ---------------------------------------------------------------------------------------------------------------------------------------------------------
46
  number_of_messages = 0
47
  user_cooldowns = {}
 
137
  user_cooldowns[message.author.id]['timestamp'] = message.created_at
138
 
139
 
140
+ if message.channel.id == 1356901938981240932: # twitter channel
141
+
142
  new_content = message.content.replace("https://x.com", "https://fxtwitter.com").replace("https://twitter.com", "https://fxtwitter.com")
143
  # 1375548644379332658 = alerts
144
  # 1359026656114638858 = tweets
145
+
146
+ destination_channel_id = 1375549560515989677 # custom-logs
147
+ destination_channel = bot.get_channel(destination_channel_id)
148
 
149
  try:
150
+ #await message.delete() # don't delete for now- watch and see how it goes
151
+ #await message.channel.send(f'Hey tweets, **yeet** just posted a new banger! 😎 \n{new_content}')
152
+ await destination_channel.send(f'Hey tweets, **yeet** just posted a new banger! 😎 \n{new_content}')
153
  except discord.Forbidden:
154
  print("Missing permissions to delete or send messages.")
155
  except discord.HTTPException as e: