Initial commit
This commit is contained in:
3255
node_modules/discord.js/typings/index.d.ts
generated
vendored
Normal file
3255
node_modules/discord.js/typings/index.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
40
node_modules/discord.js/typings/index.js
generated
vendored
Normal file
40
node_modules/discord.js/typings/index.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
/// <reference path="index.d.ts" />
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const discord_js_1 = require("discord.js");
|
||||
const client = new discord_js_1.Client();
|
||||
client.on('ready', () => {
|
||||
console.log(`Client is logged in as ${client.user.tag} and ready!`);
|
||||
});
|
||||
client.on('guildCreate', g => {
|
||||
const channel = g.channels.cache.random();
|
||||
if (!channel)
|
||||
return;
|
||||
channel.setName('foo').then(updatedChannel => {
|
||||
console.log(`New channel name: ${updatedChannel.name}`);
|
||||
});
|
||||
});
|
||||
client.on('messageReactionRemoveAll', async (message) => {
|
||||
console.log(`messageReactionRemoveAll - id: ${message.id} (${message.id.length})`);
|
||||
if (message.partial)
|
||||
message = await message.fetch();
|
||||
console.log(`messageReactionRemoveAll - content: ${message.content}`);
|
||||
});
|
||||
client.on('message', ({ channel }) => {
|
||||
assertIsMessage(channel.send('string'));
|
||||
assertIsMessage(channel.send({}));
|
||||
assertIsMessage(channel.send({ embed: {} }));
|
||||
assertIsMessage(channel.send({ another: 'property' }, {}));
|
||||
const attachment = new discord_js_1.MessageAttachment('file.png');
|
||||
const embed = new discord_js_1.MessageEmbed();
|
||||
assertIsMessage(channel.send(attachment));
|
||||
assertIsMessage(channel.send(embed));
|
||||
assertIsMessage(channel.send([attachment, embed]));
|
||||
assertIsMessageArray(channel.send(Symbol('another primitive'), { split: true }));
|
||||
assertIsMessageArray(channel.send({ split: true }));
|
||||
// @ts-expect-error
|
||||
channel.send();
|
||||
// @ts-expect-error
|
||||
channel.send({ another: 'property' });
|
||||
});
|
||||
client.login('absolutely-valid-token');
|
53
node_modules/discord.js/typings/index.ts
generated
vendored
Normal file
53
node_modules/discord.js/typings/index.ts
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
/// <reference path="index.d.ts" />
|
||||
|
||||
import { Client, Message, MessageAttachment, MessageEmbed } from 'discord.js';
|
||||
|
||||
const client: Client = new Client();
|
||||
|
||||
client.on('ready', () => {
|
||||
console.log(`Client is logged in as ${client.user!.tag} and ready!`);
|
||||
});
|
||||
|
||||
client.on('guildCreate', g => {
|
||||
const channel = g.channels.cache.random();
|
||||
if (!channel) return;
|
||||
|
||||
channel.setName('foo').then(updatedChannel => {
|
||||
console.log(`New channel name: ${updatedChannel.name}`);
|
||||
});
|
||||
});
|
||||
|
||||
client.on('messageReactionRemoveAll', async message => {
|
||||
console.log(`messageReactionRemoveAll - id: ${message.id} (${message.id.length})`);
|
||||
|
||||
if (message.partial) message = await message.fetch();
|
||||
|
||||
console.log(`messageReactionRemoveAll - content: ${message.content}`);
|
||||
});
|
||||
|
||||
// These are to check that stuff is the right type
|
||||
declare const assertIsMessage: (m: Promise<Message>) => void;
|
||||
declare const assertIsMessageArray: (m: Promise<Message[]>) => void;
|
||||
|
||||
client.on('message', ({ channel }) => {
|
||||
assertIsMessage(channel.send('string'));
|
||||
assertIsMessage(channel.send({}));
|
||||
assertIsMessage(channel.send({ embed: {} }));
|
||||
assertIsMessage(channel.send({ another: 'property' }, {}));
|
||||
|
||||
const attachment = new MessageAttachment('file.png');
|
||||
const embed = new MessageEmbed();
|
||||
assertIsMessage(channel.send(attachment));
|
||||
assertIsMessage(channel.send(embed));
|
||||
assertIsMessage(channel.send([attachment, embed]));
|
||||
|
||||
assertIsMessageArray(channel.send(Symbol('another primitive'), { split: true }));
|
||||
assertIsMessageArray(channel.send({ split: true }));
|
||||
|
||||
// @ts-expect-error
|
||||
channel.send();
|
||||
// @ts-expect-error
|
||||
channel.send({ another: 'property' });
|
||||
});
|
||||
|
||||
client.login('absolutely-valid-token');
|
Reference in New Issue
Block a user