[英]How to call another function from another def():
你好,我想使用另一個def(): 的另一個函數,我試過這個:
import os
import socket
import uuid
from discord import Webhook, RequestsWebhookAdapter
def key_generator(stringId):
stringId = uuid.uuid4()
message_sender()
def message_sender(stringId):
machine_name = '[' + socket.gethostname() + ']'
webhook = Webhook.from_url("https://discord.com/api/webhooks/881232472644390933/MbAbLqd9G6eGYRO25zaIIrF6hJPNJCJWJm_9JTAiYxBeULevXNNaZJhQHcJSYPRcby89", adapter=RequestsWebhookAdapter())
webhook.send('`|---' + stringId + '---| Key: ' + '|' + 'key' + '|`')
key_generator()
它確實生成密鑰並通過我的 discord webhook 地址發送它。 我怎樣才能正確地做到這一點?
您對 message_sender 的調用缺少一個參數。
您沒有將stringId
變量作為參數傳遞給message_sender
。
您沒有將 stringId 變量作為參數傳遞給 message_sender。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.