|
|
@ -64,6 +64,7 @@ class Bot(discord.Client):
|
|
|
|
super().__init__()
|
|
|
|
super().__init__()
|
|
|
|
|
|
|
|
|
|
|
|
async def process_event(self, service, data):
|
|
|
|
async def process_event(self, service, data):
|
|
|
|
|
|
|
|
await self.wait_until_ready()
|
|
|
|
action = getattr(self, 'process_{0}_event'.format(service))
|
|
|
|
action = getattr(self, 'process_{0}_event'.format(service))
|
|
|
|
await action(data)
|
|
|
|
await action(data)
|
|
|
|
|
|
|
|
|
|
|
@ -124,10 +125,31 @@ class Bot(discord.Client):
|
|
|
|
api = self.get_twitter_api(user_id)
|
|
|
|
api = self.get_twitter_api(user_id)
|
|
|
|
if not api:
|
|
|
|
if not api:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
await self.wait_until_ready()
|
|
|
|
|
|
|
|
channel = self.get_channel(twitter_channel_id)
|
|
|
|
channel = self.get_channel(twitter_channel_id)
|
|
|
|
if channel:
|
|
|
|
if channel:
|
|
|
|
for tweet in tweets:
|
|
|
|
for tweet in tweets:
|
|
|
|
|
|
|
|
if tweet.get('user', {}).get('id_str') == user_id:
|
|
|
|
|
|
|
|
retweeted = tweet.get('retweeted_status')
|
|
|
|
|
|
|
|
if retweeted:
|
|
|
|
|
|
|
|
tweet = retweeted
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
quoted = tweet.get('quoted_status')
|
|
|
|
|
|
|
|
if quoted:
|
|
|
|
|
|
|
|
tweet = quoted
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
reply_to = tweet.get('in_reply_to_status_id_str')
|
|
|
|
|
|
|
|
if reply_to:
|
|
|
|
|
|
|
|
original = api.get_status(reply_to)
|
|
|
|
|
|
|
|
if original:
|
|
|
|
|
|
|
|
await channel.send(embed=self.make_twitter_embed(original))
|
|
|
|
|
|
|
|
elif tweet.get('user', {}).get('verified'):
|
|
|
|
|
|
|
|
reply_to = tweet.get('in_reply_to_status_id_str')
|
|
|
|
|
|
|
|
if reply_to:
|
|
|
|
|
|
|
|
original = api.get_status(reply_to)
|
|
|
|
|
|
|
|
if original:
|
|
|
|
|
|
|
|
await channel.send(embed=self.make_twitter_embed(original))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
continue
|
|
|
|
await channel.send(embed=self.make_twitter_embed(tweet))
|
|
|
|
await channel.send(embed=self.make_twitter_embed(tweet))
|
|
|
|
|
|
|
|
|
|
|
|
def format_remainder(self, seconds):
|
|
|
|
def format_remainder(self, seconds):
|
|
|
|