mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
USER_UPDATE & TYPING_START (#37)
* USER_UPDATE * TYPING_START * fix: fmt
This commit is contained in:
parent
a908104904
commit
9cd9d307c5
@ -14,6 +14,7 @@ import type {
|
|||||||
DiscordIntegration,
|
DiscordIntegration,
|
||||||
DiscordIntegrationDelete,
|
DiscordIntegrationDelete,
|
||||||
DiscordInteraction,
|
DiscordInteraction,
|
||||||
|
DiscordMemberWithUser,
|
||||||
DiscordMessage,
|
DiscordMessage,
|
||||||
DiscordMessageDelete,
|
DiscordMessageDelete,
|
||||||
DiscordMessageReactionAdd,
|
DiscordMessageReactionAdd,
|
||||||
@ -25,6 +26,7 @@ import type {
|
|||||||
// DiscordThreadMemberUpdate,
|
// DiscordThreadMemberUpdate,
|
||||||
// DiscordThreadMembersUpdate,
|
// DiscordThreadMembersUpdate,
|
||||||
DiscordThreadListSync,
|
DiscordThreadListSync,
|
||||||
|
DiscordTypingStart,
|
||||||
DiscordUser,
|
DiscordUser,
|
||||||
DiscordWebhookUpdate,
|
DiscordWebhookUpdate,
|
||||||
} from "../discordeno/mod.ts";
|
} from "../discordeno/mod.ts";
|
||||||
@ -34,11 +36,7 @@ import type { Session } from "./Session.ts";
|
|||||||
import type { Channel } from "./structures/channels.ts";
|
import type { Channel } from "./structures/channels.ts";
|
||||||
import type { Interaction } from "./structures/interactions/InteractionFactory.ts";
|
import type { Interaction } from "./structures/interactions/InteractionFactory.ts";
|
||||||
|
|
||||||
import {
|
import { ChannelFactory, GuildChannel, ThreadChannel } from "./structures/channels.ts";
|
||||||
ChannelFactory,
|
|
||||||
GuildChannel,
|
|
||||||
ThreadChannel,
|
|
||||||
} from "./structures/channels.ts";
|
|
||||||
|
|
||||||
import ThreadMember from "./structures/ThreadMember.ts";
|
import ThreadMember from "./structures/ThreadMember.ts";
|
||||||
import Member from "./structures/Member.ts";
|
import Member from "./structures/Member.ts";
|
||||||
@ -132,6 +130,18 @@ export const GUILD_ROLE_DELETE: RawHandler<DiscordGuildRoleDelete> = (session, _
|
|||||||
session.emit("guildRoleDelete", { guildId: data.guild_id, roleId: data.role_id });
|
session.emit("guildRoleDelete", { guildId: data.guild_id, roleId: data.role_id });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const TYPING_START: RawHandler<DiscordTypingStart> = (session, _shardId, payload) => {
|
||||||
|
session.emit("typingStart", {
|
||||||
|
channelId: payload.channel_id,
|
||||||
|
guildId: payload.guild_id ? payload.guild_id : undefined,
|
||||||
|
userId: payload.user_id,
|
||||||
|
timestamp: payload.timestamp,
|
||||||
|
member: payload.guild_id
|
||||||
|
? new Member(session, payload.member as DiscordMemberWithUser, payload.guild_id)
|
||||||
|
: undefined,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const INTERACTION_CREATE: RawHandler<DiscordInteraction> = (session, _shardId, interaction) => {
|
export const INTERACTION_CREATE: RawHandler<DiscordInteraction> = (session, _shardId, interaction) => {
|
||||||
session.emit("interactionCreate", InteractionFactory.from(session, interaction));
|
session.emit("interactionCreate", InteractionFactory.from(session, interaction));
|
||||||
};
|
};
|
||||||
@ -185,6 +195,10 @@ export const CHANNEL_PINS_UPDATE: RawHandler<DiscordChannelPinsUpdate> = (sessio
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const USER_UPDATE: RawHandler<DiscordUser> = (session, _shardId, payload) => {
|
||||||
|
session.emit("userUpdate", new User(session, payload));
|
||||||
|
};
|
||||||
|
|
||||||
export const WEBHOOKS_UPDATE: RawHandler<DiscordWebhookUpdate> = (session, _shardId, webhook) => {
|
export const WEBHOOKS_UPDATE: RawHandler<DiscordWebhookUpdate> = (session, _shardId, webhook) => {
|
||||||
session.emit("webhooksUpdate", { guildId: webhook.guild_id, channelId: webhook.channel_id });
|
session.emit("webhooksUpdate", { guildId: webhook.guild_id, channelId: webhook.channel_id });
|
||||||
};
|
};
|
||||||
@ -269,6 +283,7 @@ export interface Events {
|
|||||||
"guildRoleCreate": Handler<[{ guildId: Snowflake, role: DiscordRole }]>;
|
"guildRoleCreate": Handler<[{ guildId: Snowflake, role: DiscordRole }]>;
|
||||||
"guildRoleUpdate": Handler<[{ guildId: Snowflake, role: DiscordRole }]>;
|
"guildRoleUpdate": Handler<[{ guildId: Snowflake, role: DiscordRole }]>;
|
||||||
"guildRoleDelete": Handler<[{ guildId: Snowflake, roleId: Snowflake }]>;
|
"guildRoleDelete": Handler<[{ guildId: Snowflake, roleId: Snowflake }]>;
|
||||||
|
"typingStart": Handler<[{channelId: Snowflake, guildId?: Snowflake, userId: Snowflake, timestamp: number, member?: Member}]>
|
||||||
"channelCreate": Handler<[Channel]>;
|
"channelCreate": Handler<[Channel]>;
|
||||||
"channelUpdate": Handler<[Channel]>;
|
"channelUpdate": Handler<[Channel]>;
|
||||||
"channelDelete": Handler<[GuildChannel]>;
|
"channelDelete": Handler<[GuildChannel]>;
|
||||||
@ -283,4 +298,5 @@ export interface Events {
|
|||||||
"integrationDelete": Handler<[{ id: Snowflake, guildId?: Snowflake, applicationId?: Snowflake }]>;
|
"integrationDelete": Handler<[{ id: Snowflake, guildId?: Snowflake, applicationId?: Snowflake }]>;
|
||||||
"raw": Handler<[unknown, number]>;
|
"raw": Handler<[unknown, number]>;
|
||||||
"webhooksUpdate": Handler<[{ guildId: Snowflake, channelId: Snowflake }]>;
|
"webhooksUpdate": Handler<[{ guildId: Snowflake, channelId: Snowflake }]>;
|
||||||
|
"userUpdate": Handler<[User]>;
|
||||||
}
|
}
|
||||||
|
@ -33,17 +33,16 @@ export type ComponentBuilder =
|
|||||||
|
|
||||||
/***
|
/***
|
||||||
* Utility type
|
* Utility type
|
||||||
* */
|
*/
|
||||||
export type ComponentEmoji = {
|
export type ComponentEmoji = {
|
||||||
id: Snowflake;
|
id: Snowflake;
|
||||||
name: string;
|
name: string;
|
||||||
animated?: boolean;
|
animated?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility type
|
* Utility type
|
||||||
* */
|
*/
|
||||||
export interface PermissionsOverwrites {
|
export interface PermissionsOverwrites {
|
||||||
id: Snowflake;
|
id: Snowflake;
|
||||||
type: 0 | 1;
|
type: 0 | 1;
|
||||||
@ -63,7 +62,7 @@ export type ImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility functions
|
* Utility functions
|
||||||
* */
|
*/
|
||||||
export class Util {
|
export class Util {
|
||||||
static formatImageURL(url: string, size: ImageSize = 128, format?: ImageFormat) {
|
static formatImageURL(url: string, size: ImageSize = 128, format?: ImageFormat) {
|
||||||
return `${url}.${format || (url.includes("/a_") ? "gif" : "jpg")}?size=${size}`;
|
return `${url}.${format || (url.includes("/a_") ? "gif" : "jpg")}?size=${size}`;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Model } from "./Base.ts";
|
import type { Model } from "./Base.ts";
|
||||||
import type { Snowflake } from "../Snowflake.ts";
|
import type { Snowflake } from "../Snowflake.ts";
|
||||||
import type { Session } from "../Session.ts";
|
import type { Session } from "../Session.ts";
|
||||||
import type { DiscordMemberWithUser } from "../../discordeno/mod.ts"
|
import type { DiscordMemberWithUser } from "../../discordeno/mod.ts";
|
||||||
import type { ImageFormat, ImageSize } from "../Util.ts";
|
import type { ImageFormat, ImageSize } from "../Util.ts";
|
||||||
import type { CreateGuildBan, ModifyGuildMember } from "./guilds/Guild.ts";
|
import type { CreateGuildBan, ModifyGuildMember } from "./guilds/Guild.ts";
|
||||||
import Util from "../Util.ts";
|
import Util from "../Util.ts";
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
import type { Session } from "../../Session.ts";
|
import type { Session } from "../../Session.ts";
|
||||||
import type { DiscordComponent } from "../../../discordeno/mod.ts"
|
import type { DiscordComponent } from "../../../discordeno/mod.ts";
|
||||||
import type { Component } from "./Component.ts";
|
import type { Component } from "./Component.ts";
|
||||||
import { ButtonStyles, MessageComponentTypes } from "../../../discordeno/mod.ts";
|
import { ButtonStyles, MessageComponentTypes } from "../../../discordeno/mod.ts";
|
||||||
import ActionRow from "./ActionRowComponent.ts";
|
import ActionRow from "./ActionRowComponent.ts";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user