Compare commits
2 Commits
fdbf05b846
...
0cd23ff738
Author | SHA1 | Date | |
---|---|---|---|
0cd23ff738 | |||
ba8d2f5cb9 |
@ -6,10 +6,11 @@ var DataStore = require("./datastore");
|
|||||||
var ds = new DataStore("activity");
|
var ds = new DataStore("activity");
|
||||||
|
|
||||||
|
|
||||||
app.get("/detect/:userid", (req, res) => {
|
app.get("/detect/:code", (req, res) => {
|
||||||
res.sendFile(process.cwd() + "/track-image.png");
|
res.sendFile(process.cwd() + "/track-image.png");
|
||||||
if (req.headers["user-agent"].includes("Discordbot")) return;
|
if (req.headers["user-agent"].includes("Discordbot")) return;
|
||||||
onActivity(req.params.userid);
|
onActivity(ds.get(req.params.code));
|
||||||
|
ds.del(req.params.code);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -82,11 +83,14 @@ async function deactivateMember(member) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var magic_channel_message_id = ds.get(member.id + "magicchannelmessage");
|
var magic_channel_message_id = ds.get(member.id + "magicchannelmessage");
|
||||||
|
var unique_code = Math.random().toString();
|
||||||
|
ds.put(unique_code, member.id);
|
||||||
|
var content = `${config.base_uri}/detect/${unique_code}`;
|
||||||
if (!magic_channel_message_id) {
|
if (!magic_channel_message_id) {
|
||||||
var magic_channel_message = await magic_channel.send(`${config.base_uri}/detect/${member.id}?${Math.random()}`);
|
var magic_channel_message = await magic_channel.send({content});
|
||||||
ds.put(member.id + "magicchannelmessage", magic_channel_message.id)
|
ds.put(member.id + "magicchannelmessage", magic_channel_message.id)
|
||||||
} else {
|
} else {
|
||||||
await magic_channel.messages.edit(magic_channel_message_id, {content: `${config.base_uri}/detect/${member.id}?${Math.random()}`});
|
await magic_channel.messages.edit(magic_channel_message_id, {content});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user