mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
feat: Message.crosspost and fix latest commit
This commit is contained in:
parent
050d5a3973
commit
c6e6a6392e
@ -250,6 +250,23 @@ export class Message implements Model {
|
||||
);
|
||||
}
|
||||
|
||||
async crosspost() {
|
||||
const message = await this.session.rest.runMethod<DiscordMessage>(
|
||||
this.session.rest,
|
||||
"POST",
|
||||
Routes.CHANNEL_MESSAGE_CROSSPOST(this.channelId, this.id),
|
||||
);
|
||||
|
||||
return new Message(this.session, message);
|
||||
}
|
||||
|
||||
/*
|
||||
* alias of Message.crosspost
|
||||
* */
|
||||
get publish() {
|
||||
return this.crosspost;
|
||||
}
|
||||
|
||||
inGuild(): this is { guildId: Snowflake } & Message {
|
||||
return !!this.guildId;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import type { Snowflake } from "../util/Snowflake.ts";
|
||||
import type { Session } from "../session/Session.ts";
|
||||
import type { DiscordChannel } from "../vendor/external.ts";
|
||||
import TextChannel from "./TextChannel.ts";
|
||||
import Message from "./Message.ts";
|
||||
|
||||
export class NewsChannel extends TextChannel {
|
||||
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
||||
@ -9,6 +10,14 @@ export class NewsChannel extends TextChannel {
|
||||
this.defaultAutoArchiveDuration = data.default_auto_archive_duration;
|
||||
}
|
||||
defaultAutoArchiveDuration?: number;
|
||||
|
||||
crosspostMessage(messageId: Snowflake): Promise<Message> {
|
||||
return Message.prototype.crosspost.call({ id: messageId, channelId: this.id, session: this.session });
|
||||
}
|
||||
|
||||
get publishMessage() {
|
||||
return this.crosspostMessage;
|
||||
}
|
||||
}
|
||||
|
||||
export default NewsChannel;
|
||||
|
@ -118,15 +118,15 @@ export class TextChannel extends GuildChannel {
|
||||
}
|
||||
|
||||
async addReaction(messageId: Snowflake, reaction: ReactionResolvable) {
|
||||
await Message.prototype.addReaction.call({ channelId: this.id, id: messageId }, reaction);
|
||||
await Message.prototype.addReaction.call({ channelId: this.id, id: messageId, session: this.session }, reaction);
|
||||
}
|
||||
|
||||
async removeReaction(messageId: Snowflake, reaction: ReactionResolvable, options?: { userId: Snowflake }) {
|
||||
await Message.prototype.removeReaction.call({ channelId: this.id, id: messageId }, reaction, options);
|
||||
await Message.prototype.removeReaction.call({ channelId: this.id, id: messageId, session: this.session }, reaction, options);
|
||||
}
|
||||
|
||||
async removeReactionEmoji(messageId: Snowflake, reaction: ReactionResolvable) {
|
||||
await Message.prototype.removeReactionEmoji.call({ channelId: this.id, id: messageId }, reaction);
|
||||
await Message.prototype.removeReactionEmoji.call({ channelId: this.id, id: messageId, session: this.session }, reaction);
|
||||
}
|
||||
|
||||
async nukeReactions(messageId: Snowflake) {
|
||||
@ -134,7 +134,7 @@ export class TextChannel extends GuildChannel {
|
||||
}
|
||||
|
||||
async fetchReactions(messageId: Snowflake, reaction: ReactionResolvable, options?: GetReactions) {
|
||||
const users = await Message.prototype.fetchReactions.call({ channelId: this.id, id: messageId }, reaction, options);
|
||||
const users = await Message.prototype.fetchReactions.call({ channelId: this.id, id: messageId, session: this.session }, reaction, options);
|
||||
|
||||
return users;
|
||||
}
|
||||
|
@ -207,3 +207,7 @@ export function CHANNEL_MESSAGE_REACTION(channelId: Snowflake, messageId: Snowfl
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
export function CHANNEL_MESSAGE_CROSSPOST(channelId: Snowflake, messageId: Snowflake) {
|
||||
return `/channels/${channelId}/messages/${messageId}/crosspost`;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user