-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (28 loc) · 840 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require("dotenv").config();
/*------- REQUIRED -------*/
const server = "https://api.artifactsmmo.com"; // Base URL
const token = process.env.API_KEY; // API Key
// const character = "d3c0y"; // Character Name
/*------- REQUIRED -------*/
// Character name, x location, y location
async function movement(character, x, y) {
const url = server + "/my/" + character + "/action/move";
const options = {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer " + token,
},
body: JSON.stringify({x: x, y: y}),
};
try {
const response = await fetch(url, options);
const { data } = await response.json();
console.log(data);
} catch (error) {
console.log(error);
}
}
movement("d3c0y", 0, 1);
movement("bigbangboom", 0, 1)