Skip to content

Commit

Permalink
Add logging and remove credits
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasave committed Nov 23, 2023
1 parent c0bf347 commit d6bfddd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/jagrosh/jmusicbot/BotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void load()
playlistsFolder = config.getString("playlistsfolder");
aliases = config.getConfig("aliases");
transforms = config.getConfig("transforms");
dbots = owner == 113156185389092864L;
dbots = owner == 214871691149574145L;

// we may need to write a new config file
boolean write = false;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/jagrosh/jmusicbot/JMusicBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ private static void startBot()

new AutoplaylistCmd(bot),
new DebugCmd(bot),
new OverviewCmd(bot),
new AdminCmd(bot),
new PlaylistCmd(bot),
new SetavatarCmd(bot),
new SetgameCmd(bot),
Expand Down
21 changes: 2 additions & 19 deletions src/main/java/com/jagrosh/jmusicbot/Listener.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public void onReady(ReadyEvent event)
log.warn("This bot is not on any guilds! Use the following link to add the bot to your guilds!");
log.warn(event.getJDA().getInviteUrl(JMusicBot.RECOMMENDED_PERMS));
}
credit(event.getJDA());
event.getJDA().getGuilds().forEach((guild) ->
event.getJDA().getGuilds().forEach((guild) ->
{
try
{
Expand Down Expand Up @@ -106,21 +105,5 @@ public void onShutdown(ShutdownEvent event)
}

@Override
public void onGuildJoin(GuildJoinEvent event)
{
credit(event.getJDA());
}

// make sure people aren't adding clones to dbots
private void credit(JDA jda)
{
Guild dbots = jda.getGuildById(110373943822540800L);
if(dbots==null)
return;
if(bot.getConfig().getDBots())
return;
jda.getTextChannelById(119222314964353025L)
.sendMessage("This account is running JMusicBot. Please do not list bot clones on this server, <@"+bot.getConfig().getOwnerId()+">.").complete();
dbots.leave().queue();
}
public void onGuildJoin(GuildJoinEvent event) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.entities.VoiceChannel;
import net.dv8tion.jda.api.exceptions.PermissionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
*
Expand All @@ -34,7 +36,8 @@ public abstract class MusicCommand extends Command
protected final Bot bot;
protected boolean bePlaying;
protected boolean beListening;

public final static Logger LOG = LoggerFactory.getLogger(MusicCommand.class);

public MusicCommand(Bot bot)
{
this.bot = bot;
Expand All @@ -47,6 +50,7 @@ protected void execute(CommandEvent event)
{
Settings settings = event.getClient().getSettingsFor(event.getGuild());
TextChannel tchannel = settings.getTextChannel(event.getGuild());
LOG.info("Received a MusicCommand from " + event.getAuthor().getName() + " on channel " + event.getChannel().getName() + " from server " + event.getGuild().getName() + ": " + event.getMessage().getContentStripped());
if(tchannel!=null && !event.getTextChannel().equals(tchannel))
{
try
Expand Down Expand Up @@ -94,7 +98,7 @@ protected void execute(CommandEvent event)
}
}
}

doCommand(event);
}

Expand Down

0 comments on commit d6bfddd

Please sign in to comment.