-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Conversation
…o instagrambot-master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong method resolution order. Method super() can't find right function
|
||
class Bot(API): | ||
class Bot(API, BotArchive, BotBlock, BotComment, BotDelete, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong method resolution order. API must be in end
super(Bot, self).__init__() | ||
|
||
stop_words=None): | ||
super(self.__class__, self).__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API init
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not self.__class__
delay.small_delay(self) | ||
media = self.get_media_info(media_id) | ||
media = media[0] if isinstance(media, list) else media | ||
if super(self.__class__, self).archiveMedia(media, undo): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
return False | ||
if limits.check_if_bot_can_block(self): | ||
delay.block_delay(self) | ||
if super(self.__class__, self).block(user_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
user_id = self.convert_to_user_id(user_id) | ||
if limits.check_if_bot_can_unblock(self): | ||
delay.unblock_delay(self) | ||
if super(self.__class__, self).unblock(user_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
class BotPhoto(object): | ||
def upload_photo(self, photo, caption=None, upload_id=None): | ||
delay.small_delay(self) | ||
if super(self.__class__, self).uploadPhoto(photo, caption, upload_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
caption = media['caption']['text'] | ||
with open('{path}{0}_{1}.txt'.format(media['user']['username'], media_id, path=path), encoding='utf8', mode='w') as f: | ||
f.write(caption) | ||
photo = super(self.__class__, self).downloadPhoto( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
return True # whitelisted user | ||
if limits.check_if_bot_can_unfollow(self): | ||
delay.unfollow_delay(self) | ||
if super(self.__class__, self).unfollow(user_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
def unlike(self, media_id): | ||
if limits.check_if_bot_can_unlike(self): | ||
delay.unlike_delay(self) | ||
if super(self.__class__, self).unlike(media_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
def upload_video(self, video, thumbnail, caption=''): | ||
delay.small_delay(self) | ||
self.logger.info("Started uploading '{video}'".format(video=video)) | ||
if not super(self.__class__, self).uploadVideo(video, thumbnail, caption): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API class method
@xen Will you fix the issues with the super class? Your pull request is awesome but there are several bugs that should be fixed! |
@xen Waiting for your fixes. |
What I purpose with this PR:
I hope it will help to maintain and develop code in the future.