mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +00:00
Changed embeds to HybridInteractionMessage
This commit is contained in:
@@ -24,7 +24,7 @@ import Users from '../../services/Users';
|
|||||||
const hexToDecimal = (hex: string) => parseInt(hex.replace('#', ''), 16);
|
const hexToDecimal = (hex: string) => parseInt(hex.replace('#', ''), 16);
|
||||||
|
|
||||||
const EMBEDS = {
|
const EMBEDS = {
|
||||||
ANNOUNCEMENT_INFO: (data: Message | BaseInteraction) => {
|
ANNOUNCEMENT_INFO: (data: HybridInteractionMessage) => {
|
||||||
return makeInfoEmbed({
|
return makeInfoEmbed({
|
||||||
title: 'Service Announcement',
|
title: 'Service Announcement',
|
||||||
description: `This module contains management tool for announcement feed\n The announcement message is located in \`\`configs/ServiceAnnouncement.json\`\``,
|
description: `This module contains management tool for announcement feed\n The announcement message is located in \`\`configs/ServiceAnnouncement.json\`\``,
|
||||||
@@ -34,14 +34,14 @@ const EMBEDS = {
|
|||||||
value: '``reload`` ``previewNews`` ``sendNews`` ``previewMaintenance`` ``sendMaintenance`` ``previewMessage`` ``sendMessage`` ``previewAlert`` ``sendAlert``'
|
value: '``reload`` ``previewNews`` ``sendNews`` ``previewMaintenance`` ``sendMaintenance`` ``previewMessage`` ``sendMessage`` ``previewAlert`` ``sendAlert``'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
NOT_DEVELOPER: (data: Message | BaseInteraction) => {
|
NOT_DEVELOPER: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: 'Developer only',
|
title: 'Developer only',
|
||||||
description: `This command is restricted to the developers only`,
|
description: `This command is restricted to the developers only`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
MAKE_PAYLOAD: (payload: EmbedData) => {
|
MAKE_PAYLOAD: (payload: EmbedData) => {
|
||||||
@@ -67,38 +67,38 @@ const EMBEDS = {
|
|||||||
|
|
||||||
return new EmbedBuilder(payload);
|
return new EmbedBuilder(payload);
|
||||||
},
|
},
|
||||||
RELOADED: (data: Message | BaseInteraction) => {
|
RELOADED: (data: HybridInteractionMessage) => {
|
||||||
return makeSuccessEmbed({
|
return makeSuccessEmbed({
|
||||||
title: 'Service Announcement Configuration Reloaded',
|
title: 'Service Announcement Configuration Reloaded',
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
RELOAD_ERROR: (data: Message | BaseInteraction, error: string) => {
|
RELOAD_ERROR: (data: HybridInteractionMessage, error: string) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: 'Unable to reload Service Announcement Configuration',
|
title: 'Unable to reload Service Announcement Configuration',
|
||||||
description: `\`\`\`${error}\`\`\``,
|
description: `\`\`\`${error}\`\`\``,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
SENDING_SERVICE_ANNOUNCEMENT: (data: Message | BaseInteraction) => {
|
SENDING_SERVICE_ANNOUNCEMENT: (data: HybridInteractionMessage) => {
|
||||||
return makeProcessingEmbed({
|
return makeProcessingEmbed({
|
||||||
title: 'Service Announcement',
|
title: 'Service Announcement',
|
||||||
description: `Broadcasting Service Announcement`,
|
description: `Broadcasting Service Announcement`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
SERVICE_ANNOUNCEMENT_SENT: (data: Message | BaseInteraction) => {
|
SERVICE_ANNOUNCEMENT_SENT: (data: HybridInteractionMessage) => {
|
||||||
return makeSuccessEmbed({
|
return makeSuccessEmbed({
|
||||||
title: 'Service Announcement',
|
title: 'Service Announcement',
|
||||||
description: `Broadcasted Service Announcement`,
|
description: `Broadcasted Service Announcement`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
SERVICE_ANNOUNCEMENT_SENT_WITH_ERRORS: (data: Message | BaseInteraction) => {
|
SERVICE_ANNOUNCEMENT_SENT_WITH_ERRORS: (data: HybridInteractionMessage) => {
|
||||||
return makeWarningEmbed({
|
return makeWarningEmbed({
|
||||||
title: 'Service Announcement',
|
title: 'Service Announcement',
|
||||||
description: `Broadcasted Service Announcement with errors, check console for more info`,
|
description: `Broadcasted Service Announcement with errors, check console for more info`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -167,7 +167,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
async run(data: HybridInteractionMessage, args: any) {
|
async run(data: HybridInteractionMessage, args: any) {
|
||||||
if (!Users.isDeveloper(data.getUser()!.id))
|
if (!Users.isDeveloper(data.getUser()!.id))
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.NOT_DEVELOPER(data.getRaw())]
|
embeds: [EMBEDS.NOT_DEVELOPER(data)]
|
||||||
});
|
});
|
||||||
|
|
||||||
const channel = data.getChannel();
|
const channel = data.getChannel();
|
||||||
@@ -185,7 +185,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
Logger.error('Unable to load custom ServiceAnnouncement config: ' + err);
|
Logger.error('Unable to load custom ServiceAnnouncement config: ' + err);
|
||||||
return await sendMessage(channel, undefined, {
|
return await sendMessage(channel, undefined, {
|
||||||
embeds: [EMBEDS.RELOAD_ERROR(data.getRaw(), err)]
|
embeds: [EMBEDS.RELOAD_ERROR(data, err)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -197,7 +197,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return await sendMessage(channel, undefined, {
|
return await sendMessage(channel, undefined, {
|
||||||
embeds: [EMBEDS.RELOADED(data.getRaw())]
|
embeds: [EMBEDS.RELOADED(data)]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
previewNews: async (data: HybridInteractionMessage) => {
|
previewNews: async (data: HybridInteractionMessage) => {
|
||||||
@@ -252,7 +252,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
|
|
||||||
let _placeholder = await sendHybridInteractionMessageResponse(
|
let _placeholder = await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.SENDING_SERVICE_ANNOUNCEMENT(data.getRaw())] },
|
{ embeds: [EMBEDS.SENDING_SERVICE_ANNOUNCEMENT(data)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
||||||
@@ -300,7 +300,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({
|
.edit({
|
||||||
embeds: [
|
embeds: [
|
||||||
EMBEDS.SERVICE_ANNOUNCEMENT_SENT_WITH_ERRORS(data.getRaw())
|
EMBEDS.SERVICE_ANNOUNCEMENT_SENT_WITH_ERRORS(data)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
@@ -308,7 +308,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
data,
|
data,
|
||||||
{
|
{
|
||||||
embeds: [
|
embeds: [
|
||||||
EMBEDS.SERVICE_ANNOUNCEMENT_SENT_WITH_ERRORS(data.getRaw())
|
EMBEDS.SERVICE_ANNOUNCEMENT_SENT_WITH_ERRORS(data)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
@@ -317,11 +317,11 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||||
return placeholder
|
return placeholder
|
||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({ embeds: [EMBEDS.SERVICE_ANNOUNCEMENT_SENT(data.getRaw())] });
|
.edit({ embeds: [EMBEDS.SERVICE_ANNOUNCEMENT_SENT(data)] });
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
return await sendHybridInteractionMessageResponse(
|
return await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.SERVICE_ANNOUNCEMENT_SENT(data.getRaw())] },
|
{ embeds: [EMBEDS.SERVICE_ANNOUNCEMENT_SENT(data)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
if (data.isMessage()) {
|
if (data.isMessage()) {
|
||||||
if (args.length === 0)
|
if (args.length === 0)
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.ANNOUNCEMENT_INFO(data.getRaw())]
|
embeds: [EMBEDS.ANNOUNCEMENT_INFO(data)]
|
||||||
});
|
});
|
||||||
query = args[0].toLowerCase();
|
query = args[0].toLowerCase();
|
||||||
} else if (data.isApplicationCommand()) {
|
} else if (data.isApplicationCommand()) {
|
||||||
@@ -343,7 +343,7 @@ export default class ServiceAnnouncement extends DiscordModule {
|
|||||||
switch (query) {
|
switch (query) {
|
||||||
case 'info':
|
case 'info':
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.ANNOUNCEMENT_INFO(data.getRaw())]
|
embeds: [EMBEDS.ANNOUNCEMENT_INFO(data)]
|
||||||
});
|
});
|
||||||
case 'reload':
|
case 'reload':
|
||||||
return await funct.reload(data);
|
return await funct.reload(data);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
} from '../utils/DiscordInteraction';
|
} from '../utils/DiscordInteraction';
|
||||||
|
|
||||||
const EMBEDS = {
|
const EMBEDS = {
|
||||||
INTERACTION_INFO: (data: Message | BaseInteraction) => {
|
INTERACTION_INFO: (data: HybridInteractionMessage) => {
|
||||||
return makeInfoEmbed({
|
return makeInfoEmbed({
|
||||||
title: 'Interaction',
|
title: 'Interaction',
|
||||||
description: `This module contains management tool for interaction based contents`,
|
description: `This module contains management tool for interaction based contents`,
|
||||||
@@ -28,47 +28,47 @@ const EMBEDS = {
|
|||||||
value: '``reloadAll`` ``unloadAll`` ``reloadglobal``'
|
value: '``reloadAll`` ``unloadAll`` ``reloadglobal``'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
PROCESSING: (data: Message | BaseInteraction) => {
|
PROCESSING: (data: HybridInteractionMessage) => {
|
||||||
return makeProcessingEmbed({
|
return makeProcessingEmbed({
|
||||||
icon: data instanceof Message ? undefined : '⌛',
|
icon: data instanceof Message ? undefined : '⌛',
|
||||||
title: `Performing actions`,
|
title: `Performing actions`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
NOT_DEVELOPER: (data: Message | BaseInteraction) => {
|
NOT_DEVELOPER: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: 'Developer only',
|
title: 'Developer only',
|
||||||
description: `This command is restricted to the developers only`,
|
description: `This command is restricted to the developers only`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
UNLOADALL_SUCCESS: (data: Message | BaseInteraction) => {
|
UNLOADALL_SUCCESS: (data: HybridInteractionMessage) => {
|
||||||
return makeSuccessEmbed({
|
return makeSuccessEmbed({
|
||||||
title: 'Unloaded all Interaction',
|
title: 'Unloaded all Interaction',
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
UNLOADALL_ERROR: (data: Message | BaseInteraction, err: any) => {
|
UNLOADALL_ERROR: (data: HybridInteractionMessage, err: any) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: 'An error occurred while trying to unload interaction',
|
title: 'An error occurred while trying to unload interaction',
|
||||||
description: '```' + err + '```',
|
description: '```' + err + '```',
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
RELOADALL_SUCCESS: (data: Message | BaseInteraction) => {
|
RELOADALL_SUCCESS: (data: HybridInteractionMessage) => {
|
||||||
return makeSuccessEmbed({
|
return makeSuccessEmbed({
|
||||||
title: 'Reloaded all Interaction',
|
title: 'Reloaded all Interaction',
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
RELOADALL_ERROR: (data: Message | BaseInteraction, err: any) => {
|
RELOADALL_ERROR: (data: HybridInteractionMessage, err: any) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: 'An error occurred while trying to reload interaction',
|
title: 'An error occurred while trying to reload interaction',
|
||||||
description: '```' + err + '```',
|
description: '```' + err + '```',
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -92,7 +92,7 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
|
|
||||||
if (!Users.isDeveloper(user.id))
|
if (!Users.isDeveloper(user.id))
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.NOT_DEVELOPER(data.getRaw())]
|
embeds: [EMBEDS.NOT_DEVELOPER(data)]
|
||||||
});
|
});
|
||||||
|
|
||||||
const funct = {
|
const funct = {
|
||||||
@@ -100,7 +100,7 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
let placeholder: HybridInteractionMessage | undefined;
|
let placeholder: HybridInteractionMessage | undefined;
|
||||||
|
|
||||||
let _placeholder = await sendHybridInteractionMessageResponse(data, {
|
let _placeholder = await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.PROCESSING(data.getRaw())]
|
embeds: [EMBEDS.PROCESSING(data)]
|
||||||
});
|
});
|
||||||
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
||||||
|
|
||||||
@@ -110,22 +110,22 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||||
return placeholder
|
return placeholder
|
||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({ embeds: [EMBEDS.UNLOADALL_SUCCESS(data.getRaw())] });
|
.edit({ embeds: [EMBEDS.UNLOADALL_SUCCESS(data)] });
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
return await sendHybridInteractionMessageResponse(
|
return await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.UNLOADALL_SUCCESS(data.getRaw())] },
|
{ embeds: [EMBEDS.UNLOADALL_SUCCESS(data)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||||
return placeholder
|
return placeholder
|
||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({ embeds: [EMBEDS.UNLOADALL_ERROR(data.getRaw(), err)] });
|
.edit({ embeds: [EMBEDS.UNLOADALL_ERROR(data, err)] });
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
return await sendHybridInteractionMessageResponse(
|
return await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.UNLOADALL_ERROR(data.getRaw(), err)] },
|
{ embeds: [EMBEDS.UNLOADALL_ERROR(data, err)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
let placeholder: HybridInteractionMessage | undefined;
|
let placeholder: HybridInteractionMessage | undefined;
|
||||||
|
|
||||||
let _placeholder = await sendHybridInteractionMessageResponse(data, {
|
let _placeholder = await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.PROCESSING(data.getRaw())]
|
embeds: [EMBEDS.PROCESSING(data)]
|
||||||
});
|
});
|
||||||
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
||||||
|
|
||||||
@@ -145,22 +145,22 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||||
return placeholder
|
return placeholder
|
||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({ embeds: [EMBEDS.RELOADALL_SUCCESS(data.getRaw())] });
|
.edit({ embeds: [EMBEDS.RELOADALL_SUCCESS(data)] });
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
return await sendHybridInteractionMessageResponse(
|
return await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.RELOADALL_SUCCESS(data.getRaw())] },
|
{ embeds: [EMBEDS.RELOADALL_SUCCESS(data)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||||
return placeholder
|
return placeholder
|
||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({ embeds: [EMBEDS.RELOADALL_ERROR(data.getRaw(), err)] });
|
.edit({ embeds: [EMBEDS.RELOADALL_ERROR(data, err)] });
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
return await sendHybridInteractionMessageResponse(
|
return await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.RELOADALL_ERROR(data.getRaw(), err)] },
|
{ embeds: [EMBEDS.RELOADALL_ERROR(data, err)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
let placeholder: HybridInteractionMessage | undefined;
|
let placeholder: HybridInteractionMessage | undefined;
|
||||||
|
|
||||||
let _placeholder = await sendHybridInteractionMessageResponse(data, {
|
let _placeholder = await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.PROCESSING(data.getRaw())]
|
embeds: [EMBEDS.PROCESSING(data)]
|
||||||
});
|
});
|
||||||
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
||||||
|
|
||||||
@@ -180,22 +180,22 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||||
return placeholder
|
return placeholder
|
||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({ embeds: [EMBEDS.RELOADALL_SUCCESS(data.getRaw())] });
|
.edit({ embeds: [EMBEDS.RELOADALL_SUCCESS(data)] });
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
return await sendHybridInteractionMessageResponse(
|
return await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.RELOADALL_SUCCESS(data.getRaw())] },
|
{ embeds: [EMBEDS.RELOADALL_SUCCESS(data)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||||
return placeholder
|
return placeholder
|
||||||
.getMessage()
|
.getMessage()
|
||||||
.edit({ embeds: [EMBEDS.RELOADALL_ERROR(data.getRaw(), err)] });
|
.edit({ embeds: [EMBEDS.RELOADALL_ERROR(data, err)] });
|
||||||
else if (data.isApplicationCommand())
|
else if (data.isApplicationCommand())
|
||||||
return await sendHybridInteractionMessageResponse(
|
return await sendHybridInteractionMessageResponse(
|
||||||
data,
|
data,
|
||||||
{ embeds: [EMBEDS.RELOADALL_ERROR(data.getRaw(), err)] },
|
{ embeds: [EMBEDS.RELOADALL_ERROR(data, err)] },
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
if (data.isMessage()) {
|
if (data.isMessage()) {
|
||||||
if (args.length === 0)
|
if (args.length === 0)
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.INTERACTION_INFO(data.getRaw())]
|
embeds: [EMBEDS.INTERACTION_INFO(data)]
|
||||||
});
|
});
|
||||||
|
|
||||||
query = args[0].toLowerCase();
|
query = args[0].toLowerCase();
|
||||||
@@ -218,7 +218,7 @@ export default class InteractionManager extends DiscordModule {
|
|||||||
switch (query) {
|
switch (query) {
|
||||||
case 'info':
|
case 'info':
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.INTERACTION_INFO(data.getRaw())]
|
embeds: [EMBEDS.INTERACTION_INFO(data)]
|
||||||
});
|
});
|
||||||
case 'reloadall':
|
case 'reloadall':
|
||||||
return await funct.reloadAll(data);
|
return await funct.reloadAll(data);
|
||||||
|
|||||||
+21
-21
@@ -21,7 +21,7 @@ import {
|
|||||||
} from '../utils/DiscordMessage';
|
} from '../utils/DiscordMessage';
|
||||||
|
|
||||||
const EMBEDS = {
|
const EMBEDS = {
|
||||||
osu_INFO: (data: Message | BaseInteraction) => {
|
osu_INFO: (data: HybridInteractionMessage) => {
|
||||||
return makeInfoEmbed({
|
return makeInfoEmbed({
|
||||||
title: 'osu!',
|
title: 'osu!',
|
||||||
description: `[osu!](https://osu.ppy.sh/home) is a free-to-play rhythm game primarily developed, published, and created by Dean "peppy" Herbert`,
|
description: `[osu!](https://osu.ppy.sh/home) is a free-to-play rhythm game primarily developed, published, and created by Dean "peppy" Herbert`,
|
||||||
@@ -35,43 +35,43 @@ const EMBEDS = {
|
|||||||
value: '``user``'
|
value: '``user``'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
NO_USER_FOUND: (data: Message | BaseInteraction) => {
|
NO_USER_FOUND: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: `That user doesn't exists on osu!`,
|
title: `That user doesn't exists on osu!`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
NO_USER_MENTIONED: (data: Message | BaseInteraction) => {
|
NO_USER_MENTIONED: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: `No osu! username or user id provided`,
|
title: `No osu! username or user id provided`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
INVALID_USER_MENTIONED: (data: Message | BaseInteraction) => {
|
INVALID_USER_MENTIONED: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: `Not a valid osu username or id`,
|
title: `Not a valid osu username or id`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
INVALID_BEATMAP_ID_MENTIONED: (data: Message | BaseInteraction) => {
|
INVALID_BEATMAP_ID_MENTIONED: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: `Not a valid osu beatmap id`,
|
title: `Not a valid osu beatmap id`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
NO_BEATMAP_FOUND: (data: Message | BaseInteraction) => {
|
NO_BEATMAP_FOUND: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: `That beatmap doesn't exists on osu!`,
|
title: `That beatmap doesn't exists on osu!`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
NO_BEATMAP_MENTIONED: (data: Message | BaseInteraction) => {
|
NO_BEATMAP_MENTIONED: (data: HybridInteractionMessage) => {
|
||||||
return makeErrorEmbed({
|
return makeErrorEmbed({
|
||||||
title: `No osu! beatmap id provided`,
|
title: `No osu! beatmap id provided`,
|
||||||
user: data instanceof BaseInteraction ? data.user : data.author
|
user: data.getUser()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -99,7 +99,7 @@ export default class osu extends DiscordModule {
|
|||||||
if (data.isMessage()) {
|
if (data.isMessage()) {
|
||||||
if (typeof args[1] === 'undefined')
|
if (typeof args[1] === 'undefined')
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.NO_USER_MENTIONED(data.getRaw())]
|
embeds: [EMBEDS.NO_USER_MENTIONED(data)]
|
||||||
});
|
});
|
||||||
const [removed, ...newArgs] = args;
|
const [removed, ...newArgs] = args;
|
||||||
user = newArgs.join(' ');
|
user = newArgs.join(' ');
|
||||||
@@ -108,14 +108,14 @@ export default class osu extends DiscordModule {
|
|||||||
|
|
||||||
if (!validator.isNumeric(user) && !this.validate_osu_username(user))
|
if (!validator.isNumeric(user) && !this.validate_osu_username(user))
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.INVALID_USER_MENTIONED(data.getRaw())]
|
embeds: [EMBEDS.INVALID_USER_MENTIONED(data)]
|
||||||
});
|
});
|
||||||
|
|
||||||
let result = await osuAPI.client.getUser({ u: user });
|
let result = await osuAPI.client.getUser({ u: user });
|
||||||
|
|
||||||
if (result instanceof Array && result.length === 0)
|
if (result instanceof Array && result.length === 0)
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.NO_USER_FOUND(data.getRaw())]
|
embeds: [EMBEDS.NO_USER_FOUND(data)]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.isApplicationCommand()) {
|
if (data.isApplicationCommand()) {
|
||||||
@@ -277,7 +277,7 @@ export default class osu extends DiscordModule {
|
|||||||
if (data.isMessage()) {
|
if (data.isMessage()) {
|
||||||
if (typeof args[1] === 'undefined')
|
if (typeof args[1] === 'undefined')
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.NO_BEATMAP_MENTIONED(data.getRaw())]
|
embeds: [EMBEDS.NO_BEATMAP_MENTIONED(data)]
|
||||||
});
|
});
|
||||||
const [removed, ...newArgs] = args;
|
const [removed, ...newArgs] = args;
|
||||||
beatmap = newArgs.join(' ');
|
beatmap = newArgs.join(' ');
|
||||||
@@ -286,14 +286,14 @@ export default class osu extends DiscordModule {
|
|||||||
|
|
||||||
if (!validator.isNumeric(beatmap))
|
if (!validator.isNumeric(beatmap))
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.INVALID_BEATMAP_ID_MENTIONED(data.getRaw())]
|
embeds: [EMBEDS.INVALID_BEATMAP_ID_MENTIONED(data)]
|
||||||
});
|
});
|
||||||
|
|
||||||
let result = await osuAPI.client.getBeatmaps({ b: beatmap });
|
let result = await osuAPI.client.getBeatmaps({ b: beatmap });
|
||||||
|
|
||||||
if (result instanceof Array && result.length === 0)
|
if (result instanceof Array && result.length === 0)
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.NO_BEATMAP_FOUND(data.getRaw())]
|
embeds: [EMBEDS.NO_BEATMAP_FOUND(data)]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.isApplicationCommand()) await data.getSlashCommand().deferReply();
|
if (data.isApplicationCommand()) await data.getSlashCommand().deferReply();
|
||||||
@@ -473,7 +473,7 @@ export default class osu extends DiscordModule {
|
|||||||
if (data.isMessage()) {
|
if (data.isMessage()) {
|
||||||
if (args.length === 0) {
|
if (args.length === 0) {
|
||||||
return await sendHybridInteractionMessageResponse(data, {
|
return await sendHybridInteractionMessageResponse(data, {
|
||||||
embeds: [EMBEDS.osu_INFO(data.getRaw())]
|
embeds: [EMBEDS.osu_INFO(data)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
query = args[0].toLowerCase();
|
query = args[0].toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user