()
| 619 | headers: this.headers, |
| 620 | method: "DELETE", |
| 621 | }); |
| 622 | } |
| 623 | deleteEvent() { |
| 624 | if (!this.channel.messages.has(this.id)) return; |
| 625 | if (!this.id.includes("fake") && this.channel.messageCount !== undefined) |
| 626 | this.channel.messageCount--; |
| 627 | console.log("deleted"); |
| 628 | this.channel.infinite.deleteId(this.id); |
| 629 | if (this.div) { |
| 630 | this.div.remove(); |
| 631 | this.div.innerHTML = ""; |
| 632 | this.div = undefined; |
| 633 | } |
| 634 | const prev = this.channel.idToPrev.get(this.id); |
| 635 | const next = this.channel.idToNext.get(this.id); |
| 636 | |
| 637 | this.channel.messages.delete(this.id); |
| 638 | if (this.channel.idToPrev.has(this.id) && this.channel.idToNext.has(this.id)) { |
| 639 | if (next) this.channel.idToPrev.set(next, prev); |
| 640 | if (prev) this.channel.idToNext.set(prev, next); |
| 641 | } else if (prev) { |
| 642 | this.channel.idToNext.delete(prev); |
| 643 | } else if (next) { |
| 644 | this.channel.idToPrev.delete(next); |
| 645 | } |
| 646 | if (prev) { |
| 647 | const prevMessage = this.channel.messages.get(prev); |
| 648 | if (prevMessage) { |
| 649 | prevMessage.generateMessage(); |
| 650 | } |
| 651 | } |
| 652 | if (next) { |
| 653 | const nextMessage = this.channel.messages.get(next); |
| 654 | if (nextMessage) { |
| 655 | nextMessage.generateMessage(); |
| 656 | } |
| 657 | } |
| 658 | if (this.channel.lastmessage === this || this.channel.lastmessageid === this.id) { |
| 659 | if (prev) { |
| 660 | this.channel.lastmessage = this.channel.messages.get(prev); |
| 661 | this.channel.lastmessageid = prev; |
| 662 | } else { |
| 663 | this.channel.lastmessage = undefined; |
| 664 | this.channel.lastmessageid = undefined; |
| 665 | } |
| 666 | } |
| 667 | if (this.channel.lastreadmessageid === this.id) { |
| 668 | if (prev) { |
| 669 | this.channel.lastreadmessageid = prev; |
| 670 | } else { |
| 671 | this.channel.lastreadmessageid = undefined; |
| 672 | } |
| 673 | } |
| 674 | console.log("deleted done"); |
| 675 | } |
| 676 | pollUpdate(update: pollUpdateJson) { |
no test coverage detected