This file contains 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
/** | |
* Functional queue shift. Will return an array in which the first element is sent to the back of the array and the others moved forward. Does not mutate origional array. | |
* @param arr The array you want to shift. | |
* @returns The new shifted array. | |
*/ | |
function shiftQueue<T>(arr: Array<T>): Array<T> { | |
const [first , ...rest] = arr | |
return [...rest, first] | |
} |
This file contains 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
// TODO what if we restructured to take the slash command/other command objects, and then created specific objects for akairo related. | |
import { AkairoModule, AkairoModuleOptions } from "discord-akairo" | |
import type { ApplicationCommandData, ApplicationCommandPermissionData, CommandInteraction } from 'discord.js' | |
/**Outlines permissions that can be passed to define how the command handles being added to the server specified */ | |
export interface ServerCommandPermissionSettings { | |
/**The server to install this command on. */ | |
serverID: string | |
/**The server specific roles we want to give this command access to be used by */ |
This file contains 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 pot_filter = { | |
mp300: (item) => item && item.name == 'mpot0', | |
mp500: (item) => item && item.name == 'mpot1', | |
hp300: (item) => item && item.name == 'hpot0', | |
hp500: (item) => item && item.name == 'hpot1', | |
find_usable: (input_filter) => character | |
.items | |
.findIndex(input_filter), | |
find_total: (input_filter) => character | |
.items |
This file contains 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 { | |
DateTime, | |
Settings, | |
Duration | |
} = require('luxon') | |
const iter = [0, 0] | |
function resolveOffset() { | |
const this_second = () => DateTime.local().second | |
let current_tenth = null |
This file contains 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 readline = require('readline') | |
let skillList = { | |
punch: 10, | |
kick: 20, | |
bite: 30 | |
} | |
const skillNames = Object.keys(skillList) | |
const getRandomInt = MaxRoll => Math.floor(Math.random() * Math.floor(MaxRoll)) | |
const getRandomSkill = skillNames[getRandomInt(3)] |
This file contains 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
let date = new Date() //Get today | |
let transformDate = date.getDate() - 30 //Remove 30 days from today | |
date.setDate(transformDate) //Set the current date to the removed days version variable | |
console.log(`${date.getFullYear()}-${date.getMonth().toString().length == 1 ? '0' + (date.getMonth()+1) : date.getMonth()}-${date.getDate()}`) //Console logs the new format for sql |
This file contains 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
let meme = [['Goofy', 1, 'hello'], ['Goofy', 4, 'bye'], ['Daffy', 1, 'hello'], ['Daffy', 2, 'bye']] | |
.reduce((test, line)=>{ | |
test[line[0]] = test[line[0]] || [] | |
test[line[0]].push({ | |
quantity: line[1], | |
query: line[2] | |
}) | |
return test | |
}, {}) |
This file contains 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
let count = {} | |
whateverYourArrayIs.forEach((i)=>{ count[i] = (count[i]||0) + 1 }) | |
console.log(count) |
This file contains 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
func Sleepy($time) | |
for $i = 1 to $time step 1 | |
Sleep(1000) | |
ConsoleWrite("Sleepy slept for "&$i&" seconds so far."&@CRLF) | |
Next | |
EndFunc |
NewerOlder