discordthings-api 1.0.0 → 1.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.
Files changed (2) hide show
  1. package/index.js +19 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -61,6 +61,25 @@ class DiscordThings {
61
61
  }
62
62
  }
63
63
 
64
+ /**
65
+ * Sync commands for the bot
66
+ * @param {string} botId - The ID of the bot
67
+ * @param {Array} commands - Array of command objects
68
+ * @returns {Promise<Object>} API Response
69
+ */
70
+ async syncCommands(botId, commands) {
71
+ if (!botId || !Array.isArray(commands)) throw new Error('Bot ID and commands array are required');
72
+
73
+ try {
74
+ const response = await this.client.post(`/bots/${botId}/commands`, {
75
+ commands
76
+ });
77
+ return response.data;
78
+ } catch (error) {
79
+ this._handleError(error);
80
+ }
81
+ }
82
+
64
83
  _handleError(error) {
65
84
  if (error.response) {
66
85
  throw new Error(`API Error [${error.response.status}]: ${error.response.data.error || error.response.statusText}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discordthings-api",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Official API Wrapper for DiscordThings.com",
5
5
  "main": "index.js",
6
6
  "scripts": {