我如何通过discord.py机器人将消息从网站发送到Discord频道

问题描述

所以我正在尝试为discord.py机器人制作仪表板 所以我做了一个页面,我将在其中输入我的姓名,电子邮件和电话号码,单击提交后,将打开另一个页面,在该页面中我将看到值 所以我想将discord.py机器人连接到它,这样当我单击“提交”时它将发送嵌入到特定频道 我不知道该怎么做,我尝试了很多事情,但没用

from flask import Flask,render_template,redirect,url_for,request


import discord
from dhooks import Webhook,Embed
from discord.ext import commands,tasks



app = Flask(__name__)
@app.route('/yami/home/posts')
def posts():
   return render_template('posts.html')

@app.route('/verified',methods = ['POST','GET'])
async def verified():
    if request.method == "POST":
        result = request.form
        channel_entry = 694563592518893601
        msg_entry = 'test'


        channel = client.get_channel(channel_entry)
        await channel.send(msg_entry)

        return render_template("verified.html",result = result) 
<!--posts-->
{% extends "base.html" %}
<!--HEAD-->
{% block head %}
<title>TEST posts 1</title>

{% endblock %}
<!--HEAD end-->

<!--STYLE-->
{% block style %} {% endblock %}
<!--STYLE end-->

<!--BODY-->
{% block body %}
<div class="center">
    <h1>This is posts</h1>

     <div class="side">
         <a href="index">Click to go to index</a><br>
         <a href="home">click to go to home</a><br>
         <a href="new">Click to go to new</a><br>
           <a href="/result">click to go to result</a><br>
    <a href="/student">click to go to student</a><br>

          <a href="verified">click to go to verified</a>
     </div>
</div>
{% for s in stuff1%}
<h1>{{s.title}}</h1>
<p>{{s.content}}</p>
{% endfor %}
<form action="/verified" method="POST">
    <div class="side">
        <h3>Sign up</h3>

    Author:<input type="text" name="author">
        Email:<input type="email" name="email">
        Phone no.:<input type="number" name="phone no">
    Submit:<input type="submit" value="submit">
    </div>



</form>
{% endblock %}
<!--BODY end-->
<!--verified-->
{% extends "base.html" %}
<!--HEAD-->
{% block head %}
<title>TEST posts 1</title>

{% endblock %}
<!--HEAD end-->

<!--STYLE-->

{% block style %} {% endblock %}
<!--STYLE end-->

<!--BODY-->
{% block body %}
<div class="side">
   <a href="/yami/home/index">Click to go to index</a><br>
    <a href="/yami/home/home">click to go to home</a><br>
    <a href="/yami/home/new">Click to go to new</a><br>
     <a href="/yami/home/posts">click to go to posts</a><br>
      <a href="/result">click to go to result</a><br>
    <a href="/student">click to go to student</a><br>
</div>
{% for key,value in result.items() %}
<h1><ins>{{ key }} :</ins></h1>
<h3>{{ value }} </h3>
{% endfor %}



{% endblock %}

这些是与2页相关的代码

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...