mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Added support for deleting dm's with the new Twitter API methods
This commit is contained in:
parent
ca3f8779b8
commit
40105f37ed
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## changes in this version
|
## changes in this version
|
||||||
|
|
||||||
|
* Added support for deleting direct messages by using the new Twitter API methods.
|
||||||
* When quoting a retweet, the quote will be made to the original tweet instead of the retweet.
|
* When quoting a retweet, the quote will be made to the original tweet instead of the retweet.
|
||||||
* If the sent direct messages buffer is hidden, TWBlue should keep loading everything as expected. ([#246](https://github.com/manuelcortez/TWBlue/issues/246))
|
* If the sent direct messages buffer is hidden, TWBlue should keep loading everything as expected. ([#246](https://github.com/manuelcortez/TWBlue/issues/246))
|
||||||
* There is a new soundpack, called FreakyBlue (Thanks to [Andre Louis](https://twitter.com/FreakyFwoof)) as a new option in TWBlue. This pack can be the default in the next stable, so users can take a look and share their opinion in snapshot versions. ([#247](https://github.com/manuelcortez/TWBlue/issues/247))
|
* There is a new soundpack, called FreakyBlue (Thanks to [Andre Louis](https://twitter.com/FreakyFwoof)) as a new option in TWBlue. This pack can be the default in the next stable, so users can take a look and share their opinion in snapshot versions. ([#247](https://github.com/manuelcortez/TWBlue/issues/247))
|
||||||
|
@ -557,7 +557,6 @@ class baseBufferController(baseBuffers.buffer):
|
|||||||
self.session.twitter.destroy_status(id=self.get_right_tweet()["id"])
|
self.session.twitter.destroy_status(id=self.get_right_tweet()["id"])
|
||||||
self.session.db[self.name].pop(index)
|
self.session.db[self.name].pop(index)
|
||||||
self.buffer.list.remove_item(index)
|
self.buffer.list.remove_item(index)
|
||||||
# if index > 0:
|
|
||||||
except TwythonError:
|
except TwythonError:
|
||||||
self.session.sound.play("error.ogg")
|
self.session.sound.play("error.ogg")
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class Twython(EndpointsMixin, object):
|
|||||||
if k in ('timeout', 'allow_redirects', 'stream', 'verify'):
|
if k in ('timeout', 'allow_redirects', 'stream', 'verify'):
|
||||||
requests_args[k] = v
|
requests_args[k] = v
|
||||||
|
|
||||||
if method == 'get':
|
if method == 'get' or method == 'delete':
|
||||||
requests_args['params'] = params
|
requests_args['params'] = params
|
||||||
else:
|
else:
|
||||||
# Check for json_encoded so we will sent params as "data" or "json"
|
# Check for json_encoded so we will sent params as "data" or "json"
|
||||||
@ -242,7 +242,7 @@ class Twython(EndpointsMixin, object):
|
|||||||
(e.g. search/tweets)
|
(e.g. search/tweets)
|
||||||
:type endpoint: string
|
:type endpoint: string
|
||||||
:param method: (optional) Method of accessing data, either
|
:param method: (optional) Method of accessing data, either
|
||||||
GET or POST. (default GET)
|
GET, POST or DELETE. (default GET)
|
||||||
:type method: string
|
:type method: string
|
||||||
:param params: (optional) Dict of parameters (if any) accepted
|
:param params: (optional) Dict of parameters (if any) accepted
|
||||||
the by Twitter API endpoint you are trying to
|
the by Twitter API endpoint you are trying to
|
||||||
@ -281,6 +281,10 @@ class Twython(EndpointsMixin, object):
|
|||||||
"""Shortcut for POST requests via :class:`request`"""
|
"""Shortcut for POST requests via :class:`request`"""
|
||||||
return self.request(endpoint, 'POST', params=params, version=version, json_encoded=json_encoded)
|
return self.request(endpoint, 'POST', params=params, version=version, json_encoded=json_encoded)
|
||||||
|
|
||||||
|
def delete(self, endpoint, params=None, version='1.1', json_encoded=False):
|
||||||
|
"""Shortcut for delete requests via :class:`request`"""
|
||||||
|
return self.request(endpoint, 'DELETE', params=params, version=version, json_encoded=json_encoded)
|
||||||
|
|
||||||
def get_lastfunction_header(self, header, default_return_value=None):
|
def get_lastfunction_header(self, header, default_return_value=None):
|
||||||
"""Returns a specific header from the last API call
|
"""Returns a specific header from the last API call
|
||||||
This will return None if the header is not present
|
This will return None if the header is not present
|
||||||
|
@ -329,10 +329,10 @@ class EndpointsMixin(object):
|
|||||||
"""Destroys the direct message specified in the required ``id`` parameter
|
"""Destroys the direct message specified in the required ``id`` parameter
|
||||||
|
|
||||||
Docs:
|
Docs:
|
||||||
https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message
|
https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.post('direct_messages/destroy', params=params)
|
return self.delete('direct_messages/events/destroy', params=params)
|
||||||
|
|
||||||
def send_direct_message(self, **params):
|
def send_direct_message(self, **params):
|
||||||
"""Sends a new direct message to the specified user from the
|
"""Sends a new direct message to the specified user from the
|
||||||
|
Loading…
Reference in New Issue
Block a user