Manage the Microsoft 365 Global through the telegram bot
Read in other languages: English | 简体中文
Organization.Read.All, Organization.ReadWrite.All
RoleManagement.Read.Directory, RoleManagement.ReadWrite.Directory
User.Read.All, User.ReadWrite.All
Directory.Read.All, Directory.ReadWrite.All
start - Start Robot
log - Get the log of the robot
myapp - Specify an app
newapp - Create a new app
getorg - Get organization information
getrole - Get role information
getsub - Get subscription information
getuser - Get user information
getuserbyname - Gets user information (specifies user by username)
searchuser - Get user information (by fuzzy search with username)
addUser - Add a user
cancel - Cancel the current operation
python 3.10
git clone https://github.com/bitjerry/Microsoft-365-bot.git
cd Microsoft-365-bot
-
Create a PostgresSQL database
-
Create an application
-
Setting environment variables
You need to do this from the command line:
- Create a PostgresSQL database for app
flyctl postgres create to create table
- Create app
flyctl launch
- Attach database to app
flyctl postgres attach --app <app-name> <postgres-app-name>
- Add environment variables to the app
flyctl secrets set BOT_TOKEN="xxx"
flyctl secrets set ADMIN_ID="xxx"
- Deployment Program
flyctl deploy
-
Prepare your database If you don't want to use Postgres, you can try using SQLite3 in
db/db.py
.
I have written a database core class in the py file, but I have not tested it. By the way, you can write another class to replace them, such as mysql. -
Add environment variables to the app
-
Deployment Program
pip install -r requirements.txt
python3 setup.py
If it is webhook just access /set_webhook, stop using /stop_webhook
- The program has two modes: debug and release. Mode switch in config.py
DEBUG = True
.
The public and private keys of RSA will be deleted in release mode, please note that. - Some serverless may sleep regularly. Make sure to generate RSA key pairs before deployment!!! (in the. /db directory) or keep server awake, otherwise the state will be reset after hibernation and the key pair will be lost.
- The program uses flask to implement webhook, you can use polling for local development.
- It is important to ensure that the applications created in AZ have sufficient permissions, which APIs need which permissions to view Microsoft documents.
MIT © bitjerry
2022/9/1 Mr.lin