如何从我的服务器向另一台服务器发送消息?

时间:2018-03-07 12:21:39

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

我需要帮助:

@Override
protected void configure(HttpSecurity http) throws Exception {
  http
    .csrf().disable()
     .authorizeRequests()
      .antMatchers("/api/**").authenticated()
      .anyRequest().permitAll()
      .and()
    .httpBasic().and()
    .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
}

错误列表:

我在不和谐服务器中输入的内容:

import discord
from discord.ext import commands
from discord.voice_client import VoiceClient

bot = commands.Bot(";")

@bot.command(pass_context=True)
async def sendm(member, sv, ch, *, msg):
    serverd = member.server.id("{0}".format(sv))
    channel = member.server.get_channel("{0}".format(ch))
    await bot.send_message(serverd, channel, msg)
bot.run("TOKEN")

使用Raspberry Pi 3主持

1 个答案:

答案 0 :(得分:0)

您正在传递上下文,这意味着第一个参数将是Context对象,而不是Member。只要邮件包含频道ID,您就不需要任何其他内容。

@bot.command()
async def sendm(ch, *, msg):
    channel = bot.get_channel(ch)
    if channel:
        await bot.send_message(channel, msg)
    else:
        await bot.say('I can't find that channel')