Skip to content

Commit 8ef5650

Browse files
authored
Merge pull request #28 from Smieszkokoleszko/Signup-name-changer
New command for changing signups name
2 parents 75df309 + 880e1a1 commit 8ef5650

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

ArmaforcesMissionBot/Helpers/SignupHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ await signupChannel.ModifyAsync(x =>
280280
// really hacky solution to avoid recalculating indexes for each channel integer should have
281281
// space for around 68 years, and this bot is not going to work this long for sure
282282
x.Position = index;
283+
x.Name = mission.Title;
283284
});
284285

285286
var mainEmbed = await CreateMainEmbed(guild, mission);

ArmaforcesMissionBot/Modules/Signups.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,29 @@ public async Task EditMission(int missionNo)
685685
}
686686
}
687687

688+
[Command("edytuj-nazwe-misji")]
689+
[Summary("Edycja nazwy już utworzonej misji.")]
690+
[ContextDMOrChannel]
691+
public async Task MissionName([Remainder] string newTitle)
692+
{
693+
if (SignupsData.Missions.Any(x =>
694+
(x.Editing == ArmaforcesMissionBotSharedClasses.Mission.EditEnum.Started) &&
695+
x.Owner == Context.User.Id))
696+
{
697+
var mission = SignupsData.Missions.Single(x =>
698+
(x.Editing == ArmaforcesMissionBotSharedClasses.Mission.EditEnum.Started) &&
699+
x.Owner == Context.User.Id);
700+
701+
mission.Title = newTitle;
702+
703+
await ReplyAsync("Niech będzie...");
704+
}
705+
else
706+
{
707+
await ReplyAsync("Bez wybrania misji to dupę se edytuj. Pozdrawiam.");
708+
}
709+
}
710+
688711
[Command("zapisz-zmiany")]
689712
[Summary("Zapisuje zmiany w aktualnie edytowanej misji, jesli w parametrze zostanie podana wartość true to zostanie wysłane ogłoszenie o zmianach w misji.")]
690713
[ContextDMOrChannel]

0 commit comments

Comments
 (0)