-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'cloud-discordshim' into 'dev'
Cloud discordshim See merge request cameron/OctoPrint-DiscordRemote!6
- Loading branch information
Showing
40 changed files
with
1,219 additions
and
1,623 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[bumpversion] | ||
current_version = 4.7.0 | ||
current_version = 5.0.0 | ||
|
||
[bumpversion:file:setup.py] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="discordshim" type="PythonConfigurationType" factoryName="Python"> | ||
<module name="OctoPrint-DiscordRemote" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="PARENT_ENVS" value="true" /> | ||
<envs> | ||
<env name="CONFIG" value="config.yaml" /> | ||
</envs> | ||
<option name="SDK_HOME" value="$PROJECT_DIR$/testenv/bin/python" /> | ||
<option name="SDK_NAME" value="Python 3.11 (OctoPrint-DiscordRemote)" /> | ||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | ||
<option name="IS_MODULE_SDK" value="false" /> | ||
<option name="ADD_CONTENT_ROOTS" value="true" /> | ||
<option name="ADD_SOURCE_ROOTS" value="true" /> | ||
<option name="SCRIPT_NAME" value="octoprint_discordshim" /> | ||
<option name="PARAMETERS" value="" /> | ||
<option name="SHOW_COMMAND_LINE" value="false" /> | ||
<option name="EMULATE_TERMINAL" value="false" /> | ||
<option name="MODULE_MODE" value="true" /> | ||
<option name="REDIRECT_INPUT" value="false" /> | ||
<option name="INPUT_FILE" value="" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# This example requires the 'members' and 'message_content' privileged intents to function. | ||
|
||
import discord | ||
import yaml | ||
from discord.ext import commands | ||
import random | ||
|
||
description = '''An example bot to showcase the discord.ext.commands extension | ||
module. | ||
There are a number of utility commands being showcased here.''' | ||
|
||
intents = discord.Intents.default() | ||
intents.members = True | ||
intents.message_content = True | ||
|
||
bot = commands.Bot(command_prefix='?', description=description, intents=intents) | ||
|
||
|
||
@bot.event | ||
async def on_ready(): | ||
print(f'Logged in as {bot.user} (ID: {bot.user.id})') | ||
print('------') | ||
|
||
|
||
@bot.command() | ||
async def add(ctx, left: int, right: int): | ||
"""Adds two numbers together.""" | ||
await ctx.send(left + right) | ||
|
||
|
||
@bot.command() | ||
async def roll(ctx, dice: str): | ||
"""Rolls a dice in NdN format.""" | ||
try: | ||
rolls, limit = map(int, dice.split('d')) | ||
except Exception: | ||
await ctx.send('Format has to be in NdN!') | ||
return | ||
|
||
result = ', '.join(str(random.randint(1, limit)) for r in range(rolls)) | ||
await ctx.send(result) | ||
|
||
|
||
@bot.command(description='For when you wanna settle the score some other way') | ||
async def choose(ctx, *choices: str): | ||
"""Chooses between multiple choices.""" | ||
await ctx.send(random.choice(choices)) | ||
|
||
|
||
@bot.command() | ||
async def repeat(ctx, times: int, content='repeating...'): | ||
"""Repeats a message multiple times.""" | ||
for i in range(times): | ||
await ctx.send(content) | ||
|
||
|
||
@bot.command() | ||
async def joined(ctx, member: discord.Member): | ||
"""Says when a member joined.""" | ||
await ctx.send(f'{member.name} joined {discord.utils.format_dt(member.joined_at)}') | ||
|
||
|
||
@bot.group() | ||
async def cool(ctx): | ||
"""Says if a user is cool. | ||
In reality this just checks if a subcommand is being invoked. | ||
""" | ||
if ctx.invoked_subcommand is None: | ||
await ctx.send(f'No, {ctx.subcommand_passed} is not cool') | ||
|
||
|
||
@cool.command(name='bot') | ||
async def _bot(ctx): | ||
"""Is the bot cool?""" | ||
await ctx.send('Yes, the bot is cool.') | ||
|
||
if __name__ == '__main__': | ||
with open('config.yaml') as f: | ||
data = yaml.load(f) | ||
|
||
bot.run(data['bottoken']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
channelid: "DO NOT COMMIT CHANGES TO THIS FILE" | ||
bottoken: "DO NOT COMMIT CHANGES TO THIS FILE" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.