@koishijs/plugin-adapter-discord 2.1.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +3 -14
- package/lib/index.js +21 -1544
- package/lib/index.js.map +4 -4
- package/package.json +10 -22
- package/lib/bot.d.ts +0 -64
- package/lib/sender.d.ts +0 -36
- package/lib/types/application.d.ts +0 -84
- package/lib/types/audit-log.d.ts +0 -128
- package/lib/types/ban.d.ts +0 -67
- package/lib/types/channel.d.ts +0 -368
- package/lib/types/command.d.ts +0 -214
- package/lib/types/component.d.ts +0 -84
- package/lib/types/device.d.ts +0 -41
- package/lib/types/emoji.d.ts +0 -63
- package/lib/types/gateway.d.ts +0 -248
- package/lib/types/guild-member.d.ts +0 -216
- package/lib/types/guild-scheduled-event.d.ts +0 -167
- package/lib/types/guild-template.d.ts +0 -88
- package/lib/types/guild.d.ts +0 -419
- package/lib/types/index.d.ts +0 -31
- package/lib/types/integration.d.ts +0 -111
- package/lib/types/interaction.d.ts +0 -182
- package/lib/types/internal.d.ts +0 -8
- package/lib/types/invite.d.ts +0 -163
- package/lib/types/message.d.ts +0 -404
- package/lib/types/presence.d.ts +0 -151
- package/lib/types/reaction.d.ts +0 -114
- package/lib/types/role.d.ts +0 -221
- package/lib/types/scheduled-event.d.ts +0 -167
- package/lib/types/stage-instance.d.ts +0 -78
- package/lib/types/sticker.d.ts +0 -149
- package/lib/types/team.d.ts +0 -30
- package/lib/types/thread.d.ts +0 -201
- package/lib/types/user.d.ts +0 -122
- package/lib/types/voice.d.ts +0 -102
- package/lib/types/webhook.d.ts +0 -199
- package/lib/types.d.ts +0 -354
- package/lib/utils.d.ts +0 -15
- package/lib/ws.d.ts +0 -26
package/package.json
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koishijs/plugin-adapter-discord",
|
|
3
3
|
"description": "Discord Adapter for Koishi",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib"
|
|
9
9
|
],
|
|
10
|
-
"author": "
|
|
11
|
-
"maintainers": [
|
|
12
|
-
"Shigma <shigma10826@gmail.com>",
|
|
13
|
-
"LittleC <i@ltlec.cn>"
|
|
14
|
-
],
|
|
10
|
+
"author": "Shigma <shigma10826@gmail.com>",
|
|
15
11
|
"license": "MIT",
|
|
16
12
|
"repository": {
|
|
17
13
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/
|
|
19
|
-
"directory": "
|
|
14
|
+
"url": "git+https://github.com/satorijs/satori.git",
|
|
15
|
+
"directory": "adapters/discord"
|
|
20
16
|
},
|
|
21
17
|
"bugs": {
|
|
22
|
-
"url": "https://github.com/
|
|
18
|
+
"url": "https://github.com/satorijs/satori/issues"
|
|
23
19
|
},
|
|
24
|
-
"homepage": "https://koishi.js.org/
|
|
20
|
+
"homepage": "https://koishi.js.org/plugins/adapter/discord.html",
|
|
25
21
|
"keywords": [
|
|
26
22
|
"bot",
|
|
27
23
|
"discord",
|
|
@@ -29,6 +25,7 @@
|
|
|
29
25
|
"koishi"
|
|
30
26
|
],
|
|
31
27
|
"koishi": {
|
|
28
|
+
"category": "adapter",
|
|
32
29
|
"description": {
|
|
33
30
|
"en": "Discord Adapter",
|
|
34
31
|
"zh": "Discord 适配器"
|
|
@@ -40,18 +37,9 @@
|
|
|
40
37
|
}
|
|
41
38
|
},
|
|
42
39
|
"peerDependencies": {
|
|
43
|
-
"koishi": "^4.
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@koishijs/plugin-mock": "^1.0.5",
|
|
47
|
-
"@types/es-aggregate-error": "^1.0.2",
|
|
48
|
-
"@types/ws": "^8.5.3",
|
|
49
|
-
"axios": "^0.24.0"
|
|
40
|
+
"koishi": "^4.9.0"
|
|
50
41
|
},
|
|
51
42
|
"dependencies": {
|
|
52
|
-
"
|
|
53
|
-
"file-type": "^16.5.3",
|
|
54
|
-
"form-data": "^4.0.0",
|
|
55
|
-
"ws": "^8.6.0"
|
|
43
|
+
"@satorijs/adapter-discord": "^3.1.0"
|
|
56
44
|
}
|
|
57
|
-
}
|
|
45
|
+
}
|
package/lib/bot.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Adapter, Bot, Quester, Schema } from 'koishi';
|
|
3
|
-
import { AdapterConfig } from './utils';
|
|
4
|
-
import { Internal } from './types';
|
|
5
|
-
interface PrivilegedIntents {
|
|
6
|
-
members?: boolean;
|
|
7
|
-
presence?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface BotConfig extends Bot.BaseConfig, Quester.Config {
|
|
10
|
-
token: string;
|
|
11
|
-
gateway?: string;
|
|
12
|
-
intents?: PrivilegedIntents;
|
|
13
|
-
}
|
|
14
|
-
export declare const BotConfig: Schema<Quester.Config & {
|
|
15
|
-
gateway?: string;
|
|
16
|
-
intents?: {
|
|
17
|
-
members?: boolean;
|
|
18
|
-
presence?: boolean;
|
|
19
|
-
} & import("koishi").Dict<any, string>;
|
|
20
|
-
} & import("koishi").Dict<any, string> & {
|
|
21
|
-
token?: string;
|
|
22
|
-
}, Quester.Config & {
|
|
23
|
-
gateway: string;
|
|
24
|
-
intents: {
|
|
25
|
-
members: boolean;
|
|
26
|
-
presence: boolean;
|
|
27
|
-
} & import("koishi").Dict<any, string>;
|
|
28
|
-
} & import("koishi").Dict<any, string> & {
|
|
29
|
-
token: string;
|
|
30
|
-
}>;
|
|
31
|
-
export declare class DiscordBot extends Bot<BotConfig> {
|
|
32
|
-
static schema: Schema<AdapterConfig, AdapterConfig>;
|
|
33
|
-
_d: number;
|
|
34
|
-
_ping: NodeJS.Timeout;
|
|
35
|
-
_sessionId: string;
|
|
36
|
-
http: Quester;
|
|
37
|
-
internal: Internal;
|
|
38
|
-
constructor(adapter: Adapter, config: BotConfig);
|
|
39
|
-
getIntents(): number;
|
|
40
|
-
getSelf(): Promise<Bot.User>;
|
|
41
|
-
private parseQuote;
|
|
42
|
-
sendMessage(channelId: string, content: string, guildId?: string): Promise<string[]>;
|
|
43
|
-
sendPrivateMessage(channelId: string, content: string): Promise<string[]>;
|
|
44
|
-
deleteMessage(channelId: string, messageId: string): Promise<void>;
|
|
45
|
-
editMessage(channelId: string, messageId: string, content: string): Promise<void>;
|
|
46
|
-
getMessage(channelId: string, messageId: string): Promise<Bot.Message>;
|
|
47
|
-
getUser(userId: string): Promise<Bot.User>;
|
|
48
|
-
getGuildMemberList(guildId: string): Promise<Bot.User[]>;
|
|
49
|
-
getChannel(channelId: string): Promise<Bot.Channel>;
|
|
50
|
-
getGuildMember(guildId: string, userId: string): Promise<{
|
|
51
|
-
nickname: string;
|
|
52
|
-
userId: string;
|
|
53
|
-
username?: string;
|
|
54
|
-
avatar?: string;
|
|
55
|
-
discriminator?: string;
|
|
56
|
-
isBot?: boolean;
|
|
57
|
-
}>;
|
|
58
|
-
kickGuildMember(guildId: string, userId: string): Promise<void>;
|
|
59
|
-
getGuild(guildId: string): Promise<Bot.Guild>;
|
|
60
|
-
getGuildList(): Promise<Bot.Guild[]>;
|
|
61
|
-
getChannelList(guildId: string): Promise<Bot.Channel[]>;
|
|
62
|
-
getChannelMessageHistory(channelId: string, before?: string): Promise<Bot.Message[]>;
|
|
63
|
-
}
|
|
64
|
-
export {};
|
package/lib/sender.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { DiscordBot } from './bot';
|
|
2
|
-
import { Dict, Schema } from 'koishi';
|
|
3
|
-
export declare type HandleExternalAsset = 'auto' | 'download' | 'direct';
|
|
4
|
-
export declare type HandleMixedContent = 'auto' | 'separate' | 'attach';
|
|
5
|
-
export declare namespace Sender {
|
|
6
|
-
interface Config {
|
|
7
|
-
/**
|
|
8
|
-
* 发送外链资源时采用的方式
|
|
9
|
-
* - download:先下载后发送
|
|
10
|
-
* - direct:直接发送链接
|
|
11
|
-
* - auto:发送一个 HEAD 请求,如果返回的 Content-Type 正确,则直接发送链接,否则先下载后发送(默认)
|
|
12
|
-
*/
|
|
13
|
-
handleExternalAsset?: HandleExternalAsset;
|
|
14
|
-
/**
|
|
15
|
-
* 发送图文等混合内容时采用的方式
|
|
16
|
-
* - separate:将每个不同形式的内容分开发送
|
|
17
|
-
* - attach:图片前如果有文本内容,则将文本作为图片的附带信息进行发送
|
|
18
|
-
* - auto:如果图片本身采用直接发送则与前面的文本分开,否则将文本作为图片的附带信息发送(默认)
|
|
19
|
-
*/
|
|
20
|
-
handleMixedContent?: HandleMixedContent;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export declare class Sender {
|
|
24
|
-
private bot;
|
|
25
|
-
private url;
|
|
26
|
-
static Config: Schema<Sender.Config>;
|
|
27
|
-
private results;
|
|
28
|
-
private errors;
|
|
29
|
-
private constructor();
|
|
30
|
-
static from(bot: DiscordBot, url: string): (content: string, addition?: Dict<any, string>) => Promise<string[]>;
|
|
31
|
-
post(data?: any, headers?: any): Promise<void>;
|
|
32
|
-
sendEmbed(fileBuffer: ArrayBuffer, payload_json: Dict, filename: string): Promise<void>;
|
|
33
|
-
sendContent(content: string, addition: Dict): Promise<void>;
|
|
34
|
-
sendAsset(type: string, data: Dict<string>, addition: Dict): Promise<void>;
|
|
35
|
-
sendMessage(content: string, addition?: Dict): Promise<string[]>;
|
|
36
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { Guild, integer, snowflake, Team, User } from '.';
|
|
2
|
-
/** https://discord.com/developers/docs/resources/application#application-object-application-structure */
|
|
3
|
-
export interface Application {
|
|
4
|
-
/** the id of the app */
|
|
5
|
-
id: snowflake;
|
|
6
|
-
/** the name of the app */
|
|
7
|
-
name: string;
|
|
8
|
-
/** the icon hash of the app */
|
|
9
|
-
icon?: string;
|
|
10
|
-
/** the description of the app */
|
|
11
|
-
description: string;
|
|
12
|
-
/** an array of rpc origin urls, if rpc is enabled */
|
|
13
|
-
rpc_origins?: string[];
|
|
14
|
-
/** when false only app owner can join the app's bot to guilds */
|
|
15
|
-
bot_public: boolean;
|
|
16
|
-
/** when true the app's bot will only join upon completion of the full oauth2 code grant flow */
|
|
17
|
-
bot_require_code_grant: boolean;
|
|
18
|
-
/** the url of the app's terms of service */
|
|
19
|
-
terms_of_service_url?: string;
|
|
20
|
-
/** the url of the app's privacy policy */
|
|
21
|
-
privacy_policy_url?: string;
|
|
22
|
-
/** partial user object containing info on the owner of the application */
|
|
23
|
-
owner?: Partial<User>;
|
|
24
|
-
/** if this application is a game sold on Discord, this field will be the summary field for the store page of its primary sku */
|
|
25
|
-
summary: string;
|
|
26
|
-
/** the hex encoded key for verification in interactions and the GameSDK's GetTicket */
|
|
27
|
-
verify_key: string;
|
|
28
|
-
/** if the application belongs to a team, this will be a list of the members of that team */
|
|
29
|
-
team?: Team;
|
|
30
|
-
/** if this application is a game sold on Discord, this field will be the guild to which it has been linked */
|
|
31
|
-
guild_id?: snowflake;
|
|
32
|
-
/** if this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */
|
|
33
|
-
primary_sku_id?: snowflake;
|
|
34
|
-
/** if this application is a game sold on Discord, this field will be the URL slug that links to the store page */
|
|
35
|
-
slug?: string;
|
|
36
|
-
/** the application's default rich presence invite cover image hash */
|
|
37
|
-
cover_image?: string;
|
|
38
|
-
/** the application's public flags */
|
|
39
|
-
flags?: integer;
|
|
40
|
-
}
|
|
41
|
-
/** https://discord.com/developers/docs/resources/application#application-object-application-flags */
|
|
42
|
-
export declare enum ApplicationFlag {
|
|
43
|
-
GATEWAY_PRESENCE = 4096,
|
|
44
|
-
GATEWAY_PRESENCE_LIMITED = 8192,
|
|
45
|
-
GATEWAY_GUILD_MEMBERS = 16384,
|
|
46
|
-
GATEWAY_GUILD_MEMBERS_LIMITED = 32768,
|
|
47
|
-
VERIFICATION_PENDING_GUILD_LIMIT = 65536,
|
|
48
|
-
EMBEDDED = 131072
|
|
49
|
-
}
|
|
50
|
-
/** https://discord.com/developers/docs/topics/gateway#ready-ready-event-fields */
|
|
51
|
-
export interface ReadyEvent {
|
|
52
|
-
/** gateway version */
|
|
53
|
-
v: integer;
|
|
54
|
-
/** information about the user including email */
|
|
55
|
-
user: User;
|
|
56
|
-
/** the guilds the user is in */
|
|
57
|
-
guilds: Partial<Guild>[];
|
|
58
|
-
/** used for resuming connections */
|
|
59
|
-
session_id: string;
|
|
60
|
-
/** the shard information associated with this session, if sent when identifying */
|
|
61
|
-
shard?: [shard_id: integer, num_shards: integer];
|
|
62
|
-
/** contains id and flags */
|
|
63
|
-
application: Partial<Application>;
|
|
64
|
-
}
|
|
65
|
-
declare module './gateway' {
|
|
66
|
-
interface GatewayEvents {
|
|
67
|
-
/** contains the initial state information */
|
|
68
|
-
READY: ReadyEvent;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
declare module './internal' {
|
|
72
|
-
interface Internal {
|
|
73
|
-
/**
|
|
74
|
-
* Returns the bot's application object.
|
|
75
|
-
* @see https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information
|
|
76
|
-
*/
|
|
77
|
-
getCurrentBotApplicationInformation(): Promise<Application>;
|
|
78
|
-
/**
|
|
79
|
-
* Returns info about the current authorization. Requires authentication with a bearer token.
|
|
80
|
-
* @see https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information
|
|
81
|
-
*/
|
|
82
|
-
getCurrentAuthorizationInformation(): Promise<any>;
|
|
83
|
-
}
|
|
84
|
-
}
|
package/lib/types/audit-log.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { Channel, integer, Integration, snowflake, User, Webhook } from '.';
|
|
2
|
-
/** https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure */
|
|
3
|
-
export interface AuditLog {
|
|
4
|
-
/** list of audit log entries */
|
|
5
|
-
audit_log_entries: AuditLog.Entry[];
|
|
6
|
-
/** list of partial integration objects */
|
|
7
|
-
integrations: Partial<Integration>[];
|
|
8
|
-
/** list of threads found in the audit log* */
|
|
9
|
-
threads: Channel[];
|
|
10
|
-
/** list of users found in the audit log */
|
|
11
|
-
users: User[];
|
|
12
|
-
/** list of webhooks found in the audit log */
|
|
13
|
-
webhooks: Webhook[];
|
|
14
|
-
}
|
|
15
|
-
export declare namespace AuditLog {
|
|
16
|
-
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
|
|
17
|
-
interface Entry {
|
|
18
|
-
/** id of the affected entity (webhook, user, role, etc.) */
|
|
19
|
-
target_id?: string;
|
|
20
|
-
/** changes made to the target_id */
|
|
21
|
-
changes?: Change[];
|
|
22
|
-
/** the user who made the changes */
|
|
23
|
-
user_id?: snowflake;
|
|
24
|
-
/** id of the entry */
|
|
25
|
-
id: snowflake;
|
|
26
|
-
/** type of action that occurred */
|
|
27
|
-
action_type: Type;
|
|
28
|
-
/** additional info for certain action types */
|
|
29
|
-
options?: OptionalInfo;
|
|
30
|
-
/** the reason for the change (0-512 characters) */
|
|
31
|
-
reason?: string;
|
|
32
|
-
}
|
|
33
|
-
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
|
|
34
|
-
enum Type {
|
|
35
|
-
GUILD_UPDATE = 1,
|
|
36
|
-
CHANNEL_CREATE = 10,
|
|
37
|
-
CHANNEL_UPDATE = 11,
|
|
38
|
-
CHANNEL_DELETE = 12,
|
|
39
|
-
CHANNEL_OVERWRITE_CREATE = 13,
|
|
40
|
-
CHANNEL_OVERWRITE_UPDATE = 14,
|
|
41
|
-
CHANNEL_OVERWRITE_DELETE = 15,
|
|
42
|
-
MEMBER_KICK = 20,
|
|
43
|
-
MEMBER_PRUNE = 21,
|
|
44
|
-
MEMBER_BAN_ADD = 22,
|
|
45
|
-
MEMBER_BAN_REMOVE = 23,
|
|
46
|
-
MEMBER_UPDATE = 24,
|
|
47
|
-
MEMBER_ROLE_UPDATE = 25,
|
|
48
|
-
MEMBER_MOVE = 26,
|
|
49
|
-
MEMBER_DISCONNECT = 27,
|
|
50
|
-
BOT_ADD = 28,
|
|
51
|
-
ROLE_CREATE = 30,
|
|
52
|
-
ROLE_UPDATE = 31,
|
|
53
|
-
ROLE_DELETE = 32,
|
|
54
|
-
INVITE_CREATE = 40,
|
|
55
|
-
INVITE_UPDATE = 41,
|
|
56
|
-
INVITE_DELETE = 42,
|
|
57
|
-
WEBHOOK_CREATE = 50,
|
|
58
|
-
WEBHOOK_UPDATE = 51,
|
|
59
|
-
WEBHOOK_DELETE = 52,
|
|
60
|
-
EMOJI_CREATE = 60,
|
|
61
|
-
EMOJI_UPDATE = 61,
|
|
62
|
-
EMOJI_DELETE = 62,
|
|
63
|
-
MESSAGE_DELETE = 72,
|
|
64
|
-
MESSAGE_BULK_DELETE = 73,
|
|
65
|
-
MESSAGE_PIN = 74,
|
|
66
|
-
MESSAGE_UNPIN = 75,
|
|
67
|
-
INTEGRATION_CREATE = 80,
|
|
68
|
-
INTEGRATION_UPDATE = 81,
|
|
69
|
-
INTEGRATION_DELETE = 82,
|
|
70
|
-
STAGE_INSTANCE_CREATE = 83,
|
|
71
|
-
STAGE_INSTANCE_UPDATE = 84,
|
|
72
|
-
STAGE_INSTANCE_DELETE = 85,
|
|
73
|
-
STICKER_CREATE = 90,
|
|
74
|
-
STICKER_UPDATE = 91,
|
|
75
|
-
STICKER_DELETE = 92,
|
|
76
|
-
THREAD_CREATE = 110,
|
|
77
|
-
THREAD_UPDATE = 111,
|
|
78
|
-
THREAD_DELETE = 112
|
|
79
|
-
}
|
|
80
|
-
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
|
|
81
|
-
interface OptionalInfo {
|
|
82
|
-
/** channel in which the entities were targeted */
|
|
83
|
-
channel_id: snowflake;
|
|
84
|
-
/** number of entities that were targeted */
|
|
85
|
-
count: string;
|
|
86
|
-
/** number of days after which inactive members were kicked */
|
|
87
|
-
delete_member_days: string;
|
|
88
|
-
/** id of the overwritten entity */
|
|
89
|
-
id: snowflake;
|
|
90
|
-
/** number of members removed by the prune */
|
|
91
|
-
members_removed: string;
|
|
92
|
-
/** id of the message that was targeted */
|
|
93
|
-
message_id: snowflake;
|
|
94
|
-
/** name of the role if type is "0" (not present if type is "1") */
|
|
95
|
-
role_name: string;
|
|
96
|
-
/** type of overwritten entity - "0" for "role" or "1" for "member" */
|
|
97
|
-
type: string;
|
|
98
|
-
}
|
|
99
|
-
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
|
100
|
-
interface Change {
|
|
101
|
-
/** new value of the key */
|
|
102
|
-
new_value?: any;
|
|
103
|
-
/** old value of the key */
|
|
104
|
-
old_value?: any;
|
|
105
|
-
/** name of audit log change key */
|
|
106
|
-
key: string;
|
|
107
|
-
}
|
|
108
|
-
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-params */
|
|
109
|
-
interface GetParams {
|
|
110
|
-
/** filter the log for actions made by a user */
|
|
111
|
-
user_id?: snowflake;
|
|
112
|
-
/** the type of audit log event */
|
|
113
|
-
action_type?: Type;
|
|
114
|
-
/** filter the log before a certain entry id */
|
|
115
|
-
before?: snowflake;
|
|
116
|
-
/** how many entries are returned (default 50, minimum 1, maximum 100) */
|
|
117
|
-
limit?: integer;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
declare module './internal' {
|
|
121
|
-
interface Internal {
|
|
122
|
-
/**
|
|
123
|
-
* Returns an audit log object for the guild. Requires the 'VIEW_AUDIT_LOG' permission.
|
|
124
|
-
* @see https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
|
|
125
|
-
*/
|
|
126
|
-
getGuildAuditLog(guildId: snowflake, params?: AuditLog.GetParams): Promise<AuditLog>;
|
|
127
|
-
}
|
|
128
|
-
}
|
package/lib/types/ban.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { integer, snowflake, User } from '.';
|
|
2
|
-
/** https://discord.com/developers/docs/resources/guild#ban-object-ban-structure */
|
|
3
|
-
export interface Ban {
|
|
4
|
-
/** the reason for the ban */
|
|
5
|
-
reason?: string;
|
|
6
|
-
/** the banned user */
|
|
7
|
-
user: User;
|
|
8
|
-
}
|
|
9
|
-
export declare namespace Ban {
|
|
10
|
-
namespace Event {
|
|
11
|
-
/** https://discord.com/developers/docs/topics/gateway#guild-ban-add-guild-ban-add-event-fields */
|
|
12
|
-
interface Add {
|
|
13
|
-
/** id of the guild */
|
|
14
|
-
guild_id: snowflake;
|
|
15
|
-
/** the banned user */
|
|
16
|
-
user: User;
|
|
17
|
-
}
|
|
18
|
-
/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove-guild-ban-remove-event-fields */
|
|
19
|
-
interface Remove {
|
|
20
|
-
/** id of the guild */
|
|
21
|
-
guild_id: snowflake;
|
|
22
|
-
/** the unbanned user */
|
|
23
|
-
user: User;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
namespace Params {
|
|
27
|
-
/** https://discord.com/developers/docs/resources/guild#create-guild-ban-json-params */
|
|
28
|
-
interface Create {
|
|
29
|
-
/** number of days to delete messages for (0-7) */
|
|
30
|
-
delete_message_days?: integer;
|
|
31
|
-
/** reason for the ban (deprecated) */
|
|
32
|
-
reason?: string;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
declare module './gateway' {
|
|
37
|
-
interface GatewayEvents {
|
|
38
|
-
/** user was banned from a guild */
|
|
39
|
-
GUILD_BAN_ADD: Ban.Event.Add;
|
|
40
|
-
/** user was unbanned from a guild */
|
|
41
|
-
GUILD_BAN_REMOVE: Ban.Event.Remove;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
declare module './internal' {
|
|
45
|
-
interface Internal {
|
|
46
|
-
/**
|
|
47
|
-
* Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission.
|
|
48
|
-
* @see https://discord.com/developers/docs/resources/guild#get-guild-bans
|
|
49
|
-
*/
|
|
50
|
-
getGuildBans(guild_id: snowflake): Promise<Ban[]>;
|
|
51
|
-
/**
|
|
52
|
-
* Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission.
|
|
53
|
-
* @see https://discord.com/developers/docs/resources/guild#get-guild-ban
|
|
54
|
-
*/
|
|
55
|
-
getGuildBan(guild_id: snowflake, user_id: snowflake): Promise<Ban>;
|
|
56
|
-
/**
|
|
57
|
-
* Create a guild ban, and optionally delete previous messages sent by the banned user. Requires the BAN_MEMBERS permission. Returns a 204 empty response on success. Fires a Guild Ban Add Gateway event.
|
|
58
|
-
* @see https://discord.com/developers/docs/resources/guild#create-guild-ban
|
|
59
|
-
*/
|
|
60
|
-
createGuildBan(guild_id: snowflake, user_id: snowflake, params: Ban.Params.Create): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Remove the ban for a user. Requires the BAN_MEMBERS permissions. Returns a 204 empty response on success. Fires a Guild Ban Remove Gateway event.
|
|
63
|
-
* @see https://discord.com/developers/docs/resources/guild#remove-guild-ban
|
|
64
|
-
*/
|
|
65
|
-
removeGuildBan(guild_id: snowflake, user_id: snowflake): Promise<void>;
|
|
66
|
-
}
|
|
67
|
-
}
|