Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit 0a14312

Browse files
committed
add role join guild
1 parent 9405007 commit 0a14312

File tree

9 files changed

+24
-9
lines changed

9 files changed

+24
-9
lines changed

Core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<parent>
66
<artifactId>funix-bot</artifactId>
77
<groupId>fr.funixgaming.funixbot</groupId>
8-
<version>1.1.5</version>
8+
<version>1.1.6</version>
99
</parent>
1010

1111
<modelVersion>4.0.0</modelVersion>
1212

1313
<groupId>fr.funixgaming.funixbot.core</groupId>
1414
<artifactId>core</artifactId>
15-
<version>1.1.5</version>
15+
<version>1.1.6</version>
1616

1717
<build>
1818
<plugins>

FunixBot-Discord/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<parent>
77
<artifactId>funix-bot</artifactId>
88
<groupId>fr.funixgaming.funixbot</groupId>
9-
<version>1.1.5</version>
9+
<version>1.1.6</version>
1010
</parent>
1111

1212
<modelVersion>4.0.0</modelVersion>
1313

1414
<groupId>fr.funixgaming.funixbot.discord</groupId>
1515
<artifactId>funix-bot-discord</artifactId>
16-
<version>1.1.5</version>
16+
<version>1.1.6</version>
1717

1818
<dependencies>
1919
<dependency>

FunixBot-Discord/src/main/java/fr/funixgaming/funixbot/discord/configs/BotConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class BotConfig {
1919
private String generalChannelId;
2020
private String rolesChannelId;
2121

22+
private String followerRoleId;
2223
private String twitchNotifRoleId;
2324
private String youtubeNotifRoleId;
2425
private String tiktokNotifRoleId;

FunixBot-Discord/src/main/java/fr/funixgaming/funixbot/discord/events/BotGuildEvents.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import lombok.AllArgsConstructor;
88
import lombok.extern.slf4j.Slf4j;
99
import net.dv8tion.jda.api.EmbedBuilder;
10+
import net.dv8tion.jda.api.entities.Guild;
1011
import net.dv8tion.jda.api.entities.User;
1112
import net.dv8tion.jda.api.events.guild.GuildBanEvent;
1213
import net.dv8tion.jda.api.events.guild.GuildUnbanEvent;
@@ -44,6 +45,15 @@ public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) {
4445
@Override
4546
public void onGuildMemberJoin(@NotNull GuildMemberJoinEvent event) {
4647
guildMemberEventLog(event.getUser(), GuildEventType.JOIN);
48+
49+
try {
50+
final FunixBot funixBot = FunixBot.getInstance();
51+
final Guild guild = funixBot.getBotGuild();
52+
53+
guild.addRoleToMember(event.getUser(), funixBot.getBotRoles().getFollowerRole()).queue();
54+
} catch (FunixBotException e) {
55+
log.error("Erreur pendant l'ajout d'un membre au discord {}.", e.getMessage());
56+
}
4757
}
4858

4959
private void guildMemberEventLog(final User user, final GuildEventType eventType) {

FunixBot-Discord/src/main/java/fr/funixgaming/funixbot/discord/modules/BotRoles.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class BotRoles {
1313
private final Role twitchNotifRole;
1414
private final Role youtubeNotifRole;
1515
private final Role tiktokNotifRole;
16+
private final Role followerRole;
1617

1718
public BotRoles(final FunixBot funixBot) throws FunixBotException {
1819
final Guild guild = funixBot.getBotGuild();
@@ -21,8 +22,9 @@ public BotRoles(final FunixBot funixBot) throws FunixBotException {
2122
this.twitchNotifRole = guild.getRoleById(botConfig.getTwitchNotifRoleId());
2223
this.youtubeNotifRole = guild.getRoleById(botConfig.getYoutubeNotifRoleId());
2324
this.tiktokNotifRole = guild.getRoleById(botConfig.getTiktokNotifRoleId());
25+
this.followerRole = guild.getRoleById(botConfig.getFollowerRoleId());
2426

25-
if (this.twitchNotifRole == null || this.youtubeNotifRole == null || this.tiktokNotifRole == null) {
27+
if (this.twitchNotifRole == null || this.youtubeNotifRole == null || this.tiktokNotifRole == null || this.followerRole == null) {
2628
throw new FunixBotException("L'un des rôles n'existe pas sur le discord.");
2729
}
2830
}

FunixBot-Discord/src/main/resources/application-local.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ discord.bot.config.log-channel-id=687278453640527883
1111
discord.bot.config.general-channel-id=687238121712254990
1212
discord.bot.config.roles-channel-id=984116014335803422
1313

14+
discord.bot.config.follower-role-id=687290866121179136
1415
discord.bot.config.twitch-notif-role-id=984969123924697158
1516
discord.bot.config.youtube-notif-role-id=986293102048342097
1617
discord.bot.config.tiktok-notif-role-id=986293280851497051

FunixBot-Discord/src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ discord.bot.config.log-channel-id=${DISCORD_LOG_CHANNEL_ID}
2525
discord.bot.config.general-channel-id=${DISCORD_GENERAL_CHANNEL_ID}
2626
discord.bot.config.roles-channel-id=${DISCORD_ROLES_CHANNEL_ID}
2727

28+
discord.bot.config.follower-role-id=${DISCORD_FOLLOWER_ROLE_ID}
2829
discord.bot.config.twitch-notif-role-id=${DISCORD_TWITCH_NOTIF_ROLE_ID}
2930
discord.bot.config.youtube-notif-role-id=${DISCORD_YOUTUBE_NOTIF_ROLE_ID}
3031
discord.bot.config.tiktok-notif-role-id=${DISCORD_TIKTOK_NOTIF_ROLE_ID}

FunixBot-Twitch/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<parent>
77
<artifactId>funix-bot</artifactId>
88
<groupId>fr.funixgaming.funixbot</groupId>
9-
<version>1.1.5</version>
9+
<version>1.1.6</version>
1010
</parent>
1111

1212
<modelVersion>4.0.0</modelVersion>
1313

1414
<groupId>fr.funixgaming.funixbot.twitch</groupId>
1515
<artifactId>funix-bot-twitch</artifactId>
16-
<version>1.1.5</version>
16+
<version>1.1.6</version>
1717

1818
<dependencies>
1919
<dependency>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<artifactId>funix-bot</artifactId>
99
<name>FunixBot</name>
1010
<packaging>pom</packaging>
11-
<version>1.1.5</version>
11+
<version>1.1.6</version>
1212

1313
<parent>
1414
<artifactId>funix-api</artifactId>
@@ -62,7 +62,7 @@
6262
<java.version>17</java.version>
6363

6464
<twitchApi.version>1.2.2</twitchApi.version>
65-
<funixbot.core.version>1.1.5</funixbot.core.version>
65+
<funixbot.core.version>1.1.6</funixbot.core.version>
6666

6767
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
6868
<commons.io.version>2.11.0</commons.io.version>

0 commit comments

Comments
 (0)