問(wèn)題描述
所以我正在嘗試創(chuàng)建我的機(jī)器人,我希望有一個(gè)命令可以將信息添加到 sqlite 數(shù)據(jù)庫(kù)
So I'm trying to create my bot and I want there to be a command which adds information to a sqlite database
https://gyazo.com/6961a05dc2d6aeca6683b59f888c2e82
if (command === "addplayer") {
message.delete()
let [name, crew, rank, weapon, df, talent, profession, other] = args;
if(!name) return message.author.send("Name argument is required!");
let id = name.toLowerCase();
if(!crew) {let crew = "Blank";}
if(!rank) {let rank = "Blank";}
if(!weapon) {let weapon = "Blank";}
if(!df) {let df = "Blank";}
if(!talent) {let talent = "Blank";}
if(!profession) {let profession = "Blank";}
if(!other) {let other = "Blank";}
sql.run("INSERT INTO players (id, Name, Crew, Rank, Weapon, DF,
Talent, Profession, Other) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", [id,
name, crew, rank, weapon, df, talent, profession, other]);
return
}
我真正想知道的是如何在參數(shù)中添加空格鍵這樣我就可以做到
All I want to know really is how to add like a space key to the arguments so I can do
>用空格添加玩家信息,更多信息,甚至更多,等等
當(dāng)我執(zhí)行其他命令時(shí),它會(huì)這樣列出:
And when I do the other command it lists it out like this:
Info1:帶空格的信息Info2:更多信息Info3:更多Info4:等等
推薦答案
我剛剛決定使用多個(gè)命令,例如
I've just decided to go with multiple commands like
>編輯示例
然后做類似的事情
>editname EXAMPLE1
將名稱設(shè)置為EXAMPLE1而不是EXAMPLE
>editname EXAMPLE1
setting the name to EXAMPLE1 instead of EXAMPLE
這篇關(guān)于Discord.js 帶空格的參數(shù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!