API:https://github.com/satom99/litcordは、どのように私は私の「変数が」有効「ID」であるかどうかを確認することができます
がどのように私は私のvaliableその場合、有効なIDを確認することができますか?
local cmd, serverID, channelID, arg = string.match(message.content, '(%S+) (%d+) (%d+) (%S+.*)')
local server = client.servers:get('id', serverID)
のserverIDは可変であり、私はそうでなければ、私は、サーバーがnilの値であるというエラーメッセージが表示されますサーバーIDが有効なID であるかどうかを確認する必要があります。
私は1つのコマンドを完了するための日数を試していますが、これはその一部です。 さらに内容が必要な場合は教えてください、私はそれをあなたにリンクします。
全コード:
client:on(
'message',
function(message)
local userID = message.author.id
local cmd, serverID, channelID, arg = string.match(message.content, '(%S+) (%d+) (%d+) (%S+.*)')
local server = client.servers:get('id', serverID)
local channel = server.channels:get('id', channelID)
local cmd = cmd or message.content
if (cmd == "!say") and message.parent.is_private then
if (userID == "187590758360940545") then
if not server then
return
end
if (server == servers) then
if (channel == channels) then
message.channel:sendMessage(arg)
else
message:reply("I don't know this channel.")
return
end
message:reply("I don't know this server.")
end
else
message:reply(":sob: Stop!!!!")
end
end
end
)
そして、どのように私はそれが私が機能 message.channel:sendMessage(argにしたいチャンネルに書いてみましょうことができます) これは、メッセージのようなものです:返信 は、それが戻って返信メッセージはどこから来たのか。
'message.content'が正しい形式かどうか、' client.servers:get() 'があなたの' serverID'を受け入れるかどうか確認する必要がありますか? – mpeterv
Skype? 私はそのclient.serversを推測します:get() 私はそれをあなたにスカイプしてすべてをリンクすれば、それをより良く説明できます。 serverIDがmyコマンドから受け入れられるかどうかを確認する必要があります。 – jepjep40
okgeändert.... – jepjep40