mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 07:20:29 +03:00
Fix commands (#791)
* Fix commands and added more * Add /me & /shrug commands * Add help command * Fix cmd descriptions * Add reason in command
This commit is contained in:
parent
0f6f65045d
commit
ac155bbf4c
8 changed files with 351 additions and 72 deletions
|
|
@ -257,10 +257,10 @@ class RoomList extends EventEmitter {
|
|||
const latestMDirects = this.getMDirects();
|
||||
|
||||
latestMDirects.forEach((directId) => {
|
||||
const myRoom = this.matrixClient.getRoom(directId);
|
||||
if (this.mDirects.has(directId)) return;
|
||||
this.mDirects.add(directId);
|
||||
|
||||
const myRoom = this.matrixClient.getRoom(directId);
|
||||
if (myRoom === null) return;
|
||||
if (myRoom.getMyMembership() === 'join') {
|
||||
this.directs.add(directId);
|
||||
|
|
@ -268,6 +268,19 @@ class RoomList extends EventEmitter {
|
|||
this.emit(cons.events.roomList.ROOMLIST_UPDATED);
|
||||
}
|
||||
});
|
||||
|
||||
[...this.directs].forEach((directId) => {
|
||||
if (latestMDirects.has(directId)) return;
|
||||
this.mDirects.delete(directId);
|
||||
|
||||
const myRoom = this.matrixClient.getRoom(directId);
|
||||
if (myRoom === null) return;
|
||||
if (myRoom.getMyMembership() === 'join') {
|
||||
this.directs.delete(directId);
|
||||
this.rooms.add(directId);
|
||||
this.emit(cons.events.roomList.ROOMLIST_UPDATED);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.matrixClient.on('Room.name', (room) => {
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ class RoomsInput extends EventEmitter {
|
|||
return this.roomIdToInput.get(roomId)?.isSending || false;
|
||||
}
|
||||
|
||||
async sendInput(roomId) {
|
||||
async sendInput(roomId, msgType) {
|
||||
const room = this.matrixClient.getRoom(roomId);
|
||||
const input = this.getInput(roomId);
|
||||
input.isSending = true;
|
||||
|
|
@ -288,7 +288,7 @@ class RoomsInput extends EventEmitter {
|
|||
const rawMessage = input.message;
|
||||
let content = {
|
||||
body: rawMessage,
|
||||
msgtype: 'm.text',
|
||||
msgtype: msgType ?? 'm.text',
|
||||
};
|
||||
|
||||
// Apply formatting if relevant
|
||||
|
|
@ -459,12 +459,14 @@ class RoomsInput extends EventEmitter {
|
|||
const room = this.matrixClient.getRoom(roomId);
|
||||
const isReply = typeof mEvent.getWireContent()['m.relates_to']?.['m.in_reply_to'] !== 'undefined';
|
||||
|
||||
const msgtype = mEvent.getWireContent().msgtype ?? 'm.text';
|
||||
|
||||
const content = {
|
||||
body: ` * ${editedBody}`,
|
||||
msgtype: 'm.text',
|
||||
msgtype,
|
||||
'm.new_content': {
|
||||
body: editedBody,
|
||||
msgtype: 'm.text',
|
||||
msgtype,
|
||||
},
|
||||
'm.relates_to': {
|
||||
event_id: mEvent.getId(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue