Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get builds from store repo #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Copyright 2024 Vita3K
Copyright 2024 Vita3K-team

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Vita3KBot
A bot for the Vita3K Discord server.
20 changes: 10 additions & 10 deletions Vita3KBot/APIClients/GithubClient/GithubClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ public static class GithubClient {
public static async Task<Embed> GetLatestBuild() {

GitHubClient github = new GitHubClient(new ProductHeaderValue("Vita3KBot"));
Release latestRelease = await github.Repository.Release.Get("Vita3k", "Vita3k", "continuous");
Release latestRelease = await github.Repository.Release.Get("Vita3K", "Vita3K-builds", "latest");
string releaseTime = $"Published at {latestRelease.PublishedAt:u}";
ReleaseAsset windowsRelease = latestRelease.Assets.Where(release => {
return release.Name.StartsWith("windows-latest");
return release.Name.EndsWith("windows.7z");
}).First();
ReleaseAsset linuxRelease = latestRelease.Assets.Where(release => {
return release.Name.StartsWith("ubuntu-latest");
return release.Name.EndsWith("ubuntu.7z");
}).First();
ReleaseAsset appimageRelease = latestRelease.Assets.Where(release => {
return release.Name.StartsWith("Vita3K-x86_64.AppImage");
return release.Name.EndsWith("Vita3K-x86_64.AppImage");
}).First();
ReleaseAsset macosRelease = latestRelease.Assets.Where(release => {
return release.Name.StartsWith("macos-latest");
return release.Name.EndsWith("macos.dmg");
}).First();

string commit = latestRelease.Body.Substring(latestRelease.Body.IndexOf(":") + 1).Trim();
commit = commit.Substring(0, commit.IndexOf("\n"));
GitHubCommit REF = await github.Repository.Commit.Get("Vita3k", "Vita3k", commit);
Issue prInfo = await GetPRInfo(github, commit);
string commitSha = latestRelease.Body.Substring(latestRelease.Body.IndexOf("https://github.com/Vita3K/Vita3K/commit/") + 46).Trim();
commitSha = commitSha.Substring(0, commitSha.IndexOf(")"));
GitHubCommit REF = await github.Repository.Commit.Get("Vita3k", "Vita3k", commitSha);
Issue prInfo = await GetPRInfo(github, commitSha);

EmbedBuilder LatestBuild = new EmbedBuilder();
EmbedBuilder LatestBuild = new();
if (prInfo != null) {
LatestBuild.WithTitle($"PR: #{prInfo.Number} By {prInfo.User.Login}")
.WithUrl(prInfo.HtmlUrl);
Expand Down
2 changes: 1 addition & 1 deletion Vita3KBot/Services/MessageHandlingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private static async Task MonitorNewBuilds(SocketUserMessage msg) {
if (msg.Channel.Name != "github" && msg.Author.ToString() != "GitHub#0000") return;
var embed = msg.Embeds.FirstOrDefault();

if (embed != null && embed.Title == "[Vita3K/Vita3K] New release published: continuous") {
if (embed != null && embed.Title.StartsWith("[Vita3K/Vita3K-builds] New release published:")) {
var guild = (msg.Channel as SocketGuildChannel).Guild;
await guild.GetTextChannel(965725409574539274).SendMessageAsync(embed: await GithubClient.GetLatestBuild());
}
Expand Down