forked from HyDevelop/PicqBotX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
989c333
commit 5ff91c5
Showing
5 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/cc/moecraft/icq/event/events/notice/EventNoticeFriendRecall.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package cc.moecraft.icq.event.events.notice; | ||
|
||
import cc.moecraft.icq.sender.returndata.returnpojo.get.RMessage; | ||
import cc.moecraft.icq.user.User; | ||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
import lombok.*; | ||
|
||
/** | ||
* 好友消息撤回事件 | ||
* | ||
* @author CrazyKid ([email protected]) | ||
* @since 2020/12/30 21:16 | ||
*/ | ||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@Setter(AccessLevel.NONE) | ||
@ToString(callSuper = true) | ||
public class EventNoticeFriendRecall extends EventNotice { | ||
/** | ||
* 被撤回的消息 ID | ||
*/ | ||
@SerializedName("message_id") | ||
@Expose | ||
protected Long messageId; | ||
|
||
/** | ||
* 获取消息发送者的用户对象 | ||
* | ||
* @return 消息发送者的用户对象 | ||
*/ | ||
public User getSender() { | ||
return getBot().getUserManager().getUserFromID(userId); | ||
} | ||
|
||
/** | ||
* 获取被撤回的消息 | ||
* | ||
* @param raw 是否获取未经处理的消息 | ||
* @return 消息内容 | ||
*/ | ||
public String getMessage(boolean raw) { | ||
RMessage message = getHttpApi().getMsg(messageId).getData(); | ||
return raw ? message.getMessageRaw() : message.getMessage(); | ||
} | ||
|
||
@Override | ||
public boolean contentEquals(Object o) { | ||
if (!(o instanceof EventNoticeFriendRecall)) return false; | ||
EventNoticeFriendRecall other = (EventNoticeFriendRecall) o; | ||
|
||
return super.contentEquals(o) && | ||
other.getMessageId().equals(this.getMessageId()); | ||
} | ||
} |