Skip to content

Commit

Permalink
Merge branch 'dev' into pr/1544
Browse files Browse the repository at this point in the history
  • Loading branch information
BabyBoySnow committed Sep 28, 2023
2 parents de51079 + b8c744e commit f903623
Show file tree
Hide file tree
Showing 16 changed files with 546 additions and 175 deletions.
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
After creating your pull request, tick these boxes if they are applicable to you.

- [ ] I have tested my changes against the `review` branch (the latest developmental version), and this pull request is targeting that branch as a base
- [ ] I have tested my changes on Python 3.8 or higher
- [ ] I have ensured my code is formatted using [Black](https://github.com/psf/black)
- [] I have tested my changes against the `dev` branch (the latest developmental version), and this pull request is targeting that branch as a base
- [] I have tested my changes on Python 3.8 or higher
- [] I have ensured my code is formatted using [Black](https://github.com/psf/black)

----

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2015-2021 Just-Some-Bots (https://github.com/Just-Some-Bots)
Copyright (c) 2015-2023 Just-Some-Bots (https://github.com/Just-Some-Bots)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Python version](https://img.shields.io/badge/python-3.8%2C%203.6%2C%203.7-blue.svg)](https://python.org)
[![Discord](https://discordapp.com/api/guilds/129489631539494912/widget.png?style=shield)](https://discord.gg/bots)

MusicBot is the original Discord music bot written for [Python](https://www.python.org "Python homepage") 3.8+, using the [pycord](https://github.com/Pycord-Development/pycord) library. It plays requested songs from YouTube and other services into a Discord server (or multiple servers). If the queue is empty, MusicBot will play a list of existing songs that is configurable. The bot features a permission system, allowing owners to restrict commands to certain people. MusicBot is capable of streaming live media into a voice channel (experimental).
MusicBot is the original Discord music bot written for [Python](https://www.python.org "Python homepage") 3.8+, using the [discord.py](https://github.com/Rapptz/discord.py) library. It plays requested songs from YouTube and other services into a Discord server (or multiple servers). If the queue is empty, MusicBot will play a list of existing songs that is configurable. The bot features a permission system, allowing owners to restrict commands to certain people. MusicBot is capable of streaming live media into a voice channel (experimental).

![Main](https://i.imgur.com/FWcHtcS.png)

Expand Down
2 changes: 1 addition & 1 deletion config/example_options.ini
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ DefaultSearchResults = 3
# Specify a custom message to use as the bots embed footer.
CustomEmbedFooter =

# Sets if you'd like the bot to deafen when joining a voice channel
# Sets if you'd like the bot to deafen when joining a voice channel.
SelfDeafen = yes

[Files]
Expand Down
8 changes: 8 additions & 0 deletions config/example_permissions.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
;
; InstaSkip = no
; Allows the user to skip a song without having to vote, like the owner.
;
; SkipLooped = no
; Allows the user to skip a looped song.
;
; Remove = no
; Allows the user to remove any song from the queue at any point.
Expand Down Expand Up @@ -105,6 +108,7 @@
; ToggleAutoPlaylists = yes
; SummonNoVoice = yes
; Extractors =
; SkipLooped = yes

; This is the fallback group for any users that don't get assigned to another group. Don't remove/rename this group.
; You cannot assign users or roles to this group. Those options are ignored.
Expand All @@ -122,6 +126,7 @@ Remove = no
SkipWhenAbsent = no
BypassKaraokeMode = no
SummonNoVoice = no
SkipLooped = no
Extractors = generic youtube youtube:playlist soundcloud

; This group has full permissions.
Expand All @@ -138,6 +143,7 @@ Remove = yes
SkipWhenAbsent = no
BypassKaraokeMode = yes
SummonNoVoice = yes
SkipLooped = yes
Extractors =

; This group can't use the blacklist and listids commands, but otherwise has full permissions.
Expand All @@ -155,6 +161,7 @@ Remove = yes
SkipWhenAbsent = no
BypassKaraokeMode = yes
SummonNoVoice = yes
SkipLooped = yes
Extractors = generic youtube youtube:playlist soundcloud

; This group can only use the listed commands, can only use play/skip when in the bot's voice channel,
Expand All @@ -173,4 +180,5 @@ Remove = no
SkipWhenAbsent = yes
BypassKaraokeMode = no
SummonNoVoice = no
SkipLooped = no
Extractors = generic youtube youtube:playlist
17 changes: 17 additions & 0 deletions config/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
"cmd-skip-reply-voted-1": "Your skip for `{0}` was acknowledged.\n**{1}** more {2} required to vote to skip this song.",
"cmd-skip-reply-voted-2": "person is",
"cmd-skip-reply-voted-3": "people are",
"cmd-skip-force-noperms-looped-song": "You do not have permission to force skip a looped song.",
"cmd-skip-vote-noperms-looped-song": "You do not have permission to skip a looped song.",
"cmd-volume-current": "Current volume: `%s%%`",
"cmd-volume-invalid": "`{0}` is not a valid number",
"cmd-volume-reply": "Updated volume from **%d** to **%d**",
Expand All @@ -114,6 +116,21 @@
"cmd-queue-entry-noauthor": "{0} -- `{1}`",
"cmd-clean-invalid": "Invalid parameter. Please provide a number of messages to search.",
"cmd-clean-reply": "Cleaned up {0} message{1}.",
"cmd-repeat-no-voice": "The bot is not in a voice channel. Use %ssummon to summon it to your voice channel.",
"cmd-repeat-no-songs": "No songs are currently playing. Play something with {}play.",
"cmd-repeat-playlist-looping": "Playlist is now repeating.",
"cmd-repeat-playlist-not-looping": "Playlist is no longer repeating.",
"cmd-repeat-song-looping": "Song is now repeating.",
"cmd-repeat-song-not-looping": "Song is no longer repeating.",
"cmd-repeat-noOption-playlist-looping": "The playlist is now repeating.",
"cmd-repeat-noOption-playlist-not-looping": "The playlist is no longer repeating.",
"cmd-repeat-noOption-song-looping": "Song is now looping.",
"cmd-repeat-noOption-song-not-looping": "Song is no longer looping.",
"cmd-move-no-voice": "The bot is not in a voice channel. Use %ssummon to summon it to your voice channel.",
"cmd-move-no-songs": "No songs are currently playing. Play something with {}play.",
"cmd-move-indexes-not-intergers": "Song indexes must be intergers.",
"cmd-move-invalid-indexes": "Sent indexes are outsite of playlist scope!",
"cmd-move-success": "Succefully moved the requested song from positon number {0} in queue to position {1}!",
"playlists-noperms": "You are not allowed to request playlists",
"playlists-big": "Playlist has too many entries ({0} > {1})",
"playlists-limit": "Playlist entries + your already queued songs reached limit ({0} + {1} > {2})",
Expand Down
148 changes: 148 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# -----------------------------------------------------CONSTANTS-------------------------------------------------------

$DEFAULT_URL_BASE = "https://discordapp.com/api"

# ----------------------------------------------INSTALLING DEPENDENCIES------------------------------------------------

# Check if git is installed
"checking if git is already installed..."
Invoke-Expression "winget list -q Git.Git"
if (!($LastExitCode -eq 0))
{
# install git
"installing git..."
Invoke-Expression "winget install Git.Git"
}
else
{
"git already installed"
}

# Check if python is installed
"checking if python is already installed..."
Invoke-Expression "winget list -q Python.Python.3"
if (!($LastExitCode -eq 0))
{
# install python
"installing python..."
Invoke-Expression "winget install Python.Python.3.11 --custom \`"/passive Include_launcher=1\`""
}
else
{
"python already installed"
}

Invoke-Expression "refreshenv"

# --------------------------------------------------PULLING THE BOT----------------------------------------------------

"Do you want to install experimental (review) branch?"
$experimental = Read-Host "Installing experimental (review) branch means limited support, but you get access to newer fixes and features. (N/y): "
if($experimental -eq "Y" -or $experimental -eq "y")
{
"installing review branch..."
$branch = "review"
}
else
{
"installing master branch..."
$branch = "master"
}

Invoke-Expression "git clone https://github.com/Just-Some-Bots/MusicBot.git MusicBot -b $branch"
Invoke-Expression "cd MusicBot"

# --------------------------------------------INSTALL PYTHON DEPENDENCIES----------------------------------------------

if (Get-Command "python" -errorAction SilentlyContinue)
{
Invoke-Expression "python -c 'import sys; exit(0 if sys.version_info >= (3, 6) else 1)'"
if($LastExitCode -eq 0)
{
$PYTHON = "python"
}
}

$versionArray = "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"

foreach ($version in $versionArray)
{
Invoke-Expression "py -$version -c 'exit()'"
if($LastExitCode -eq 0)
{
$PYTHON = "py -$version"
}
}

Invoke-Expression "$PYTHON -m pip install --upgrade -r requirements.txt"

# -------------------------------------------------CONFIGURE THE BOT---------------------------------------------------
Copy-Item ".\config\example_options.ini" -Destination ".\config\options.ini"

# GET AND VERIFY TOKEN
""
"Please enter your bot token. This can be found in your discordapp developer page."
$token = Read-Host "Enter Token:" -AsSecureString
$token_plain = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($token))
$header = @{
"Authorization" = "Bot $token_plain"
"Content-Type" = "application/json"
}
$result = Invoke-WebRequest -Headers $header -Method "GET" -Uri "$DEFAULT_URL_BASE/users/@me"
$result_code = $result.StatusCode
$result_content = $result.Content
if (!($result_code -eq 200))
{
"Error getting user profile, is the token correct? ($result_code $result_content)"
Return
}
$result_object = ConvertFrom-Json -InputObject $result_content
# Cause whoever wrote ConvertFrom-Json cmdlet was insane and use some strange data type instead
$result_table = @{}
$result_object.PsObject.Properties | ForEach-Object{
$result_table[$_.Name] = $_.Value
}
$result_table += @{"token" = $token_plain}
$config = (Get-Content -Path ".\config\options.ini") -creplace "bot_token", $token_plain

# GET PREFIX
$cprefix = Read-Host "Would you like to change the command prefix? [N/y]: "
if($cprefix -eq "Y" -or $cprefix -eq "y")
{
"Please enter the prefix you'd like for your bot."
$prefix = Read-Host "This is what comes before all commands. The default is [!] "
$config = $config -creplace "CommandPrefix = !", "CommandPrefix = $prefix"
}
else
{
"Using default prefix [!]"
}

# GET OWNER
$cowner = Read-Host "Would you like to automatically get the owner ID from the OAuth application? [Y/n]: "
if($cowner -eq "N" -or $cowner -eq "n")
{
$owner = Read-Host "Please enter the owner ID. "
$config = $config -creplace "OwnerID = auto", "OwnerID = $owner"
}
else
{
"Getting owner ID from OAuth application..."
}

# GET AP
$cap = Read-Host "Would you like to enable the autoplaylist? [Y/n] "
if($cap -eq "N" -or $cap -eq "n")
{
$config = $config -creplace "UseAutoPlaylist = yes", "UseAutoPlaylist = no"
"Autoplaylist disabled"
}
else
{
"Autoplaylist enabled"
}

"Saving your config..."
Set-Content -Path ".\config\options.ini" -Value $config

"You can now use run.bat to run the bot"
Loading

0 comments on commit f903623

Please sign in to comment.