本文整理汇总了Java中net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent类的典型用法代码示例。如果您正苦于以下问题:Java GuildMessageUpdateEvent类的具体用法?Java GuildMessageUpdateEvent怎么用?Java GuildMessageUpdateEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuildMessageUpdateEvent类属于net.dv8tion.jda.core.events.message.guild包,在下文中一共展示了GuildMessageUpdateEvent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onGuildMessageUpdate
import net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent; //导入依赖的package包/类
@Override
public void onGuildMessageUpdate(GuildMessageUpdateEvent event) {
if (!Bot.isReady() || event.getMember().getUser().isBot() || event.getMember().getUser().isFake()) {
return;
}
if (!new UserClient(event.getMember().getUser().getId()).isStaff()) {
filterMessage(event.getMessage());
}
}
开发者ID:Minehut,项目名称:MinehutBOT,代码行数:11,代码来源:ChatEvents.java
示例2: onGuildMessageUpdate
import net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent; //导入依赖的package包/类
@Override
public void onGuildMessageUpdate(GuildMessageUpdateEvent event)
{
EmbedBuilder builder = new EmbedBuilder();
Guild guild = event.getGuild();
TextChannel tc = db.getServerlogChannel(guild);
Message message = MessagesLogging.getMsg(event.getMessageIdLong());
Message newmsg = event.getMessage();
String title;
TextChannel channel = FinderUtil.getDefaultChannel(event.getGuild());
if(!(message.getContent().equals("No cached message")) && !(tc==null) && !(event.getAuthor().isBot()))
{
if(!(tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_HISTORY)))
guild.getOwner().getUser().openPrivateChannel().queue(s -> s.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue(
null, (e) -> channel.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
else
{
title = "`[Message Edited]:` :pencil2: **"+message.getAuthor().getName()+"#"+message.getAuthor().getDiscriminator()+"**'s message was edited in "+message.getTextChannel().getAsMention()+":";
builder.setAuthor(message.getAuthor().getName(), null, message.getAuthor().getEffectiveAvatarUrl());
builder.addField("Old Content:", "```"+message.getContent()+"```", false);
builder.addField("New Content:", "```"+newmsg.getContent()+"```", false);
builder.setFooter("Message ID: "+message.getId(), null);
builder.setColor(event.getGuild().getSelfMember().getColor());
builder.setTimestamp(message.getCreationTime());
tc.sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue((m) -> {
MessagesLogging.removeMessage(newmsg.getIdLong());
MessagesLogging.addMessage(newmsg.getIdLong(), newmsg);
});
}
}
else
{
if(!(tc==null) && !(event.getAuthor().isBot()))
{
if(!(tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_READ, Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS, Permission.MESSAGE_HISTORY)))
guild.getOwner().getUser().openPrivateChannel().queue(s -> s.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue(
null, (e) -> tc.sendMessage(Messages.SRVLOG_NOPERMISSIONS).queue()));
else
{
title = "`[Message Edited]:` :pencil2: A message was edited:";
builder.addField("Old Content:", "```No cached message.```", false);
builder.addField("New Content:", "```"+newmsg.getContent()+"```", false);
builder.setFooter("Message ID: " + event.getMessageId(), null);
builder.setColor(event.getGuild().getSelfMember().getColor());
tc.sendMessage(new MessageBuilder().append(title).setEmbed(builder.build()).build()).queue((m) -> {
MessagesLogging.removeMessage(newmsg.getIdLong());
MessagesLogging.addMessage(newmsg.getIdLong(), newmsg);
});
}
}
}
}
开发者ID:EndlessBot,项目名称:Endless,代码行数:58,代码来源:ServerLogging.java
示例3: onGuildMessageUpdate
import net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent; //导入依赖的package包/类
@Override
public void onGuildMessageUpdate(GuildMessageUpdateEvent event) {
if (RuntimeEditor.isFilteringAdverts())
checkForAdvertising(event.getMember(), event.getMessage(), event.getChannel());
}
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:6,代码来源:AutoMod.java
示例4: onGuildMessageUpdate
import net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
private void onGuildMessageUpdate(final GuildMessageUpdateEvent event)
{
this.update(event.getChannel());
}
开发者ID:JDA-Applications,项目名称:GuildBot,代码行数:6,代码来源:CommandExecutor.java
示例5: onGuildMessageUpdate
import net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent; //导入依赖的package包/类
public void onGuildMessageUpdate(GuildMessageUpdateEvent e) {
onGuildMessageReceived(new GuildMessageReceivedEvent(e.getJDA(), e.getResponseNumber(), e.getMessage()));
}
开发者ID:Sanduhr32,项目名称:Uselessbot,代码行数:4,代码来源:Mentioneveryone.java
示例6: onGuildMessageUpdate
import net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent; //导入依赖的package包/类
@Override
public void onGuildMessageUpdate(GuildMessageUpdateEvent event) {
performAutomod(event.getMessage());
}
开发者ID:jagrosh,项目名称:Vortex,代码行数:5,代码来源:AutoMod.java
示例7: handleMessage
import net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent; //导入依赖的package包/类
private Long handleMessage(JSONObject content)
{
Message message;
try
{
message = api.getEntityBuilder().createMessage(content);
}
catch (IllegalArgumentException e)
{
switch (e.getMessage())
{
case EntityBuilder.MISSING_CHANNEL:
{
final long channelId = content.getLong("channel_id");
api.getEventCache().cache(EventCache.Type.CHANNEL, channelId, () -> handle(responseNumber, allContent));
EventCache.LOG.debug("Received a message update for a channel that JDA does not currently have cached");
return null;
}
case EntityBuilder.MISSING_USER:
{
final long authorId = content.getJSONObject("author").getLong("id");
api.getEventCache().cache(EventCache.Type.USER, authorId, () -> handle(responseNumber, allContent));
EventCache.LOG.debug("Received a message update for a user that JDA does not currently have cached");
return null;
}
default:
throw e;
}
}
switch (message.getChannelType())
{
case TEXT:
{
TextChannel channel = message.getTextChannel();
if (api.getGuildLock().isLocked(channel.getGuild().getIdLong()))
{
return channel.getGuild().getIdLong();
}
api.getEventManager().handle(
new GuildMessageUpdateEvent(
api, responseNumber,
message));
break;
}
case PRIVATE:
{
api.getEventManager().handle(
new PrivateMessageUpdateEvent(
api, responseNumber,
message));
break;
}
case GROUP:
{
api.getEventManager().handle(
new GroupMessageUpdateEvent(
api, responseNumber,
message));
break;
}
default:
WebSocketClient.LOG.warn("Received a MESSAGE_UPDATE with a unknown MessageChannel ChannelType. JSON: {}", content);
return null;
}
//Combo event
api.getEventManager().handle(
new MessageUpdateEvent(
api, responseNumber,
message));
return null;
}
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:75,代码来源:MessageUpdateHandler.java
注:本文中的net.dv8tion.jda.core.events.message.guild.GuildMessageUpdateEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论