Removed, using typescript
This commit is contained in:
		
							
								
								
									
										26
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								index.js
									
									
									
									
									
								
							@@ -1,26 +0,0 @@
 | 
				
			|||||||
const sdk = require("matrix-bot-sdk");
 | 
					 | 
				
			||||||
const MatrixClient = sdk.MatrixClient;
 | 
					 | 
				
			||||||
const SimpleFsStorageProvider = sdk.SimpleFsStorageProvider;
 | 
					 | 
				
			||||||
const AutojoinRoomsMixin = sdk.AutojoinRoomsMixin;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const homeserverUrl = "";
 | 
					 | 
				
			||||||
const accessToken = "";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const storage = new SimpleFsStorageProvider("config/bot.json");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const client = new MatrixClient(homeserverUrl, accessToken, storage);
 | 
					 | 
				
			||||||
AutojoinRoomsMixin.setupOnClient(client);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
client.start().then(() => console.log("Client started!"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
client.on("room.message", (roomId, event) => {
 | 
					 | 
				
			||||||
    if (! event["content"]) return;
 | 
					 | 
				
			||||||
    const sender = event["sender"];
 | 
					 | 
				
			||||||
    const body = event["content"]["body"];
 | 
					 | 
				
			||||||
    console.log(`${roomId}: ${sender} says '${body}`);
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
client.sendMessage(roomId, {
 | 
					 | 
				
			||||||
    "msgtype": "m.text",
 | 
					 | 
				
			||||||
    "body": "This is message text.",
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user