Search code examples
pythondiscordnotificationsdiscord.py

Is there a way to get the guild's notification settings?


For example, whenever a user uses the !notification command, it should print in the console whether the server's notification settings are set to "all messages" or "only @mentions".

Here is an idea of what I'd like to use it for.

@bot.command()
async def notification():
  notificationsettings = # Notification settings here

  if notificationsettings == "only @mentions":
    print("You'll only get mention notifications")

  else:
    print("You'll get every message notifications")

Image


Solution

  • A Guild's notification level can be found through the Guild.default_notifications attribute. This will return a NotificationLevel object.