TweetDelete | Delete old tweets from your Twitter timeline
kandi X-RAY | TweetDelete Summary
kandi X-RAY | TweetDelete Summary
Delete old tweets from your Twitter timeline.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Main function for tweets .
TweetDelete Key Features
TweetDelete Examples and Code Snippets
Community Discussions
Trending Discussions on TweetDelete
QUESTION
I'm in the process of building a new Discord bot (of course), and I've been working on the Twitter integration using Tweetinvi. I've got most of the Twitter streaming bits working normally (at least, as far as I can tell in my simplified testing), but I wanted to have the bot modify/delete posts in Discord if the Tweet is subsequently deleted. Tweetinvi has a TweetDeleted
event that I can use to detect this as a part of my stream, but I'm having difficulty figuring out how to find the post in Discord.
What I'd like to do is "simply":
- Search for posts (embeds) from the author (defined by the original Tweet)
- Find the post with a matching
.Url
value in the embed - Replace that post with a message like "
THIS TWEET WAS DELETED
".
The problem I'm running into, however, is I can't seem to find a way to do "step 1" - search for and return any posts from the specified author. The only option I've found so far is the GetMessagesAsync
method, but that doesn't seem to have a way to filter the results. Plus, with the "soft limit" of 100 messages, I worry that I could still not find the message I'm looking to delete.
I post the embeds using the DiscordSocketClient
object in my class like this:
ANSWER
Answered 2020-Aug-16 at 14:06- Discord does not provide an endpoints for Bots to search/filter on specific criteria. The only way to retrieve messages is to use the
GetMessagesAsync()
method - The limit for
GetMessagesAsync()
is technicallyInt32.MaxValue
. The 100 that you see is simply the default. This is because Discord will return in chunks; 100 messages at a time. For example if you set the limit to 1000, you will get 10 chunks of 100. - Possible issues with retrieving a large number of messages? The main issue would be the length of time taken to retrieve the messages, which could block the gateway unless offload the process to its own task.
A possible solution would be to implement your own system for linking and storing twitter posts to discord posts. Could be as simple as a dictionary of Twitter post id and discord post id which would allow you to easily find the message id related to a given twitter post.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install TweetDelete
You can use TweetDelete like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page