Add ability to set hubUrl
This commit is contained in:
parent
c7d23be557
commit
e1a982fb96
|
@ -81,6 +81,11 @@ const opts = { // Map of option number to step number
|
|||
return 'Please provide a Discord Channel ID for logging, or say `none` to unset. Say `cancel` to exit.';
|
||||
}
|
||||
},
|
||||
9: {
|
||||
step: 29, exec: (hubId, uid) => {
|
||||
return 'Provide the full game link to your hub game! Say `cancel` to exit.';
|
||||
}
|
||||
},
|
||||
99: {
|
||||
step: 99, exec: async (hubId, uid) => {
|
||||
// generate a random confirmation code
|
||||
|
@ -225,6 +230,22 @@ const execute = async (message) => {
|
|||
return;
|
||||
});
|
||||
break;
|
||||
case 29: // Set Hub Game Link
|
||||
const gameLink = message.content.trim();
|
||||
if (gameLink.toLowerCase() === 'cancel') {
|
||||
cancel(message.author);
|
||||
return;
|
||||
}
|
||||
const gameLinkPattern = /^https?:\/\/(www\.)?roblox\.com\/games\/(\d+)(\/[a-zA-Z0-9_-]+)?$/;
|
||||
const match = gameLink.match(gameLinkPattern);
|
||||
if (!match) {
|
||||
message.channel.send('Invalid game link. Please provide a valid Roblox game link (e.g., https://www.roblox.com/games/1234567890/Game-Name), or `cancel` to exit.');
|
||||
return;
|
||||
}
|
||||
await pool.query('UPDATE hubs SET hubUrl = ? WHERE id = ?', [gameLink, global.hubSettingsHandlers[message.author.id].hub]);
|
||||
global.hubSettingsHandlers[message.author.id].step = 1;
|
||||
message.channel.send('Hub game link updated.\n\nType an option number, or `cancel` to exit.');
|
||||
break;
|
||||
case 99: // Delete Hub
|
||||
const confirmMatch = message.content.trim().match(/^confirm (\w{16})$/);
|
||||
if (message.content.toLowerCase() === 'cancel') {
|
||||
|
|
Loading…
Reference in a new issue