async def test_role(self, bot, channel):
    content = "!welcome role 895463648326221854"
    await channel.send(content)

    msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
    content = "!welcome role"
    await channel.send(content)
    await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
    assert "New members will now receive the role " in msg.embeds[0].title
  async def test_message(self, bot, channel):
    content = '!welcome message "this is a message to {user} from {server}"'
    await channel.send(content)

    msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
    content = "!welcome message"
    await channel.send(content)
    await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
    assert "This servers welcome message is now" in msg.embeds[0].title and "this is a message to @Friday Unit Tester from Diary" in msg.embeds[0].description
  async def test_channel(self, bot, channel):
    content = f"!welcome channel {channel.id}"
    await channel.send(content)

    msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
    content = "!welcome channel"
    await channel.send(content)
    await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
    assert "Welcome message will be sent to" in msg.embeds[0].title
async def test_language(bot: "bot", channel: "channel"):
  content = "!lang es"
  await channel.send(content)

  f_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
  content = "!lang en"
  await channel.send(content)
  l_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
  assert f_msg.embeds[0].title == "New language set to: `Spanish`" and l_msg.embeds[0].title == "New language set to: `English`"
async def test_deletecommandsafter(bot: "bot", channel: "channel"):
  content = "!deletecommandsafter 120"
  await channel.send(content)

  f_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
  assert f_msg.embeds[0].title == "I will now delete commands after `120` seconds"
  content = "!deletecommandsafter"
  await channel.send(content)
  l_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
  assert l_msg.embeds[0].title == "I will no longer delete command messages"
async def test_prefix(bot: "bot", channel: "channel"):
  content = "!prefix ?"
  await channel.send(content)

  f_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)

  content = "?prefix !"
  await channel.send(content)
  l_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
  assert f_msg.embeds[0].title == "My new prefix is `?`" and l_msg.embeds[0].title == "My new prefix is `!`"
async def test_lock(bot: "bot", voice_channel: "voice_channel", channel: "channel"):
  vc = await voice_channel.connect(timeout=10.0)
  content = "!lock 895486009465266176"
  await channel.send(content)

  f_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)

  await channel.send(content)
  l_msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
  await vc.disconnect()
  assert "Locked" in f_msg.embeds[0].title and "Unlocked" in l_msg.embeds[0].title
async def test_vote_remind(bot: "bot", channel: "channel"):
    content = "!vote remind"
    await channel.send(content)

    f_msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    content = "!vote remind"
    await channel.send(content)
    l_msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    options = (
        "I will now DM you every 12 hours after you vote for when you can vote again",
        "I will stop DMing you for voting reminders 😢")
    assert f_msg.embeds[0].title in options and l_msg.embeds[0].title in options
async def test_invite(bot: "bot", channel: "channel"):
    content = "!invite"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].title == "Invite me :)"
Exemple #10
0
async def test_command(bot, channel, command: str):
    content = f"!help {command}"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].title == f"!{command}"
Exemple #11
0
async def test_command_unknown(bot, channel):
    content = "!help asd"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].title == 'No command called "asd" found.'
Exemple #12
0
async def test_donate(bot: "bot", channel: "channel"):
    content = "!donate"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout / 2)
    assert msg.content == "https://www.patreon.com/bePatron?u=42649008"
async def test_coinflip(bot: "bot", channel: "channel"):
    content = "!coinflip"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert "The coin landed on: " in msg.embeds[0].title
async def test_minesweeper(bot: "bot", channel: "channel"):
    content = "!ms"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].author.name == "Minesweeper"
async def test_countdown(bot: "bot", channel: "channel"):
    content = "!countdown 0 0 20"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].title == "Countdown:"
async def test_souptime(bot: "bot", channel: "channel"):
    content = "!souptime"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert "Here is sum soup, just for you" in msg.embeds[0].title
Exemple #17
0
async def test_support(bot: "bot", channel: "channel"):
    content = "!support"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout / 2)
    assert msg.content == "https://discord.gg/NTRuFjU"
  async def test_remove(self, bot, channel):
    content = "!blacklist remove word"
    await channel.send(content)

    def say_check(m) -> bool:
      return m.channel.id == channel.id and m.author.id == 751680714948214855

    msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
    assert msg.embeds[0].title == "Removed `word` from the blacklist" or msg.embeds[0].title == "You don't seem to be blacklisting that word"
Exemple #19
0
async def test_server(bot: "bot", channel: "channel"):
    content = "!patreon server"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout / 2)
    assert msg.embeds[0].title == "You are not allowed to use this command"
Exemple #20
0
    async def test_clear(self, bot: "bot", channel: "channel"):
        content = "!c clear"
        await channel.send(content)

        msg = await bot.wait_for(
            "message",
            check=lambda message: pytest.msg_check(message, content=content),
            timeout=pytest.timeout)
        assert msg.embeds[0].title == "Cleared this servers custom commands"
Exemple #21
0
async def test_patreon(bot: "bot", channel: "channel"):
    content = "!patreon"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout / 2)
    assert msg.embeds[0].title == "!patreon"
Exemple #22
0
async def test_dev_with_sudo(bot: "bot", channel: "channel", command: str):
    content = f"!dev {command}"
    await channel.send(content)

    with pytest.raises(asyncio.TimeoutError):
        await bot.wait_for(
            "message",
            check=lambda message: pytest.msg_check(message, content=content),
            timeout=2.0)
async def test_dice(bot: "bot", channel: "channel", roll: str):
  content = f"!dice {roll}"
  await channel.send(content)

  msg = await bot.wait_for("message", check=lambda message: pytest.msg_check(message, content=content), timeout=pytest.timeout)
  if roll == "":
    assert msg.embeds[0].title == "!dice"
  else:
    assert "Your total:" in msg.embeds[0].title and msg.embeds[0].color.value == MessageColors.DEFAULT
Exemple #24
0
async def test_meme(bot: "bot", channel: "channel"):
    content = "!meme"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].color.value == MessageColors.MEME
async def test_say(bot: "bot", channel: "channel", words: str):
    content = f"!say {words}"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.content == words
async def test_say_no_argument(bot: "bot", channel: "channel"):
    content = "!say"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].title == "!say"
Exemple #27
0
async def test_subcommand(bot: "bot", channel: "channel", subcommand: str):
    content = f"!help {subcommand}"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].title == f"!{subcommand}"
    assert len(msg.embeds[0].fields) > 0
Exemple #28
0
async def test_bot(bot: "bot", channel: "channel"):
    content = "!info"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert "Friday" in msg.embeds[0].title and "- About" in msg.embeds[
        0].title and msg.embeds[0].color.value == MessageColors.DEFAULT
Exemple #29
0
async def test_cog(bot, channel, cog: str):
    content = f"!help {cog}"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert cog in msg.embeds[0].title
    assert len(msg.embeds[0].fields) > 0
Exemple #30
0
async def test_help(bot: "bot", channel: "channel"):
    content = "!help"
    await channel.send(content)

    msg = await bot.wait_for(
        "message",
        check=lambda message: pytest.msg_check(message, content=content),
        timeout=pytest.timeout)
    assert msg.embeds[0].title == "Friday - Help"
    assert len(msg.embeds[0].fields) > 0