1
Fork 0
mirror of https://gitlab.com/Kwoth/nadekobot.git synced 2024-10-02 12:09:07 +00:00

docs: Updated more links to point to new repo url

dev: Fixed project id as nadeko is moved to nadeko/nadekobot
This commit is contained in:
Kwoth 2024-05-09 01:46:20 +00:00
parent d30fa44f3c
commit 6caea8e9e7
6 changed files with 68 additions and 53 deletions

View file

@ -78,7 +78,7 @@ build:
# - if: $CI_COMMIT_TAG
# script:
# - |
# release-cli create --name "NadekoBot v$CI_COMMIT_TAG" --description "## [Changelog](https://gitlab.com/Kwoth/nadekobot/-/blob/v4/CHANGELOG.md#$(echo "$CI_COMMIT_TAG" | sed "s/\.//g")-$(date +%d%m%Y))" --tag-name $CI_COMMIT_TAG \
# release-cli create --name "NadekoBot v$CI_COMMIT_TAG" --description "## [Changelog](https://gitlab.com/nadeko/nadekobot/-/blob/v5/CHANGELOG.md#$(echo "$CI_COMMIT_TAG" | sed "s/\.//g")-$(date +%d%m%Y))" --tag-name $CI_COMMIT_TAG \
# --assets-link "{\"name\":\"${LINUX_X64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_X64_RELEASE}\"}" \
# --assets-link "{\"name\":\"${LINUX_ARM64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_ARM64_RELEASE}\"}" \
# --assets-link "{\"name\":\"${WIN_X64_RELEASE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WIN_X64_RELEASE}\"}" \

View file

@ -5,5 +5,5 @@
[![nadeko2](https://cdn.nadeko.bot/tutorial/docs-bot.png)](https://nadeko.bot/commands)
### Useful links
- [Self hosting Guides and Docs](https://nadekobot.readthedocs.io/en/v4)
- [Self hosting Guides and Docs](https://nadekobot.readthedocs.io/en/latest)
- [Discord support server](https://discord.nadeko.bot)

View file

@ -1,6 +1,6 @@
# How to contribute
1. Make Merge Requests to the [**v4 branch**](https://gitlab.com/nadeko/nadekobot/tree/v5)
1. Make Merge Requests to the [**v5 branch**](https://gitlab.com/nadeko/nadekobot/tree/v5)
2. Keep a single Merge Request to a single feature
3. Fill out the MR template

View file

@ -1,6 +1,6 @@
site_name: 'NadekoBot'
site_url: 'https://nadeko.bot'
repo_url: 'https://gitlab.com/kwoth/nadekobot'
repo_url: 'https://gitlab.com/nadeko/nadekobot'
site_author: 'Kwoth'
theme:

View file

@ -1,9 +1,15 @@
using System.Net.Http.Json;
using System.Text;
using NadekoBot.Common.ModuleBehaviors;
using System.Text.Json.Serialization;
namespace NadekoBot.Modules.Administration.Self;
public sealed class GitlabReleaseModel
{
[JsonPropertyName("tag_name")]
public required string TagName { get; init; }
}
public sealed class CheckForUpdatesService : INService, IReadyExecutor
{
private readonly BotConfigService _bcs;
@ -12,8 +18,15 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
private readonly DiscordSocketClient _client;
private readonly IMessageSenderService _sender;
public CheckForUpdatesService(BotConfigService bcs, IBotCredsProvider bcp, IHttpClientFactory httpFactory,
DiscordSocketClient client, IMessageSenderService sender)
private const string RELEASES_URL = "https://gitlab.com/api/v4/projects/57687445/releases";
public CheckForUpdatesService(
BotConfigService bcs,
IBotCredsProvider bcp,
IHttpClientFactory httpFactory,
DiscordSocketClient client,
IMessageSenderService sender)
{
_bcs = bcs;
_bcp = bcp;
@ -21,12 +34,12 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
_client = client;
_sender = sender;
}
public async Task OnReadyAsync()
{
if (_client.ShardId != 0)
return;
using var timer = new PeriodicTimer(TimeSpan.FromHours(1));
while (await timer.WaitForNextTickAsync())
{
@ -34,17 +47,17 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
if (!conf.CheckForUpdates)
continue;
try
{
const string URL = "https://cdn.nadeko.bot/cmds/versions.json";
using var http = _httpFactory.CreateClient();
var versions = await http.GetFromJsonAsync<string[]>(URL);
var gitlabRelease = (await http.GetFromJsonAsync<GitlabReleaseModel[]>(RELEASES_URL))
?.FirstOrDefault();
if (versions is null)
if (gitlabRelease?.TagName is null)
continue;
var latest = versions[0];
var latest = gitlabRelease.TagName;
var latestVersion = Version.Parse(latest);
var lastKnownVersion = GetLastKnownVersion();
@ -53,13 +66,13 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
UpdateLastKnownVersion(latestVersion);
continue;
}
if (latestVersion > lastKnownVersion)
{
UpdateLastKnownVersion(latestVersion);
// pull changelog
var changelog = await http.GetStringAsync("https://gitlab.com/Kwoth/nadekobot/-/raw/v4/CHANGELOG.md");
var changelog = await http.GetStringAsync("https://gitlab.com/nadeko/nadekobot/-/raw/v5/CHANGELOG.md");
var thisVersionChangelog = GetVersionChangelog(latestVersion, changelog);
@ -72,22 +85,24 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
var creds = _bcp.GetCreds();
await creds.OwnerIds
.Select(async x =>
{
var user = await _client.GetUserAsync(x);
if (user is null)
return;
.Select(async x =>
{
var user = await _client.GetUserAsync(x);
if (user is null)
return;
var eb = _sender.CreateEmbed()
.WithOkColor()
.WithAuthor($"NadekoBot v{latestVersion} Released!")
.WithTitle("Changelog")
.WithUrl("https://gitlab.com/Kwoth/nadekobot/-/blob/v4/CHANGELOG.md")
.WithDescription(thisVersionChangelog.TrimTo(4096))
.WithFooter("You may disable these messages by typing '.conf bot checkforupdates false'");
var eb = _sender.CreateEmbed()
.WithOkColor()
.WithAuthor($"NadekoBot v{latest} Released!")
.WithTitle("Changelog")
.WithUrl("https://gitlab.com/nadeko/nadekobot/-/blob/v5/CHANGELOG.md")
.WithDescription(thisVersionChangelog.TrimTo(4096))
.WithFooter(
"You may disable these messages by typing '.conf bot checkforupdates false'");
await _sender.Response(user).Embed(eb).SendAsync();
}).WhenAll();
await _sender.Response(user).Embed(eb).SendAsync();
})
.WhenAll();
}
}
catch (Exception ex)
@ -111,7 +126,7 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
// if we got to previous version, end
if (line.StartsWith("## ["))
break;
// if we're reading a new segment, reformat it to print it better to discord
if (line.StartsWith("### "))
{
@ -136,11 +151,12 @@ public sealed class CheckForUpdatesService : INService, IReadyExecutor
}
private const string LAST_KNOWN_VERSION_PATH = "data/last_known_version.txt";
private Version? GetLastKnownVersion()
{
if (!File.Exists(LAST_KNOWN_VERSION_PATH))
return null;
return Version.TryParse(File.ReadAllText(LAST_KNOWN_VERSION_PATH), out var ver)
? ver
: null;

View file

@ -519,7 +519,7 @@ public sealed class Help : NadekoModule<HelpService>
=> smc.RespondConfirmAsync(_sender,
"""
- In case you don't want or cannot Donate to NadekoBot project, but you
- NadekoBot is a completely free and fully [open source](https://gitlab.com/kwoth/nadekobot) project which means you can run your own "selfhosted" instance on your computer or server for free.
- NadekoBot is a free and [open source](https://gitlab.com/nadeko/nadekobot) project which means you can run your own "selfhosted" instance on your computer.
*Keep in mind that running the bot on your computer means that the bot will be offline when you turn off your computer*
@ -532,7 +532,6 @@ public sealed class Help : NadekoModule<HelpService>
[OnlyPublicBot]
public async Task Donate()
{
// => new NadekoInteractionData(new Emoji("🖥️"), "donate:selfhosting", "Selfhosting");
var selfhostInter = _inter.Create(ctx.User.Id,
new SimpleInteraction<object>(new ButtonBuilder(
emote: new Emoji("🖥️"),
@ -545,33 +544,33 @@ public sealed class Help : NadekoModule<HelpService>
.WithTitle("Thank you for considering to donate to the NadekoBot project!");
eb
.WithDescription("NadekoBot relies on donations to keep the servers, services and APIs running.\n"
+ "Donating will give you access to some exclusive features. You can read about them on the [patreon page](https://patreon.com/join/nadekobot)")
.WithDescription("""
NadekoBot relies on donations to keep the servers, services and APIs running.
Donating will give you access to some exclusive features. You can read about them on the [patreon page](https://patreon.com/join/nadekobot)
""")
.AddField("Donation Instructions",
$@"
🗒 Before pledging it is recommended to open your DMs as Nadeko will send you a welcome message with instructions after you pledge has been processed and confirmed.
$"""
🗒 Before pledging it is recommended to open your DMs as Nadeko will send you a welcome message with instructions after you pledge has been processed and confirmed.
**Step 1:** Pledge on Patreon
**Step 1:** Pledge on Patreon
`1.` Go to <https://patreon.com/join/nadekobot> and choose a tier.
`2.` Make sure your payment is processed and accepted.
`1.` Go to <https://patreon.com/join/nadekobot> and choose a tier.
`2.` Make sure your payment is processed and accepted.
**Step 2** 🤝 Connect your Discord account 🤝
**Step 2** 🤝 Connect your Discord account 🤝
`1.` Go to your profile settings on Patreon and connect your Discord account to it.
*please make sure you're logged into the correct Discord account*
`1.` Go to your profile settings on Patreon and connect your Discord account to it.
*please make sure you're logged into the correct Discord account*
If you do not know how to do it, you may follow instructions in this link:
<https://support.patreon.com/hc/en-us/articles/212052266-How-do-I-connect-Discord-to-Patreon-Patron->
If you do not know how to do it, you may [follow instructions here](https://support.patreon.com/hc/en-us/articles/212052266-How-do-I-connect-Discord-to-Patreon-Patron-)
**Step 3** Wait a short while (usually 1-3 minutes)
Nadeko will DM you the welcome instructions, and you may start using the patron-only commands and features!
🎉 **Enjoy!** 🎉
")
**Step 3** Wait a short while (usually 1-3 minutes)
Nadeko will DM you the welcome instructions, and you may will receive your rewards!
🎉 **Enjoy!** 🎉
""")
.AddField("Troubleshooting",
"""
*In case you didn't receive the rewards within 5 minutes:*
`1.` Make sure your DMs are open to everyone. Maybe your pledge was processed successfully but the bot was unable to DM you. Use the `.patron` command to check your status.
`2.` Make sure you've connected the CORRECT Discord account. Quite often users log in to different Discord accounts in their browser. You may also try disconnecting and reconnecting your account.