所以我正在尝试创建我的机器人,我希望有一个命令可以将信息添加到 sqlite 数据库
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
}
我真正想知道的是如何在参数中添加空格键这样我就可以做到
All I want to know really is how to add like a space key to the arguments so I can do
>用空格添加玩家信息,更多信息,甚至更多,等等
当我执行其他命令时,它会这样列出:
And when I do the other command it lists it out like this:
Info1:带空格的信息Info2:更多信息Info3:更多Info4:等等
我刚刚决定使用多个命令,例如
I've just decided to go with multiple commands like
>编辑示例然后做类似的事情
>editname EXAMPLE1将名称设置为EXAMPLE1而不是EXAMPLE
>editname EXAMPLE1 setting the name to EXAMPLE1 instead of EXAMPLE
这篇关于Discord.js 带空格的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
discord.js v12:我如何等待 DM 频道中的消息?discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 频道中的消息?)
如何让我的机器人提及发出该机器人命令的人how to make my bot mention the person who gave that bot command(如何让我的机器人提及发出该机器人命令的人)
如何修复必须使用导入来加载 ES 模块 discord.jsHow to fix Must use import to load ES Module discord.js(如何修复必须使用导入来加载 ES 模块 discord.js)
如何列出来自特定服务器的所有成员?How to list all members from a specific server?(如何列出来自特定服务器的所有成员?)
Discord bot:修复“找不到 FFMPEG"Discord bot: Fix ‘FFMPEG not found’(Discord bot:修复“找不到 FFMPEG)
使用 discord.js 加入 discord 服务器时的欢迎消息Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服务器时的欢迎消息)