Add /info command

This commit is contained in:
Franck Royer 2021-04-23 14:56:18 +10:00
parent f5edd09fa9
commit e467cf1379
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 10 additions and 0 deletions

View File

@ -82,6 +82,7 @@ export default function App() {
switch (cmd) { switch (cmd) {
case '/help': case '/help':
commandResponses.push('/nick <nickname>: set a new nickname'); commandResponses.push('/nick <nickname>: set a new nickname');
commandResponses.push('/info: some information about the node');
commandResponses.push( commandResponses.push(
'/connect <Multiaddr>: connect to the given peer' '/connect <Multiaddr>: connect to the given peer'
); );
@ -96,6 +97,15 @@ export default function App() {
commandResponses.push(`New nick: ${arg}`); commandResponses.push(`New nick: ${arg}`);
} }
break; break;
case '/info':
if (!stateWaku) {
commandResponses.push(`Waku node is starting`);
} else {
commandResponses.push(
`PeerId: ${stateWaku.libp2p.peerId.toB58String()}`
);
}
break;
case '/connect': case '/connect':
const peer = args.shift(); const peer = args.shift();
if (!peer) { if (!peer) {