【发布时间】:2022-02-09 14:46:23
【问题描述】:
我想要什么:
我正在努力做到这一点,因此当在我的不和谐中从员工中添加或删除成员时,它会在我拥有的网站上更新它。我试过用 node.js 做这个,但是我不能使用文档属性等。基本上我想知道这是否可能。
代码 JS:
const headBoardOfDirectors = document.querySelector('#hbod-role');
const boardOfDirectors = document.querySelector('#bod-role');
const headAdmin = document.querySelector('#ha-role');
const seniorAdmin = document.querySelector('#sa-role');
const admin = document.querySelector('#a-role');
const headModerator = document.querySelector('#hm-role');
const moderator = document.querySelector('#m-role');
const trialModerator = document.querySelector('#tm-role');
// Below is just an example of what I am talking about.
staff = [
bunch of staff roles here
]
if (some member role add or remove event) {
if (role added or removed is staff) {
if (role name is Head Board of Directors) {
headBoardOfDirectors.innerHTML = `${headBoardOfDirectors.innerHTML}\n${member name}`
}
}
}
代码 HTML:
<div id="staff">
<table>
<tr>
<th class="main"></th>
<th class="main">Staff</th>
<th class="main"></th>
</tr>
<tr>
<th></th>
<th>Founder</th>
<th></th>
</tr>
<tr>
<td></td>
<td>killrebeest#1001</td>
<td></td>
</tr>
<tr>
<th></th>
<th>Owner</th>
<th></th>
</tr>
<tr>
<td></td>
<td>fluffy#9459</td>
<td></td>
</tr>
<tr>
<th></th>
<th>Head of Board of Directors</th>
<th></th>
</tr>
<tr>
<td></td>
<td id="hbod-role"></td>
<td></td>
</tr>
<tr>
<th></th>
<th>Board of Directors</th>
<th></th>
</tr>
<tr id="bod-role">
</tr>
<tr>
<th></th>
<th>Head Administration</th>
<th></th>
</tr>
<tr id="ha-role">
</tr>
<tr>
<th></th>
<th>Senior Administration</th>
<th></th>
</tr>
<tr id="sa-role">
</tr>
<tr>
<tr>
<th></th>
<th>Administration</th>
<th></th>
</tr>
<tr id="a-role">
</tr>
<tr>
<th></th>
<th>Head Moderation</th>
<th></th>
</tr>
<tr id="hm-role">
</tr>
<tr>
<th></th>
<th>Moderation</th>
<th></th>
</tr>
<tr id="m-role">
</tr>
<tr>
<th></th>
<th>Trial Moderation</th>
<th></th>
</tr>
<tr id="tm-role">
</tr>
</table>
</div>
总结:
基本上我主要想知道这是否可能,我认为这绝对应该是。如果可能的话,怎么做,或者有任何参考资料可以帮助我解决这个问题。
谢谢,
杀羚羊
【问题讨论】:
标签: javascript html node.js discord discord.js