我正在为Discord开发聊天机器人,它与名为" Duelyst"的纸牌游戏有关。我这么说就是这么说的 [[CardName]] 它会回复有关卡的信息。我使用Node.js使用npm包。
目前它的设置如下:
$ou = "OU=Test,DC=Contoso,DC=com"
$adpath = "AD:\$ou"
# Check if this OU Exist
Test-Path $adpath
# Throw Error if OU doesn't exist
Join-Path 'AD:' $ou -Resolve
我只是想知道我是否可以使用类似的东西:
else if (sinput === "[[shutdown]]")
我用来删除任何空格/大写字母,删除[[xxx]]之外的任何文字,以便有人可以在句子中调用它。现在你需要调用IF中的内容(不包括大写字母和空格)。
示例聊天文字
"你们怎么想[[astral]]我觉得很酷#34;
所以我希望能够修改字符串以删除[[]]周围的任何内容
答案 0 :(得分:0)
试试这个
<script type="text/javascript">
var str = "This is just [[Testing]] for you";
var str = str.toLowerCase();
var regExp = /\[\[([^)]+)\]\]/;
var matches = regExp.exec(str);
alert(matches[0]);
</script>
答案 1 :(得分:0)
考虑一种不同的方法:拉出declare var componentHandler: any;
中包含的任何内容然后对其采取行动:
[[]]