Skip to content

Commit

Permalink
編輯文檔
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYen-Tang committed Aug 7, 2020
1 parent 6861c09 commit de6ea71
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 32 deletions.
20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/----.md

This file was deleted.

63 changes: 63 additions & 0 deletions Docs/Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## **MicrosoftGraphBot** 做出貢獻
如果您有興趣為穩定基準做出貢獻,您的貢獻將分為兩類:

1. 您想提出一個新功能並實施它
- 創建有關您的預期功能的問題,我們將討論設計和實現。一旦我們同意該計劃看起來不錯,請繼續執行它。

1. 您想為未解決的問題實施功能或錯誤修復
- 在這裡查看未解決的問題:https://github.com/NTUT-SELab/MicrosoftGraphBot/issues
- 在這裡查看路線圖:https://github.com/NTUT-SELab/MicrosoftGraphBot/projects/2
- 選擇一個問題或功能,並對此問題或功能發表評論。
- 如果您需要有關特定問題的更多背景信息,請提出需求,我們將提供更多背景信息。

完成功能或錯誤修復後,請向 https://github.com/NTUT-SELab/MicrosoftGraphBot 開啟 **pull request**,針對不同情境 **pull request** 指向的目標 branch 也不同。(備註: 禁止對 master 及 release 分支開啟 **pull request**)
- 增加功能: 請將目標指向 develop 分支
- 解決Bug: 請將目標指向 hotfix 分支
- 編輯文檔: 請將目標指向 document 分支

如果您不熟悉創建請求請求,請參考以下指南:
- http://stackoverflow.com/questions/14680711/how-to-do-a-github-pull-request
- https://help.github.com/articles/creating-a-pull-request/

## Pull Request (PR)
在提出PR之前,請先提出一個問題,然後對該功能進行討論。這樣可以避免提出重複的PR,也可以簡化代碼審查過程。

## 開發 **MicrosoftGraphBot**

1. 安裝 [Dotnet core 3.1 SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1)
- 如果 電腦已經安裝 **Visual studio 2019** 或更新版本,並且安裝 **.NET Core 跨平台開發** 功能可略過該步驟。

1. 從 Github clone **MicrosoftGraphBot** 程式碼
```
git clone https://github.com/NTUT-SELab/MicrosoftGraphBot/
cd MicrosoftGraphBot
```
1. 還原相依性套件
```
dotnet restore
```
1. 如果使用 **Visual studio 2019** 或更新版本可以使用 [Visual Studio IntelliCode](https://visualstudio.microsoft.com/services/intellicode/) 提高開發效率。
- 配置內容如下: 工具->選項-> **IntelliCode**
![IntelliCode](../Imgs/IntelliCode.png)
## 測試
任何修改除了文檔都必須在 MicrosoftGraphBotTests 增加測試,以確保一切正常。
執行測試的方法有兩種:
1. Visual Studio 測試功能
- 檢視 -> Test Explorer
1. 指令:
```
dotnet test
```
## 變更日誌和文檔
請不要忘記更新變更日誌(ReleaseNote/Changelog.md)並根據需要添加文檔。
變更日誌內容範例:
```
- 支援 Outlook API [(#3)](https://github.com/NTUT-SELab/MicrosoftGraphBot/issues/3) [(pr0)](https://github.com/NTUT-SELab/MicrosoftGraphBot/pull/0)
```
Binary file added Imgs/IntelliCode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 85 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,63 @@ Microsoft Graph API 是一個 RESTful 的 Web API,可讓您存取 Microsoft Cl

本專案基於教育與開發目的建立自動化呼叫 Microsoft Graph API 機器人伺服器,該機器人會根據組態檔的設定排成呼叫 Microsoft Graph API。

應用: Microsoft365 😘
應用: Office365 開發者 😘

||Ubuntu|Windows|MacOS|
|----|----|----|----|
|master|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=master)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=master)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=master)|
|develop|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=develop&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=develop)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=develop&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=develop)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=develop&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=develop)|
|hotfix|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=hotfix&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=hotfix)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=hotfix&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=hotfix)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=hotfix&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=hotfix)|
|document|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=document&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=document)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=document&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=document)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=document&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=document)|
|release|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=release&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=release)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=release&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=release)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=release&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=release)|
|master|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=master)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=master)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=master)|
|develop|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=develop&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=develop)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=develop&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=develop)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=develop&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=develop)|
|hotfix|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=hotfix&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=hotfix)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=hotfix&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=hotfix)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=hotfix&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=hotfix)|
|document|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=document&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=document)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=document&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=document)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=document&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=document)|
|release|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=release&jobname=Build%20and%20test%20project%20on%20Ubuntu%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=release)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=release&jobname=Build%20and%20test%20project%20on%20Windows%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=release)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=release&jobname=Build%20and%20test%20project%20on%20MacOS%20platform)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=release)|

||Master|develop|hotfix|document|release|
|----|----|----|----|----|----|
|Code coverage|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/8/master)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=master)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/8/develop)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=develop)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/8/hotfix)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=hotfix)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/8/document)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=document)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/8/release)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=8&branchName=release)
|Coverage|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/9/master)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=master)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/9/develop)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=develop)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/9/hotfix)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=hotfix)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/9/document)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=document)|[![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/KennethTang/github/9/release)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=release)

||Github|Docker|
|----|----|----|
|Publish|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&stagename=Publish%20the%20current%20version%20to%20Github)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=release)|[![Build Status](https://dev.azure.com/KennethTang/Github/_apis/build/status/NTUT-SELab.MicrosoftGraphBot?branchName=master&stagename=Publish%20the%20current%20version%20to%20Dockerhub)](https://dev.azure.com/KennethTang/Github/_build/latest?definitionId=9&branchName=release)|

## 組態檔介紹:

範例文件: [appsettings.json.example](appsettings.json.example)
```
{
"JoinBotMessage": "歡迎使用 Microsoft Graph Bot",
"Cron": "0 */4 * * *",
"AdminPassword": "P@ssw0rd",
"Telegram": {
"Token": "1119104861:AAH4D1-ZdtwvFPeQARLJAdhBYPA1xK7px08"
},
"MSSQL": {
"Host": "mssql",
"Port": 1433,
"User": "sa",
"Password": "P@ssw0rd",
"DataBase": "MicrosoftGraphBot"
},
"API": {
"NumberOfServiceCall": 0,
"NumberOfMethodCall": 0
}
}
```

||配置項|說明|
|----|----|----|
||JoinBotMessage|使用者第一次與 Bot 建立聯繫時,Bot的問候語|
||Cron|Api 排程觸發的頻率,請參考 Crontab 格式|
||AdminPassword|管理者密碼,與 Bot 溝通後,輸入此密碼可取得管理者權限|
|Telegram|Token|Telegram bot token,請與 [Telegram bot father](https://core.telegram.org/bots) 聊天建立 Telegram bot 並取得 Token|
|MSSQL|Host|SQL server 主機位置 (備註:使用 Docker compose 在 MSSQL 項不需要做任何更改)|
||Port|SQL server port|
||User|SQL server 使用者|
||Password|SQL server 使用者的密碼|
||DataBase|資料庫名稱|
|API|NumberOfServiceCall|每次呼叫 API 時,呼叫 API 種類數量的上限 例如: Outlook API|
||NumberOfMethodCall|每個 API 種類,呼叫 API 數量的上限 例如: List messages|


## 架設方法:
[Github Release](https://github.com/NTUT-SELab/MicrosoftGraphBot/releases) 下載最新的 appsettings.json(應用程式配置文件)
Expand All @@ -28,21 +72,29 @@ Microsoft Graph API 是一個 RESTful 的 Web API,可讓您存取 Microsoft Cl
- Windows
1. 開啟 Powershell,並切換至 **docker.tar.gz** 解壓縮後的目錄
1. 第一次執行需要建立必要資料夾
`PS C:\docker> .\CreateContainerFolder.ps1`
```
PS C:\docker> .\CreateContainerFolder.ps1
```
1. 將 appsettings.json 移動至 docker 資料夾下的 bot 資料夾內
1. 編輯 appsettings.json 文件的內容
1. 建立並啟動容器
`PS C:\docker> docker-compose up -d`
```
PS C:\docker> docker-compose up -d
```
- Linux & MacOS
1. 切換至 **docker.tar.gz** 解壓縮後的目錄
1. 第一次執行需要建立必要資料夾
`root@docker_server:~/docker$ .\CreateContainerFolder.sh`
```
root@docker_server:~/docker$ .\CreateContainerFolder.sh
```
1. 將 appsettings.json 移動至 docker 資料夾下的 bot 資料夾內
1. 編輯 appsettings.json 文件的內容
1. 建立並啟動容器
`root@docker_server:~/docker$ docker-compose up -d`
```
root@docker_server:~/docker$ docker-compose up -d
```
### Windows(x64):
待編輯
Expand All @@ -53,6 +105,28 @@ Microsoft Graph API 是一個 RESTful 的 Web API,可讓您存取 Microsoft Cl
### MacOS(x64):
待編輯
## 支援 API:
**未來還會持續更新新的Api**
### [Outlook API](https://github.com/NTUT-SELab/MicrosoftGraphBot/issues/3):
- List messages
- Create Message
- Get message
- Update message
- Delete message
- message: send
## 貢獻:
我們將貢獻分為3類:
1. 提出功能需求,但無撰寫程式能力
- 開啟新的 issue,並使用 **功能要求** 模板
1. 提出錯誤報告,但無撰寫程式能力
- 開啟新的 issue,並使用 **錯誤報告** 模板
1. 有撰寫程式能力者
- 請參考 [Contributing.md](./Docs/Contributing.md)
## 技術:
- C#
- Dependency injection
Expand Down
9 changes: 9 additions & 0 deletions ReleaseNotes/Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Release - <version>

## 新功能:

## 變更:

## Bug 修復:

## 文件:
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ stages:
displayName: 'Train intelliCode model'
dependsOn:
- Build_and_Test
condition: succeeded()
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/develop'))
jobs:
- job: 'Training'
displayName: 'Train intelliCode model'
Expand Down

0 comments on commit de6ea71

Please sign in to comment.