例如,每当用户使用!notification命令时,应在控制台中打印服务器的通知设置是否设置为"all messages""only @mentions".

这是我想用它做什么的 idea .

@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

推荐答案

公会的通知级别可以通过Guild.default_notifications属性找到.这将返回一个NotificationLevel对象.

Python相关问答推荐

通过优化空间在Python中的饼图中添加标签

Python多处理:当我在一个巨大的pandas数据框架上启动许多进程时,程序就会陷入困境

Python daskValue错误:无法识别的区块管理器dask -必须是以下之一:[]

Odoo 14 hr. emergency.public内的二进制字段

numba jitClass,记录类型为字符串

如何在Python脚本中附加一个Google tab(已经打开)

在vscode上使用Python虚拟环境时((env))

名为__main__. py的Python模块在导入时不运行'

isinstance()在使用dill.dump和dill.load后,对列表中包含的对象失败

ConversationalRetrivalChain引发键错误

基于Scipy插值法的三次样条系数

在Google Drive中获取特定文件夹内的FolderID和文件夹名称

pandas:在操作pandora之后将pandora列转换为int

在用于Python的Bokeh包中设置按钮的样式

你能把函数的返回类型用作其他地方的类型吗?'

删除Dataframe中的第一个空白行并重新索引列

Polars定制函数返回多列

如何在表单中添加管理员风格的输入(PDF)

多个布尔条件的`jax.lax.cond`等效项

如何计算Pandas 中具有特定条件的行之间的天差