This repository has been archived on 2026-01-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
frostbot/src/plugins/key_value.js
2025-06-25 11:43:53 -07:00

40 lines
588 B
JavaScript

function main(context) {
const { bot } = context;
bot.KeyValue = class {
constructor() {
this.map = new Map();
}
store(key, value, time) {
this.map.set(key, value);
setTimeout(() => this.map.delete(key), time);
}
get(key) {
return this.map.get(key);
}
delete(key) {
this.map.delete(key);
}
clear() {
this.map = new Map();
}
keys() {
return this.map.keys();
}
values() {
return this.map.values();
}
getMap() {
return this.map;
}
};
}
module.exports = main;