AttributeError:'ClientUser'对象没有属性'create_dm'(discord.py,我正在尝试对公会的所有成员进行dm)

时间:2020-06-11 08:43:57

标签: python discord.py send dm

我一直在尝试向公会的所有成员发送DM,但是我总是会收到此错误:

public async Task AddSprintsStories(List<SprintStories> sprintStories)
{
    var tasks = new List<Task>();
    try
    {
        if (sprintStories.Count > 0)
        {
            foreach (var item in sprintStories)
            {
                SprintStories sprintStoryData = new SprintStories();
                sprintStoryData.Id = item.Id;
                sprintStoryData.ProjectId = item.ProjectId;
                sprintStoryData.SprintId = item.SprintId;
                tasks.Add(mapper.InsertAsync<SprintStories>(sprintStoryData, new CqlQueryOptions().SetConsistencyLevel(ConsistencyLevel.LocalQuorum)));
            }

            await Task.WhenAll(tasks);
        }
    }
    catch (Exception e)
    {

    }
}

这是我的代码

AttributeError: 'ClientUser' object has no attribute 'create_dm'

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

我知道了,我必须等待频道。发送