【问题标题】:AttributeError: 'set' object has no attribute 'items' python discord errorAttributeError:'set'对象没有属性'items'python不和谐错误
【发布时间】:2021-09-01 15:01:12
【问题描述】:

这是我的代码

  1. 顺便说一句,我正在运行 Windows 10 Home,并且正在运行带有 VS 代码的 Python 3.8.2
  2. 只要能解决我的 Naro 问题,任何解决方案都可以(我的软件适用于 discord.com)
  3. 顺便说一句,如果你有,请在解决方案中留下你的 github 链接,这样我就可以在我的 github 上记下你了 4.常见问题 5.Q-这个软件是干什么用的 6.A- 在不和谐的地方挑拨离间
  4. Q- 我可以被封禁吗
  5. A- 是的,因为您使用的是用户帐户(这违反了 TOS)
   import os
file = os.path.realpath(__file__)
f = open("Tokens.txt" , 'w+')
print ('Naro by hackamous')
print('1) Spam a Channel')
print('2) Spam Friend Requests')
print('3) spam DMs')
choice = input('Enter your choice:')
if choice == '1':
    server_id = input("Server id:")
    Channel_id = input("Channel id:")
    message = input('Message to spam:')
    while True:
        headers = {
            'authorization:' f"{f.readlines()}"
        }
        payload = {
            'content:' f"{message}"
        }
        total = f'https://discord.com/api/v9/channels/{server_id}{Channel_id}'
        requests.post(f'{total}' , headers = headers , data = payload)
        exit_1 = input('Exit y/n:')
        if exit_1 == 'y':
            exit()
        else:
            continue


if choice == '2':
    name = input('Username:')
    dircrim = input('discriminator:')
    while True:
        headers = {
            'authorization:' f"{f.readlines()}"
        }
        payload = {
            'discriminator:' f"{dircrim}"
            'username:' f"{name}"
        }
        total = f'https://discord.com/api/v9/users/@me/relationships'
        requests.post(f'{total}' , headers = headers , data = payload)
        exit_1 = input('Exit y/n:')
        if exit_1 == 'y':
            exit()
        else:
            continue




if choice == '3':
    cha_ID = input('Channel ID:')
    msg = input('Message:')
    while True:
        headers = {
            'authorization:' f"{f.readlines()}"
        }
        payload = {
            'content:' f"{msg}"
        }
        total = f'https://discord.com/api/v9/channels/{cha_ID}/messages'
        requests.post(f'{total}' , headers = headers , data = payload)
        exit_1 = input('Exit y/n:')
        if exit_1 == 'y':
            exit()
        else:
            continue'''

【问题讨论】:

    标签: python api discord


    【解决方案1】:

    问题在于您用于构建 dicts 的语法。例如:

    'content:' f"{message}"
    

    这不是dict 条目,但实际上是单个连接字符串。因此,它不是创建dict,而是创建set

    为了使其成为dict 条目,冒号需要位于字符串之外,如下所示:

    'content' : f"{message}"
    

    所有的字典都有同样的问题,可以用同样的方法修复。

    【讨论】:

      猜你喜欢
      • 2022-10-20
      • 2018-03-11
      • 2015-11-14
      • 1970-01-01
      • 2021-08-09
      • 1970-01-01
      • 1970-01-01
      • 2012-05-11
      • 1970-01-01
      相关资源
      最近更新 更多