How to use the eris/lib/rest/Endpoints.CHANNEL function in eris

To help you get started, we’ve selected a few eris examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dragory / modmailbot / src / modules / move.js View on Github external
return;
    }

    // If enabled, sync thread channel permissions with the category it's moved to
    if (config.syncPermissionsOnMove) {
      const newPerms = Array.from(targetCategory.permissionOverwrites.map(ow => {
        return {
          id: ow.id,
          type: ow.type,
          allow: ow.allow,
          deny: ow.deny
        };
      }));

      try {
        await bot.requestHandler.request("PATCH", erisEndpoints.CHANNEL(thread.channel_id), true, {
          permission_overwrites: newPerms
        });
      } catch (e) {
        thread.postSystemMessage(`Thread moved to ${targetCategory.name.toUpperCase()}, but failed to sync permissions: ${e.message}`);
        return;
      }
    }

    thread.postSystemMessage(`Thread moved to ${targetCategory.name.toUpperCase()}`);
  });
};
github atlasbot / bot / src / commands / Moderation / slowmode.js View on Github external
async action(msg, args) {
		const responder = new this.Atlas.structs.Responder(msg);

		if (!args.length) {
			return responder.embed(this.helpEmbed(msg)).send();
		}

		const num = this.Atlas.lib.utils.parseNumber(args[0]);

		if (this.Atlas.lib.utils.toggleType(args[0], false) === false || num === 0) {
			await this.Atlas.client.requestHandler.request('PATCH', Endpoints.CHANNEL(msg.channel.id), true, {
				rate_limit_per_user: 0,
			});

			return responder.text('slowmode.disabled', msg.channel.mention).send();
		}

		if (isNaN(num)) {
			return responder.embed(this.helpEmbed(msg)).send();
		}

		if (num < 0 || num > 120) {
			return responder.error('slowmode.invalid').send();
		}

		await this.Atlas.client.requestHandler.request('PATCH', Endpoints.CHANNEL(msg.channel.id), true, {
			rate_limit_per_user: num,