Merge pull request #27 from Roxedus/dev

Jenkins be gone!
This commit is contained in:
Ev-1 authored and GitHub committed 2020-08-27 20:58:28 +02:00
commit 2fdab56887
10 files changed
+94 -23

No files matched your search

@@ -4,8 +4,10 @@ on: [push, pull_request]
jobs:
flake8:
runs-on: ubuntu-latest
env:
CheckFiles: "bot.py cogs/"
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
@@ -13,7 +15,25 @@ jobs:
- name: Lint with flake8
run: |
pip install flake8
flake8 --max-line-length 120 --statistics ${FLAKE_FILES}
flake8 ${CheckFiles}
- name: Check with Isort
run: |
pip install isort
isort --check --sp setup.cfg ${CheckFiles}
- name: Sort with Isort
if: failure()
run: |
isort --sp setup.cfg ${CheckFiles}
- name: Create Pull Request
if: failure()
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GH_TOKEN }}
branch: actions/auto
commit-message: Changes done by tests
committer: Roxedus <bot@roxedus.dev>
title: Linter changed files
build-and-push:
needs: flake8
@@ -23,8 +43,9 @@ jobs:
ref: ${{github.ref}}
DOCKER_USERNAME: roxedus
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Build the Docker image
run: |
branch="${ref##*/}"
+7
View File
@@ -0,0 +1,7 @@
{
"recommendations": [
"oderwat.indent-rainbow",
"ms-python.python",
"ms-python.vscode-pylance"
]
}
+15
View File
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"name": "Debug Bot",
"type": "python",
"request": "launch",
"program": "bot.py",
"console": "integratedTerminal",
"args": ["-D", "-d", "data"],
"host": "localhost"
}]
}
+15
View File
@@ -0,0 +1,15 @@
{
"python.languageSever": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.pycodestyleEnabled": true,
"[python]": {
"editor.rulers": [120],
},
"[Dockerfile]": {
"editor.formatOnSave": false
},
"editor.tabSize": 4
}
+11 -9
View File
@@ -1,9 +1,10 @@
# WIP - Shite Music Bot
[![Build Status](https://jenkins.roxedus.net/buildStatus/icon?job=MusicBot%2Fdev)](https://jenkins.roxedus.net/job/MusicBot/job/dev/)
[![](https://images.microbadger.com/badges/image/rnorge/music:dev-amd64.svg)](https://microbadger.com/images/rnorge/music:dev-amd64 "Get your own image badge on microbadger.com")
[![MicroBadger](https://images.microbadger.com/badges/image/rnorge/music:dev-amd64.svg)](https://microbadger.com/images/rnorge/music:dev-amd64 "Get your own image badge on microbadger.com")
## Features
### Features:
- Translations, get the bot in your preferred langauge!
- Round Robin style queue, you won't have to wait forever for your songs to play.
- Noice per server customization options.
@@ -12,18 +13,19 @@
- Lyrics command that sometimes gives the correct lyrics
- DJ roles
### Setup
#### Setup
1. Change or copy data/config.yaml.example to config.yaml
2. Create or find a [lavalink](https://github.com/Frederikam/Lavalink) server you can use.
3. Add your bot token and lavalink server.
4. Edit any other settings you want.
5. install requirements
> python -m pip install -r requirements.txt
5. install requirements `python -m pip install -r requirements.txt`
6. run the bot :)
#### Docker
#### Compose Example:
### Docker
### Compose Example
````yaml
version: '3'
networks:
@@ -42,7 +44,7 @@ services:
- lavalink
volumes:
- /compose/BottStack/lavalink/application.yml:/opt/Lavalink/application.yml
bot:
bot:
container_name: ProdMaster
image: rnorge/music
networks:
@@ -51,4 +53,4 @@ services:
volumes:
- /compose/BottStack/ProdBetaMaster/script:/diks
- /compose/BottStack/ProdBetaMaster/data:/app/data
````
````
+3 -4
View File
@@ -57,10 +57,9 @@ class Errors(commands.Cog):
elif (err.original == 'You need to be in my voicechannel.'):
return await send_error_embed('{errors.my_channel}')
if isinstance(err, commands.CommandOnCooldown):
await ctx.send(f"{ctx.message.author.mention} Command is on cooldown. "
f"Try again in `{err.retry_after:.1f}` seconds.")
f"Try again in `{err.retry_after:.1f}` seconds.")
elif isinstance(err, commands.NoPrivateMessage):
await ctx.send('That command is not available in DMs')
@@ -70,11 +69,11 @@ class Errors(commands.Cog):
if self.bot.debug:
tb = err.__traceback__
traceback.print_tb(tb)
self.logger.debug("Error running command: %s\nTraceback: %s" % (ctx.command, err))
self.logger.debug("Error running command: %s\nTraceback: %s" % (ctx.command, err))
else:
to_log = (RuntimeError, commands.CheckFailure, commands.CommandInvokeError,
commands.NoPrivateMessage)
commands.NoPrivateMessage)
if isinstance(err, to_log):
self.logger.debug("Error running command: %s\nTraceback: %s" % (ctx.command, err))
-1
View File
@@ -16,7 +16,6 @@ from typing import Optional
from bs4 import BeautifulSoup
from .utils import checks, thumbnailer, timeformatter
from .utils.mixplayer import MixPlayer
from .utils.paginator import QueuePaginator, Scroller, TextPaginator
from .utils.selector import Selector
+4 -2
View File
@@ -8,9 +8,11 @@ import codecs
import yaml
from .utils.mixplayer import MixPlayer
# Bot Utilities
from cogs.helpformatter import commandhelper
from cogs.utils.paginator import Scroller
from .utils.mixplayer import MixPlayer
class NodeManager(commands.Cog):
def __init__(self, bot):
@@ -51,7 +53,7 @@ class NodeManager(commands.Cog):
if node['name'] in name_cache:
continue
self.bot.lavalink.add_node(**node)
self.bot.lavalink.add_node(**node)
self.logger.debug("Adding Lavalink node: %s on %s with the port %s in %s" % (
node['name'], node['host'],
node['port'], node['region'],))
-1
View File
@@ -6,7 +6,6 @@ from os import path
import yaml
"""
Not the prettiest this, works by replacing any found aliases in a command string with the actual command names.
Allows per guild aliases of subcommands without doing anything to discord.py itself. Suggestions of better/correct
+15 -3
View File
@@ -1,5 +1,7 @@
[pycodestyle]
max_line_length = 120
[flake8]
max-line-length = 120
count = True
statistics = True
[isort]
known_discord = discord,lavalink
@@ -11,4 +13,14 @@ no_lines_before = LOCALFOLDER
indent = " "
line_length = 120
balanced_wrapping = True
multi_line_output = 4
multi_line_output = 4
[pycodestyle]
max_line_length = 120
[pylint.FORMAT]
max-line-length=120
[pylint.BASIC]
variable-naming-style=camelCase
constant-naming-style=camelCase