-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
744d2c3
commit 6fe5fcf
Showing
132 changed files
with
1,640 additions
and
2,810 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
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,2 +1,3 @@ | ||
recursive-include rustplus *.png | ||
recursive-include rustplus *.ttf | ||
recursive-include rustplus *.ttf | ||
include requirements.txt |
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 was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,11 @@ | ||
# Command Options | ||
|
||
Command options are what you use to tell the [`RustSocket`](../getting-started/rustsocket/) what the general structure of your commands will be. These define the prefix for the command, as well as any "overruling commands" which are commands that do not require a prefix. Usage: | ||
Command options are what you use to tell the [`RustSocket`](../getting-started/rustsocket/) what the general structure of your commands will be. | ||
These define the prefix for the command, as well as any "overruling commands" which are commands that do not require a prefix. Usage: | ||
|
||
```python | ||
from rustplus import RustSocket | ||
from rustplus import CommandOptions | ||
|
||
options = CommandOptions(prefix="!", overruling_commands = ["time"]) | ||
|
||
# Prefix is a string, and the overruling_commands are a list of strings which would be the name of the coroutines | ||
options = CommandOptions(prefix="!") | ||
``` | ||
|
||
You can then just pass these into the RustSocket constructor using the `overruling_commands` kwarg. | ||
|
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,4 @@ | ||
# Community Examples | ||
|
||
This page contains a list of community-contributed examples that demonstrate how to use the Library. | ||
Contact me on Discord if you would like to add your example to this list! |
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
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
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,5 @@ | ||
from .command import Command | ||
from .entity_event import EntityEvent | ||
from .chat_event import ChatEvent | ||
from .team_event import TeamEvent | ||
from .protobuf_event import ProtobufEvent |
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,21 @@ | ||
from typing import Callable | ||
|
||
from .. import ServerDetails | ||
from ..identification import RegisteredListener | ||
from ..events import ChatEventPayload as ChatEventManager | ||
|
||
|
||
def ChatEvent(server_details: ServerDetails) -> Callable: | ||
|
||
def wrapper(func) -> RegisteredListener: | ||
|
||
if isinstance(func, RegisteredListener): | ||
func = func.get_coro() | ||
|
||
listener = RegisteredListener(func.__name__, func) | ||
|
||
ChatEventManager.HANDLER_LIST.register(listener, server_details) | ||
|
||
return listener | ||
|
||
return wrapper |
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,23 @@ | ||
from typing import Callable | ||
|
||
from ..identification import RegisteredListener, ServerDetails | ||
from ..commands import ChatCommand, ChatCommandData | ||
|
||
|
||
def Command( | ||
server_details: ServerDetails, aliases: list = None, alias_func: Callable = None | ||
) -> Callable: | ||
|
||
def wrapper(func): | ||
|
||
if isinstance(func, RegisteredListener): | ||
func = func.get_coro() | ||
|
||
command_data = ChatCommandData( | ||
coroutine=func, aliases=aliases, callable_func=alias_func | ||
) | ||
ChatCommand.REGISTERED_COMMANDS[server_details][func.__name__] = command_data | ||
|
||
return RegisteredListener(func.__name__, func) | ||
|
||
return wrapper |
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,19 @@ | ||
from typing import Callable | ||
|
||
from .. import ServerDetails | ||
from ..identification import RegisteredListener | ||
from ..events import EntityEventPayload as EntityEventManager | ||
|
||
|
||
def EntityEvent(server_details: ServerDetails, eid: int) -> Callable: | ||
def wrapper(func) -> RegisteredListener: | ||
if isinstance(func, RegisteredListener): | ||
func = func.get_coro() | ||
|
||
listener = RegisteredListener(str(eid), func) | ||
|
||
EntityEventManager.HANDLER_LIST.register(listener, server_details) | ||
|
||
return listener | ||
|
||
return wrapper |
Oops, something went wrong.