(Discord.py) Make a logger which saves conversations the bot is in

Showing off some functionality and setup commands

Logger is an extremely powerful and configurable logging bot. It is dedicated solely towards logging, no extra crap that do-everything bots have. Here are some features:

  • Easy to use web dashboard
  • Almost every event is available to be logged (event meaning message delete, role update, etc)
  • Ignore text channels
  • Disable events individually (only log what you want where you want)
  • Toggle logging bot actions (Dyno, Mee6 autorole for instance)
  • Utility commands
    • Get information about a user
    • Get information about the server
    • Get last names of user
    • Archive up to 1000 messages in a channel
  • Please make sure I have the permissions requested in the invite! If not, I will not work!
    • Manage server to fetch invites
    • Manage webhooks to create logging webhooks
    • Everything else is self-explanatory

All events and their meanings:

  • channelCreate
    • When a channel is created
  • channelUpdate
    • When a channel is updated (overwrites, name, bitrate…)
  • guildBanAdd
    • When a member gets banned
  • guildBanRemove
    • When a member gets unbanned
  • guildRoleCreate
    • When a role is created
  • guildRoleDelete
    • When a role is deleted
  • guildRoleUpdate
    • When a role is changed
  • guildUpdate
    • When a property of the server is updated (name, afk channel, welcome channel, etc)
  • messageDelete
    • When a message is deleted
  • messageDeleteBulk
    • When a large amount of messages is deleted by a bot
  • messageUpdate
    • When a message is edited
  • guildMemberAdd
    • When a member joins the server
  • guildMemberKick
    • When a member is kicked from the server
  • guildMemberRemove
    • When a member voluntarily leaves the server
  • guildMemberUpdate
    • When a member is given or revoked a role
  • voiceChannelLeave
    • When a member leaves a voice channel
  • voiceChannelJoin
    • When a member joins a voice channel
  • voiceStateUpdate
    • When a member mutes or deafens themself (or server-wide mute/deafen)
  • voiceChannelSwitch
    • When a member moves from one voice channel to another
  • guildEmojisUpdate
    • When an emoji is added or removed from the server
  • Special Patreon bot
    • See who deletes messages!
    • Image logging
    • Longer message caching times
    • Less limits
    • Faster bot
    • Priority support for bot uptime
    • Special website for viewing archives and bulk delete logs (https://logs.discord.website/9xMtM)
    • Archive up to 10,000 messages at once
    • See role permissions being updated
    • Ability to ignore actions done by a user (create role, apply role, kick, ban, etc)

Patreon (rad features, yo)

So you can track that person that keeps changing their username

Votes: 33

Invites: 1,595

Tags: 11

Deadpool is one of the best multipurpose discord bots , it has plenty of commands and functions that will help you improve your server.


Votes: 15

Invites: 1,006

Tags: 11

A multipurpose bot which has 400+ commands, 13+ categories and modules with a simple website dashboard.


Votes: 23

Invites: 1,290

Tags: 7

Auto NSFW/porn, twitch/youtube notifier, reaction images, games, moderation, fun, wikipedia, reddit, cats and more!


Votes: 8

Invites: 364

Tags: 6

A multifunctional Discord Bot providing fun, utilities commands and others..


Votes: 14

Invites: 450

Tags: 5

A customizable Discord bot offering a variety of commands for moderation, utilities, logging, polls, giveaways, public roles, and more


Votes: 22

Invites: 1,226

Tags: 4

Wick is an advanced security bot, one of its kind made to conquer any type of nukes, raids and spam. Many other features are available! [Version 2 out!]

Votes: 8

Invites: 362

Tags: 11

Pets | Custom Ranks | Reaction Roles | Music | Polls | Giveaways | Birthdays | Mod/Admin | Economy | Logging | Twitch | Games | Auto Role


Votes: 3

Invites: 670

Tags: 10

Twitch notifications, airing anime notifications, music players, reminders, weather checks, periodic messages in channels, osu! commands, advanced message deletion, and more. View our page to see everything Mirai can do for your server!

Votes: 0

Invites: 1,588

Tags: 7

Vexera is a free, high quality, multipurpose Discord Music Bot. Used by over 150,000 discord servers.

11 months ago
11 months ago
618 times

how do I make a a logger bot in discord.py which saves conversation into a text file.

So for example the bot saves all chats in a folder called «chatlogs» and in discord Server A
every time someone says something that the bot can see, the bot logs it in a file called ServerA.txt
and when Server B
adds my bot, it generates a file called ServerB.txt
and saves all Server B
conversations in there.

improve this question

1 Answer 1

active oldest votes

In an on_message
event, open the file in append mode and write the latest message.

from discord.ext import commands  bot = commands.Bot(command_prefix='!')  @bot.event async def on_message(message):     guild = message.guild     if guild:         path = "chatlogs/{}.txt".format(guild.id)           with open(path, 'a+') as f:             print("{0.timestamp} : {0.author.name} : {0.content}".format(message), file=f)     await bot.process_commands(message)  bot.run("token") 
improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.

Рейтинг автора
Подборку подготовил
Андрей Ульянов
Наш эксперт
Написано статей
Ссылка на основную публикацию
Похожие публикации