GithubHelp home page GithubHelp logo

telegram.net's Introduction

Telegram.Net

Build status

Unofficial Telegram (http://telegram.org) client library implemented in C#.

Supported features:

  • Library supports API Layer 23 (latest officially documented Api. See https://core.telegram.org/schema)
  • Automatic reconnection on network absence
  • Main requests are implemented as methods in TelegramClient. If your one isn't yet there, just use SendRpcRequest
  • Update notifications handling

Upcoming features:

  • Session storing in custom format
  • Convert library to PCL
  • Handle bad system time settings

Table of contents?

How do I add this to my project?

Library isn't ready for production usage, that's why no Nu-Get package available.

To use it follow next steps:

  1. Clone Telegram.Net from GitHub
  2. Compile source with VS2015
  3. Add reference to Telegram.Net.Core.dll to your project.

Starter Guide

Quick Configuration

Telegram API isn't that easy to start. You need to do some configuration first.

  1. Create a developer account in Telegram.
  2. Goto API development tools and copy API_ID and API_HASH from your account. You'll need it later.

Initializing client

To initialize client you need to implement your own instance of ISessionStore which Telegram.Net will use to save Session info.

class MySesionStore: ISessionStore
{
	//...
}

Next, create client instance and pass all required parameters. You need your API_ID and API_HASH for this step.

var client = new TelegramClient(sessionStore, apiId, apiHash);

If you are going to handle Update notifications from Telegram server or network connection state, then you should subscribe to appropriate events.

client.UpdateMessage += UpdateHandler;
client.ConnectionStateChanged += ConnectionHandler;

And finally you need to call Start method. It returns bool indicating if client has successfully connected to the server. If not, library will automatically try to reconnect every 8 seconds.

Now you can call methods.

All methods except IsPhoneRegistered requires an authenticated user. Example usage of all methods you can find in [Tests].

FAQ

I get an exception: "Channel was closed"

This can happen when sending your request was successfull but before receiving the response network connection was lost. This should be considered as missing internet connection situation.

Why I get FLOOD_WAIT error?

It's Telegram restrictions. See this

License

The MIT License

Copyright (c) 2016 Stepan Tyzhai

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copy of the parental license.

The MIT License

Copyright (c) 2015 Ilya Pirozhenko http://www.sochix.ru/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

telegram.net's People

Contributors

ctphu avatar

Watchers

James Cloos 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.