7
7
use wcf \system \cache \builder \DiscordGuildChannelsCacheBuilder ;
8
8
use wcf \system \exception \AJAXException ;
9
9
use wcf \system \exception \PermissionDeniedException ;
10
- use wcf \system \file \upload \UploadFile ;
11
10
use wcf \system \WCF ;
12
11
13
12
/**
@@ -47,13 +46,7 @@ public function create()
47
46
unset($ this ->parameters ['data ' ]['useApplicationCommands ' ]);
48
47
}
49
48
50
- $ discordBot = parent ::create ();
51
-
52
- if (isset ($ this ->parameters ['webhookIcon ' ]) && \is_array ($ this ->parameters ['webhookIcon ' ])) {
53
- $ this ->processWebhookIcon ($ discordBot ->botID );
54
- }
55
-
56
- return $ discordBot ;
49
+ return parent ::create ();
57
50
}
58
51
59
52
#[Override]
@@ -67,34 +60,6 @@ public function update()
67
60
}
68
61
69
62
parent ::update ();
70
-
71
- foreach ($ this ->getObjects () as $ object ) {
72
- if (isset ($ this ->parameters ['webhookIcon ' ]) && \is_array ($ this ->parameters ['webhookIcon ' ])) {
73
- if ($ this ->parameters ['webhookIcon ' ] === '' ) {
74
- $ filename = \sprintf ('%simages/discord_webhook/%s.png ' , WCF_DIR , $ object ->botID );
75
- if (\file_exists ($ filename )) {
76
- \unlink ($ filename );
77
- }
78
- } else {
79
- $ this ->processWebhookIcon ($ object ->botID );
80
- }
81
- }
82
- }
83
- }
84
-
85
- #[Override]
86
- public function delete ()
87
- {
88
- $ returnValues = parent ::delete ();
89
-
90
- foreach ($ this ->getObjects () as $ object ) {
91
- $ filename = \sprintf ('%simages/discord_webhook/%s.png ' , WCF_DIR , $ object ->botID );
92
- if (\file_exists ($ filename )) {
93
- \unlink ($ filename );
94
- }
95
- }
96
-
97
- return $ returnValues ;
98
63
}
99
64
100
65
#[Override]
@@ -103,23 +68,6 @@ protected function resetCache()
103
68
DiscordGuildChannelsCacheBuilder::getInstance ()->reset ();
104
69
}
105
70
106
- /**
107
- * verarbeitet hochgeladenes Icon
108
- *
109
- * @param mixed $botID
110
- * @return void
111
- */
112
- protected function processWebhookIcon (int $ botID )
113
- {
114
- $ iconFile = \reset ($ this ->parameters ['webhookIcon ' ]);
115
- if ($ iconFile instanceof UploadFile && !$ iconFile ->isProcessed ()) {
116
- $ filename = \sprintf ('%simages/discord_webhook/%s.png ' , WCF_DIR , $ botID );
117
-
118
- \rename ($ iconFile ->getLocation (), $ filename );
119
- $ iconFile ->setProcessed ($ filename );
120
- }
121
- }
122
-
123
71
/**
124
72
* validiert die Methode getBotToken
125
73
*
0 commit comments