Skip to content

Latest commit

 

History

History
54 lines (34 loc) · 1.54 KB

README.md

File metadata and controls

54 lines (34 loc) · 1.54 KB

twim

A X(Formally known as Twitter) API wrapper library for Nim. Inspired by Tweepy and twitter.nim.

Be aware I only have free-tier API access to the X API so I will only develop for those endpoints.

This uses OAuth 1.0a.

Endpoints supported:

  • POST v2/tweets
  • POST media/upload

Install

nimble install twim

Example

import twim

when isMainModule:

  # This is API Key
  const CONSUMER_KEY = "CONSUMERKEY"

  # This is the API secret key
  const CONSUMER_SECRET = "CONSUMERSECRET"

  # This is the Authentication Access Token
  const ACCESS_TOKEN = "ACCESSTOKEN"

  # This is the Authentication Access Secret
  const TOKEN_SECRET = "TOKENSECRET"

  const xCli = newXAPI(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, TOKEN_SECRET)
  let res = xCli.PostTextTweet("Hello from twim!")
  echo res

Look at the OMORI upscale bot as an example for how to use this API to deploy a bot on Twitter.

Dependencies

  • nimcrypto - For SHA1-HMAC encoding to encode signature

RoadMap:

  • Look at the GitHub Project
  • All progress will be on unstable until the issue is completed
  • If there's any feature you'd like to see, please submit an issue 😄