feat: TextChannel.sendMessage/editMessage

This commit is contained in:
Yuzu 2022-07-01 16:10:56 -05:00
parent 37f4071da6
commit 3f714eb295
3 changed files with 17 additions and 4 deletions

View File

@ -44,8 +44,7 @@ export interface Embed {
provider?: { provider?: {
url?: string; url?: string;
name?: string; name?: string;
} };
} }
export function embed(data: Embed): DiscordEmbed { export function embed(data: Embed): DiscordEmbed {

View File

@ -1,7 +1,13 @@
import type { Model } from "./Base.ts"; import type { Model } from "./Base.ts";
import type { Snowflake } from "../util/Snowflake.ts"; import type { Snowflake } from "../util/Snowflake.ts";
import type { Session } from "../session/Session.ts"; import type { Session } from "../session/Session.ts";
import type { AllowedMentionsTypes, DiscordEmbed, DiscordMessage, DiscordUser, FileContent } from "../vendor/external.ts"; import type {
AllowedMentionsTypes,
DiscordEmbed,
DiscordMessage,
DiscordUser,
FileContent,
} from "../vendor/external.ts";
import type { GetReactions } from "../util/Routes.ts"; import type { GetReactions } from "../util/Routes.ts";
import { MessageFlags } from "../util/shared/flags.ts"; import { MessageFlags } from "../util/shared/flags.ts";
import User from "./User.ts"; import User from "./User.ts";

View File

@ -2,7 +2,7 @@ import type { Session } from "../session/Session.ts";
import type { Snowflake } from "../util/Snowflake.ts"; import type { Snowflake } from "../util/Snowflake.ts";
import type { GetMessagesOptions, GetReactions } from "../util/Routes.ts"; import type { GetMessagesOptions, GetReactions } from "../util/Routes.ts";
import type { DiscordChannel, DiscordInvite, DiscordMessage, TargetTypes } from "../vendor/external.ts"; import type { DiscordChannel, DiscordInvite, DiscordMessage, TargetTypes } from "../vendor/external.ts";
import type { ReactionResolvable } from "./Message.ts"; import type { CreateMessage, EditMessage, ReactionResolvable } from "./Message.ts";
import GuildChannel from "./GuildChannel.ts"; import GuildChannel from "./GuildChannel.ts";
import ThreadChannel from "./ThreadChannel.ts"; import ThreadChannel from "./ThreadChannel.ts";
import Message from "./Message.ts"; import Message from "./Message.ts";
@ -151,6 +151,14 @@ export class TextChannel extends GuildChannel {
return users; return users;
} }
sendMessage(options: CreateMessage) {
return Message.prototype.reply.call({ channelId: this.id, session: this.session }, options);
}
editMessage(messageId: Snowflake, options: EditMessage) {
return Message.prototype.edit.call({ channelId: this.id, id: messageId, session: this.session }, options);
}
} }
export default TextChannel; export default TextChannel;