mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 15:57:43 +02:00
Allow deleting reminders
This commit is contained in:
@@ -268,7 +268,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 563
|
Total: 564
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -849,6 +849,11 @@ Total: 563
|
|||||||
* **soundboard:** Plays a sound in a voice channel.
|
* **soundboard:** Plays a sound in a voice channel.
|
||||||
* **vocodes:** Speak text like a variety of famous figures.
|
* **vocodes:** Speak text like a variety of famous figures.
|
||||||
|
|
||||||
|
### Reminders:
|
||||||
|
|
||||||
|
* **delete-reminder:** Deletes your reminder.
|
||||||
|
* **remind:** Sets a reminder.
|
||||||
|
|
||||||
### Phone:
|
### Phone:
|
||||||
|
|
||||||
* **admin-phone:** Starts an admin phone call with a server. (Owner-Only)
|
* **admin-phone:** Starts an admin phone call with a server. (Owner-Only)
|
||||||
@@ -870,7 +875,6 @@ Total: 563
|
|||||||
* **dating:** Find the person of your dreams with this dating system!
|
* **dating:** Find the person of your dreams with this dating system!
|
||||||
* **portal-send:** Send a message to a portal channel.
|
* **portal-send:** Send a message to a portal channel.
|
||||||
* **prune:** Deletes up to 99 messages from the current channel.
|
* **prune:** Deletes up to 99 messages from the current channel.
|
||||||
* **remind:** Sets a reminder.
|
|
||||||
* **rename-all:** Renames every member of the server. (Owner-Only)
|
* **rename-all:** Renames every member of the server. (Owner-Only)
|
||||||
* **screenshot:** Takes a screenshot of any webpage.
|
* **screenshot:** Takes a screenshot of any webpage.
|
||||||
* **smilebasic:** Responds with a ZIP file for a SmileBASIC project.
|
* **smilebasic:** Responds with a ZIP file for a SmileBASIC project.
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ client.registry
|
|||||||
['edit-text', 'Text Manipulation'],
|
['edit-text', 'Text Manipulation'],
|
||||||
['edit-number', 'Number Manipulation'],
|
['edit-number', 'Number Manipulation'],
|
||||||
['voice', 'Play Audio'],
|
['voice', 'Play Audio'],
|
||||||
|
['remind', 'Reminders'],
|
||||||
['phone', 'Phone'],
|
['phone', 'Phone'],
|
||||||
['code', 'Coding Tools'],
|
['code', 'Coding Tools'],
|
||||||
['other', 'Other'],
|
['other', 'Other'],
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
|
||||||
|
module.exports = class DeleteReminderCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'delete-reminder',
|
||||||
|
aliases: ['delete-remind', 'delete-timer', 'del-reminder', 'del-remind', 'del-timer'],
|
||||||
|
group: 'remind',
|
||||||
|
memberName: 'remind',
|
||||||
|
description: 'Deletes your reminder.'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg) {
|
||||||
|
const exists = await this.client.timers.exists(msg.channel.id, msg.author.id);
|
||||||
|
if (!exists) return msg.reply('You do not have a timer set in this channel.');
|
||||||
|
await this.client.timers.deleteTimer(msg.channel.id, msg.author.id);
|
||||||
|
return msg.say('🕰️ Your timer has been deleted.');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -7,7 +7,7 @@ module.exports = class RemindCommand extends Command {
|
|||||||
super(client, {
|
super(client, {
|
||||||
name: 'remind',
|
name: 'remind',
|
||||||
aliases: ['timer', 'remind-me'],
|
aliases: ['timer', 'remind-me'],
|
||||||
group: 'other',
|
group: 'remind',
|
||||||
memberName: 'remind',
|
memberName: 'remind',
|
||||||
description: 'Sets a reminder.',
|
description: 'Sets a reminder.',
|
||||||
args: [
|
args: [
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "121.2.2",
|
"version": "121.3.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const winston = require('winston');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Redis = require('./Redis');
|
const Redis = require('./Redis');
|
||||||
const TimerManager = require('./timer/TimerManager');
|
const TimerManager = require('./remind/TimerManager');
|
||||||
const PokemonStore = require('./pokemon/PokemonStore');
|
const PokemonStore = require('./pokemon/PokemonStore');
|
||||||
const MemePosterClient = require('./MemePoster');
|
const MemePosterClient = require('./MemePoster');
|
||||||
const activities = require('../assets/json/activity');
|
const activities = require('../assets/json/activity');
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
module.exports = class TimerManager {
|
module.exports = class TimerManager {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
Object.defineProperty(this, 'client', { value: client });
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
|
|
||||||
|
this.timeouts = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchAll() {
|
async fetchAll() {
|
||||||
@@ -23,9 +25,16 @@ module.exports = class TimerManager {
|
|||||||
}
|
}
|
||||||
}, time);
|
}, time);
|
||||||
if (updateRedis) await this.client.redis.hset('timer', { [`${channelID}-${userID}`]: JSON.stringify(data) });
|
if (updateRedis) await this.client.redis.hset('timer', { [`${channelID}-${userID}`]: JSON.stringify(data) });
|
||||||
|
this.timeouts.set(`${channelID}-${userID}`, timeout);
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteTimer(channelID, userID) {
|
||||||
|
clearTimeout(this.timeouts.get(`${channelID}-${userID}`));
|
||||||
|
this.timeouts.delete(`${channelID}-${userID}`);
|
||||||
|
return this.client.redis.hdel('timer', `${channelID}-${userID}`);
|
||||||
|
}
|
||||||
|
|
||||||
exists(channelID, userID) {
|
exists(channelID, userID) {
|
||||||
return this.client.redis.hexists('timer', `${channelID}-${userID}`);
|
return this.client.redis.hexists('timer', `${channelID}-${userID}`);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user