GithubHelp home page GithubHelp logo

alikaptanoglu / keylesstwitter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lin-e/keylesstwitter

0.0 1.0 0.0 16 KB

A small module I was working on for a friend's project that allows (very) basic interaction with Twitter without using an API key

License: Other

C# 100.00%

keylesstwitter's Introduction

KeylessTwitter

A small module I was working on for a friend's project that allows (very) basic interaction with Twitter without using an API key

Dependencies

Features

  • Signing in
  • Sending simple tweets
  • Sending tweets with media
  • Sending tweets with more than one image (media item)
  • Direct Messages
  • DM Received Event
  • New Tweet Event
  • Notifications
  • Following / Unfollowing
  • A lot more...

Usage

Starting usage

Twitter mainTwitter = new Twitter("USERNAME", "PASSWORD"); // Creates a new Twitter with the specified credentials
mainTwitter.directMessage += MainTwitter_directMessage; // Optional event handler, which fires when the user receives a DM
mainTwitter.tryLogin(); // Logs in to the Twitter account (returns true or false depending on login status)

Sending a tweet

mainTwitter.Tweet("Hello world! #KeylessTwitter"); // Tweets the specified tweet. Remember, there is a 140 character limit, which will cause a 403 if exceeded

Tweeting an image (by URL)

// The general idea is that they use byte[], which allows for you to load from a file if needed
mainTwitter.TweetImage(new WebClient().DownloadData("http://example.com/my_twitter_picture.jpg"), "Check out this image!"); // Tweets from said URL

Tweeting images (by URLs)

mainTwitter.TweetImages(new byte[][] { new WebClient().DownloadData("http://example.com/my_twitter_picture.jpg"), new WebClient().DownloadData("http://example.com/my_other_picture.jpg") }, "Check out these images!"); // Tweets from the specified URLs

Follow / Unfollow a user

mainTwitter.Follow("c0mmodity"); // Follows me (shameless plug)
mainTwitter.Unfollow("c0mmodity"); // Unfollows specified user

DM Event Example

private static void MainTwitter_directMessage(string conversationID, string messageContents) // Auto generated
{
    Console.WriteLine("{0}: {1}", conversationID, messageContents); // Outputs the message and its conversation ID
    mainTwitter.SendMessage_ID(conversationID, messageContents); // Replies with the same message (using Twitter.SendMessage_ID)
}

keylesstwitter's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.