Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nadeo_event_api/src/nadeo_event_api/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@

PASTEBIN_POST_URL = "https://pastebin.com/api/api_post.php"

PASTES_IO_LOGIN_URL = "http://pastes.io/api/login"
PASTES_IO_CREATE_URL = "http://pastes.io/api/paste/create"
PASTES_IO_LOGIN_URL = "http://pastesio.com/api/login"
PASTES_IO_CREATE_URL = "http://pastesio.com/api/paste/create"

PASTEFY_SKIFF_CREATE_URL = "https://pastes.skiff.dev/api/v2/paste"
PASTEFY_SKIFF_RAW_URL_FMT = "https://pastes.skiff.dev/{0}/raw"
42 changes: 42 additions & 0 deletions nadeo_event_api/src/nadeo_event_api/api/pastefy/pastefy_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Hosted by Matrix, requires dedicated IP whitelist to work.

import datetime
import json
import requests

from nadeo_event_api.api.endpoints import PASTEFY_SKIFF_CREATE_URL, PASTEFY_SKIFF_RAW_URL_FMT
from nadeo_event_api.objects.outbound.pastebin.tmwt_2v2 import Tmwt2v2Paste

def post_tmwt_2v2(tmwt_2v2_pastebin: Tmwt2v2Paste, title: str) -> str:
"""Posts a TMWT 2v2 paste to pastes.skiff.dev and returns the URL of the raw paste. Expires in 1 hour.
NOTE: Must have a whitelisted IP -- contact Matrix/Skiff for this if needed.

Args:
tmwt_2v2_pastebin (Tmwt2v2Pastebin): The TMWT paste.
title (str): The title of the paste.

Returns:
str: The raw URL of the paste.
"""
content = json.dumps(tmwt_2v2_pastebin.as_jsonable_dict(), indent=4)
expiry_date = datetime.datetime.utcnow() + datetime.timedelta(hours=1)
formatted = expiry_date.strftime('%Y-%m-%d %H:%M:%S') + '.0'
data = {
"type": "PASTE",
"title": title,
"content": content,
"expire_at": formatted,
"visibility": "PUBLIC",
}

response = requests.post(
url=PASTEFY_SKIFF_CREATE_URL,
data=data,
)
if response.status_code != 200:
print(response.text)
raise Exception(f"Failed to post to pastes.skiff.dev API.")

paste_id = response.json()["paste"]["id"]
paste_url = PASTEFY_SKIFF_RAW_URL_FMT.format(paste_id)
return paste_url
72 changes: 0 additions & 72 deletions nadeo_event_api/src/nadeo_event_api/api/pastesio/pastesio_api.py

This file was deleted.

8 changes: 5 additions & 3 deletions sample/tmwt_scrim.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from nadeo_event_api.api.structure.settings.plugin_settings import TMWTPluginSettings
from nadeo_event_api.api.structure.settings.script_settings import TMWT2025ScriptSettings, TMWC2023ScriptSettings, BaseTMWTScriptSettings, BaseScriptSettings
from nadeo_event_api.objects.outbound.pastebin.tmwt_2v2 import Tmwt2v2Paste, Tmwt2v2PasteTeam
from nadeo_event_api.api.pastebin.pastebin_api import post_tmwt_2v2
from nadeo_event_api.api.pastefy.pastefy_api import post_tmwt_2v2
from nadeo_event_api.objects.outbound.settings.pick_ban_style import PickBanStyle

# Event info
Expand All @@ -37,12 +37,14 @@
# Create teams of two by UID
blue_team = Tmwt2v2PasteTeam(
team_name="Blue",
team_id="Blue",
p1_tm_account_id="febeaf4d-f340-4954-9fe2-88390959ae53", # Charles
p2_tm_account_id="6e3bf3f9-7dcb-47d4-bdae-037ab66628f2", # Randomize
)

red_team = Tmwt2v2PasteTeam(
team_name="Red",
team_id="Red",
p1_tm_account_id="2e34c3cb-9548-4815-aee3-c68518a1fd88", # Nixotica
p2_tm_account_id="da244fe1-a978-449e-8a06-1362bce8b203", # Slorpie
)
Expand All @@ -52,7 +54,7 @@
team_b=red_team,
)

# pastebin_url = post_tmwt_2v2(pastebin, os.environ.get("PASTEBIN_API_DEV_KEY")) # type: ignore
teams_url = post_tmwt_2v2(pastebin, "tmwt2025test")

now = datetime.utcnow()
match_start = now + timedelta(minutes=1)
Expand Down Expand Up @@ -96,7 +98,7 @@
),
match_points_limit=2,
match_info="2025 THE YEAR",
teams_url="https://pastebin.com/raw/hSLVPj1c",
teams_url=teams_url, #"https://pastebin.com/raw/hSLVPj1c",
),
map_points_limit=5,
loading_screen_image_url="https://download.dashmap.live/6e3bf3f9-7dcb-47d4-bdae-037ab66628f2/AM_Stream_BG_Nologo.png",
Expand Down