Skip to content

Commit 7dad1ec

Browse files
committed
Add visual studio quickstart guide
1 parent 835e316 commit 7dad1ec

File tree

7 files changed

+79
-4
lines changed

7 files changed

+79
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
_site
55
Gemfile.lock
66
node_modules
7-
vendor
7+
_vendor
8+
vendor

Media/CreateProjectVisualStudio.gif

204 KB
Loading
475 KB
Loading

Media/RunProjectVisualStudio.jpg

65.4 KB
Loading
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
layout: default
3+
title: Quickstart Visual Studio
4+
parent: Quickstart overview
5+
nav_order: 2
6+
---
7+
8+
# Quickstart Guide (Visual Studio)
9+
10+
Hey 👋,
11+
thanks for using [RxTelegram.Bot](https://github.com/RxTelegram/RxTelegram.Bot). This quickstart guide will give you an easy 3 Steps Solution how you can get started with RxTelegram.Bot using Visual Studio. Quickstart guides are also Available for the Terminal or Rider.
12+
13+
## 1. Bot Father
14+
15+
Before we can get started you need to create a Telegram Bot by visiting [@BotFather](https://t.me/BotFather) with any Telegram client and create a new bot. He will give you an access token which you need to authorize your bot at every request, but do not worry we will handle this for you.
16+
17+
## 2. Hello World - by clicking
18+
19+
This Tutotial will not explain how to get Visual Studio installed, but you need a working Visual Studio installation __with the ".NET Core cross-platform development" workload installed__ so go and set it up. It is quite simple just ask any search engine and you will find many tutorial or click [here](https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2019) follow the offical tutorial by Microsoft.
20+
21+
So since you have a running Visual Studio installation, lets begin.
22+
23+
### 2.1 Create a Project
24+
25+
First of all you have to create a new "Console Project" as shown in the video below.
26+
![Creating a new Project in Visual Studio](../Media/CreateProjectVisualStudio.gif)
27+
28+
### 2.2 Install RxTelegram.Bot
29+
30+
Now you have to install the [RxTelegram.Bot](https://github.com/RxTelegram/RxTelegram.Bot) Nuget package as shown in the video below.
31+
![Installing RxTelegram.Bot](../Media/InstallNugetPackageVisualStudio.gif)
32+
33+
### 2.3 Paste the code
34+
35+
Open the ```Programm.cs``` file and paste the following content.
36+
37+
> **Replace ACCESS_TOKEN_HERE with the access token Botfaher gave you.**
38+
39+
```csharp
40+
using System;
41+
using RxTelegram.Bot;
42+
43+
namespace Awesome {
44+
class Program {
45+
public static void Main () {
46+
var botClient = new TelegramBot ("ACCESS_TOKEN_HERE");
47+
var me = botClient.GetMe().Result;
48+
Console.WriteLine (
49+
$"Hello, World! I am user {me.Id} and my name is {me.FirstName}."
50+
);
51+
}
52+
}
53+
}
54+
```
55+
56+
## 3. Run your programm
57+
58+
The last step is quid simple. Just click on the "Awesome" button and your awesome Project will start.
59+
![Running the project](../Media/RunProjectVisualStudio.jpg)
60+
61+
## Troubleshooting
62+
63+
### Invalid Bot Token
64+
65+
```text
66+
Unhandled exception. RxTelegram.Bot.Exceptions.InvalidTokenException: The given bot token is not valid. See "https://core.telegram.org/bots/api#authorizing-your-bot" for further information. Token was: ACCESS_TOKEN_HERE
67+
at RxTelegram.Bot.BotInfo.ValidateToken(String token)
68+
at RxTelegram.Bot.BotInfo..ctor(String token)
69+
at RxTelegram.Bot.TelegramBot..ctor(String token)
70+
at Awesome.Program.Main() in C:\Users\nikwe\Downloads\asf\Program.cs:line 7
71+
```
72+
73+
If you get an Exception like this it is most likely that you did not replaced the access token in the code sample or you copied the wrong one.

Quickstart/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
layout: default
3-
title: Quickstart overview
3+
title: Quickstart Overview
44
has_child: true
55
nav_order: 1
66
---
77

88
# Quickstart Overview
99

10-
* [Quickstart Guide using the Terminal](QuickstartGuideTerminal.md)
10+
* [Quickstart Guide using the Terminal](QuickstartGuideTerminal.md)
11+
* [Quickstart Guide using the Visual Studio](QuickstartGuideVisualStudio.md)

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
command: jekyll serve --host 0.0.0.0 --drafts --config _config.yml --watch --livereload --force_polling
88
volumes:
99
- .:/srv/jekyll
10-
- ./vendor/bundle:/usr/local/bundle
10+
- ./_vendor/bundle:/usr/local/bundle
1111

1212
ports:
1313
- 4000:4000

0 commit comments

Comments
 (0)