seyfert
Version:
The most advanced framework for discord bots
58 lines (57 loc) • 1.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvitesShorter = void 0;
const utils_1 = require("../it/utils");
const base_1 = require("./base");
class InvitesShorter extends base_1.BaseShorter {
get(code) {
return this.client.proxy
.invites(code)
.get()
.then(x => (0, utils_1.toCamelCase)(x));
}
delete(code, reason) {
return this.client.proxy
.invites(code)
.delete({ reason })
.then(x => (0, utils_1.toCamelCase)(x));
}
/**
* Returns a list of users that can accept this invite.
* @param code The invite code.
* @returns The csv file as a string, with a single header user_id.
*/
getTargetUsers(code) {
return this.client.proxy.invites(code)['target-users'].get();
}
updateTargetUsers(code, targetIds) {
return this.client.proxy.invites(code)['target-users'].put({
body: {
target_users_file: new Blob([`users\n${targetIds.join('\n')}`], { type: 'text/csv' }),
},
appendToFormData: true,
});
}
jobStatus(code) {
return this.client.proxy
.invites(code)['target-users']['job-status'].get()
.then(x => (0, utils_1.toCamelCase)(x));
}
channels = {
create: ({ channelId, reason, ...body }) => this.client.proxy
.channels(channelId)
.invites.post({ body, reason })
.then(x => (0, utils_1.toCamelCase)(x)),
list: (channelId) => this.client.proxy
.channels(channelId)
.invites.get()
.then(x => (0, utils_1.toCamelCase)(x)),
};
guilds = {
list: (guildId) => this.client.proxy
.guilds(guildId)
.invites.get()
.then(x => (0, utils_1.toCamelCase)(x)),
};
}
exports.InvitesShorter = InvitesShorter;