def on_message(message): if message.channel.is_private and message.author.id != c.user.id: console.display("PRIVATE| {0}>{1}>{2}: {3}".format(message.server, message.channel, message.author.display_name, message.content)) client.send_queue.append(['msg', message.channel, config.cfg.HELPINFO]) if message.content == '!enable_pickups': if message.channel.permissions_for(message.author).manage_channels: if message.channel.id not in [x.id for x in bot.channels]: newcfg = stats3.new_channel(message.server.id, message.server.name, message.channel.id, message.channel.name, message.author.id) bot.channels.append(bot.Channel(message.channel, newcfg)) client.reply(message.channel, message.author, config.cfg.FIRST_INIT_MESSAGE) else: client.reply(message.channel, message.author, "this channel allready have pickups configured!") else: client.reply(message.channel, message.author, "You must have permission to manage channels to enable pickups.") elif message.content == '!disable_pickups': if message.channel.permissions_for(message.author).manage_channels: for chan in bot.channels: if chan.id == message.channel.id: stats3.delete_channel(message.channel.id) bot.channels.remove(chan) client.reply(message.channel, message.author, "pickups on this channel have been disabled.") return client.reply(message.channel, message.author, "pickups on this channel has not been set up yet!") else: client.reply(message.channel, message.author, "You must have permission to manage channels to disable pickups.") else: for channel in bot.channels: if message.channel.id == channel.id: console.display("CHAT| {0}>{1}>{2}: {3}".format(message.server, message.channel, message.author.display_name, message.content)) try: channel.processmsg(message.content, message.author) except: console.display("ERROR| Error processing message: {0}".format(traceback.format_exc()))
async def on_message(message): # if message.author.bot: # return if isinstance( message.channel, discord.abc.PrivateChannel) and message.author.id != c.user.id: console.display("PRIVATE| {0}>{1}>{2}: {3}".format( message.guild, message.channel, message.author.display_name, message.content)) private_reply(message.author, config.cfg.HELPINFO) elif message.content == '!enable_pickups': if message.channel.permissions_for(message.author).manage_channels: if message.channel.id not in [x.id for x in bot.channels]: newcfg = stats3.new_channel(message.guild.id, message.guild.name, message.channel.id, message.channel.name, message.author.id) bot.channels.append(bot.Channel(message.channel, newcfg)) reply(message.channel, message.author, config.cfg.FIRST_INIT_MESSAGE) else: reply(message.channel, message.author, "this channel allready have pickups configured!") else: reply( message.channel, message.author, "You must have permission to manage channels to enable pickups." ) elif message.content == '!disable_pickups': if message.channel.permissions_for(message.author).manage_channels: for chan in bot.channels: if chan.id == message.channel.id: bot.delete_channel(chan) reply(message.channel, message.author, "pickups on this channel have been disabled.") return reply(message.channel, message.author, "pickups on this channel has not been set up yet!") else: reply( message.channel, message.author, "You must have permission to manage channels to disable pickups." ) elif message.content != '': for channel in bot.channels: if message.channel.id == channel.id: try: await channel.processmsg(message) except: console.display( "ERROR| Error processing message: {0}".format( traceback.format_exc()))