Skip to content

Commit

Permalink
stable
Browse files Browse the repository at this point in the history
  • Loading branch information
besoeasy authored Nov 22, 2024
1 parent 9a2286d commit 597af45
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ const handleClean = (ctx) => {
}
};

const handleSetURL = (ctx, newURL) => {
if (!newURL || !newURL.startsWith("http")) {
ctx.reply(
"Invalid URL. Please provide a valid URL starting with http or https."
);
return;
}

teleariaURL = newURL; // Update the URL
ctx.reply(`TeleAria URL has been updated to: ${teleariaURL}`);
};

// Message handler
bot.on("message", async (ctx) => {
if (ctx.message.text) {
Expand All @@ -206,6 +218,10 @@ bot.on("message", async (ctx) => {
console.log(`@${ctx.from.username} (ID: ${ctx.from.id}): ${text}`);

switch (lowerCaseCommand) {
case "/seturl":
if (trimmedArgs.length > 0) handleSetURL(ctx, trimmedArgs[0]);
else ctx.reply("Please provide a new URL.");
break;
case "/clean":
handleClean(ctx);
break;
Expand Down

0 comments on commit 597af45

Please sign in to comment.