Skip to content

Commit 7c46a25

Browse files
authored
Merge pull request #1777 from Avdhesh-Varshney/wishingBot
[GSSoC'23] Wishing Bot Model Ready
2 parents d864a1d + 1b9aad6 commit 7c46a25

File tree

7 files changed

+109
-0
lines changed

7 files changed

+109
-0
lines changed

Wishing Bot/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Wishing Bot
2+
3+
_______________________________________________________________________
4+
5+
## What is it
6+
7+
- This program can greetings to the people in the coding style.
8+
- Generated different emojis will give a very attractive and shiny look.
9+
- Playing song in the background will impress more and more.
10+
- You can as many songs in the directory **music** will automatically fetch by the program.
11+
- After fetching program will give you a suggesion of playing songs.
12+
- Add more and more songs to expand this **Wishing bot model**
13+
14+
<br>
15+
16+
## TechStack
17+
18+
1. Module Used:
19+
20+
- time
21+
- random
22+
- pygame
23+
- threading
24+
- sys
25+
- os
26+
27+
First install these libraries and use python 3 to enjoy this **Wishing bot model**
28+
29+
<br>
30+
31+
## Demo Video
32+
33+
https://github.com/avinashkranjan/Amazing-Python-Scripts/assets/114330097/c0ccf866-c8f2-4850-9519-9e7d1ea1bbf3
34+
35+
<br>
36+
37+
## Author
38+
39+
[Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
40+

Wishing Bot/WishingBot.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import time
2+
from random import randint
3+
import pygame
4+
import threading
5+
import sys
6+
import os
7+
8+
pygame.init()
9+
emojis = ['😃', '🐻‍❄️', '🐏', '🌲', '🎆', '❤️', '⛄', '🎮', '🔊', '⚙️', '😍', '😴', '🤑', '💀', '👻', '👽', '🐭', '🐸', '🐢', '🐬', '🧟', '🥷', '🎈', '🎉', '😷', '🕸️', '🎯', '🔒', '🔑', '🧲', '☎️', '🏧', '⏰', '🧭', '🏚️', '☢️', '📵', '🚓']
10+
11+
# Fetching songs from the given directory
12+
musicDir = './Wishing Bot/musics'
13+
songs = os.listdir(musicDir)
14+
15+
def wishingBot():
16+
for i in range(len(songs)):
17+
print(f"[{i}] - {songs[i][:-4]}")
18+
id = int(input("\nEnter your occasion number - "))
19+
20+
# emojis printing function
21+
def playEmojis():
22+
for i in range(1, 85):
23+
print('')
24+
space = ''
25+
26+
l = len(emojis)
27+
28+
i = 0
29+
while pygame.mixer.music.get_busy():
30+
count = randint(1, 100)
31+
while count > 0:
32+
space += ' '
33+
count -= 1
34+
35+
if i % 10 == 0:
36+
print(space + songs[id][:-4] + emojis[0])
37+
else:
38+
print(space + emojis[i % l])
39+
40+
space = ''
41+
i = i+1
42+
time.sleep(0.2)
43+
44+
def playSong():
45+
pygame.mixer.music.load(os.path.join(musicDir, songs[id]))
46+
pygame.mixer.music.play()
47+
48+
# Wait for the song to finish playing
49+
while pygame.mixer.music.get_busy():
50+
time.sleep(1)
51+
52+
# Song has finished playing, stop the printing function
53+
thread1.join()
54+
55+
thread1 = threading.Thread(target=playEmojis)
56+
thread2 = threading.Thread(target=playSong)
57+
58+
# Start threads
59+
thread1.start()
60+
thread2.start()
61+
62+
# Wait for the song to finish playing
63+
thread2.join()
64+
65+
# Exit the program
66+
sys.exit()
67+
68+
# Start the bot
69+
wishingBot()

Wishing Bot/musics/Children Day.mp3

2.33 MB
Binary file not shown.

Wishing Bot/musics/Happy New Year.mp3

225 KB
Binary file not shown.
4.65 MB
Binary file not shown.
3.44 MB
Binary file not shown.

Wishing Bot/musics/Jai Ho Bhole.mp3

3.57 MB
Binary file not shown.

0 commit comments

Comments
 (0)