Skip to content

Commit

Permalink
Send random string as DM to avoid overzealous abuse detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dandv committed Jul 13, 2018
1 parent e53bb4f commit 5ee2ce4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions twitter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,20 @@ it("should unfollow user", async () => {

it("should DM user", async () => {
const client = newClient();
const randomString = Math.random()
.toString(36)
.substr(2, 11);

// POST with body and no parameters per https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/guides/direct-message-migration.html
const response = await client.post("direct_messages/events/new", {
event: {
type: "message_create",
message_create: {
target: {
recipient_id: "15008676"
recipient_id: "50426068"
},
message_data: {
text: "Hello from twitter-lite"
text: randomString
}
}
}
Expand All @@ -169,7 +172,7 @@ it("should DM user", async () => {
created_timestamp: expect.any(String),
message_create: {
message_data: {
text: "Hello from twitter-lite"
text: randomString
}
}
}
Expand Down

0 comments on commit 5ee2ce4

Please sign in to comment.