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

discord-slim

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-slim - npm Package Compare versions

Comparing version 2.0.0-dev.3 to 2.0.0-dev.4

2

package.json
{
"name": "discord-slim",
"version": "2.0.0-dev.3",
"version": "2.0.0-dev.4",
"description": "Lightweight Discord client for Node.js.",

@@ -5,0 +5,0 @@ "author": "Hanabishi",

@@ -29,11 +29,7 @@ # Discord Slim

```js
const
Discord = require('discord-slim'),
client = new Discord.Client();
const { Client, Authorization, Actions, Helpers } = require('discord-slim');
// Authorization object. Required for client and actions.
const authorization = new Discord.Authorization('token');
// Basic setup to control client operation.
// You probably want to use such code for every bot.
const client = new Client();
client.on('connect', () => console.log('Connection established.'));

@@ -45,2 +41,5 @@ client.on('disconnect', (code) => console.error(`Disconnect. (${code})`));

// Authorization object. Required for client and actions.
const authorization = new Authorization('token');
// Request options for actions

@@ -66,3 +65,3 @@ const requestOptions = {

```js
client.events.on(Events.MESSAGE_CREATE, (message) => {
client.events.on(Helpers.Events.MESSAGE_CREATE, (message) => {
if(message.author.id == client.user.id) return;

@@ -79,3 +78,3 @@ if(message.content.toLowerCase().indexOf('hello bot') < 0) return;

client.Connect(authorization, Intents.GUILDS | Intents.GUILD_MESSAGES);
client.Connect(authorization, Helpers.Intents.GUILDS | Helpers.Intents.GUILD_MESSAGES);
```

@@ -87,3 +86,3 @@

// Create a command in your guild(s).
client.events.on(Events.GUILD_CREATE, (guild) => {
client.events.on(Helpers.Events.GUILD_CREATE, (guild) => {
Actions.Application.CreateGuildCommand(client.user.id, guild.id, {

@@ -94,3 +93,3 @@ name: 'echo',

{
type: Discord.Helpers.ApplicationCommandOptionTypes.STRING,
type: Helpers.ApplicationCommandOptionTypes.STRING,
name: 'text',

@@ -105,9 +104,9 @@ description: 'Echo message text.',

// Respond to interaction event.
client.events.on(Events.INTERACTION_CREATE, (interaction) => {
client.events.on(Helpers.Events.INTERACTION_CREATE, (interaction) => {
if(!(interaction.data && interaction.data.name == 'echo')) return;
Actions.Application.CreateInteractionResponse(interaction.id, interaction.token, {
type: Discord.Helpers.InteractionResponseTypes.CHANNEL_MESSAGE_WITH_SOURCE,
type: Helpers.InteractionResponseTypes.CHANNEL_MESSAGE_WITH_SOURCE,
data: {
content: interaction.data.options[0].value,
flags: Discord.Helpers.InteractionResponseFlags.EPHEMERAL,
flags: Helpers.InteractionResponseFlags.EPHEMERAL,
},

@@ -117,3 +116,3 @@ }, requestOptions);

client.Connect(authorization, Intents.GUILDS);
client.Connect(authorization, Helpers.Intents.GUILDS);
```

@@ -120,0 +119,0 @@

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