Skip to content

Commit a27fa30

Browse files
committed
Fixt Problem wenn Rolle nicht zurück kommt
1 parent e9607bf commit a27fa30

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

files/lib/system/discord/type/ChannelMultiSelectDiscordType.class.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace wcf\system\discord\type;
44

5+
use Throwable;
56
use wcf\data\discord\bot\DiscordBotList;
67
use wcf\system\exception\UserInputException;
78
use wcf\system\WCF;
@@ -54,10 +55,17 @@ public function getFormElement($value, $channelTypes = [])
5455
];
5556
}
5657

58+
$realValue = [];
59+
try {
60+
$realValue = \unserialize($value);
61+
} catch (Throwable $e) {
62+
// do nothing
63+
}
64+
5765
WCF::getTPL()->assign([
5866
'bots' => $channels,
5967
'optionName' => $this->optionName,
60-
'value' => \unserialize($value),
68+
'value' => $realValue,
6169
'channelTypes' => $channelTypes,
6270
]);
6371

files/lib/system/discord/type/ChannelSelectDiscordType.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace wcf\system\discord\type;
44

5-
use UnexpectedValueException;
5+
use Throwable;
66
use wcf\data\discord\bot\DiscordBotList;
77
use wcf\system\exception\UserInputException;
88
use wcf\system\WCF;
@@ -59,7 +59,7 @@ public function getFormElement($value, $channelTypes = [])
5959
$realValue = [];
6060
try {
6161
$realValue = \unserialize($value);
62-
} catch (UnexpectedValueException $e) {
62+
} catch (Throwable $e) {
6363
// do nothing
6464
}
6565

files/lib/system/discord/type/RoleMultiSelectDiscordType.class.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace wcf\system\discord\type;
44

5+
use Throwable;
56
use wcf\data\discord\bot\DiscordBotList;
67
use wcf\system\exception\UserInputException;
78
use wcf\system\WCF;
@@ -27,11 +28,11 @@ public function getFormElement($value)
2728
$roles = [];
2829
$guildRoles = $this->getGuildRoles();
2930
foreach ($this->getDiscordBotList() as $discordBot) {
30-
$rolesTmp = [];
31-
if (isset($guildRoles[$discordBot->botID])) {
32-
$rolesTmp = $guildRoles[$discordBot->botID];
31+
if (!isset($guildRoles[$discordBot->botID]['body'])) {
32+
continue;
3333
}
34-
$rolesTmp = $rolesTmp['body'];
34+
35+
$rolesTmp = $guildRoles[$discordBot->botID]['body'];
3536
if (!\is_array($rolesTmp)) {
3637
$rolesTmp = [];
3738
}
@@ -44,10 +45,17 @@ public function getFormElement($value)
4445
];
4546
}
4647

48+
$realValue = [];
49+
try {
50+
$realValue = \unserialize($value);
51+
} catch (Throwable $e) {
52+
// do nothing
53+
}
54+
4755
WCF::getTPL()->assign([
4856
'bots' => $roles,
4957
'optionName' => $this->optionName,
50-
'value' => \unserialize($value),
58+
'value' => $realValue,
5159
]);
5260

5361
return WCF::getTPL()->fetch('discordRoleMultiSelect');

package.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
<packagename language="de">Discord-API</packagename>
77
<packagedescription>API to cummincate with Discord.</packagedescription>
88
<packagedescription language="de">API um mit Discord zu kommunizieren.</packagedescription>
9-
<version>2.5.1</version>
10-
<date>2022-10-21</date>
9+
<version>2.5.2</version>
10+
<date>2024-07-03</date>
1111
<license>https://creativecommons.org/publicdomain/zero/1.0/deed.en</license>
1212
</packageinformation>
1313
<authorinformation>
1414
<author>Hanashi Development</author>
1515
<authorurl>https://hanashi.dev/</authorurl>
1616
</authorinformation>
1717
<requiredpackages>
18-
<requiredpackage minversion="5.5.0">com.woltlab.wcf</requiredpackage>
18+
<requiredpackage minversion="5.5.22">com.woltlab.wcf</requiredpackage>
1919
</requiredpackages>
2020
<excludedpackages>
2121
<excludedpackage version="6.0.0 Alpha 1">com.woltlab.wcf</excludedpackage>
@@ -30,7 +30,7 @@
3030
<instruction type="option"/>
3131
<instruction type="script">acp/install_dev.hanashi.wsc.discord-api.php</instruction>
3232
</instructions>
33-
<instructions type="update" fromversion="2.5.0">
33+
<instructions type="update" fromversion="2.5.1">
3434
<instruction type="file"/>
3535
</instructions>
3636
</package>

0 commit comments

Comments
 (0)