server = server_id : int
Tchan = server.get_channel(channel_id : int)
import tweepy
api_key = "string"
api_key_secret = "string"
access_token = "string-8z95tnY8Fid91sFUxACJeMQWv4RsI6D"
access_token_secret = "string"
authenticator = tweepy.OAuthHandler(api_key, api_key_secret)
authenticator.set_access_token(access_token, access_token_secret)
api = tweepy.API(authenticator, wait_on_rate_limit=True)
from tweepy.asynchronous.streaming import AsyncStream
class AsyncStream(tweepy.asynchronous.AsyncStream):
async def on_status(self, status):
if hasattr(status, 'retweeted_status'):
return False
elif status.in_reply_to_status_id != None:
return False
elif status.in_reply_to_screen_name != None:
return False
elif status.in_reply_to_user_id != None:
return False
else:
await Tchan.send(status.text)
myStream = AsyncStream(api_key, api_key_secret, access_token, access_token_secret)
myStream.filter(track=["python"])