Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

foxcord

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

foxcord - npm Package Compare versions

Comparing version 0.0.1-alpha to 0.0.1-alpha-0.1

src/structures/Collection.d.ts

10

package.json
{
"name": "foxcord",
"version": "0.0.1-alpha",
"version": "0.0.1-alpha-0.1",
"description": "A modern and simple way to interact with the Discord API !",

@@ -15,3 +15,3 @@ "main": "./src/index.js",

"discordjs",
"disord api",
"discord api",
"api",

@@ -43,5 +43,9 @@ "foxcord.js"

},
"directories": {
"example": "tests",
"test": "tests"
},
"engines": {
"node": ">=v12.x"
}
}
}
<p align="center">
<img src="https://media.discordapp.net/attachments/774598287712845864/867789487664005140/foxcord-text.png" alt="Foxcord logo" width="80%" height="80%"></img>
<br>
<a href="https://www.npmjs.com/package/discord.js"><img src="https://img.shields.io/npm/dt/foxcord.svg?maxAge=3600" alt="NPM downloads" /></a>
<a href="https://www.npmjs.com/package/foxcord"><img src="https://img.shields.io/npm/dt/foxcord.svg?maxAge=3600" alt="NPM downloads" /></a>
<br>

@@ -35,22 +35,10 @@ <img src="https://forthebadge.com/images/badges/made-with-typescript.svg" alt="Made with Typescript"></img>

```js
const { Client } = require('foxcord');
<p align="center">
const client = new Client({ device: 'MOBILE', intents: ['ALL'] });
![Bot code image example](https://media.discordapp.net/attachments/835896457454026802/868045935761059860/carbon.png?width=1007&height=676)
client.on('READY', async () => {
client.setGame('powered by Foxcord !', { type: 'PLAYING' });
console.log(client.user.tag + ' is online!');
});
![Webhook code image example](https://media.discordapp.net/attachments/835896457454026802/868046408442331136/webhook.png?width=1015&height=676)
client.on('MESSAGE', (message) => {
if (message.content === 'ping') {
return message.channel.send('🏓 pong!');
}
});
</p>
client.connect('token');
```
# 🔗 Links

@@ -57,0 +45,0 @@

/// <reference types="node" />
import { EventEmitter } from 'events';
import { Badges } from '../structures/Badges';
import { EventEmitter } from 'events';
declare type ImageSize = '128' | '256' | '512' | '1024';

@@ -82,2 +82,14 @@ declare type ImageFormat = 'jpg' | 'jpeg' | 'gif' | 'png' | 'tiff' | 'bmp';

/**
* Set the client username
* @param {string} username
* @returns {Promise<void>}
*/
setUsername(username: string): Promise<void>;
/**
* Set the client avatar
* @param {string} avatarURL The avatar URL, **no image directory**
* @returns {Promise<void>}
*/
setAvatar(avatarURL: string): Promise<void>;
/**
* @ignore

@@ -84,0 +96,0 @@ * @private

@@ -16,2 +16,3 @@ "use strict";

const Badges_1 = require("../structures/Badges");
const Utils_1 = require("../utils/Utils");
/**

@@ -51,2 +52,36 @@ * Class symbolozing a `ClientUser`

/**
* Set the client username
* @param {string} username
* @returns {Promise<void>}
*/
setUsername(username) {
return __awaiter(this, void 0, void 0, function* () {
if (!username || typeof username !== 'string')
throw new SyntaxError('NO_USERNAME_PROVIDED_OR_INVALID_USERNAME');
return yield RestManager_1.RestManager.prototype.REQUEST(`${Constants_1.DISCORD_API}users/@me`, {
method: 'PATCH',
token: this._token,
data: JSON.stringify({ username: username }),
});
});
}
/**
* Set the client avatar
* @param {string} avatarURL The avatar URL, **no image directory**
* @returns {Promise<void>}
*/
setAvatar(avatarURL) {
return __awaiter(this, void 0, void 0, function* () {
if (!avatarURL || typeof avatarURL !== 'string')
throw new SyntaxError('NO_USERNAME_PROVIDED_OR_INVALID_USERNAME');
if (!Utils_1._testURL(avatarURL))
throw new Error('INVALID_NEW_AVATAR_URL');
return yield RestManager_1.RestManager.prototype.REQUEST(`${Constants_1.DISCORD_API}users/@me`, {
method: 'PATCH',
token: this._token,
data: JSON.stringify({ avatar: avatarURL }),
});
});
}
/**
* @ignore

@@ -53,0 +88,0 @@ * @private

@@ -9,1 +9,20 @@ export { version } from '../package.json';

export * from './structures/DiscordSelectMenu';
export * from './structures/Collection';
export * from './client/ClientUser';
export * from './structures/Author';
export * from './structures/Badges';
export * from './structures/ButtonInteraction';
export * from './structures/Channel';
export * from './structures/Guild';
export * from './structures/GuildMember';
export * from './structures/Member';
export * from './structures/Message';
export * from './structures/SelectMenuInteraction';
export * from './structures/SentMessage';
export * from './structures/SlashCommand';
export * from './structures/User';
export * from './structures/WebhookMessage';
export * from './rest/RestManager';
export * from './websocket/Websocket';
export * as Constants from './utils/Constants';
export * as Utils from './utils/Utils';

@@ -9,7 +9,19 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.Utils = exports.Constants = exports.version = void 0;
var package_json_1 = require("../package.json");

@@ -24,1 +36,20 @@ Object.defineProperty(exports, "version", { enumerable: true, get: function () { return package_json_1.version; } });

__exportStar(require("./structures/DiscordSelectMenu"), exports);
__exportStar(require("./structures/Collection"), exports);
__exportStar(require("./client/ClientUser"), exports);
__exportStar(require("./structures/Author"), exports);
__exportStar(require("./structures/Badges"), exports);
__exportStar(require("./structures/ButtonInteraction"), exports);
__exportStar(require("./structures/Channel"), exports);
__exportStar(require("./structures/Guild"), exports);
__exportStar(require("./structures/GuildMember"), exports);
__exportStar(require("./structures/Member"), exports);
__exportStar(require("./structures/Message"), exports);
__exportStar(require("./structures/SelectMenuInteraction"), exports);
__exportStar(require("./structures/SentMessage"), exports);
__exportStar(require("./structures/SlashCommand"), exports);
__exportStar(require("./structures/User"), exports);
__exportStar(require("./structures/WebhookMessage"), exports);
__exportStar(require("./rest/RestManager"), exports);
__exportStar(require("./websocket/Websocket"), exports);
exports.Constants = __importStar(require("./utils/Constants"));
exports.Utils = __importStar(require("./utils/Utils"));

@@ -146,4 +146,4 @@ "use strict";

toObject(array) {
var rv = {};
for (var i = 0; i < array.length; ++i)
const rv = {};
for (let i = 0; i < array.length; ++i)
if (array[i] !== undefined)

@@ -150,0 +150,0 @@ rv[i] = array[i];

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -49,12 +58,14 @@ exports.Author = void 0;

_patchData(data) {
this.voiceChannelID = data.channel_id;
this.guildID = data.guild_id;
this.username = data.author.username;
this.bot = data.author.bot !== undefined;
this.id = data.author.id;
this.discriminator = data.author.discriminator;
this.avatar = data.author.avatar;
this.badges = new Badges_1.Badges(data.author.public_flags);
return __awaiter(this, void 0, void 0, function* () {
this.voiceChannelID = data.channel_id;
this.guildID = data.guild_id;
this.username = data.author.username;
this.bot = data.author.bot !== undefined;
this.id = data.author.id;
this.discriminator = data.author.discriminator;
this.avatar = data.author.avatar;
this.badges = new Badges_1.Badges(data.author.public_flags);
});
}
}
exports.Author = Author;

@@ -193,13 +193,15 @@ "use strict";

_patchData(data) {
this.message = new Message_1.Message(data.message, this._token);
this.member = new Member_1.Member(data.member, this._token, this.guildID);
this.deferred = false;
this.replied = false;
this.guildID = data.guild_id;
this.customID = data.data.custom_id;
this.id = data.id;
this.token = data.token;
this.applicationID = data.application_id;
return __awaiter(this, void 0, void 0, function* () {
this.message = new Message_1.Message(data.message, this._token);
this.member = new Member_1.Member(data.member, this._token, this.guildID);
this.deferred = false;
this.replied = false;
this.guildID = data.guild_id;
this.customID = data.data.custom_id;
this.id = data.id;
this.token = data.token;
this.applicationID = data.application_id;
});
}
}
exports.ButtonInteraction = ButtonInteraction;

@@ -107,3 +107,3 @@ declare type buttonStyle = 'BLURPLE' | 'GREY' | 'GREEN' | 'RED' | 'URL';

/**
* Set the disable parameter. *The button style musn't be `URL (5)`*
* Set the disable parameter. *The button style must not be `URL (5)`*
* @param {boolean} state

@@ -110,0 +110,0 @@ * @returns {DiscordButton}

@@ -107,3 +107,3 @@ "use strict";

/**
* Set the disable parameter. *The button style musn't be `URL (5)`*
* Set the disable parameter. *The button style must not be `URL (5)`*
* @param {boolean} state

@@ -110,0 +110,0 @@ * @returns {DiscordButton}

@@ -55,3 +55,3 @@ interface AuthorOptions {

/**
* Video URL **(no YouTube or Daylimotion link, only `.mp4` link)**
* Video URL **(no YouTube or Dailymotion link, only `.mp4` link)**
*/

@@ -58,0 +58,0 @@ url?: string;

@@ -65,5 +65,5 @@ import { Channel } from './Channel';

/**
* Message attachements
* Message attachments
*/
attachements: any[] | [];
attachments: any[] | [];
private _token;

@@ -70,0 +70,0 @@ /**

@@ -54,3 +54,3 @@ "use strict";

this.editedTimestamp = data.edited_timestamp;
this.attachements = data.attachements;
this.attachments = data.attachments;
});

@@ -57,0 +57,0 @@ }

@@ -193,14 +193,16 @@ "use strict";

_patchData(data) {
this.deferred = false;
this.replied = false;
this.guildID = data.guild_id;
this.customID = data.data.custom_id;
this.id = data.id;
this.token = data.token;
this.values = data.data.values;
this.applicationID = data.application_id;
this.member = new Member_1.Member(data.member, this._token, this.guildID);
this.message = new Message_1.Message(data.message, this._token);
return __awaiter(this, void 0, void 0, function* () {
this.deferred = false;
this.replied = false;
this.guildID = data.guild_id;
this.customID = data.data.custom_id;
this.id = data.id;
this.token = data.token;
this.values = data.data.values;
this.applicationID = data.application_id;
this.member = new Member_1.Member(data.member, this._token, this.guildID);
this.message = new Message_1.Message(data.message, this._token);
});
}
}
exports.SelectMenuInteraction = SelectMenuInteraction;

@@ -78,5 +78,5 @@ import { Channel } from './Channel';

/**
* Message attachements
* Message attachments
*/
attachements: any[] | [];
attachments: any[] | [];
private _token;

@@ -83,0 +83,0 @@ /**

@@ -133,3 +133,3 @@ "use strict";

this.editedTimestamp = data.edited_timestamp;
this.attachements = data.attachements;
this.attachments = data.attachments;
});

@@ -136,0 +136,0 @@ }

@@ -119,19 +119,20 @@ "use strict";

_patchData(data) {
this.id = data.author.id;
this.type = data.type;
this.message = {
id: data.id,
content: data.content,
timestamp: data.timestamp,
formatedTimestamp: moment_1.default(data.timestamp).format('LLLL'),
};
this.avatar = data.author.avatar;
this.isBot = data.author.bot;
this.webhookID = data.webhook_id;
this.channelID = data.channel_id;
this.discriminator = data.author.discriminator;
this.username = data.author.userusername;
return;
return __awaiter(this, void 0, void 0, function* () {
this.id = data.author.id;
this.type = data.type;
this.message = {
id: data.id,
content: data.content,
timestamp: data.timestamp,
formatedTimestamp: moment_1.default(data.timestamp).format('LLLL'),
};
this.avatar = data.author.avatar;
this.isBot = data.author.bot;
this.webhookID = data.webhook_id;
this.channelID = data.channel_id;
this.discriminator = data.author.discriminator;
this.username = data.author.userusername;
});
}
}
exports.WebhookMessage = WebhookMessage;

@@ -60,3 +60,8 @@ "use strict";

this._token = token;
this.socket = new ws_1.default(Constants_1.WEBSOCKET_URL);
try {
this.socket = new ws_1.default(Constants_1.WEBSOCKET_URL);
}
catch (err) {
throw new Error('INVALID_TOKEN_WEBSOCKET_ERROR_' + String(err).toUpperCase());
}
this.socket.once('open', () => {

@@ -63,0 +68,0 @@ this.online = true;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc