[twitter] Add username to twitter bots
This commit is contained in:
parent
b66f906f88
commit
a7f0898fd7
|
@ -38,6 +38,9 @@ class TwitterBot(Censor):
|
||||||
if self.twitter_model.dms_since_id is None:
|
if self.twitter_model.dms_since_id is None:
|
||||||
logger.debug('since_id is None in model, fetch newest dm id')
|
logger.debug('since_id is None in model, fetch newest dm id')
|
||||||
await self._poll_direct_messages()
|
await self._poll_direct_messages()
|
||||||
|
user = await self.client.user
|
||||||
|
if user.screen_name:
|
||||||
|
await self.twitter_model.update(username=user.screen_name)
|
||||||
logger.debug('Starting Twitter bot: %s' % self.twitter_model.__dict__)
|
logger.debug('Starting Twitter bot: %s' % self.twitter_model.__dict__)
|
||||||
await gather(self.poll(), self.push())
|
await gather(self.poll(), self.push())
|
||||||
except CancelledError:
|
except CancelledError:
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Twitter(Model):
|
||||||
mentions_since_id: Integer(allow_null=True) = None
|
mentions_since_id: Integer(allow_null=True) = None
|
||||||
access_token: Text()
|
access_token: Text()
|
||||||
access_token_secret: Text()
|
access_token_secret: Text()
|
||||||
|
username: Text(allow_null=True) = None
|
||||||
verified: Boolean() = False
|
verified: Boolean() = False
|
||||||
enabled: Boolean() = False
|
enabled: Boolean() = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue