An SDK that facilitates interaction with my API.
npm install @duque.edits/restbash
npm install @duque.edits/rest
`
Usage
`javascript
const { REST } = require("@duque.edits/rest");
const client = new REST();
// Always initiate as it caches users, guilds, bets, matches.
client.init().then(async () => {
const guild = client.guilds.cache.at("1336809872884371587");
// In my API, using fetch will automatically create an user if he doesn't exist
const user = guild.users.fetch("877598927149490186");
console.log({ user });
// Reseting users
client.users.resetAll();
// Or
client.betUsers.resetAll();
});
`
Update 2.1.0
$3
`js
client.init().then(async (_) => {
const guild = client.guilds.cache.get("1336809872884371587");
const shop = guild?.shop;
const products = await shop.products.fetchAll();
const product = await shop.products.create({ name: "Duque", description: "The duque is the one", price: 20 });
await product.addBuyer("877598927149490186", "duque7x", "bet");
await product.update({ description: "Netflix por 10€", name: "Duque ain't the one", price: 100 });
});
`
Update 2.3.0
$3
`js
client.init().then(async (_) => {
const guild = client.guilds.cache.get("1336809872884371587");
const { tickets } = guild;
const ticket = await tickets.create("877598927149490186", "support");
await Promise.all([
await ticket.setAdminId("199992755886358528"),
await ticket.setClosedById("199992755886358528"),
await ticket.setCustomerRating(10),
await ticket.setType("support"),
]);
});
``