使用列表将消息随机发送到频道

时间:2019-01-03 02:38:38

标签: python python-3.x discord discord.py

我在time.sleep上有一个频道列表和一个正在运行的后台线程。我的目标是从list_of_msgs = []向channel_list = []的随机信道发送随机消息。

这是我填充频道列表的方式:

chan_list = []
        for server in self.bot.servers:
            for channel in server.channels:
                if channel.type == discord.ChannelType.text:
                    chan_list.append(channel)
        print(', '.join(map(str, chan_list))) ###for testing###

从列表向另一个列表中的频道发送send_message的正确方法是什么?

1 个答案:

答案 0 :(得分:2)

<?xml version="1.0" encoding="UTF-8" ?>
<amx:view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amx="http://xmlns.oracle.com/adf/mf/amx"
          xmlns:dvtm="http://xmlns.oracle.com/adf/mf/amx/dvt">
  <amx:panelPage id="pp1">
    <amx:facet name="header">
      <amx:tableLayout id="tl1" halign="center">
        <amx:rowLayout id="rl1">
          <amx:cellFormat id="cf5" >
            <amx:outputText value="Care Apps" id="ot1" styleClass="titleText" />
          </amx:cellFormat>
        </amx:rowLayout>
      </amx:tableLayout>
    </amx:facet>
    <amx:facet name="primary">
        <amx:tableLayout id="tl2" halign="center">
        <amx:rowLayout id="rl2">
                <amx:cellFormat id="cf4" >
            <amx:image id="i3" source="/images/CARE_logo_60.png"/>
          </amx:cellFormat>
        </amx:rowLayout>
        </amx:tableLayout>
    </amx:facet>
    <amx:tableLayout id="tl4" styleClass="menuUserLayout">
      <amx:rowLayout id="rl6">
        <amx:cellFormat id="cf6" halign="center" valign="middle">
          <amx:image id="i4" source="/images/user_logo.png" inlineStyle="width:100px; height:100px; margin-left: auto; margin-right: auto;"/>
        </amx:cellFormat>
      </amx:rowLayout>
      <amx:rowLayout id="rl5">
        <amx:cellFormat id="cf3">
          <amx:outputText value="User Name" id="ot3" styleClass="menuText"/>
        </amx:cellFormat>
      </amx:rowLayout>
    </amx:tableLayout>
    <amx:tableLayout id="tl3" styleClass="menuTabLayout">
      <amx:iterator var="row" value="#{bindings.features.collectionModel}" id="i1" >
        <amx:rowLayout id="rl3">
          <amx:cellFormat id="cf1">
            <amx:commandLink actionListener="#{bindings.gotoFeature.execute}"
                             disabled="#{!bindings.gotoFeature.enabled}" id="cl1">
              <amx:image id="i2" source="#{row.image}" inlineStyle="width:45px;height:45px;"/>
              <amx:setPropertyListener id="spl1" from="#{row.id}" to="#{pageFlowScope.FeatureId}" type="action"/>
            </amx:commandLink>
          </amx:cellFormat>
          <amx:cellFormat id="cf2">
            <amx:outputText value="#{row.name}" id="ot2" styleClass="menuText"/>
          </amx:cellFormat>         
        </amx:rowLayout>
        <amx:rowLayout id="rl4">       
        </amx:rowLayout>
      </amx:iterator>
    </amx:tableLayout>
  </amx:panelPage>
</amx:view>

您尝试过吗?