Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jokokendi committed Apr 30, 2024
1 parent 45a5341 commit 78981bd
Show file tree
Hide file tree
Showing 117 changed files with 4,234 additions and 1,855 deletions.
9 changes: 0 additions & 9 deletions .dockerignore

This file was deleted.

9 changes: 0 additions & 9 deletions .gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM nikolaik/python-nodejs:python3.9-nodejs18
FROM ubuntu:latest
RUN apt-get update -y && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends ffmpeg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /app/
WORKDIR /app/
RUN pip3 install -U -r requirements.txt
RUN pip3 install --no-cache-dir --upgrade --requirement requirements.txt
CMD bash start
9 changes: 5 additions & 4 deletions Musikku/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#
# Copyright (C) 2021-2022 by kenkansaja@Github, < https://github.com/kenkansaja >.
# Copyright (C) 2023-2024 by YukkiOwner@Github, < https://github.com/YukkiOwner >.
#
# This file is part of < https://github.com/kenkansaja/Musikku > project,
# This file is part of < https://github.com/YukkiOwner/YukkiMusicBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/kenkansaja/Musikku/blob/master/LICENSE >
# Please see < https://github.com/YukkiOwner/YukkiMusicBot/blob/master/LICENSE >
#
# All rights reserved.
#

from Musikku.core.bot import MusikkuBot
from Musikku.core.dir import dirr
Expand All @@ -18,7 +19,7 @@
# Directories
dirr()

#Check Git Updates
# Check Git Updates
git()

# Initialize Memory DB
Expand Down
31 changes: 22 additions & 9 deletions Musikku/__main__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#
# Copyright (C) 2021-2022 by kenkansaja@Github, < https://github.com/kenkansaja >.
# Copyright (C) 2023-2024 by YukkiOwner@Github, < https://github.com/YukkiOwner >.
#
# This file is part of < https://github.com/kenkansaja/Musikku > project,
# This file is part of < https://github.com/YukkiOwner/YukkiMusicBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/kenkansaja/Musikku/blob/master/LICENSE >
# Please see < https://github.com/YukkiOwner/YukkiMusicBot/blob/master/LICENSE >
#
# All rights reserved.
#

import asyncio
import importlib
import sys

from pyrogram import idle
from pytgcalls.exceptions import NoActiveGroupCall

import config
from config import BANNED_USERS
Expand All @@ -32,15 +34,15 @@ async def init():
and not config.STRING5
):
LOGGER("Musikku").error(
"Tidak Ada Asisten Klien yang Ditentukan Vars!.. Proses Keluar."
"No Assistant Clients Vars Defined!.. Exiting Process."
)
return
if (
not config.SPOTIFY_CLIENT_ID
and not config.SPOTIFY_CLIENT_SECRET
):
LOGGER("MusikkuMusic").warning(
"Tidak ada Spotify Vars yang ditentukan. Bot Anda tidak akan dapat memainkan kueri spotify."
LOGGER("Musikku").warning(
"No Spotify Vars defined. Your bot won't be able to play spotify queries."
)
try:
users = await get_gbanned()
Expand All @@ -55,15 +57,26 @@ async def init():
for all_module in ALL_MODULES:
importlib.import_module("Musikku.plugins" + all_module)
LOGGER("Musikku.plugins").info(
"Modul Berhasil Diimpor"
"Successfully Imported Modules "
)
await userbot.start()
await Musikku.start()
try:
await Musikku.stream_call(
"http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4"
)
except NoActiveGroupCall:
LOGGER("Musikku").error(
"[ERROR] - \n\nPlease turn on your Logger Group's Voice Call. Make sure you never close/end voice call in your log group"
)
sys.exit()
except:
pass
await Musikku.decorators()
LOGGER("Musikku").info("Musikku Music Bot Berhasil Dimulai")
LOGGER("Musikku").info("Musikku Started Successfully")
await idle()


if __name__ == "__main__":
loop.run_until_complete(init())
LOGGER("Musikku").info("Menghentikan Bot Musikku! Selamat tinggal")
LOGGER("Musikku").info("Stopping Musikku! GoodBye")
36 changes: 29 additions & 7 deletions Musikku/core/bot.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#
# Copyright (C) 2021-2022 by kenkansaja@Github, < https://github.com/kenkansaja >.
# Copyright (C) 2023-2024 by YukkiOwner@Github, < https://github.com/YukkiOwner >.
#
# This file is part of < https://github.com/kenkansaja/Musikku > project,
# This file is part of < https://github.com/YukkiOwner/YukkiMusicBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/kenkansaja/Musikku/blob/master/LICENSE >
# Please see < https://github.com/YukkiOwner/YukkiMusicBot/blob/master/LICENSE >
#
# All rights reserved.
#

import sys

from pyrogram import Client
from pyrogram.enums import ChatMemberStatus
from pyrogram.types import BotCommand

import config

Expand All @@ -20,7 +23,7 @@ class MusikkuBot(Client):
def __init__(self):
LOGGER(__name__).info(f"Starting Bot")
super().__init__(
"Musikku",
name="MusikkuBot",
api_id=config.API_ID,
api_hash=config.API_HASH,
bot_token=config.BOT_TOKEN,
Expand All @@ -37,13 +40,32 @@ async def start(self):
)
except:
LOGGER(__name__).error(
"Bot gagal mengakses Grup log. Pastikan Anda telah menambahkan bot ke saluran log dan dipromosikan sebagai admin!"
"Bot has failed to access the log Group. Make sure that you have added your bot to your log channel and promoted as admin!"
)
sys.exit()
if config.SET_CMDS == str(True):
try:
await self.set_bot_commands(
[
BotCommand("ping", "Check that bot is alive or dead"),
BotCommand("play", "Starts playing the requested song"),
BotCommand("skip", "Moves to the next track in queue"),
BotCommand("pause", "Pause the current playing song"),
BotCommand("resume", "Resume the paused song"),
BotCommand("end", "Clear the queue and leave voice chat"),
BotCommand("shuffle", "Randomly shuffles the queued playlist."),
BotCommand("playmode", "Allows you to change the default playmode for your chat"),
BotCommand("settings", "Open the settings of the music bot for your chat.")
]
)
except:
pass
else:
pass
a = await self.get_chat_member(config.LOG_GROUP_ID, self.id)
if a.status != "administrator":
if a.status != ChatMemberStatus.ADMINISTRATOR:
LOGGER(__name__).error(
"Tolong promosikan Bot sebagai Admin di Grup Logger"
"Please promote Bot as Admin in Logger Group"
)
sys.exit()
if get_me.last_name:
Expand Down
30 changes: 15 additions & 15 deletions Musikku/core/call.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#
# Copyright (C) 2021-2022 by kenkansaja@Github, < https://github.com/kenkansaja >.
# Copyright (C) 2023-2024 by YukkiOwner@Github, < https://github.com/YukkiOwner >.
#
# This file is part of < https://github.com/kenkansaja/Musikku > project,
# This file is part of < https://github.com/YukkiOwner/YukkiMusicBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/kenkansaja/Musikku/blob/master/LICENSE >
# Please see < https://github.com/YukkiOwner/YukkiMusicBot/blob/master/LICENSE >
#
# All rights reserved.
#

import asyncio
from datetime import datetime, timedelta
Expand All @@ -16,7 +17,7 @@
UserAlreadyParticipant,
UserNotParticipant)
from pyrogram.types import InlineKeyboardMarkup
from pytgcalls import PyTgCalls, StreamType
from pytgcalls import PyTgCalls
from pytgcalls.exceptions import (AlreadyJoinedError,
NoActiveGroupCall,
TelegramServerError)
Expand Down Expand Up @@ -59,45 +60,50 @@ async def _clear_(chat_id):
class Call(PyTgCalls):
def __init__(self):
self.userbot1 = Client(
name="Musikku_One",
api_id=config.API_ID,
api_hash=config.API_HASH,
session_name=str(config.STRING1),
session_string=str(config.STRING1),
)
self.one = PyTgCalls(
self.userbot1,
cache_duration=100,
)
self.userbot2 = Client(
name="Musikku_Two",
api_id=config.API_ID,
api_hash=config.API_HASH,
session_name=str(config.STRING2),
session_string=str(config.STRING2),
)
self.two = PyTgCalls(
self.userbot2,
cache_duration=100,
)
self.userbot3 = Client(
name="Musikku_Three",
api_id=config.API_ID,
api_hash=config.API_HASH,
session_name=str(config.STRING3),
session_string=str(config.STRING3),
)
self.three = PyTgCalls(
self.userbot3,
cache_duration=100,
)
self.userbot4 = Client(
name="Musikku_Four",
api_id=config.API_ID,
api_hash=config.API_HASH,
session_name=str(config.STRING4),
session_string=str(config.STRING4),
)
self.four = PyTgCalls(
self.userbot4,
cache_duration=100,
)
self.userbot5 = Client(
name="Musikku_Five",
api_id=config.API_ID,
api_hash=config.API_HASH,
session_name=str(config.STRING5),
session_string=str(config.STRING5),
)
self.five = PyTgCalls(
self.userbot5,
Expand Down Expand Up @@ -191,7 +197,6 @@ async def stream_call(self, link):
await assistant.join_group_call(
config.LOG_GROUP_ID,
AudioVideoPiped(link),
stream_type=StreamType().pulse_stream,
)
await asyncio.sleep(0.5)
await assistant.leave_group_call(config.LOG_GROUP_ID)
Expand All @@ -206,15 +211,13 @@ async def join_assistant(self, original_chat_id, chat_id):
except ChatAdminRequired:
raise AssistantErr(_["call_1"])
if get.status == "banned" or get.status == "kicked":
await app.unban_chat_member(chat_id, userbot.id)
raise AssistantErr(
_["call_2"].format(userbot.username, userbot.id)
)
except UserNotParticipant:
chat = await app.get_chat(chat_id)
if chat.username:
try:
await app.unban_chat_member(chat_id, userbot.id)
await userbot.join_chat(chat.username)
except UserAlreadyParticipant:
pass
Expand Down Expand Up @@ -249,7 +252,6 @@ async def join_assistant(self, original_chat_id, chat_id):
"https://t.me/+", "https://t.me/joinchat/"
)
await asyncio.sleep(3)
await app.unban_chat_member(chat_id, userbot.id)
await userbot.join_chat(invitelink)
await asyncio.sleep(4)
await m.edit(_["call_6"].format(userbot.name))
Expand Down Expand Up @@ -283,7 +285,6 @@ async def join_call(
await assistant.join_group_call(
chat_id,
stream,
stream_type=StreamType().pulse_stream,
)
except NoActiveGroupCall:
try:
Expand All @@ -294,7 +295,6 @@ async def join_call(
await assistant.join_group_call(
chat_id,
stream,
stream_type=StreamType().pulse_stream,
)
except Exception as e:
raise AssistantErr(
Expand Down
13 changes: 10 additions & 3 deletions Musikku/core/dir.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#
# Copyright (C) 2021-2022 by kenkansaja@Github, < https://github.com/kenkansaja >.
# Copyright (C) 2023-2024 by YukkiOwner@Github, < https://github.com/YukkiOwner >.
#
# This file is part of < https://github.com/kenkansaja/Musikku > project,
# This file is part of < https://github.com/YukkiOwner/YukkiMusicBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/kenkansaja/Musikku/blob/master/LICENSE >
# Please see < https://github.com/YukkiOwner/YukkiMusicBot/blob/master/LICENSE >
#
# All rights reserved.
#

import os
import sys
Expand All @@ -26,6 +27,12 @@ def dirr():
for file in os.listdir():
if file.endswith(".jpeg"):
os.remove(file)
for file in os.listdir():
if file.endswith(".session"):
os.remove(file)
for file in os.listdir():
if file.endswith(".session-journal"):
os.remove(file)
if "downloads" not in listdir():
mkdir("downloads")
if "cache" not in listdir():
Expand Down
7 changes: 4 additions & 3 deletions Musikku/core/git.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#
# Copyright (C) 2021-2022 by kenkansaja@Github, < https://github.com/kenkansaja >.
# Copyright (C) 2023-2024 by YukkiOwner@Github, < https://github.com/YukkiOwner >.
#
# This file is part of < https://github.com/kenkansaja/Musikku > project,
# This file is part of < https://github.com/YukkiOwner/YukkiMusicBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/kenkansaja/Musikku/blob/master/LICENSE >
# Please see < https://github.com/YukkiOwner/YukkiMusicBot/blob/master/LICENSE >
#
# All rights reserved.
#

import asyncio
import shlex
Expand Down
Loading

0 comments on commit 78981bd

Please sign in to comment.