This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| client.on('message', message => { | |
| if (!message.content.startsWith(prefix) || message.author.bot) return | |
| let user = message.mentions.users.first() | |
| const args = message.content.slice(prefix.length).split(/ +/) | |
| const command = args.shift().toLowerCase() | |
| if (command === 'marry') { | |
| if (!user) return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { details } = resp.Result | |
| const keyMatch = i => | |
| `InternetGatewayDevice.TraceRouteDiagnostics.RouteHops.${i}.HopErrorCode` | |
| for (let i = 1; i < details.length; i++) { | |
| let resp2 = details.find(x => x.key == keyMatch(i)).value | |
| return resp2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function extractParamStrings(s) { | |
| if (s[0] === '?') s = s.slice(1, s.length) | |
| return s.split('&') | |
| } | |
| const extractParamKeyValPair = paramString => | |
| paramString.split('=').map(decodeURIComponent) | |
| const addParam = (toObj, [key, val]) => { | |
| toObj[key] = val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function fromUrlQuery(str) { | |
| if (!str) return {} | |
| if (str[0] === '?') str = str.slice(1, str.length) | |
| return str.split('&').reduce((acc, vars) => { | |
| const [key, val] = vars.split('=').map(decodeURIComponent) | |
| acc[key] = val | |
| return acc | |
| }, {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ret = str.split('&').reduce((acc, vars) => { | |
| const [key, val] = vars.split('=').map(decodeURIComponent) | |
| console.log('fromURLQuery', { key, val }) | |
| acc[key] = val | |
| return acc | |
| }, {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (let i = 0; i < vars.length; i++) { | |
| let pair = vars[i].split('=').map(decodeURIComponent) | |
| ret[pair[0]] = pair[1] | |
| console.log('fromURLQuery', pair) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function fromURLQuery(str) { | |
| console.log('fromURLQuery BEGIN', str) | |
| if (!str) { | |
| console.log('fromURLQuery return empty', ret) | |
| return {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function fromURLQuery(str) { | |
| console.log('fromURLQuery BEGIN', str) | |
| let ret = {} | |
| if (!str) { | |
| console.log('fromURLQuery return empty', ret) | |
| return ret | |
| } | |
| if (str[0] === '?') str = str.slice(1, str.length) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function fromURLQuery(str) { | |
| console.log('fromURLQuery BEGIN', str) | |
| let ret = {} | |
| if (!str) { | |
| console.log('fromURLQuery return empty', ret) | |
| return ret | |
| } | |
| if (str[0] === '?') str = str.slice(1, str.length) | |
| let vars = str.split('&') | |
| for (let i = 0; i < vars.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const prices = { | |
| "Residential": 90, | |
| "Business": 150, | |
| } | |
| // TODO Handle no price found. | |
| const price = numberOfRooms * prices[propertyUsage] | |
| let discountMultiplier = 0 | |
| if (numberOfRooms >= 10) { |
NewerOlder