Compare commits
15
Commits
Development
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebb5042075 | ||
|
|
4160f2a8d3 | ||
|
|
8cdab50d11 | ||
|
|
51e801eed1 | ||
|
|
d04f3b63e3 | ||
|
|
a8e7f0c882 | ||
|
|
b0e2704ab7 | ||
|
|
622f8daa81 | ||
|
|
661df1852b | ||
|
|
b1294284f5 | ||
|
|
a3675562e7 | ||
|
|
070640a164 | ||
|
|
7fdde99b57 | ||
|
|
6f03c0c432 | ||
|
|
3255bfae29 |
@@ -0,0 +1,17 @@
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag toneapi/sonar:latest
|
||||
@@ -0,0 +1,95 @@
|
||||
name: Docker
|
||||
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
# Publish semver tags as releases.
|
||||
tags: [ 'v*.*.*' ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: ghcr.io
|
||||
# github.repository as <account>/<repo>
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
# This is used to complete the identity challenge
|
||||
# with sigstore/fulcio when running outside of PRs.
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Install the cosign tool except on PR
|
||||
# https://github.com/sigstore/cosign-installer
|
||||
- name: Install cosign
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
|
||||
with:
|
||||
cosign-release: 'v2.1.1'
|
||||
|
||||
# Workaround: https://github.com/docker/build-push-action/issues/461
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
|
||||
|
||||
# Login against a Docker registry except on PR
|
||||
# https://github.com/docker/login-action
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# Extract metadata (tags, labels) for Docker
|
||||
# https://github.com/docker/metadata-action
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
|
||||
# Sign the resulting Docker image digest except on PRs.
|
||||
# This will only write to the public Rekor transparency log when the Docker
|
||||
# repository is public to avoid leaking data. If you would like to publish
|
||||
# transparency data even for private images, pass --force to cosign below.
|
||||
# https://github.com/sigstore/cosign
|
||||
- name: Sign the published Docker image
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
env:
|
||||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
|
||||
TAGS: ${{ steps.meta.outputs.tags }}
|
||||
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
||||
# This step uses the identity token to provision an ephemeral certificate
|
||||
# against the sigstore community Fulcio instance.
|
||||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
// 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": "Launch bot",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "bot.py",
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": true,
|
||||
"env":{
|
||||
"DISCORD_TOKEN":"",
|
||||
"TONE_ENDPOINT":"https://toneapi.ovh"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM python:latest
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY . .
|
||||
RUN pip install -r requirements.txt
|
||||
CMD ["python", "bot.py"]
|
||||
@@ -8,3 +8,7 @@ for further information on commands do !help or !help <commandname> in a server
|
||||
|
||||
Invite link: https://discord.com/api/oauth2/authorize?client_id=1100115547515011182&permissions=414464862272&scope=bot
|
||||
Githublink: https://github.com/ToneAPI/Sonar
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import datetime
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import discord
|
||||
@@ -5,7 +6,7 @@ import requests
|
||||
|
||||
def getleaderboard(board:str, weaponid="", server="", mapid = "", gamemodeid = ""):
|
||||
payload = {"weapon": weaponid, "server": server, "map": mapid, "gamemode": gamemodeid}
|
||||
response = requests.get('https://tone.sleepycat.date/v2/client/players', params=payload).json()
|
||||
response = requests.get(os.environ.get("TONE_ENDPOINT") + '/v2/client/players', params=payload).json()
|
||||
players = response.keys()
|
||||
if(board.lower() == "totald"):
|
||||
board = "total_distance"
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
async def getserver(s,snippet):
|
||||
server = ""
|
||||
async with s.get('https://tone.sleepycat.date/v2/client/servers') as r:
|
||||
async with s.get(os.environ.get("TONE_ENDPOINT") + '/v2/client/servers') as r:
|
||||
response = await r.json()
|
||||
servers = response.keys()
|
||||
for i in servers:
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import asyncio
|
||||
|
||||
import os
|
||||
import discord
|
||||
import requests
|
||||
|
||||
@@ -46,7 +46,7 @@ async def get_allplayer_stats(s, playerids, weaponid = "", weaponname= "",server
|
||||
|
||||
async def getstats(s, playerid, weaponid = "", server = "", mapid = "" , gamemodeid = ""):
|
||||
payload = {'player': playerid, 'weapon': weaponid, 'server': server, 'gamemode': gamemodeid, 'map' : mapid}
|
||||
async with s.get('https://tone.sleepycat.date/v2/client/players', params=payload) as r:
|
||||
async with s.get(os.environ.get("TONE_ENDPOINT") + '/v2/client/players', params=payload) as r:
|
||||
response = await r.json()
|
||||
if(response == {}):
|
||||
async with s.get("https://northstar.tf/accounts/get_username", params={"uid": playerid}) as Er:
|
||||
|
||||
@@ -3,7 +3,7 @@ import requests
|
||||
def valueschartgamemode(playerid, weaponid):
|
||||
|
||||
payload = {'player': playerid, 'weapon': weaponid}
|
||||
response = requests.get('https://tone.sleepycat.date/v2/client/gamemodes', params=payload).json()
|
||||
response = requests.get(os.environ.get("TONE_ENDPOINT") + '/v2/client/gamemodes', params=payload).json()
|
||||
|
||||
gamemode_color = {'aitdm':(1, 0.0, 0.0),'at':(1, 0.375, 0.0),'chamber':(1, 0.75, 0.0),'cp':(0.875, 1, 0.0),'ctf':(0.5, 1, 0.0),'fd':(0.125, 1, 0.0),'ffa':(0.0, 1, 0.25),'fw':(0.0, 1, 0.625),'gg':(0.0, 1.0, 1),'inf':(0.0, 0.625, 1),'lts':(0.0, 0.25, 1),'mfd':(0.125, 0.0, 1),'ps':(0.5, 0.0, 1),'sns':(0.875, 0.0, 1), 'tdm':(1, 0.0, 0.75),'ttdm':(1, 0.0, 0.375), 'other': (1, 0.0, 1)}
|
||||
gamemode_dict = {'aitdm':'Attrition','at':'Bounty Hunt','chamber':'One in the Chamber','cp':'Amped Hardpoint','ctf':'Capture the Flag','fd':'Frontier Defense','ffa':'Free for All','fw':'Frontier War','gg':'GunGame','inf':'Infection','lts':'Last Titan Standing','mfd':'Marked for Death','ps':'Pilots Vs. Pilots','sns':'Sticks and Stones','tdm':'Skirmish','ttdm':'Titan Brawl'}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,7 +3,6 @@ from discord import app_commands
|
||||
import discord
|
||||
import os
|
||||
import asyncio
|
||||
from discordtoken import discordtoken
|
||||
|
||||
client = commands.Bot(command_prefix="!", intents=discord.Intents.all())
|
||||
client.remove_command('help')
|
||||
@@ -38,6 +37,6 @@ async def main():
|
||||
async with client:
|
||||
await load()
|
||||
await slashload()
|
||||
await client.start(discordtoken.get())
|
||||
await client.start(os.environ.get("DISCORD_TOKEN"))
|
||||
|
||||
asyncio.run(main())
|
||||
@@ -0,0 +1,4 @@
|
||||
discord
|
||||
pillow
|
||||
matplotlib
|
||||
requests
|
||||
@@ -65,7 +65,7 @@ class SlashStats(commands.Cog):
|
||||
async def autocomplete_player(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice[str]]:
|
||||
data = []
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get('https://tone.sleepycat.date/v2/client/players') as r:
|
||||
async with session.get(os.environ.get("TONE_ENDPOINT") + '/v2/client/players') as r:
|
||||
players = await r.json()
|
||||
|
||||
for player_choice in players.keys():
|
||||
@@ -89,7 +89,7 @@ class SlashStats(commands.Cog):
|
||||
async def autocomplete_server(self, interaction: discord.Interaction, current: str) -> list[app_commands.Choice[str]]:
|
||||
data = []
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get('https://tone.sleepycat.date/v2/client/servers') as r:
|
||||
async with session.get(os.environ.get("TONE_ENDPOINT") + '/v2/client/servers') as r:
|
||||
servers = await r.json()
|
||||
|
||||
for server_choice in servers.keys():
|
||||
|
||||
Reference in New Issue
Block a user