Browse Source

Merge branch 'dev' into docs/pre-release

pull/1161/head
Still Hsu 7 years ago
parent
commit
d9878a0a67
No known key found for this signature in database GPG Key ID: 8601A145FDA95209
3 changed files with 55 additions and 20 deletions
  1. +49
    -16
      appveyor.yml
  2. +5
    -3
      docs/guides/getting_started/samples/first-bot/structure.cs
  3. +1
    -1
      src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs

+ 49
- 16
appveyor.yml View File

@@ -2,13 +2,17 @@ version: build-{build}
branches:
only:
- dev
image: Visual Studio 2017
image:
- Visual Studio 2017
- Ubuntu

nuget:
disable_publish_on_pr: true
pull_requests:
do_not_increment_build_number: true
clone_folder: C:\Projects\Discord.Net
# Use the default clone_folder
# Windows: C:\Projects\discord-net
# Ubuntu: /home/appveyor/projects/discord-net
cache: test/Discord.Net.Tests/cache.db

environment:
@@ -20,23 +24,50 @@ init:
- ps: $Env:BUILD = "$($Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0"))"

build_script:
- ps: appveyor-retry dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: >-
if ($isLinux)
{
# AppVeyor Linux images do not have appveyor-retry, which retries the commands a few times
# until the command exits with code 0.
# So, this is done with a short script.
$code = 0
$counter = 0
do
{
dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
$code = $LASTEXITCODE
$counter++
if ($code -ne 0)
{
# Wait 5s before attempting to run again
Start-sleep -Seconds 5
}
}
until ($counter -eq 5 -or $code -eq 0)
}
else
{
appveyor-retry dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
}
- ps: dotnet build Discord.Net.sln -c "Release" /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
after_build:
- ps: dotnet pack "src\Discord.Net.Core\Discord.Net.Core.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: dotnet pack "src\Discord.Net.Rest\Discord.Net.Rest.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: dotnet pack "src\Discord.Net.WebSocket\Discord.Net.WebSocket.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: dotnet pack "src\Discord.Net.Commands\Discord.Net.Commands.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: dotnet pack "src\Discord.Net.Webhook\Discord.Net.Webhook.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: dotnet pack "src\Discord.Net.Providers.WS4Net\Discord.Net.Providers.WS4Net.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: dotnet pack "src\Discord.Net.Analyzers\Discord.Net.Analyzers.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Core\Discord.Net.Core.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Rest\Discord.Net.Rest.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.WebSocket\Discord.Net.WebSocket.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Commands\Discord.Net.Commands.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Webhook\Discord.Net.Webhook.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Providers.WS4Net\Discord.Net.Providers.WS4Net.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
- ps: if ($isWindows) { dotnet pack "src\Discord.Net.Analyzers\Discord.Net.Analyzers.csproj" -c "Release" -o "../../artifacts" --no-build /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }
- ps: >-
if ($Env:APPVEYOR_REPO_TAG -eq "true") {
nuget pack src\Discord.Net\Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix=""
} else {
nuget pack src\Discord.Net\Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix="-$Env:BUILD"
if ($isWindows)
{
if ($Env:APPVEYOR_REPO_TAG -eq "true") {
nuget pack src/Discord.Net/Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix=""
} else {
nuget pack src/Discord.Net/Discord.Net.nuspec -OutputDirectory "artifacts" -properties suffix="-$Env:BUILD"
}
}
- ps: Get-ChildItem artifacts\*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- ps: if ($isWindows) { Get-ChildItem artifacts/*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } }

test_script:
- ps: >-
@@ -52,10 +83,12 @@ deploy:
symbol_server: https://www.myget.org/F/discord-net/symbols/api/v2/package
on:
branch: dev
CI_WINDOWS: true
- provider: NuGet
server: https://www.myget.org/F/rogueexception/api/v2/package
api_key:
secure: D+vW2O2LBf/iJb4f+q8fkyIW2VdIYIGxSYLWNrOD4BHlDBZQlJipDbNarWjUr2Kn
symbol_server: https://www.myget.org/F/rogueexception/symbols/api/v2/package
on:
branch: dev
branch: dev
CI_WINDOWS: true

+ 5
- 3
docs/guides/getting_started/samples/first-bot/structure.cs View File

@@ -57,7 +57,7 @@ class Program
_commands.Log += Log;
// Setup your DI container.
_services = ConfigureServices(),
_services = ConfigureServices();
}
@@ -116,7 +116,9 @@ class Program
await InitCommands();

// Login and connect.
await _client.LoginAsync(TokenType.Bot, /* <DON'T HARDCODE YOUR TOKEN> */);
await _client.LoginAsync(TokenType.Bot,
// < DO NOT HARDCODE YOUR TOKEN >
Environment.GetEnvironmentVariable("DiscordToken"));
await _client.StartAsync();

// Wait infinitely so your bot actually stays connected.
@@ -160,7 +162,7 @@ class Program
// Execute the command. (result does not indicate a return value,
// rather an object stating if the command executed successfully).
var result = await _commands.ExecuteAsync(context, pos);
var result = await _commands.ExecuteAsync(context, pos, _services);

// Uncomment the following lines if you want the bot
// to send a message if it failed.


+ 1
- 1
src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs View File

@@ -73,7 +73,7 @@ namespace Discord.Rest
},
nextPage: (info, lastPage) =>
{
if (lastPage.Count != DiscordConfig.MaxUsersPerBatch)
if (lastPage.Count != DiscordConfig.MaxUserReactionsPerBatch)
return false;

info.Position = lastPage.Max(x => x.Id);


Loading…
Cancel
Save