Compare commits

...

15 Commits

Author SHA1 Message Date
sclement
db70d06dc4 Do everything in one command 2023-12-28 16:53:22 +01:00
sclement
5bb2f20221 Don't move user 2023-12-28 16:38:49 +01:00
sclement
2217690daa Try to remove position ? 2023-12-28 16:35:01 +01:00
sclement
42ccdfcab0 Merge branch 'main' of github.com:Sebclem/ClaptrapBot 2023-12-28 16:23:01 +01:00
sclement
8bfb7de8a5 Try to put everething in queue 2023-12-28 16:22:10 +01:00
3ef747295a
Merge pull request #245 from Sebclem/renovate/org.liquibase-liquibase-core-4.x
⬆️ Update dependency org.liquibase:liquibase-core to v4.25.1
2023-12-28 15:59:12 +01:00
170b3597f4
Merge pull request #246 from Sebclem/renovate/org.liquibase.ext-liquibase-hibernate5-4.x
⬆️ Update dependency org.liquibase.ext:liquibase-hibernate5 to v4.25.1
2023-12-28 15:59:03 +01:00
f752ffb1b1
Merge pull request #247 from Sebclem/renovate/spring-boot
⬆️ Update plugin org.springframework.boot to v3.2.1
2023-12-28 15:58:53 +01:00
4d1fbd875d
Merge pull request #248 from Sebclem/renovate/log4j2-monorepo
⬆️ Update dependency org.apache.logging.log4j:log4j-bom to v2.22.1
2023-12-28 15:58:41 +01:00
sclement
db5ff0c3c4 Make everithing syncrone to try to fix autovoice channel 2023-12-28 15:57:57 +01:00
sclement
77b32c7e93 Fix Security error on settings 2023-12-28 15:35:22 +01:00
renovate[bot]
6a01048875
⬆️ Update dependency org.apache.logging.log4j:log4j-bom to v2.22.1 2023-12-27 09:26:14 +00:00
renovate[bot]
2131ab2801
⬆️ Update plugin org.springframework.boot to v3.2.1 2023-12-21 17:04:38 +00:00
renovate[bot]
1ee3e59bc5
⬆️ Update dependency org.liquibase.ext:liquibase-hibernate5 to v4.25.1 2023-12-20 15:28:57 +00:00
renovate[bot]
989bec74e5
⬆️ Update dependency org.liquibase:liquibase-core to v4.25.1 2023-12-18 22:34:33 +00:00
3 changed files with 20 additions and 14 deletions

View File

@ -1,5 +1,5 @@
plugins { plugins {
id 'org.springframework.boot' version '3.2.0' id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4' id 'io.spring.dependency-management' version '1.1.4'
id 'java' id 'java'
id 'groovy' id 'groovy'
@ -47,7 +47,7 @@ dependencies {
implementation('com.sedmelluq:lavaplayer:1.3.78') implementation('com.sedmelluq:lavaplayer:1.3.78')
implementation('net.dv8tion:JDA:5.0.0-beta.18') implementation('net.dv8tion:JDA:5.0.0-beta.18')
implementation(platform("org.apache.logging.log4j:log4j-bom:2.22.0")) implementation(platform("org.apache.logging.log4j:log4j-bom:2.22.1"))
implementation group: 'org.hibernate', name: 'hibernate-validator', version: '8.0.1.Final' implementation group: 'org.hibernate', name: 'hibernate-validator', version: '8.0.1.Final'
// Use MySQL Connector-J // Use MySQL Connector-J
@ -56,11 +56,11 @@ dependencies {
implementation('org.apache.commons:commons-lang3:3.14.0') implementation('org.apache.commons:commons-lang3:3.14.0')
liquibaseRuntime('org.liquibase:liquibase-core:4.25.0') liquibaseRuntime('org.liquibase:liquibase-core:4.25.1')
liquibaseRuntime('org.liquibase:liquibase-groovy-dsl:3.0.3') liquibaseRuntime('org.liquibase:liquibase-groovy-dsl:3.0.3')
liquibaseRuntime('mysql:mysql-connector-java:8.0.33') liquibaseRuntime('mysql:mysql-connector-java:8.0.33')
liquibaseRuntime group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' liquibaseRuntime group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
liquibaseRuntime group: 'org.liquibase.ext', name: 'liquibase-hibernate5', version: '4.25.0' liquibaseRuntime group: 'org.liquibase.ext', name: 'liquibase-hibernate5', version: '4.25.1'
liquibaseRuntime 'org.springframework.boot:spring-boot-starter-data-jpa' liquibaseRuntime 'org.springframework.boot:spring-boot-starter-data-jpa'
liquibaseRuntime 'org.springframework.data:spring-data-jpa' liquibaseRuntime 'org.springframework.data:spring-data-jpa'
liquibaseRuntime 'org.springframework:spring-beans' liquibaseRuntime 'org.springframework:spring-beans'

View File

@ -1,14 +1,21 @@
package net.Broken.Api.Controllers; package net.Broken.Api.Controllers;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import net.Broken.Api.Data.Settings.SettingGroup; import net.Broken.Api.Data.Settings.SettingGroup;
import net.Broken.Api.Data.Settings.Value; import net.Broken.Api.Data.Settings.Value;
import net.Broken.Api.Services.SettingService; import net.Broken.Api.Services.SettingService;
import net.Broken.DB.Entity.GuildPreferenceEntity; import net.Broken.DB.Entity.GuildPreferenceEntity;
import net.Broken.Tools.Settings.SettingValueBuilder; import net.Broken.Tools.Settings.SettingValueBuilder;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/v2/setting") @RequestMapping("/api/v2/setting")
@ -32,7 +39,7 @@ public class SettingController {
} }
@PostMapping("/{guildId}/values") @PostMapping("/{guildId}/values")
@PreAuthorize("@webSecurity.isInGuild(#guildId) && @webSecurity.anManageGuild(#guildId)") @PreAuthorize("@webSecurity.isInGuild(#guildId) && @webSecurity.canManageGuild(#guildId)")
public List<Value> getSettingValues(@PathVariable String guildId, @RequestBody List<Value> values) { public List<Value> getSettingValues(@PathVariable String guildId, @RequestBody List<Value> values) {
GuildPreferenceEntity pref = settingService.saveValue(guildId, values); GuildPreferenceEntity pref = settingService.saveValue(guildId, values);
return new SettingValueBuilder(pref).build(); return new SettingValueBuilder(pref).build();

View File

@ -41,17 +41,16 @@ public class AutoVoiceChannel {
GuildPreferenceEntity pref = SettingsUtils.getInstance().getPreference(guild); GuildPreferenceEntity pref = SettingsUtils.getInstance().getPreference(guild);
if (pref.isAutoVoice() && voiceChannel.getId().equals(pref.getAutoVoiceChannelID())) { if (pref.isAutoVoice() && voiceChannel.getId().equals(pref.getAutoVoiceChannelID())) {
logger.info("Creating new voice channel for Guild : {}", guild.getName()); logger.info("Creating new voice channel for Guild : {}", guild.getName());
AudioChannel newChannel = (AudioChannel) voiceChannel.createCopy().complete();
int next = getNextNumber(); int next = getNextNumber();
String title = pref.getAutoVoiceChannelTitle(); String title = pref.getAutoVoiceChannelTitle();
if (title.isEmpty()) { if (title.isEmpty()) {
title = "Voice @count"; title = "Voice @count";
} }
title = title.replace("@count", Integer.toString(next)); title = title.replace("@count", Integer.toString(next));
newChannel.getManager().setName(title).setPosition(voiceChannel.getPosition()).queue(); voiceChannel.createCopy().setName(title).setPosition(voiceChannel.getPosition()).queue(newChannel -> {
moveMembers(voiceChannel.getMembers(), (AudioChannel) newChannel);
createdChannels.put(next, newChannel.getId()); createdChannels.put(next, newChannel.getId());
moveMembers(voiceChannel.getMembers(), newChannel); });
} }
} }