我见过一些机器人创建了代表用户的“幽灵”帐户,它仍然是同一机器人,单击上一个迭代将显示当前迭代的名称和个人资料图片,但是从不显示有关该用户的信息,就像它们已被删除或离开服务器一样。
这是一个示例,该bot根据用户的讲话对其进行重命名,基本上是其聊天记录。
在图片中,我单击了第二个用户,您可以看到它是最近使用过的用户。 原始漫游器从不会更改名称或发生任何更改,从字面上看就像一个新帐户一样。
在这个问题上我找不到任何东西,但人们只是以某种方式知道如何制作。
答案 0 :(得分:2)
那些“幽灵帐户”被称为http://dev.openlayers.org/examples/modify-feature.html。您可以手动创建Webhooks(“服务器设置”>“ Webhooks”>“创建Webook”),也可以使用webhooks的TextChannel方法来创建。示例:
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('message', (message) => {
if (message.content == "createWebhook") {
message.channel.createWebhook("My Webhook", "https://support.discordapp.com/system/photos/3602/4079/7511/dan.png", "Reason").then(() => {message.reply("Webhook created!")}).catch((error) => {message.reply("Couldn't create webhook."); return console.log(error)});
}
});
bot.login("TOKEN");
使用网络挂钩:
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('message', (message) => {
if (message.content == "sendWebhook") {
const Webhook = new Discord.WebhookClient("Webhook ID", "Webhook Token");
Webhook.send("Hello there!");
}
});
bot.login("TOKEN");
您也可以在HTML公式中使用它。
<html>
<head>
<link rel = "stylesheet" href = "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src = "https://code.jquery.com/jquery-3.4.1.min.js"></script>
<title>Send Webhook</title>
</head>
<body class = "bg-dark">
<main class = "container">
<div class = "card">
<div class = "card-header text-center">Send Webhook</div>
<div class = "card-body">
<div class = "form-group">
<form id = "form">
<label for = "url">Webhook URL: *</label>
<input required type = "text" id = "url" class = "form-control">
<label for = "message">Webhook Message: *</label>
<input required type = "text" id = "message" class = "form-control">
<hr>
<label for = "username">Webhook Username:</label>
<input type = "text" id = "username" class = "form-control">
<label for = "avatar">Webhook Avatar:</label>
<input type = "text" id = "avatar" class = "form-control">
<hr>
<div class = "d-flex justify-content-center">
<button type = "submit" class = "btn btn-outline-primary">Submit</button>
</div>
</form>
</div>
</div>
</div>
</main>
<script>
$(document).ready(function() {
$("#form").submit(function() {
var url = $("#url").val();
var message = $("#message").val();
var username = $("#username").val();
var avatar = $("#avatar").val();
$.post(url, {"content": message, "username": username, "avatar_url": avatar})
return false;
})
})
</script>
</body>
</html>