Skip to content

Commit

Permalink
fix(readme/): replace makedown to html & add how to Deploy to Vercel
Browse files Browse the repository at this point in the history
- index.html : add More button redirect to ReadMe
- improve vers Name
- Remove LoggerId from Required to host
-
  • Loading branch information
AshokShau committed Jul 22, 2024
1 parent e35dff5 commit 20b401f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
4 changes: 0 additions & 4 deletions FallenSub/config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ func setDefaults() {
log.Fatal("DatabaseURI required")
}

if LoggerId == 0 {
log.Fatal("LoggerId required")
}

if OwnerId == 0 {
OwnerId = 5938660179
}
Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<html lang="en">
<body>

# Force Sub Bot
[![Go Build](https://github.com/Abishnoi69/Force-Sub-Bot/workflows/build/badge.svg)](https://github.com/Abishnoi69/Force-Sub-Bot/actions?query=workflow%3Abuild+event%3Apush+branch%3Amain)
<h1>Force Sub Bot</h1>

<a href="https://github.com/Abishnoi69/Force-Sub-Bot/actions?query=workflow%3Abuild+event%3Apush+branch%3Amain"><img src="https://github.com/Abishnoi69/Force-Sub-Bot/workflows/build/badge.svg" alt="build"></a>

<p>This project includes a Telegram bot designed to enforce subscription to a specific channel before allowing users to interact in a group chat. It's built using <a href="https://go.dev">Go</a> and integrates with the Telegram Bot API using <a href="https://github.com/PaulSonOfLars/gotgbot">gotgbot</a>.</p>

<section>
<h2>Installation Instructions</h2>

<h3>Install Go</h3>
<ol>
<li>Clone and install Go:
Expand Down Expand Up @@ -41,6 +42,18 @@ source /etc/profile.d/golang_path.sh</code></pre>
</ol>
</section>

<section>
<h2>Deploy to Vercel</h2>
<ol>
<li>Fork this repository 🍴</li>
<li>Login your <a href="https://vercel.com/">Vercel</a> account </li>
<li>Go to your <a href="https://vercel.com/new">Add New Project</a></li>
<li>Choose the repository you forked</li>
<li>Configure the environment variables: <code>DB_URI</code></li>
<li>Tap on Deploy</li>
</ol>
</section>

<section>
<h2>Usage</h2>
<p>Once the bot is running, it will enforce subscription to a specific channel before allowing users to interact in the group chat. Users not subscribed to the channel will be prompted to do so.</p>
Expand Down
29 changes: 17 additions & 12 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<div class="flex justify-between items-center">
<div class="space-y-4 text-3xl h-max shadow-2xl rounded-lg font-bold text-yellow-400 hover:bg-gray-700">
<a href="https://github.com/Abishnoi69/Force-Sub-Bot" target="_blank">
<span>Forcesub</span>
<span>Force Sub</span>
</a>
</div>
<div>
Expand All @@ -119,6 +119,11 @@
<button type="button"
class="btn-contact shadow-2xl rounded-md px-4 py-2 bg-green-600 text-white font-medium hover:bg-green-500">
Contact</button></a>
<a href="https://abishnoi69.github.io/Force-Sub-Bot/">
<button type="button"
class="btn-contact shadow-2xl rounded-md px-4 py-2 bg-green-600 text-white font-medium hover:bg-green-500">
More</button></a>

</div>
</div>
<div id="mainContent" class="main-content mt-8">
Expand Down Expand Up @@ -159,7 +164,7 @@ <h2 class="text-xl font-mono text-yellow-400 mb-4" id="usage">Usage</h2>
<li class="mb-2">Add the bot to your channel and group.</li>
<li class="mb-2">Forward a message from the channel to your group.</li>
<li class="mb-2">Reply to the forwarded message with <code class="bg-gray-700 text-gray-100 p-1 rounded">/fsub</code>.</li>
<li class="mb-2">You're all set! Use <code class="bg-gray-700 text-gray-100 p-1 rounded">/fsub off</code> or <code class="bg-gray-700 text-gray-100 p-1 rounded">/fsub on</code> to enable/disable.</li>
<li class="mb-2">You're all set! Use <code class="bg-gray-700 text-gray-100 p-1 rounded">/fsub on</code> or <code class="bg-gray-700 text-gray-100 p-1 rounded">/fsub off</code> to enable/disable.</li>
</ol>
</div>

Expand Down Expand Up @@ -233,14 +238,14 @@ <h2 class="text-xl font-mono text-yellow-400 mb-4" id="usage">Usage</h2>
}
});

const getme = await resp.json();
const getMe = await resp.json();

if (!getme.ok) {
showError(getme.description);
if (!getMe.ok) {
showError(getMe.description);
return;
}

const webhookUrl = `${currentUrl}/bot/${botToken}/${getme.result.username}`;
const webhookUrl = `${currentUrl}/bot/${botToken}/${getMe.result.username}`;

const response = await fetch('https://api.telegram.org/bot' + botToken + '/setWebhook', {
method: 'POST',
Expand All @@ -261,7 +266,7 @@ <h2 class="text-xl font-mono text-yellow-400 mb-4" id="usage">Usage</h2>
<div class="text-center">
<h1 class="text-4xl font-bold text-green-500 mb-4">Success 🎉</h1>
<p class="text-xl text-green-500">Bot Connected Successfully!</p>
<p class="text-base text-gray-400 mt-4">Customize Your bot from <a href='tg://resolve?domain=botfather&start=${getme.result.username}' class='text-blue-400'>@botfather</a> to Add Your Personal Touch.</p>
<p class="text-base text-gray-400 mt-4">Customize Your bot from <a href='tg://resolve?domain=botfather&start=${getMe.result.username}' class='text-blue-400'>@botfather</a> to Add Your Personal Touch.</p>
</div>
`;
// Start confetti animation
Expand Down Expand Up @@ -299,7 +304,7 @@ <h1 class="text-4xl font-bold text-green-500 mb-4">Success 🎉</h1>
let H = window.innerHeight;
const canvas = document.getElementById("canvas");
const context = canvas.getContext("2d");
const maxConfettis = 250; // Increase the number of confetti for denser effect
const maxConfetti = 250; // Increase the number of confetti for denser effect
const particles = [];

const possibleColors = [
Expand All @@ -321,7 +326,7 @@ <h1 class="text-4xl font-bold text-green-500 mb-4">Success 🎉</h1>
this.x = Math.random() * W; // x
this.y = Math.random() * H - H; // y
this.r = randomFromTo(15, 15); // Smaller radius
this.d = Math.random() * maxConfettis + 5;
this.d = Math.random() * maxConfetti + 5;
this.color = possibleColors[Math.floor(Math.random() * possibleColors.length)];
this.tilt = Math.floor(Math.random() * 33) - 11;
this.tiltAngleIncremental = Math.random() * 0.07 + 0.05;
Expand All @@ -345,13 +350,13 @@ <h1 class="text-4xl font-bold text-green-500 mb-4">Success 🎉</h1>

context.clearRect(0, 0, W, window.innerHeight);

for (i = 0; i < maxConfettis; i++) {
for (i = 0; i < maxConfetti; i++) {
results.push(particles[i].draw());
}

let particle = {};
let remainingFlakes = 0;
for (i = 0; i < maxConfettis; i++) {
for (i = 0; i < maxConfetti; i++) {
particle = particles[i];

particle.tiltAngle += particle.tiltAngleIncremental;
Expand All @@ -368,7 +373,7 @@ <h1 class="text-4xl font-bold text-green-500 mb-4">Success 🎉</h1>
}
}

for (let i = 0; i < maxConfettis; i++) {
for (let i = 0; i < maxConfetti; i++) {
particles.push(new ConfettiParticle());
}

Expand Down

0 comments on commit 20b401f

Please sign in to comment.